feat(ios): improve native thread readability
This commit is contained in:
5 files changed
+162
-143
No files matched your search
@@ -11,8 +11,8 @@ enum T3Colors {
|
||||
static let ledgerSelected = Color(white: 0.051)
|
||||
|
||||
static let textPrimary = Color.white
|
||||
static let textSecondary = Color.white.opacity(0.62)
|
||||
static let textTertiary = Color.white.opacity(0.5)
|
||||
static let textSecondary = Color.white.opacity(0.7)
|
||||
static let textTertiary = Color.white.opacity(0.57)
|
||||
|
||||
static let accent = Color(red: 0.04, green: 0.52, blue: 1)
|
||||
static let statusRunning = Color(red: 0.13, green: 0.83, blue: 0.93)
|
||||
@@ -21,6 +21,31 @@ enum T3Colors {
|
||||
static let danger = Color(red: 1, green: 0.27, blue: 0.23)
|
||||
}
|
||||
|
||||
/// The native client uses semantic fonts so every surface follows Dynamic Type.
|
||||
/// Keep roles here instead of introducing one-off point sizes in feature views.
|
||||
enum T3Typography {
|
||||
static let homeTitle = Font.system(.body, design: .default, weight: .semibold)
|
||||
static let homeMetadata = Font.system(.footnote, design: .default)
|
||||
|
||||
static let navigationTitle = Font.system(.headline, design: .default, weight: .semibold)
|
||||
static let navigationMetadata = Font.system(.footnote, design: .default)
|
||||
static let status = Font.system(.footnote, design: .default, weight: .semibold)
|
||||
|
||||
static let threadBody = Font.system(.body, design: .default)
|
||||
static let threadHeading1 = Font.system(.title2, design: .default, weight: .bold)
|
||||
static let threadHeading2 = Font.system(.title3, design: .default, weight: .bold)
|
||||
static let threadHeading3 = Font.system(.headline, design: .default, weight: .bold)
|
||||
static let threadHeading4 = Font.system(.body, design: .default, weight: .semibold)
|
||||
static let code = Font.system(.callout, design: .monospaced)
|
||||
static let tool = Font.system(.footnote, design: .monospaced)
|
||||
|
||||
static let composer = Font.system(.body, design: .default)
|
||||
static let control = Font.system(.callout, design: .default, weight: .medium)
|
||||
static let supporting = Font.system(.footnote, design: .default)
|
||||
static let supportingStrong = Font.system(.footnote, design: .default, weight: .semibold)
|
||||
static let eyebrow = Font.system(.footnote, design: .default, weight: .bold)
|
||||
}
|
||||
|
||||
enum T3Metrics {
|
||||
static let minimumTapTarget: CGFloat = 44
|
||||
static let sidebarWidth: CGFloat = 320
|
||||
|
||||
@@ -13,7 +13,7 @@ struct FeatureComposerApprovalPanel: View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(spacing: 8) {
|
||||
Text("Pending approval")
|
||||
.font(.caption2.weight(.bold))
|
||||
.font(T3Typography.eyebrow)
|
||||
.tracking(1.3)
|
||||
.textCase(.uppercase)
|
||||
.foregroundStyle(T3Colors.warning)
|
||||
@@ -22,26 +22,31 @@ struct FeatureComposerApprovalPanel: View {
|
||||
|
||||
if total > 1 {
|
||||
Text("\(position)/\(total)")
|
||||
.font(.caption2.monospacedDigit().weight(.semibold))
|
||||
.font(T3Typography.supportingStrong.monospacedDigit())
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
}
|
||||
}
|
||||
|
||||
Text(approval.title)
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.font(T3Typography.navigationTitle)
|
||||
.foregroundStyle(T3Colors.textPrimary)
|
||||
.padding(.top, 5)
|
||||
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text(detailLabel)
|
||||
.font(.system(size: 10, weight: .semibold))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.tracking(0.7)
|
||||
.textCase(.uppercase)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
|
||||
Text(approval.detail)
|
||||
.font(approval.kind == .command ? .caption.monospaced() : .callout)
|
||||
.foregroundStyle(Color.white.opacity(0.84))
|
||||
.font(
|
||||
approval.kind == .command
|
||||
? T3Typography.code
|
||||
: T3Typography.threadBody
|
||||
)
|
||||
.foregroundStyle(T3Colors.textPrimary.opacity(0.92))
|
||||
.lineSpacing(3)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
@@ -85,7 +90,7 @@ struct FeatureComposerApprovalPanel: View {
|
||||
Button("Cancel turn", action: onCancelTurn)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
}
|
||||
.font(.caption.weight(.semibold))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.buttonStyle(.plain)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
@@ -106,7 +111,7 @@ struct FeatureComposerApprovalPanel: View {
|
||||
) -> some View {
|
||||
Button(action: action) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.font(T3Typography.control.weight(.semibold))
|
||||
.foregroundStyle(.white)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: T3Metrics.minimumTapTarget)
|
||||
@@ -144,7 +149,7 @@ struct FeatureComposerUserInputPanel: View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(spacing: 8) {
|
||||
Text(question.header)
|
||||
.font(.caption2.weight(.bold))
|
||||
.font(T3Typography.eyebrow)
|
||||
.tracking(1.3)
|
||||
.textCase(.uppercase)
|
||||
.foregroundStyle(T3Colors.accent)
|
||||
@@ -153,20 +158,20 @@ struct FeatureComposerUserInputPanel: View {
|
||||
|
||||
if input.questions.count > 1 {
|
||||
Text("\(questionIndex + 1)/\(input.questions.count)")
|
||||
.font(.caption2.monospacedDigit().weight(.semibold))
|
||||
.font(T3Typography.supportingStrong.monospacedDigit())
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
}
|
||||
}
|
||||
|
||||
Text(question.question)
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.font(T3Typography.navigationTitle)
|
||||
.foregroundStyle(T3Colors.textPrimary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding(.top, 5)
|
||||
|
||||
if question.allowsMultiple {
|
||||
Text("Select one or more options")
|
||||
.font(.caption)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
.padding(.top, 4)
|
||||
}
|
||||
@@ -188,19 +193,19 @@ struct FeatureComposerUserInputPanel: View {
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.top, 10)
|
||||
}
|
||||
.frame(maxHeight: 252)
|
||||
.frame(maxHeight: 320)
|
||||
.scrollIndicators(.hidden)
|
||||
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: "pencil")
|
||||
.font(.caption)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
|
||||
TextField(
|
||||
"Write custom answer",
|
||||
text: answerBinding(for: question.id)
|
||||
)
|
||||
.font(.subheadline)
|
||||
.font(T3Typography.composer)
|
||||
.submitLabel(.next)
|
||||
.onSubmit(advanceOrSubmit)
|
||||
}
|
||||
@@ -219,19 +224,22 @@ struct FeatureComposerUserInputPanel: View {
|
||||
Button("Back") {
|
||||
questionIndex -= 1
|
||||
}
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.font(T3Typography.control.weight(.semibold))
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.frame(minWidth: T3Metrics.minimumTapTarget, minHeight: 36)
|
||||
.frame(
|
||||
minWidth: T3Metrics.minimumTapTarget,
|
||||
minHeight: T3Metrics.minimumTapTarget
|
||||
)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: advanceOrSubmit) {
|
||||
Text(isLastQuestion ? "Submit" : "Next question")
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.font(T3Typography.control.weight(.semibold))
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 18)
|
||||
.frame(height: 36)
|
||||
.frame(height: T3Metrics.minimumTapTarget)
|
||||
.background(T3Colors.accent, in: Capsule())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -287,12 +295,12 @@ struct FeatureComposerUserInputPanel: View {
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(option.label)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(T3Typography.control)
|
||||
.foregroundStyle(Color.white.opacity(0.9))
|
||||
|
||||
if !option.detail.isEmpty, option.detail != option.label {
|
||||
Text(option.detail)
|
||||
.font(.caption)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
@@ -302,7 +310,7 @@ struct FeatureComposerUserInputPanel: View {
|
||||
|
||||
if isSelected {
|
||||
Image(systemName: "checkmark")
|
||||
.font(.caption.weight(.bold))
|
||||
.font(T3Typography.supporting.weight(.bold))
|
||||
.foregroundStyle(T3Colors.accent)
|
||||
} else if number <= 9 {
|
||||
Text("\(number)")
|
||||
|
||||
@@ -106,9 +106,9 @@ struct FeatureComposerView: View {
|
||||
.stroke(Color.white.opacity(0.105), lineWidth: 1)
|
||||
}
|
||||
.clipShape(composerShape)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 8)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 10)
|
||||
.background {
|
||||
LinearGradient(
|
||||
colors: [.clear, .black.opacity(0.94), .black],
|
||||
@@ -137,7 +137,7 @@ struct FeatureComposerView: View {
|
||||
}
|
||||
} label: {
|
||||
Text(isWorking ? "Message to queue…" : "Ask anything…")
|
||||
.font(.body)
|
||||
.font(T3Typography.composer)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.contentShape(Rectangle())
|
||||
@@ -150,8 +150,8 @@ struct FeatureComposerView: View {
|
||||
submitButton
|
||||
.padding(.trailing, 7)
|
||||
}
|
||||
.padding(.leading, 12)
|
||||
.padding(.vertical, 5)
|
||||
.padding(.leading, 14)
|
||||
.padding(.vertical, 7)
|
||||
}
|
||||
|
||||
private var expandedComposer: some View {
|
||||
@@ -171,21 +171,21 @@ struct FeatureComposerView: View {
|
||||
text: $text,
|
||||
axis: .vertical
|
||||
)
|
||||
.font(.body)
|
||||
.font(T3Typography.composer)
|
||||
.lineLimit(1...7)
|
||||
.focused(focused)
|
||||
.submitLabel(.send)
|
||||
.onSubmit {
|
||||
if canSend { onSend() }
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 5)
|
||||
.frame(minHeight: 57, alignment: .top)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.top, 14)
|
||||
.padding(.bottom, 7)
|
||||
.frame(minHeight: 62, alignment: .top)
|
||||
|
||||
if !attachments.isEmpty, !imagesAllowed {
|
||||
Label("Choose a model that accepts images", systemImage: "exclamationmark.circle")
|
||||
.font(.caption)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.warning)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.horizontal, 15)
|
||||
@@ -194,7 +194,7 @@ struct FeatureComposerView: View {
|
||||
|
||||
if attachmentPreparation.isPreparing {
|
||||
Label(attachmentPreparation.statusLabel, systemImage: "hourglass")
|
||||
.font(.caption)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.horizontal, 15)
|
||||
@@ -292,7 +292,7 @@ struct FeatureComposerView: View {
|
||||
Image(systemName: "lock")
|
||||
.frame(width: 30)
|
||||
}
|
||||
.font(.caption.weight(.medium))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.frame(minHeight: 30)
|
||||
.contentShape(Rectangle())
|
||||
|
||||
@@ -29,7 +29,7 @@ struct MarkdownMessageView: View {
|
||||
|
||||
private struct MarkdownBlocksView: View {
|
||||
let blocks: [MarkdownBlock]
|
||||
var spacing: CGFloat = 10
|
||||
var spacing: CGFloat = 12
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: spacing) {
|
||||
@@ -47,8 +47,8 @@ private struct MarkdownBlockView: View {
|
||||
var body: some View {
|
||||
switch block {
|
||||
case let .paragraph(text):
|
||||
MarkdownInlineText(text, font: .system(size: 14.5))
|
||||
.lineSpacing(2.5)
|
||||
MarkdownInlineText(text, font: T3Typography.threadBody)
|
||||
.lineSpacing(4)
|
||||
|
||||
case let .heading(level, text):
|
||||
MarkdownInlineText(text, font: headingFont(level))
|
||||
@@ -61,12 +61,12 @@ private struct MarkdownBlockView: View {
|
||||
MarkdownListView(items: items, start: start)
|
||||
|
||||
case let .blockquote(document):
|
||||
MarkdownBlocksView(blocks: document.blocks, spacing: 7)
|
||||
MarkdownBlocksView(blocks: document.blocks, spacing: 9)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.padding(.leading, 12)
|
||||
.padding(.leading, 14)
|
||||
.overlay(alignment: .leading) {
|
||||
Rectangle()
|
||||
.fill(T3Colors.textTertiary.opacity(0.75))
|
||||
.fill(T3Colors.textTertiary)
|
||||
.frame(width: 2)
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ private struct MarkdownBlockView: View {
|
||||
|
||||
private func headingFont(_ level: Int) -> Font {
|
||||
switch level {
|
||||
case 1: .title3.weight(.bold)
|
||||
case 2: .headline.weight(.bold)
|
||||
case 3: .subheadline.weight(.bold)
|
||||
default: .system(size: 14.5, weight: .semibold)
|
||||
case 1: T3Typography.threadHeading1
|
||||
case 2: T3Typography.threadHeading2
|
||||
case 3: T3Typography.threadHeading3
|
||||
default: T3Typography.threadHeading4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,13 +97,13 @@ private struct MarkdownListView: View {
|
||||
let start: Int?
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
ForEach(items.indices, id: \.self) { offset in
|
||||
let item = items[offset]
|
||||
HStack(alignment: .top, spacing: 7) {
|
||||
HStack(alignment: .top, spacing: 8) {
|
||||
marker(for: item, offset: offset)
|
||||
.frame(width: 22, height: 21, alignment: .trailing)
|
||||
MarkdownBlocksView(blocks: item.blocks, spacing: 5)
|
||||
.frame(width: 24, height: 24, alignment: .trailing)
|
||||
MarkdownBlocksView(blocks: item.blocks, spacing: 7)
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
}
|
||||
@@ -114,19 +114,19 @@ private struct MarkdownListView: View {
|
||||
private func marker(for item: MarkdownListItem, offset: Int) -> some View {
|
||||
if let task = item.task {
|
||||
Image(systemName: task == .complete ? "checkmark.square.fill" : "square")
|
||||
.font(.system(size: 14, weight: .medium))
|
||||
.font(T3Typography.control)
|
||||
.foregroundStyle(
|
||||
task == .complete ? T3Colors.success : T3Colors.textSecondary
|
||||
)
|
||||
.accessibilityLabel(task == .complete ? "Completed" : "Not completed")
|
||||
} else if let start {
|
||||
Text("\(start + offset).")
|
||||
.font(.system(size: 14, design: .monospaced))
|
||||
.font(T3Typography.supporting.monospaced())
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.accessibilityLabel("Item \(start + offset)")
|
||||
} else {
|
||||
Text("•")
|
||||
.font(.system(size: 14.5, weight: .semibold))
|
||||
.font(T3Typography.threadBody.weight(.semibold))
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
@@ -142,11 +142,11 @@ private struct MarkdownCodeBlockView: View {
|
||||
HStack(spacing: 8) {
|
||||
if let language, !language.isEmpty {
|
||||
Text(language.uppercased())
|
||||
.font(.caption2.weight(.semibold))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
} else {
|
||||
Text("CODE")
|
||||
.font(.caption2.weight(.semibold))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
}
|
||||
Spacer(minLength: 8)
|
||||
@@ -154,15 +154,15 @@ private struct MarkdownCodeBlockView: View {
|
||||
UIPasteboard.general.string = code
|
||||
} label: {
|
||||
Label("Copy", systemImage: "doc.on.doc")
|
||||
.font(.caption.weight(.medium))
|
||||
.font(T3Typography.control)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.frame(minHeight: 28)
|
||||
.frame(minHeight: 32)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityHint("Copies this code block")
|
||||
}
|
||||
.padding(.horizontal, 11)
|
||||
.frame(minHeight: 34)
|
||||
.padding(.horizontal, 13)
|
||||
.frame(minHeight: 40)
|
||||
|
||||
Rectangle()
|
||||
.fill(T3Colors.separator)
|
||||
@@ -170,19 +170,19 @@ private struct MarkdownCodeBlockView: View {
|
||||
|
||||
ScrollView(.horizontal) {
|
||||
Text(verbatim: code)
|
||||
.font(.system(size: 12.5, design: .monospaced))
|
||||
.foregroundStyle(T3Colors.textPrimary.opacity(0.9))
|
||||
.lineSpacing(2)
|
||||
.font(T3Typography.code)
|
||||
.foregroundStyle(T3Colors.textPrimary.opacity(0.94))
|
||||
.lineSpacing(3)
|
||||
.textSelection(.enabled)
|
||||
.fixedSize(horizontal: true, vertical: true)
|
||||
.padding(11)
|
||||
.padding(13)
|
||||
}
|
||||
.scrollIndicators(.hidden)
|
||||
}
|
||||
.background(T3Colors.surfaceRaised)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.stroke(T3Colors.border, lineWidth: 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import SwiftUI
|
||||
|
||||
public struct ThreadDetailView: View {
|
||||
@SwiftUI.Environment(\.dismiss) private var dismiss
|
||||
|
||||
@Bindable var model: FeatureRootModel
|
||||
let thread: FeatureThread
|
||||
let submitMessage: (FeatureMessageSubmission) async -> Bool
|
||||
@@ -42,9 +40,21 @@ public struct ThreadDetailView: View {
|
||||
}
|
||||
}
|
||||
.background(Color.black)
|
||||
.toolbar(.hidden, for: .navigationBar)
|
||||
.safeAreaInset(edge: .top, spacing: 0) {
|
||||
detailHeader
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(false)
|
||||
.t3NavigationChrome()
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .principal) {
|
||||
threadHeaderTitle
|
||||
}
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
HStack(spacing: 2) {
|
||||
TimelineView(.periodic(from: .now, by: 1)) { context in
|
||||
headerStatus(at: context.date)
|
||||
}
|
||||
threadActionsMenu
|
||||
}
|
||||
}
|
||||
}
|
||||
.task(id: thread.id) {
|
||||
isLoading = true
|
||||
@@ -115,55 +125,27 @@ public struct ThreadDetailView: View {
|
||||
)
|
||||
}
|
||||
|
||||
private var detailHeader: some View {
|
||||
HStack(spacing: 8) {
|
||||
Button { dismiss() } label: {
|
||||
Image(systemName: "chevron.left")
|
||||
.font(.system(size: 17, weight: .semibold))
|
||||
.frame(width: 30, height: T3Metrics.minimumTapTarget)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.accessibilityLabel("Back")
|
||||
private var threadHeaderTitle: some View {
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(currentThread.title)
|
||||
.font(T3Typography.navigationTitle)
|
||||
.foregroundStyle(T3Colors.textPrimary)
|
||||
.lineLimit(1)
|
||||
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(currentThread.title)
|
||||
.font(.system(size: 14, weight: .semibold))
|
||||
.tracking(-0.12)
|
||||
.foregroundStyle(T3Colors.textPrimary)
|
||||
HStack(spacing: 5) {
|
||||
Image(systemName: "arrow.triangle.branch")
|
||||
Text(headerBranch)
|
||||
.lineLimit(1)
|
||||
|
||||
HStack(spacing: 5) {
|
||||
Image(systemName: "arrow.triangle.branch")
|
||||
.font(.system(size: 9, weight: .medium))
|
||||
Text(headerBranch)
|
||||
if let environmentName = currentThread.homeEnvironmentLabel(in: model.snapshot) {
|
||||
Text("·")
|
||||
Text(environmentName)
|
||||
.lineLimit(1)
|
||||
if let environmentName = currentThread.homeEnvironmentLabel(in: model.snapshot) {
|
||||
Text("·")
|
||||
Text(environmentName)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
.font(.system(size: 10.5))
|
||||
.foregroundStyle(Color.white.opacity(0.4))
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
TimelineView(.periodic(from: .now, by: 1)) { context in
|
||||
headerStatus(at: context.date)
|
||||
}
|
||||
|
||||
threadActionsMenu
|
||||
}
|
||||
.padding(.leading, 5)
|
||||
.padding(.trailing, 8)
|
||||
.frame(height: 49)
|
||||
.background(T3Colors.background)
|
||||
.overlay(alignment: .bottom) {
|
||||
Rectangle()
|
||||
.fill(T3Colors.separator)
|
||||
.frame(height: 1)
|
||||
.font(T3Typography.navigationMetadata)
|
||||
.foregroundStyle(T3Colors.textTertiary)
|
||||
}
|
||||
.accessibilityElement(children: .combine)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -171,17 +153,16 @@ public struct ThreadDetailView: View {
|
||||
HStack(spacing: 5) {
|
||||
if let icon = headerStatusIcon {
|
||||
Image(systemName: icon)
|
||||
.font(.system(size: 10.5, weight: .semibold))
|
||||
}
|
||||
if let duration = currentThread.homeWorkingDuration(at: now) {
|
||||
Text(duration)
|
||||
.font(.system(size: 10.5, weight: .semibold, design: .monospaced))
|
||||
.monospaced()
|
||||
.monospacedDigit()
|
||||
} else {
|
||||
Text(currentThread.homeStatusLabel ?? "Ready")
|
||||
}
|
||||
}
|
||||
.font(.system(size: 11.5, weight: .semibold))
|
||||
.font(T3Typography.status)
|
||||
.foregroundStyle(headerStatusColor)
|
||||
.lineLimit(1)
|
||||
.accessibilityElement(children: .combine)
|
||||
@@ -254,8 +235,8 @@ public struct ThreadDetailView: View {
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
.font(.system(size: 16, weight: .semibold))
|
||||
.frame(width: 30, height: T3Metrics.minimumTapTarget)
|
||||
.font(.body.weight(.semibold))
|
||||
.frame(width: T3Metrics.minimumTapTarget, height: T3Metrics.minimumTapTarget)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
@@ -297,7 +278,7 @@ public struct ThreadDetailView: View {
|
||||
private func timeline(_ detail: FeatureThreadDetail) -> some View {
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView {
|
||||
LazyVStack(alignment: .leading, spacing: 13) {
|
||||
LazyVStack(alignment: .leading, spacing: 22) {
|
||||
if detail.messages.isEmpty {
|
||||
ContentUnavailableView(
|
||||
"Ready for a task",
|
||||
@@ -315,9 +296,11 @@ public struct ThreadDetailView: View {
|
||||
|
||||
Color.clear.frame(height: 1).id("timeline-bottom")
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.top, 13)
|
||||
.padding(.bottom, 10)
|
||||
.padding(.horizontal, 18)
|
||||
.padding(.top, 18)
|
||||
.padding(.bottom, 14)
|
||||
.frame(maxWidth: T3Metrics.readingWidth)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
.task(id: thread.id) {
|
||||
@@ -430,22 +413,23 @@ struct FeatureMessageView: View {
|
||||
switch message.role {
|
||||
case .user:
|
||||
HStack {
|
||||
Spacer(minLength: 34)
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Spacer(minLength: 44)
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
FeatureMessageAttachmentsView(attachments: message.attachments)
|
||||
if !message.text.isEmpty {
|
||||
MarkdownMessageView(message.text)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 9)
|
||||
.padding(.horizontal, 14)
|
||||
.padding(.vertical, 11)
|
||||
.frame(maxWidth: T3Metrics.readingWidth * 0.88, alignment: .leading)
|
||||
.background(
|
||||
Color.white.opacity(0.075),
|
||||
Color.white.opacity(0.09),
|
||||
in: UnevenRoundedRectangle(
|
||||
topLeadingRadius: 14,
|
||||
bottomLeadingRadius: 14,
|
||||
topLeadingRadius: 16,
|
||||
bottomLeadingRadius: 16,
|
||||
bottomTrailingRadius: 4,
|
||||
topTrailingRadius: 14
|
||||
topTrailingRadius: 16
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -453,13 +437,13 @@ struct FeatureMessageView: View {
|
||||
.accessibilityValue(accessibilityValue)
|
||||
.accessibilityIdentifier("message-\(message.id)")
|
||||
case .assistant:
|
||||
VStack(alignment: .leading, spacing: 7) {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
if message.state == .streaming {
|
||||
HStack(spacing: 6) {
|
||||
Image(systemName: "circle.dotted")
|
||||
Text("Working")
|
||||
}
|
||||
.font(.caption.weight(.semibold))
|
||||
.font(T3Typography.supportingStrong)
|
||||
.foregroundStyle(T3Colors.statusRunning)
|
||||
}
|
||||
FeatureMessageAttachmentsView(attachments: message.attachments)
|
||||
@@ -473,21 +457,23 @@ struct FeatureMessageView: View {
|
||||
case .tool:
|
||||
DisclosureGroup {
|
||||
Text(message.text)
|
||||
.font(.caption.monospaced())
|
||||
.foregroundStyle(.secondary)
|
||||
.font(T3Typography.tool)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.lineSpacing(3)
|
||||
.textSelection(.enabled)
|
||||
.padding(.top, 6)
|
||||
.padding(.top, 8)
|
||||
} label: {
|
||||
Label(message.toolName ?? "Tool output", systemImage: "terminal")
|
||||
.font(.caption.monospaced().weight(.medium))
|
||||
.font(T3Typography.tool.weight(.medium))
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
.padding(.vertical, 6)
|
||||
.frame(minHeight: T3Metrics.minimumTapTarget)
|
||||
.accessibilityIdentifier("message-\(message.id)")
|
||||
case .system:
|
||||
Text(message.text)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.font(T3Typography.supporting)
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.accessibilityIdentifier("message-\(message.id)")
|
||||
}
|
||||
@@ -563,7 +549,7 @@ private struct FeatureMessageAttachmentsView: View {
|
||||
)
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(attachment.name)
|
||||
.font(.caption.weight(.medium))
|
||||
.font(T3Typography.control)
|
||||
.lineLimit(1)
|
||||
Text(
|
||||
ByteCountFormatter.string(
|
||||
@@ -571,7 +557,7 @@ private struct FeatureMessageAttachmentsView: View {
|
||||
countStyle: .file
|
||||
)
|
||||
)
|
||||
.font(.caption2.monospacedDigit())
|
||||
.font(T3Typography.supporting.monospacedDigit())
|
||||
.foregroundStyle(T3Colors.textSecondary)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user