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 @EnvironmentObject private var userPreferences: UserPreferences
@State private var isFontSelectorPresented = false @State private var isFontSelectorPresented = false
private var previewStatusViewModel = StatusRowViewModel(status: Status.placeholder(forSettings: true, language: "la")) // translate from latin button
private var previewStatusViewModel = StatusRowViewModel(status: Status.placeholder(parseMarkdown: true))
var body: some View { var body: some View {
Form { Form {
Section("settings.display.example-toot") { 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 sensitive: Bool
public let language: String? 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, .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(), account: .placeholder(),
createdAt: ServerDate.sampleDate, createdAt: ServerDate.sampleDate,
editedAt: nil, editedAt: nil,
reblog: nil, reblog: nil,
mediaAttachments: [], mediaAttachments: [],
mentions: [], mentions: [],
repliesCount: 0, repliesCount: 0,
reblogsCount: 0, reblogsCount: 0,
favouritesCount: 0, favouritesCount: 0,
card: nil, card: nil,
favourited: false, favourited: false,
reblogged: false, reblogged: false,
pinned: false, pinned: false,
bookmarked: false, bookmarked: false,
emojis: [], emojis: [],
url: nil, url: "https://example.com",
application: nil, application: nil,
inReplyToAccountId: nil, inReplyToAccountId: nil,
visibility: .pub, visibility: .pub,
poll: nil, poll: nil,
spoilerText: .init(stringValue: ""), spoilerText: .init(stringValue: ""),
filtered: [], filtered: [],
sensitive: false, sensitive: false,
language: nil) language: language)
} }
public static func placeholders() -> [Status] { public static func placeholders() -> [Status] {
[.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()] [.placeholder(), .placeholder(), .placeholder(), .placeholder(), .placeholder()]
} }