Layout adjustments to the editor
This commit is contained in:
parent
7eb382c052
commit
ca9dd5b469
|
@ -1931,115 +1931,115 @@
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"be" : {
|
"be" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Папярэджанне пра спойлер"
|
"value" : "Папярэджанне пра спойлер"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ca" : {
|
"ca" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoiler warning"
|
"value" : "Spoiler warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"de" : {
|
"de" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Inhaltswarnung"
|
"value" : "Inhaltswarnung"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"en" : {
|
"en" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Spoiler warning"
|
"value" : "Content warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"en-GB" : {
|
"en-GB" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Spoiler warning"
|
"value" : "Content warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"es" : {
|
"es" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Advertencia"
|
"value" : "Advertencia"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eu" : {
|
"eu" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Edukiari buruzko oharra"
|
"value" : "Edukiari buruzko oharra"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fr" : {
|
"fr" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Alerte spoiler"
|
"value" : "Alerte spoiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"it" : {
|
"it" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Avviso di Spoiler"
|
"value" : "Avviso di Spoiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ja" : {
|
"ja" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "ネタバレを警告"
|
"value" : "ネタバレを警告"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ko" : {
|
"ko" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "열람 주의 문구"
|
"value" : "열람 주의 문구"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nb" : {
|
"nb" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoiler advarsel"
|
"value" : "Spoiler advarsel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nl" : {
|
"nl" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoilerwaarschuwing"
|
"value" : "Spoilerwaarschuwing"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pl" : {
|
"pl" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Ostrzeżenie o spoilerze"
|
"value" : "Ostrzeżenie o spoilerze"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Aviso de spoiler"
|
"value" : "Aviso de spoiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tr" : {
|
"tr" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoiler uyarısı"
|
"value" : "Spoiler uyarısı"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uk" : {
|
"uk" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Увага! Спойлер."
|
"value" : "Увага! Спойлер."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "剧透警告"
|
"value" : "剧透警告"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "劇透警告"
|
"value" : "劇透警告"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64977,115 +64977,115 @@
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"be" : {
|
"be" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Тэкст спойлера"
|
"value" : "Тэкст спойлера"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ca" : {
|
"ca" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Escriviu l'espòiler"
|
"value" : "Escriviu l'espòiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"de" : {
|
"de" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Inhaltswarnung"
|
"value" : "Inhaltswarnung"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"en" : {
|
"en" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Spoiler Text"
|
"value" : "Content warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"en-GB" : {
|
"en-GB" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "Spoiler Text"
|
"value" : "Content Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"es" : {
|
"es" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Escribe tu advertencia aquí"
|
"value" : "Escribe tu advertencia aquí"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eu" : {
|
"eu" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Edukiari buruzko oharra"
|
"value" : "Edukiari buruzko oharra"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fr" : {
|
"fr" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Texte spoilé"
|
"value" : "Texte spoilé"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"it" : {
|
"it" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Testo spoiler"
|
"value" : "Testo spoiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ja" : {
|
"ja" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "ネタバレ"
|
"value" : "ネタバレ"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ko" : {
|
"ko" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "열람 주의 문구"
|
"value" : "열람 주의 문구"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nb" : {
|
"nb" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoilertekst"
|
"value" : "Spoilertekst"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nl" : {
|
"nl" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoilertekst"
|
"value" : "Spoilertekst"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pl" : {
|
"pl" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Tekst spoilera"
|
"value" : "Tekst spoilera"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Texto de Spoiler"
|
"value" : "Texto de Spoiler"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tr" : {
|
"tr" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Spoiler Yazısı"
|
"value" : "Spoiler Yazısı"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uk" : {
|
"uk" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "Спойлер"
|
"value" : "Спойлер"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "剧透警告"
|
"value" : "剧透警告"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "needs_review",
|
||||||
"value" : "劇透警告"
|
"value" : "劇透警告"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ extension StatusEditor {
|
||||||
let focusedSEVM: ViewModel
|
let focusedSEVM: ViewModel
|
||||||
@Binding var followUpSEVMs: [ViewModel]
|
@Binding var followUpSEVMs: [ViewModel]
|
||||||
|
|
||||||
@State private var isDraftsSheetDisplayed: Bool = false
|
|
||||||
@State private var isLanguageSheetDisplayed: Bool = false
|
@State private var isLanguageSheetDisplayed: Bool = false
|
||||||
@State private var isCustomEmojisSheetDisplay: Bool = false
|
@State private var isCustomEmojisSheetDisplay: Bool = false
|
||||||
@State private var languageSearch: String = ""
|
@State private var languageSearch: String = ""
|
||||||
|
@ -188,24 +187,6 @@ extension StatusEditor {
|
||||||
}
|
}
|
||||||
.accessibilityLabel("accessibility.editor.button.spoiler")
|
.accessibilityLabel("accessibility.editor.button.spoiler")
|
||||||
|
|
||||||
if !viewModel.mode.isInShareExtension {
|
|
||||||
Button {
|
|
||||||
isDraftsSheetDisplayed = true
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "archivebox")
|
|
||||||
}
|
|
||||||
.accessibilityLabel("accessibility.editor.button.drafts")
|
|
||||||
.popover(isPresented: $isDraftsSheetDisplayed) {
|
|
||||||
if UIDevice.current.userInterfaceIdiom == .phone {
|
|
||||||
draftsListView
|
|
||||||
.presentationDetents([.medium])
|
|
||||||
} else {
|
|
||||||
draftsListView
|
|
||||||
.frame(width: 400, height: 500)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !viewModel.customEmojiContainer.isEmpty {
|
if !viewModel.customEmojiContainer.isEmpty {
|
||||||
Button {
|
Button {
|
||||||
isCustomEmojisSheetDisplay = true
|
isCustomEmojisSheetDisplay = true
|
||||||
|
@ -292,16 +273,6 @@ extension StatusEditor {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private var draftsListView: some View {
|
|
||||||
DraftsListView(selectedDraft: .init(get: {
|
|
||||||
nil
|
|
||||||
}, set: { draft in
|
|
||||||
if let draft {
|
|
||||||
focusedSEVM.insertStatusText(text: draft.content)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func languageTextView(isoCode: String, nativeName: String?, name: String?) -> some View {
|
private func languageTextView(isoCode: String, nativeName: String?, name: String?) -> some View {
|
||||||
if let nativeName, let name {
|
if let nativeName, let name {
|
||||||
|
|
|
@ -147,7 +147,6 @@ extension StatusEditor {
|
||||||
private var characterCountView: some View {
|
private var characterCountView: some View {
|
||||||
let value = (currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) + viewModel.statusTextCharacterLength
|
let value = (currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) + viewModel.statusTextCharacterLength
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
|
||||||
Text("\(value)")
|
Text("\(value)")
|
||||||
.foregroundColor(value < 0 ? .red : .secondary)
|
.foregroundColor(value < 0 ? .red : .secondary)
|
||||||
.font(.scaledCallout)
|
.font(.scaledCallout)
|
||||||
|
@ -156,8 +155,9 @@ extension StatusEditor {
|
||||||
.accessibilityRemoveTraits(.isStaticText)
|
.accessibilityRemoveTraits(.isStaticText)
|
||||||
.accessibilityAddTraits(.updatesFrequently)
|
.accessibilityAddTraits(.updatesFrequently)
|
||||||
.accessibilityRespondsToUserInteraction(false)
|
.accessibilityRespondsToUserInteraction(false)
|
||||||
.padding(.trailing, 8)
|
.padding(.leading, .layoutPadding)
|
||||||
.padding(.bottom, 8)
|
.padding(.bottom, 8)
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,9 @@ extension StatusEditor {
|
||||||
.accessibilitySortPriority(1) // Ensure that all elements inside the `ScrollView` occur earlier than the accessory views
|
.accessibilitySortPriority(1) // Ensure that all elements inside the `ScrollView` occur earlier than the accessory views
|
||||||
.navigationTitle(focusedSEVM.mode.title)
|
.navigationTitle(focusedSEVM.mode.title)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar { ToolbarItems(mainSEVM: mainSEVM, followUpSEVMs: followUpSEVMs) }
|
.toolbar { ToolbarItems(mainSEVM: mainSEVM,
|
||||||
|
focusedSEVM: focusedSEVM,
|
||||||
|
followUpSEVMs: followUpSEVMs) }
|
||||||
.toolbarBackground(.visible, for: .navigationBar)
|
.toolbarBackground(.visible, for: .navigationBar)
|
||||||
.alert(
|
.alert(
|
||||||
"status.error.posting.title",
|
"status.error.posting.title",
|
||||||
|
@ -142,8 +144,8 @@ extension StatusEditor {
|
||||||
.sheet(item: $editingMediaContainer) { container in
|
.sheet(item: $editingMediaContainer) { container in
|
||||||
StatusEditor.MediaEditView(viewModel: focusedSEVM, container: container)
|
StatusEditor.MediaEditView(viewModel: focusedSEVM, container: container)
|
||||||
}
|
}
|
||||||
.presentationDetents([.large, .medium, .height(50)], selection: $presentationDetent)
|
.presentationDetents([.large, .height(100)], selection: $presentationDetent)
|
||||||
.presentationBackgroundInteraction(.enabled(upThrough: .medium))
|
.presentationBackgroundInteraction(.enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,23 @@ import Env
|
||||||
import Models
|
import Models
|
||||||
import StoreKit
|
import StoreKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import DesignSystem
|
||||||
|
|
||||||
extension StatusEditor {
|
extension StatusEditor {
|
||||||
@MainActor
|
@MainActor
|
||||||
struct ToolbarItems: ToolbarContent {
|
struct ToolbarItems: ToolbarContent {
|
||||||
@State private var isLanguageConfirmPresented = false
|
@State private var isLanguageConfirmPresented = false
|
||||||
@State private var isDismissAlertPresented: Bool = false
|
@State private var isDismissAlertPresented: Bool = false
|
||||||
|
@State private var isDraftsSheetDisplayed: Bool = false
|
||||||
|
|
||||||
let mainSEVM: ViewModel
|
let mainSEVM: ViewModel
|
||||||
|
let focusedSEVM: ViewModel
|
||||||
let followUpSEVMs: [ViewModel]
|
let followUpSEVMs: [ViewModel]
|
||||||
|
|
||||||
@Environment(\.modelContext) private var context
|
@Environment(\.modelContext) private var context
|
||||||
@Environment(UserPreferences.self) private var preferences
|
@Environment(UserPreferences.self) private var preferences
|
||||||
|
@Environment(Theme.self) private var theme
|
||||||
|
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
@Environment(\.dismissWindow) private var dismissWindow
|
@Environment(\.dismissWindow) private var dismissWindow
|
||||||
#else
|
#else
|
||||||
|
@ -20,6 +26,26 @@ extension StatusEditor {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var body: some ToolbarContent {
|
var body: some ToolbarContent {
|
||||||
|
if !mainSEVM.mode.isInShareExtension {
|
||||||
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
|
Button {
|
||||||
|
isDraftsSheetDisplayed = true
|
||||||
|
} label: {
|
||||||
|
Text("status.editor.drafts.navigation-title")
|
||||||
|
}
|
||||||
|
.accessibilityLabel("accessibility.editor.button.drafts")
|
||||||
|
.popover(isPresented: $isDraftsSheetDisplayed) {
|
||||||
|
if UIDevice.current.userInterfaceIdiom == .phone {
|
||||||
|
draftsListView
|
||||||
|
.presentationDetents([.medium])
|
||||||
|
} else {
|
||||||
|
draftsListView
|
||||||
|
.frame(width: 400, height: 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
|
@ -31,13 +57,10 @@ extension StatusEditor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
if mainSEVM.isPosting {
|
Text("status.action.post").bold()
|
||||||
ProgressView()
|
|
||||||
} else {
|
|
||||||
Text("status.action.post").bold()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.disabled(!mainSEVM.canPost)
|
.buttonStyle(.borderedProminent)
|
||||||
|
.disabled(!mainSEVM.canPost || mainSEVM.isPosting)
|
||||||
.keyboardShortcut(.return, modifiers: .command)
|
.keyboardShortcut(.return, modifiers: .command)
|
||||||
.confirmationDialog("", isPresented: $isLanguageConfirmPresented, actions: {
|
.confirmationDialog("", isPresented: $isLanguageConfirmPresented, actions: {
|
||||||
languageConfirmationDialog
|
languageConfirmationDialog
|
||||||
|
@ -137,5 +160,15 @@ extension StatusEditor {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var draftsListView: some View {
|
||||||
|
DraftsListView(selectedDraft: .init(get: {
|
||||||
|
nil
|
||||||
|
}, set: { draft in
|
||||||
|
if let draft {
|
||||||
|
focusedSEVM.insertStatusText(text: draft.content)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue