Add translate button to the preview post in settings (#724)

* Add translate button to the preview post in settings

* Accidental outdent.

* Add share button to placeholder status and also preview status in settings.
This commit is contained in:
Gareth Simpson 2023-02-09 06:38:04 +00:00 committed by GitHub
parent e2a836e6e3
commit a43a657f1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 29 deletions

View file

@ -12,9 +12,7 @@ struct DisplaySettingsView: View {
@EnvironmentObject private var userPreferences: UserPreferences
@State private var isFontSelectorPresented = false
private var previewStatusViewModel = StatusRowViewModel(status: Status.placeholder(parseMarkdown: true))
private var previewStatusViewModel = StatusRowViewModel(status: Status.placeholder(forSettings: true, language: "la")) // translate from latin button
var body: some View {
Form {
Section("settings.display.example-toot") {

View file

@ -100,36 +100,37 @@ public struct Status: AnyStatus, Codable, Identifiable, Equatable, Hashable, Sta
public let sensitive: Bool
public let language: String?
public static func placeholder(parseMarkdown:Bool = false) -> Status {
public static func placeholder(forSettings:Bool = false, language:String? = nil) -> Status {
.init(id: UUID().uuidString,
content: .init(stringValue: "Lorem ipsum [#dolor](#) sit amet\nconsectetur [@adipiscing](#) elit\nAsed do eiusmod tempor incididunt ut labore.", parseMarkdown: parseMarkdown),
content: .init(stringValue: "Lorem ipsum [#dolor](#) sit amet\nconsectetur [@adipiscing](#) elit\nAsed do eiusmod tempor incididunt ut labore.", parseMarkdown: forSettings),
account: .placeholder(),
createdAt: ServerDate.sampleDate,
editedAt: nil,
reblog: nil,
mediaAttachments: [],
mentions: [],
repliesCount: 0,
reblogsCount: 0,
favouritesCount: 0,
card: nil,
favourited: false,
reblogged: false,
pinned: false,
bookmarked: false,
emojis: [],
url: nil,
application: nil,
inReplyToAccountId: nil,
visibility: .pub,
poll: nil,
spoilerText: .init(stringValue: ""),
filtered: [],
sensitive: false,
language: nil)
account: .placeholder(),
createdAt: ServerDate.sampleDate,
editedAt: nil,
reblog: nil,
mediaAttachments: [],
mentions: [],
repliesCount: 0,
reblogsCount: 0,
favouritesCount: 0,
card: nil,
favourited: false,
reblogged: false,
pinned: false,
bookmarked: false,
emojis: [],
url: "https://example.com",
application: nil,
inReplyToAccountId: nil,
visibility: .pub,
poll: nil,
spoilerText: .init(stringValue: ""),
filtered: [],
sensitive: false,
language: language)
}
public static func placeholders() -> [Status] {
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
}