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,9 +100,9 @@ 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,
@ -119,7 +119,7 @@ public struct Status: AnyStatus, Codable, Identifiable, Equatable, Hashable, Sta
pinned: false,
bookmarked: false,
emojis: [],
url: nil,
url: "https://example.com",
application: nil,
inReplyToAccountId: nil,
visibility: .pub,
@ -127,9 +127,10 @@ public struct Status: AnyStatus, Codable, Identifiable, Equatable, Hashable, Sta
spoilerText: .init(stringValue: ""),
filtered: [],
sensitive: false,
language: nil)
language: language)
}
public static func placeholders() -> [Status] {
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
}