Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/web-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/fonts/fonts.css" />
<title>BitFun - AI Code Assistant</title>
<script>
(function () {
var dark = '#121214';
var light = '#e8ecf2';
var m = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
document.documentElement.style.backgroundColor = m && m.matches ? dark : light;
})();
</script>
<style>
* {
margin: 0;
Expand All @@ -19,7 +27,7 @@
overflow: hidden;
}

/* Default background color (will be overridden by Tauri injected styles) */
/* Default background: inline script sets from prefers-color-scheme; theme overrides later */
html {
background-color: #121214;
}
Expand Down
Binary file modified src/web-ui/public/Logo-ICON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions src/web-ui/src/features/onboarding/components/steps/ThemeStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Palette } from 'lucide-react';
import { themeService } from '@/infrastructure/theme';
import { themeService, SYSTEM_THEME_ID } from '@/infrastructure/theme';
import type { ThemeConfig } from '@/infrastructure/theme';
import { getSystemPreferredDefaultThemeId } from '@/infrastructure/theme/presets';

interface ThemeStepProps {
selectedTheme: string;
onThemeChange: (theme: string) => void;
}

const THEME_OPTIONS = [
{
id: SYSTEM_THEME_ID,
nameKey: 'theme.themes.system.name',
descKey: 'theme.themes.system.description',
},
{
id: 'bitfun-light',
nameKey: 'theme.themes.bitfun-light.name',
Expand Down Expand Up @@ -258,7 +264,10 @@ export const ThemeStep: React.FC<ThemeStepProps> = ({
{/* Theme grid */}
<div className="bitfun-onboarding-theme__grid">
{THEME_OPTIONS.map((themeOption) => {
const fullTheme = themeService.getTheme(themeOption.id as any);
const fullTheme =
themeOption.id === SYSTEM_THEME_ID
? themeService.getTheme(getSystemPreferredDefaultThemeId())
: themeService.getTheme(themeOption.id as any);

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { useOnboardingStore, isModelConfigComplete, type OnboardingModelConfig } from '../store/onboardingStore';
import type { LocaleId } from '@/infrastructure/i18n/types';
import type { ThemeId } from '@/infrastructure/theme/types';
import type { ThemeSelectionId } from '@/infrastructure/theme/types';
import { configAPI } from '@/infrastructure/api';
import { configManager } from '@/infrastructure/config/services/ConfigManager';
import { modelConfigManager } from '@/infrastructure/config/services/modelConfigs';
Expand Down Expand Up @@ -159,7 +159,7 @@ class OnboardingServiceClass {
*/
async applyConfiguration(config: {
language?: LocaleId;
theme?: ThemeId;
theme?: ThemeSelectionId;
modelConfig?: OnboardingModelConfig | null;
}): Promise<void> {
try {
Expand Down
13 changes: 7 additions & 6 deletions src/web-ui/src/features/onboarding/store/onboardingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import type { LocaleId } from '@/infrastructure/i18n/types';
import type { ThemeId } from '@/infrastructure/theme/types';
import { SYSTEM_THEME_ID, type ThemeSelectionId } from '@/infrastructure/theme/types';

/**
* Onboarding step enum.
Expand Down Expand Up @@ -58,7 +58,7 @@ interface OnboardingState {

// Configuration data
selectedLanguage: LocaleId;
selectedTheme: ThemeId;
selectedTheme: ThemeSelectionId;
modelConfig: OnboardingModelConfig | null;

// Actions
Expand All @@ -72,7 +72,7 @@ interface OnboardingState {

// Configuration updates
setLanguage: (language: LocaleId) => void;
setTheme: (theme: ThemeId) => void;
setTheme: (theme: ThemeSelectionId) => void;
setModelConfig: (config: OnboardingModelConfig | null) => void;
markStepCompleted: (step: OnboardingStep) => void;

Expand All @@ -94,7 +94,7 @@ export const useOnboardingStore = create<OnboardingState>()(
skipped: false,

selectedLanguage: 'zh-CN',
selectedTheme: 'bitfun-light',
selectedTheme: SYSTEM_THEME_ID,
modelConfig: null,

// Start onboarding
Expand Down Expand Up @@ -170,7 +170,8 @@ export const useOnboardingStore = create<OnboardingState>()(
currentStep: 'language',
completedSteps: [],
skipped: false,
modelConfig: null
modelConfig: null,
selectedTheme: SYSTEM_THEME_ID,
});
},

Expand All @@ -180,7 +181,7 @@ export const useOnboardingStore = create<OnboardingState>()(
},

// Set theme
setTheme: (theme: ThemeId) => {
setTheme: (theme: ThemeSelectionId) => {
set({ selectedTheme: theme });
},

Expand Down
33 changes: 26 additions & 7 deletions src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
useThemeManagement,
ThemeMetadata,
ThemeConfig as ThemeConfigType,
SYSTEM_THEME_ID,
} from '@/infrastructure/theme';
import { themeService } from '@/infrastructure/theme/core/ThemeService';
import { useLanguageSelector } from '@/infrastructure/i18n';
Expand Down Expand Up @@ -87,6 +88,22 @@ function BasicsAppearanceSection() {
: theme.description || '';
};

const themeSelectOptions = useMemo(
() => [
{
value: SYSTEM_THEME_ID,
label: t('appearance.systemTheme'),
description: t('appearance.systemThemeDescription'),
},
...themes.map((theme) => ({
value: theme.id,
label: getThemeDisplayName(theme),
description: getThemeDisplayDescription(theme),
})),
],
[themes, t]
);

return (
<div className="theme-config">
<div className="theme-config__content">
Expand Down Expand Up @@ -150,14 +167,16 @@ function BasicsAppearanceSection() {
value={themeId ?? ''}
onChange={(value) => handleThemeChange(value as string)}
disabled={loading}
options={themes.map((theme) => ({
value: theme.id,
label: getThemeDisplayName(theme),
description: getThemeDisplayDescription(theme),
}))}
options={themeSelectOptions}
renderOption={(option) => {
const theme = themes.find((item) => item.id === String(option.value));
const fullTheme = theme ? themeService.getTheme(theme.id) : null;
const v = String(option.value);
const fullTheme =
v === SYSTEM_THEME_ID
? themeService.getTheme(themeService.getResolvedThemeId())
: (() => {
const meta = themes.find((item) => item.id === v);
return meta ? themeService.getTheme(meta.id) : null;
})();
const optionContent = (
<div className="theme-config__theme-option">
<span className="theme-config__theme-option-name">{option.label}</span>
Expand Down
Loading
Loading