Skip to content

Commit 6300891

Browse files
author
Daniel K.
committed
Add a dropdown that shows the transcript in the recording summary
1 parent 16306f2 commit 6300891

2 files changed

Lines changed: 82 additions & 1 deletion

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import Foundation
2+
import SwiftUI
3+
4+
struct TranscriptDropdownButton: View {
5+
let transcriptText: String
6+
7+
@State private var isCollapsed: Bool = true
8+
9+
init(transcriptText: String) {
10+
self.transcriptText = transcriptText
11+
}
12+
13+
var body: some View {
14+
HStack(alignment: .top, spacing: 12) {
15+
Image(systemName: isCollapsed ? "chevron.down" : "chevron.up")
16+
.font(.system(size: 16, weight: .bold))
17+
18+
19+
VStack(alignment: .leading) {
20+
Text("Transcript")
21+
.font(UIConstants.Typography.cardTitle)
22+
.foregroundColor(UIConstants.Colors.textPrimary)
23+
24+
VStack {
25+
26+
if (!isCollapsed) {
27+
Text(transcriptText)
28+
}
29+
}
30+
}
31+
32+
Spacer()
33+
34+
}
35+
.frame(alignment: .topLeading)
36+
.padding(.horizontal, UIConstants.Spacing.cardPadding + 4)
37+
.padding(.vertical, UIConstants.Spacing.cardPadding)
38+
.background(
39+
RoundedRectangle(cornerRadius: 20)
40+
.fill(Color(hex: "242323"))
41+
.overlay(
42+
RoundedRectangle(cornerRadius: 20)
43+
.stroke(
44+
LinearGradient(
45+
gradient: Gradient(stops: [
46+
.init(color: Color(hex: "979797").opacity(0.6), location: 0),
47+
.init(color: Color(hex: "979797").opacity(0.4), location: 1)
48+
]),
49+
startPoint: .top,
50+
endPoint: .bottom
51+
),
52+
lineWidth: 1
53+
)
54+
)
55+
)
56+
.onTapGesture {
57+
withAnimation(.easeInOut(duration: 0.25)) {
58+
isCollapsed.toggle()
59+
}
60+
}
61+
}
62+
}
63+
64+
#Preview {
65+
GeometryReader { geometry in
66+
VStack(spacing: 16) {
67+
TranscriptDropdownButton(
68+
transcriptText: "Lorem ipsum dolor sit amet"
69+
)
70+
}
71+
.padding(20)
72+
}
73+
.frame(width: 500, height: 300)
74+
.background(UIConstants.Gradients.backgroundGradient)
75+
}

Recap/UseCases/Summary/SummaryView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ struct SummaryView: View {
55
let onClose: () -> Void
66
@ObservedObject var viewModel: SummaryViewModel
77
let recordingID: String?
8+
@State var showingTranscript: Bool = false
89

910
init(
1011
onClose: @escaping () -> Void,
@@ -148,9 +149,14 @@ struct SummaryView: View {
148149
ScrollView {
149150
VStack(alignment: .leading, spacing: UIConstants.Spacing.cardSpacing) {
150151
if let recording = viewModel.currentRecording,
151-
let summaryText = recording.summaryText {
152+
let summaryText = recording.summaryText,
153+
let transcriptionText = recording.transcriptionText {
152154

153155
VStack(alignment: .leading, spacing: UIConstants.Spacing.cardInternalSpacing) {
156+
if (!transcriptionText.isEmpty) {
157+
TranscriptDropdownButton(transcriptText: transcriptionText)
158+
}
159+
154160
Text("Summary")
155161
.font(UIConstants.Typography.infoCardTitle)
156162
.foregroundColor(UIConstants.Colors.textPrimary)

0 commit comments

Comments
 (0)