Skip to content

Commit 8316621

Browse files
committed
opt: universe improve onboard ux
Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai>
1 parent 2c26146 commit 8316621

43 files changed

Lines changed: 2681 additions & 850 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/macos/Scripts/package-runtime.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ VOICE_RUNTIME_REQUIREMENTS=(
3030
"funasr>=1.2,<2"
3131
"modelscope>=1.10,<2"
3232
"setuptools>=69"
33-
"torchaudio>=2.11,<3"
33+
# Match the macOS torch wheel family; newer torchaudio wheels are arm64-only.
34+
"torchaudio>=2.2,<2.3"
3435
)
3536

3637
fail() {

apps/macos/Sources/AppModel.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,8 +1197,8 @@ final class ElephantAppModel: ObservableObject {
11971197
@Published var userAvatarPath = UserDefaults.standard.string(forKey: ElephantAppModel.userAvatarPathKey) ?? ""
11981198
@Published var herdAvatarPaths: [String: String] = UserDefaults.standard.dictionary(forKey: ElephantAppModel.herdAvatarPathsKey) as? [String: String] ?? [:]
11991199
@Published var hiddenEpisodeIDs: Set<String> = Set(UserDefaults.standard.stringArray(forKey: ElephantAppModel.hiddenEpisodeIDsKey) ?? [])
1200-
@Published var isSleepDisplayPresented = false
1201-
@Published var sleepDisplayReason = "manual"
1200+
@Published var isSleepDisplayPresented = ElephantAppModel.shouldPresentLaunchLockScreen()
1201+
@Published var sleepDisplayReason = ElephantAppModel.shouldPresentLaunchLockScreen() ? "launch" : "manual"
12021202
@Published var sleepUnlockPassword = ""
12031203
@Published var sleepUnlockError = ""
12041204
@Published var sleepIdleMinutes = ElephantAppModel.persistedSleepIdleMinutes()
@@ -1260,6 +1260,10 @@ final class ElephantAppModel: ObservableObject {
12601260
return UserDefaults.standard.bool(forKey: key)
12611261
}
12621262

1263+
private static func shouldPresentLaunchLockScreen() -> Bool {
1264+
!onboardingPreviewMode && storedAppLockPasswordRecord() != nil
1265+
}
1266+
12631267
private static func localizedText(_ language: AppLanguage, en: String, zh: String, fr: String, de: String) -> String {
12641268
switch language {
12651269
case .zh: return zh

apps/macos/Sources/DesignSystem.swift

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,11 @@ struct SettingsRow: View {
539539
var value: String
540540

541541
var body: some View {
542-
HStack(alignment: .firstTextBaseline, spacing: 18) {
542+
HStack(alignment: .firstTextBaseline, spacing: 16) {
543543
Text(label)
544-
.font(.callout)
544+
.font(.callout.weight(.medium))
545545
.foregroundStyle(ElephantTheme.muted)
546-
.frame(width: 148, alignment: .leading)
546+
.frame(width: 132, alignment: .leading)
547547
Text(value)
548548
.font(.callout)
549549
.foregroundStyle(ElephantTheme.ink)
@@ -552,7 +552,8 @@ struct SettingsRow: View {
552552
.truncationMode(.middle)
553553
.frame(maxWidth: .infinity, alignment: .leading)
554554
}
555-
.padding(.vertical, 7)
555+
.frame(maxWidth: .infinity, minHeight: 34, alignment: .leading)
556+
.padding(.vertical, 5)
556557
}
557558
}
558559

@@ -572,21 +573,76 @@ struct SettingsFieldRow<Accessory: View>: View {
572573
}
573574

574575
var body: some View {
575-
HStack(alignment: .center, spacing: 18) {
576+
HStack(alignment: .center, spacing: 16) {
576577
Text(label)
577-
.font(.callout)
578+
.font(.callout.weight(.medium))
578579
.foregroundStyle(ElephantTheme.muted)
579-
.frame(width: 148, alignment: .leading)
580+
.frame(width: 132, alignment: .leading)
580581
Text(value)
581582
.font(.callout)
582583
.foregroundStyle(ElephantTheme.ink)
583584
.textSelection(.enabled)
584585
.lineLimit(1)
585586
.truncationMode(.middle)
586-
Spacer(minLength: 0)
587+
.frame(maxWidth: 260, alignment: .leading)
588+
Spacer(minLength: 12)
587589
accessory
588590
}
589-
.padding(.vertical, 7)
591+
.frame(maxWidth: .infinity, minHeight: 34, alignment: .leading)
592+
.padding(.vertical, 5)
593+
}
594+
}
595+
596+
private struct SettingsControlFieldModifier: ViewModifier {
597+
var width: CGFloat?
598+
var minHeight: CGFloat
599+
600+
func body(content: Content) -> some View {
601+
content
602+
.textFieldStyle(.plain)
603+
.font(.callout)
604+
.foregroundStyle(ElephantTheme.ink)
605+
.padding(.horizontal, 10)
606+
.frame(width: width, alignment: .center)
607+
.frame(minHeight: minHeight, alignment: .center)
608+
.frame(maxWidth: width == nil ? .infinity : width, alignment: .center)
609+
.background(
610+
Color(nsColor: .controlBackgroundColor).opacity(0.84),
611+
in: RoundedRectangle(cornerRadius: 8, style: .continuous)
612+
)
613+
.overlay(
614+
RoundedRectangle(cornerRadius: 8, style: .continuous)
615+
.stroke(ElephantTheme.line.opacity(0.72), lineWidth: 1)
616+
)
617+
}
618+
}
619+
620+
private struct SettingsTextEditorModifier: ViewModifier {
621+
var minHeight: CGFloat
622+
623+
func body(content: Content) -> some View {
624+
content
625+
.scrollContentBackground(.hidden)
626+
.padding(8)
627+
.frame(minHeight: minHeight)
628+
.background(
629+
Color(nsColor: .controlBackgroundColor).opacity(0.84),
630+
in: RoundedRectangle(cornerRadius: 8, style: .continuous)
631+
)
632+
.overlay(
633+
RoundedRectangle(cornerRadius: 8, style: .continuous)
634+
.stroke(ElephantTheme.line.opacity(0.72), lineWidth: 1)
635+
)
636+
}
637+
}
638+
639+
extension View {
640+
func settingsControlField(width: CGFloat? = nil, minHeight: CGFloat = 34) -> some View {
641+
modifier(SettingsControlFieldModifier(width: width, minHeight: minHeight))
642+
}
643+
644+
func settingsTextEditor(minHeight: CGFloat = 120) -> some View {
645+
modifier(SettingsTextEditorModifier(minHeight: minHeight))
590646
}
591647
}
592648

0 commit comments

Comments
 (0)