收口 Makelore 客户端变更
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-08-12 22:35:06 +08:00
parent 253bad8b40
commit f4113a872f
232 changed files with 4617 additions and 20121 deletions

View File

@@ -18,7 +18,6 @@ import { PreviewScene } from './pages/Makelore';
import { ProjectConfiguration } from './pages/ProjectConfiguration';
import { Workbench } from './pages/Workbench';
import { ImageCanvas } from './pages/ImageCanvas';
import { DevicePreview } from './pages/DevicePreview';
import { Settings } from './pages/Settings';
import { Setup } from './pages/Setup';
import { Login } from './pages/Login';
@@ -31,6 +30,7 @@ import { useProjectConfigStore } from './stores/project-config';
import { AI_MODULE_SELECTION_PATH } from './lib/ai-modules';
import { useUserSyncStore } from './stores/user-sync';
import { subscribeHostEvent } from '@/lib/host-events';
import { resolveSupportedLanguage } from '../shared/language';
/**
@@ -61,7 +61,7 @@ class ErrorBoundary extends Component<
color: '#7f1d1d',
background: '#FFFFFF',
minHeight: '100vh',
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
fontFamily: 'var(--font-sans)'
}}>
<h1 style={{ fontSize: '24px', fontWeight: 600, marginBottom: '16px', letterSpacing: '-0.02em' }}>Something went wrong</h1>
<pre style={{
@@ -127,8 +127,7 @@ function ProtectedLayout({
const location = useLocation();
const authenticated = useAuthStore((state) => state.isAuthenticated());
const allowsAnonymousImageWorkspace = imageWorkspaceLocalDevelopment
&& (location.pathname === '/'
|| location.pathname === '/image-canvas'
&& (location.pathname === '/image-canvas'
|| location.pathname.startsWith('/image-canvas/'));
if (!setupReady) {
@@ -152,32 +151,23 @@ function ProtectedLayout({
return <MainLayout />;
}
function ProtectedModuleSelection({
function ModuleSelectionRoute({
authReady,
authRequired,
imageWorkspaceLocalDevelopment,
setupReady,
}: {
authReady: boolean;
authRequired: boolean;
imageWorkspaceLocalDevelopment: boolean;
setupReady: boolean;
}) {
const authenticated = useAuthStore((state) => state.isAuthenticated());
if (!setupReady) {
return <StartupScreen />;
}
if (authRequired && !authReady && !imageWorkspaceLocalDevelopment) {
if (authRequired && !authReady) {
return <StartupScreen />;
}
if (authRequired && !imageWorkspaceLocalDevelopment && !authenticated) {
return <Navigate to="/login" replace state={{ from: AI_MODULE_SELECTION_PATH }} />;
}
return <ModuleSelection />;
return <ModuleSelection authRequired={authRequired} />;
}
function ProjectChatRoute() {
@@ -295,6 +285,15 @@ function App() {
}
}, [language]);
// Keep the document language in sync with the persisted setting so
// typography can preserve regional glyph forms for Japanese and Chinese.
useEffect(() => {
const resolvedLanguage = resolveSupportedLanguage(language || i18n.language);
const root = window.document.documentElement;
root.lang = resolvedLanguage === 'zh' ? 'zh-CN' : resolvedLanguage;
root.dataset.uiLanguage = resolvedLanguage;
}, [language]);
// Initialize provider snapshot only after the user can enter the app.
useEffect(() => {
if (rendererOnlyPreview) return;
@@ -359,14 +358,14 @@ function App() {
<Route
path={AI_MODULE_SELECTION_PATH}
element={(
<ProtectedModuleSelection
<ModuleSelectionRoute
authReady={authInitialized}
authRequired={authRequired}
imageWorkspaceLocalDevelopment={imageWorkspaceLocalDevelopment}
setupReady={setupReady}
/>
)}
/>
<Route path="/" element={<Navigate to={AI_MODULE_SELECTION_PATH} replace />} />
{/* Main application routes */}
<Route
@@ -379,10 +378,6 @@ function App() {
/>
)}
>
<Route
path="/"
element={<Navigate to={imageWorkspaceLocalDevelopment ? '/image-canvas' : '/opencode-chat'} replace />}
/>
<Route path="/project-config" element={<ProjectConfiguration />} />
<Route path="/makelore-home" element={<Home />} />
<Route path="/kangaroo" element={<Navigate to="/project-config" replace />} />
@@ -390,7 +385,6 @@ function App() {
<Route path="/chat" element={<Navigate to="/opencode-chat" replace />} />
<Route path="/deliverables" element={<PreviewScene />} />
<Route path="/image-canvas" element={<ImageCanvas />} />
<Route path="/device-preview" element={<DevicePreview />} />
<Route path="/workbench/:projectId" element={<Workbench />} />
<Route path="/opencode-chat" element={<ProjectChatRoute />} />
<Route path="/projects" element={<Projects />} />