Skip to content

Commit f9d0b38

Browse files
committed
Adjust UI
1 parent 5cbc458 commit f9d0b38

3 files changed

Lines changed: 11 additions & 14 deletions

File tree

Core/Sources/SuggestionWidget/Styles.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SwiftUI
55
enum Style {
66
static let panelHeight: Double = 500
77
static let panelWidth: Double = 454
8-
static let widgetHeight: Double = 30
8+
static let widgetHeight: Double = 24
99
static var widgetWidth: Double { widgetHeight }
1010
static let widgetPadding: Double = 4
1111
}

Core/Sources/SuggestionWidget/SuggestionPanelContent/ChatPanel.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,21 +290,17 @@ struct ChatPanelInputArea: View {
290290
Text(typedMessage.isEmpty ? "Hi" : typedMessage).opacity(0)
291291
.font(.system(size: 14))
292292
.frame(maxWidth: .infinity, maxHeight: 400)
293-
.overlay(alignment: .leadingFirstTextBaseline) {
294-
Text("Write something..")
295-
.foregroundColor(.secondary)
296-
.font(.system(size: 14))
297-
.opacity(typedMessage.isEmpty ? 1 : 0)
298-
}
299-
.padding(.top, 0)
300-
.padding(.bottom, 3)
293+
.padding(.top, 1)
294+
.padding(.bottom, 2)
301295
.padding(.horizontal, 4)
302296

303297
CustomTextEditor(
304298
text: $typedMessage,
305299
font: .systemFont(ofSize: 14),
306300
onSubmit: { submitText() }
307301
)
302+
.padding(.top, 1)
303+
.padding(.bottom, -1)
308304
}
309305
.focused($isInputAreaFocused)
310306
.padding(8)

Core/Sources/SuggestionWidget/WidgetView.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ struct WidgetView: View {
3838
}
3939
}
4040
.overlay {
41-
let minimumLineWidth: Double = 4
42-
let lineWidth = (1 - processingProgress) * 28 + minimumLineWidth
41+
let minimumLineWidth: Double = 3
42+
let lineWidth = (1 - processingProgress) *
43+
(Style.widgetWidth - minimumLineWidth / 2) + minimumLineWidth
4344
let scale = max(processingProgress * 1, 0.0001)
4445
let empty = panelViewModel.content == nil && chatWindowViewModel.chat == nil
4546

@@ -49,7 +50,7 @@ struct WidgetView: View {
4950
Color(nsColor: .darkGray),
5051
style: .init(lineWidth: minimumLineWidth)
5152
)
52-
.padding(2)
53+
.padding(minimumLineWidth / 2)
5354

5455
// how do I stop the repeatForever animation without removing the view?
5556
// I tried many solutions found on stackoverflow but non of them works.
@@ -59,7 +60,7 @@ struct WidgetView: View {
5960
Color.accentColor,
6061
style: .init(lineWidth: lineWidth)
6162
)
62-
.padding(2)
63+
.padding(minimumLineWidth / 2)
6364
.scaleEffect(x: scale, y: scale)
6465
.opacity(!empty || viewModel.isProcessing ? 1 : 0)
6566
.animation(
@@ -72,7 +73,7 @@ struct WidgetView: View {
7273
Color.accentColor,
7374
style: .init(lineWidth: lineWidth)
7475
)
75-
.padding(2)
76+
.padding(minimumLineWidth / 2)
7677
.scaleEffect(x: scale, y: scale)
7778
.opacity(!empty || viewModel.isProcessing ? 1 : 0)
7879
.animation(.easeInOut(duration: 1), value: processingProgress)

0 commit comments

Comments
 (0)