Skip to content

Commit d9e1908

Browse files
authored
Merge pull request #205 from SWangHash/yjt_fix_settings_ui_main
fix: settings UI consistency — empty states, MCP layout, remove power…
2 parents c87ec48 + 07a5d04 commit d9e1908

7 files changed

Lines changed: 24 additions & 113 deletions

File tree

‎src/web-ui/src/infrastructure/config/components/AIModelConfig.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377

378378
border: 1px dashed var(--border-base);
379379
border-radius: $size-radius-sm;
380-
background: transparent;
380+
background: var(--element-bg-subtle);
381381

382382
svg {
383383
opacity: 0.5;

‎src/web-ui/src/infrastructure/config/components/AcpAgentsConfig.scss‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@
241241
}
242242

243243
&__empty {
244-
padding: $size-gap-4;
244+
display: flex;
245+
align-items: center;
246+
justify-content: center;
247+
padding: $size-gap-6 $size-gap-4;
245248
color: var(--color-text-muted);
246249
font-size: var(--font-size-sm);
247250
text-align: center;

‎src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx‎

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -241,100 +241,6 @@ function BasicsAutoUpdateSection() {
241241
);
242242
}
243243

244-
function BasicsPreventSleepSection() {
245-
const { t } = useTranslation('settings/basics');
246-
const isTauri = typeof window !== 'undefined' && '__TAURI__' in window;
247-
const [enabled, setEnabled] = useState(false);
248-
const [loading, setLoading] = useState(true);
249-
const [saving, setSaving] = useState(false);
250-
const [message, setMessage] = useState<{ type: 'success' | 'error' | 'info'; text: string } | null>(null);
251-
252-
const showMessage = useCallback((type: 'success' | 'error' | 'info', text: string) => {
253-
setMessage({ type, text });
254-
setTimeout(() => setMessage(null), 3000);
255-
}, []);
256-
257-
useEffect(() => {
258-
if (!isTauri) {
259-
setLoading(false);
260-
return;
261-
}
262-
263-
let cancelled = false;
264-
void (async () => {
265-
try {
266-
setLoading(true);
267-
const value = await systemAPI.getPreventSleepEnabled();
268-
if (!cancelled) {
269-
setEnabled(value);
270-
}
271-
} catch (error) {
272-
log.error('Failed to load prevent-sleep preference', error);
273-
if (!cancelled) {
274-
showMessage('error', t('preventSleep.messages.loadFailed'));
275-
}
276-
} finally {
277-
if (!cancelled) {
278-
setLoading(false);
279-
}
280-
}
281-
})();
282-
283-
return () => {
284-
cancelled = true;
285-
};
286-
}, [isTauri, showMessage, t]);
287-
288-
const handleToggle = useCallback(
289-
async (next: boolean) => {
290-
const previous = enabled;
291-
setEnabled(next);
292-
setSaving(true);
293-
try {
294-
await systemAPI.setPreventSleepEnabled(next);
295-
showMessage('success', t('preventSleep.messages.saved'));
296-
} catch (error) {
297-
setEnabled(previous);
298-
log.error('Failed to set prevent-sleep preference', { next, error });
299-
showMessage('error', t('preventSleep.messages.saveFailed'));
300-
} finally {
301-
setSaving(false);
302-
}
303-
},
304-
[enabled, showMessage, t]
305-
);
306-
307-
if (!isTauri) {
308-
return null;
309-
}
310-
311-
if (loading) {
312-
return <ConfigPageLoading text={t('preventSleep.messages.loading')} />;
313-
}
314-
315-
return (
316-
<ConfigPageSection
317-
title={t('preventSleep.sections.title')}
318-
description={t('preventSleep.sections.hint')}
319-
>
320-
<ConfigPageMessage message={message} />
321-
<ConfigPageRow
322-
label={t('preventSleep.toggleLabel')}
323-
description={t('preventSleep.toggleDescription')}
324-
align="center"
325-
>
326-
<Switch
327-
checked={enabled}
328-
onChange={(event) => {
329-
void handleToggle(event.target.checked);
330-
}}
331-
disabled={saving}
332-
/>
333-
</ConfigPageRow>
334-
</ConfigPageSection>
335-
);
336-
}
337-
338244
function BasicsLoggingSection() {
339245
const { t } = useTranslation('settings/basics');
340246
const [configLevel, setConfigLevel] = useState<BackendLogLevel>('info');
@@ -1238,7 +1144,6 @@ const BasicsConfig: React.FC = () => {
12381144
<ConfigPageHeader title={t('title')} subtitle={t('subtitle')} />
12391145
<ConfigPageContent className="bitfun-basics-config__content">
12401146
<BasicsLaunchAtLoginSection />
1241-
<BasicsPreventSleepSection />
12421147
<BasicsAutoUpdateSection />
12431148
<BasicsWindowBehaviorSection />
12441149
<BasicsLoggingSection />

‎src/web-ui/src/infrastructure/config/components/ExternalSourcesConfig.scss‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,18 @@
542542
}
543543

544544
&__mcp-empty {
545+
display: flex;
546+
flex-direction: column;
547+
align-items: center;
548+
justify-content: center;
549+
gap: var(--size-gap-2);
550+
padding: var(--size-gap-6) var(--size-gap-4);
545551
color: var(--color-text-secondary);
546-
font-size: 13px;
547-
display: grid;
548-
gap: 8px;
549-
padding: 12px 0;
552+
font-size: var(--font-size-sm);
553+
text-align: center;
550554

551555
code {
552-
font-size: 12px;
556+
font-size: var(--font-size-xs);
553557
color: var(--color-text-muted);
554558
}
555559
}

‎src/web-ui/src/infrastructure/config/components/McpToolsConfig.scss‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
@use '../../../component-library/styles/tokens' as *;
22

33
.bitfun-mcp-tools {
4-
.bitfun-collection-empty {
5-
justify-content: flex-start;
6-
padding: $size-gap-2 0;
7-
font-size: var(--font-size-xs);
8-
}
94
// ─── JSON editor (MCP) ─────────────────────────────────────────────────────
105
&__json-editor {
11-
padding: $size-gap-3 0;
6+
padding: $size-gap-3;
127
border-bottom: 1px solid var(--border-subtle);
138
display: flex;
149
flex-direction: column;
@@ -40,7 +35,7 @@
4035

4136
&__json-actions {
4237
display: flex;
43-
justify-content: center;
38+
justify-content: flex-end;
4439
gap: $size-gap-2;
4540
}
4641

‎src/web-ui/src/infrastructure/config/components/VoiceInputConfig.scss‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@
283283
}
284284

285285
&__empty {
286-
color: var(--color-text-secondary);
286+
display: flex;
287+
align-items: center;
288+
justify-content: center;
289+
padding: $size-gap-6 $size-gap-4;
290+
color: var(--color-text-muted);
287291
font-size: var(--font-size-sm);
288292
}
289293
}

‎src/web-ui/src/shared/notification-system/components/NotificationItem.scss‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@
117117
transition: all $motion-base $easing-standard;
118118

119119
&--primary {
120-
background: var(--color-accent-600);
121-
color: var(--color-text-primary);
120+
background: color-mix(in srgb, var(--color-accent-500) 25%, var(--element-bg-base));
121+
color: var(--color-accent-500);
122122

123123
&:hover {
124-
background: var(--color-accent-500);
124+
background: color-mix(in srgb, var(--color-accent-500) 35%, var(--element-bg-base));
125125
}
126126

127127
&:active {

0 commit comments

Comments
 (0)