diff --git a/Apps/Attendi/Catalogs/Localizable.xcstrings b/Apps/Attendi/Catalogs/Localizable.xcstrings index 159afee..6c72970 100644 --- a/Apps/Attendi/Catalogs/Localizable.xcstrings +++ b/Apps/Attendi/Catalogs/Localizable.xcstrings @@ -31,6 +31,26 @@ } } } + }, + "view.transcription.unavailable.description" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nothing could be transcribed from the recording. Try recording again, or check that the picked locale matches the spoken language." + } + } + } + }, + "view.transcription.unavailable.title" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No Transcription" + } + } + } } }, "version" : "1.2" diff --git a/Apps/Attendi/Views/ContentView.swift b/Apps/Attendi/Views/ContentView.swift index e9c425a..b92cb38 100644 --- a/Apps/Attendi/Views/ContentView.swift +++ b/Apps/Attendi/Views/ContentView.swift @@ -18,8 +18,8 @@ struct ContentView: View { // MARK: Body /// The content of the view: a navigation stack with the recording feature's view, attached to the model's services, with a toolbar picker - /// for the locale of the spoken language to transcribe, and a modal sheet presenting the transcribed text of every processed recording, - /// closable through its toolbar button or a swipe. + /// for the locale of the spoken language to transcribe, and a modal sheet presenting the transcribed text of every processed recording — + /// or a content unavailable message when the transcription is empty — closable through its toolbar button or a swipe. var body: some View { NavigationStack { RecordingView( @@ -64,16 +64,26 @@ struct ContentView: View { } .sheet(item: $model.transcription) { transcription in NavigationStack { - ScrollView { - Text(transcription.text) - .font(.body) - .fontWeight(.regular) - .foregroundStyle(.primary) - .frame( - maxWidth: .infinity, - alignment: .leading + Group { + if transcription.isEmpty { + ContentUnavailableView( + "view.transcription.unavailable.title", + systemImage: "text.page.slash", + description: Text("view.transcription.unavailable.description") ) - .padding() + } else { + ScrollView { + Text(transcription.text) + .font(.body) + .fontWeight(.regular) + .foregroundStyle(.primary) + .frame( + maxWidth: .infinity, + alignment: .leading + ) + .padding() + } + } } .navigationTitle("view.transcription.navigation.title") #if !os(macOS) diff --git a/Packages/Features/Sources/Recording/Models/Transcription.swift b/Packages/Features/Sources/Recording/Models/Transcription.swift index 16931c4..86cda99 100644 --- a/Packages/Features/Sources/Recording/Models/Transcription.swift +++ b/Packages/Features/Sources/Recording/Models/Transcription.swift @@ -24,7 +24,7 @@ public struct Transcription: Equatable, Identifiable, Sendable { // MARK: Computed /// A Boolean value that indicates whether the transcription has no text. - var isEmpty: Bool { + public var isEmpty: Bool { text.isEmpty } diff --git a/Packages/Features/Sources/Recording/Styles/Buttons/RecordingButtonStyle.swift b/Packages/Features/Sources/Recording/Styles/Buttons/RecordingButtonStyle.swift index 34b0281..36fa0c7 100644 --- a/Packages/Features/Sources/Recording/Styles/Buttons/RecordingButtonStyle.swift +++ b/Packages/Features/Sources/Recording/Styles/Buttons/RecordingButtonStyle.swift @@ -137,7 +137,7 @@ private enum Constant { /// The size constants. enum Size { /// The base width and height of a button's label, before dynamic type scaling. - static let button: CGFloat = 16 + static let button: CGFloat = 32 } }