mirror of
https://github.com/handsomezhuzhu/AeroStart.git
synced 2026-02-20 20:10:15 +00:00
增加插件,自定义座右铭
This commit is contained in:
@@ -29,7 +29,8 @@ const DEFAULT_SETTINGS: UserSettings = {
|
||||
customWallpapers: [],
|
||||
enableSearchHistory: true,
|
||||
searchHistory: [],
|
||||
language: 'en'
|
||||
language: 'zh',
|
||||
motto: '同是天涯沦落人,相逢何必曾相识'
|
||||
};
|
||||
|
||||
type ViewMode = 'search' | 'dashboard';
|
||||
@@ -232,6 +233,7 @@ const App: React.FC = () => {
|
||||
<Clock
|
||||
showSeconds={settings.showSeconds}
|
||||
use24HourFormat={settings.use24HourFormat}
|
||||
motto={settings.motto}
|
||||
/>
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
|
||||
@@ -4,9 +4,10 @@ import { useTranslation } from '../i18n';
|
||||
interface ClockProps {
|
||||
showSeconds?: boolean;
|
||||
use24HourFormat?: boolean;
|
||||
motto?: string;
|
||||
}
|
||||
|
||||
const Clock: React.FC<ClockProps> = ({ showSeconds = true, use24HourFormat = true }) => {
|
||||
const Clock: React.FC<ClockProps> = ({ showSeconds = true, use24HourFormat = true, motto = '同是天涯沦落人,相逢何必曾相识' }) => {
|
||||
const [time, setTime] = useState(new Date());
|
||||
const { language } = useTranslation();
|
||||
|
||||
@@ -83,8 +84,8 @@ const Clock: React.FC<ClockProps> = ({ showSeconds = true, use24HourFormat = tru
|
||||
</div>
|
||||
|
||||
{/* Motto */}
|
||||
<div className="mt-4 text-lg md:text-xl font-light text-white/70 tracking-widest uppercase">
|
||||
同是天涯沦落人,相逢何必曾相识
|
||||
<div className="mt-4 text-lg md:text-xl font-light text-white/70 tracking-widest uppercase text-center max-w-2xl">
|
||||
{motto}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -49,6 +49,10 @@ const ThemeSettings: React.FC<ThemeSettingsProps> = ({ settings, onUpdateSetting
|
||||
onUpdateSettings({ ...settings, language: lang });
|
||||
};
|
||||
|
||||
const handleMottoChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
onUpdateSettings({ ...settings, motto: e.target.value });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
{/* Language Selection */}
|
||||
@@ -103,6 +107,18 @@ const ThemeSettings: React.FC<ThemeSettingsProps> = ({ settings, onUpdateSetting
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Motto Input */}
|
||||
<div className="space-y-2">
|
||||
<span className="text-xs font-semibold text-white/50 uppercase tracking-wider block">{t.motto}</span>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.motto || ''}
|
||||
onChange={handleMottoChange}
|
||||
className="w-full bg-white/10 border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:border-white/30 focus:outline-none transition-colors"
|
||||
placeholder={t.enterMotto}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Toggle settings */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
@@ -16,33 +16,16 @@ export const DEFAULT_BACKGROUND_IMAGE = "https://picsum.photos/1920/1080?graysca
|
||||
|
||||
export const PRESET_WALLPAPERS: PresetWallpaper[] = [
|
||||
{
|
||||
name: 'Default',
|
||||
name: 'Bench',
|
||||
type: 'image',
|
||||
url: 'https://tc-new.z.wiki/autoupload/f/JPb3wcBYRgvdgjBZlDTRdWSEpzNQ5XwArLwhNo1hcymyl5f0KlZfm6UsKj-HyTuv/20250828/JmPj/3840X2160/light-background.png/webp'
|
||||
url: '/wallpapers/bench-9964046.jpg',
|
||||
thumbnail: '/wallpapers/bench-9964046.jpg'
|
||||
},
|
||||
{
|
||||
name: 'Mountains',
|
||||
name: 'People',
|
||||
type: 'image',
|
||||
url: 'https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=1920&q=80',
|
||||
thumbnail: 'https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=200&q=60'
|
||||
},
|
||||
{
|
||||
name: 'Nebula',
|
||||
type: 'image',
|
||||
url: 'https://images.unsplash.com/photo-1462331940025-496dfbfc7564?auto=format&fit=crop&w=1920&q=80',
|
||||
thumbnail: 'https://images.unsplash.com/photo-1462331940025-496dfbfc7564?auto=format&fit=crop&w=200&q=60'
|
||||
},
|
||||
{
|
||||
name: 'City',
|
||||
type: 'image',
|
||||
url: 'https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?auto=format&fit=crop&w=1920&q=80',
|
||||
thumbnail: 'https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?auto=format&fit=crop&w=200&q=60'
|
||||
},
|
||||
{
|
||||
name: 'Rain',
|
||||
type: 'video',
|
||||
url: 'https://assets.mixkit.co/videos/preview/mixkit-rain-falling-on-the-window-glass-1634-large.mp4',
|
||||
thumbnail: 'https://images.unsplash.com/photo-1515694346937-94d85e41e6f0?auto=format&fit=crop&w=200&q=60'
|
||||
url: '/wallpapers/people-10019345.jpg',
|
||||
thumbnail: '/wallpapers/people-10019345.jpg'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ export const en: Translation = {
|
||||
|
||||
// Theme Settings
|
||||
themeColor: 'Theme Color',
|
||||
motto: 'Motto',
|
||||
enterMotto: 'Enter your motto...',
|
||||
showSeconds: 'Show Seconds',
|
||||
use24HourFormat: '24-Hour Format',
|
||||
maskBlurEffect: 'Mask Blur Effect',
|
||||
|
||||
@@ -8,6 +8,8 @@ export const zh: Translation = {
|
||||
|
||||
// Theme Settings
|
||||
themeColor: '主题颜色',
|
||||
motto: '座右铭',
|
||||
enterMotto: '输入您的座右铭...',
|
||||
showSeconds: '显示秒数',
|
||||
use24HourFormat: '24小时制',
|
||||
maskBlurEffect: '遮罩层毛玻璃',
|
||||
|
||||
@@ -8,6 +8,8 @@ export interface Translation {
|
||||
|
||||
// Theme Settings
|
||||
themeColor: string;
|
||||
motto: string;
|
||||
enterMotto: string;
|
||||
showSeconds: string;
|
||||
use24HourFormat: string;
|
||||
maskBlurEffect: string;
|
||||
|
||||
@@ -3,6 +3,12 @@ import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import { ToastProvider } from './context/ToastContext';
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
|
||||
// Register PWA Service Worker only if not running as an extension
|
||||
if (!window.location.protocol.includes('chrome-extension')) {
|
||||
registerSW({ immediate: true });
|
||||
}
|
||||
|
||||
const rootElement = document.getElementById('root');
|
||||
if (!rootElement) {
|
||||
|
||||
@@ -38,6 +38,7 @@ export interface UserSettings {
|
||||
enableSearchHistory: boolean;
|
||||
searchHistory: string[];
|
||||
language: Language;
|
||||
motto: string;
|
||||
}
|
||||
|
||||
export type SettingsSection = 'general' | 'wallpaper' | 'search';
|
||||
|
||||
2
src/vite-env.d.ts
vendored
Normal file
2
src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-pwa/client" />
|
||||
Reference in New Issue
Block a user