feat: serve website at root path

This commit is contained in:
boos
2026-06-06 05:59:48 +08:00
parent 03046152fd
commit 5ef017c54e
6 changed files with 155 additions and 60 deletions
+9 -9
View File
@@ -378,7 +378,7 @@ export const sidebarGroups = [
{
label: '控制台',
items: [
{ to: '/', label: '仪表盘', icon: <svg className="sidebar-item-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M4 5a1 1 0 011-1h4a1 1 0 011 1v5a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM14 5a1 1 0 011-1h4a1 1 0 011 1v2a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zM14 12a1 1 0 011-1h4a1 1 0 011 1v7a1 1 0 01-1 1h-4a1 1 0 01-1-1v-7z" /></svg> },
{ to: '/dashboard', label: '仪表盘', icon: <svg className="sidebar-item-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M4 5a1 1 0 011-1h4a1 1 0 011 1v5a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM14 5a1 1 0 011-1h4a1 1 0 011 1v2a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zM14 12a1 1 0 011-1h4a1 1 0 011 1v7a1 1 0 01-1 1h-4a1 1 0 01-1-1v-7z" /></svg> },
{ to: '/sites', label: '站点管理', icon: <svg className="sidebar-item-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" /></svg> },
{ to: '/site-announcements', label: '用户公告', icon: <svg className="sidebar-item-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M7 8h10M7 12h10M7 16h6M5 4h14a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2z" /></svg> },
{ to: '/accounts', label: '连接管理', icon: <svg className="sidebar-item-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z" /></svg> },
@@ -430,7 +430,7 @@ export const userSidebarGroups = [
},
];
const topNavItems = [
{ label: '控制台', to: '/' },
{ label: '控制台', to: '/dashboard' },
{ label: '模型广场', to: '/models' },
{ label: '生图助手', to: '/picture-agent' },
{ label: '短视频工厂', to: '/money-printer' },
@@ -700,11 +700,11 @@ function AppShell() {
if (isUserPage && isPublicUserPage) {
if (userAuthed) return <Navigate to="/user/dashboard" />;
if (authed) return <Navigate to="/" />;
if (authed) return <Navigate to="/dashboard" />;
}
if (isAdminLoginPage) {
if (authed) return <Navigate to="/" />;
if (authed) return <Navigate to="/dashboard" />;
return (
<AdminLoginPage
t={t}
@@ -911,7 +911,7 @@ function AppShell() {
<NavLink
key={item.to}
to={item.to}
end={item.to === '/' || item.to === '/user/dashboard' || item.to === '/settings'}
end={item.to === '/dashboard' || item.to === '/user/dashboard' || item.to === '/settings'}
className={({ isActive }) => `mobile-nav-item ${isActive ? 'active' : ''}`}
onClick={() => setDrawerOpen(false)}
>
@@ -923,7 +923,7 @@ function AppShell() {
))}
<div className="mobile-nav-group">
<div className="mobile-nav-label">{t('更多')}</div>
{currentTopNavItems.filter((n) => n.to !== '/' && n.to !== '/user/dashboard').map((item) => (
{currentTopNavItems.filter((n) => n.to !== '/dashboard' && n.to !== '/user/dashboard').map((item) => (
<NavLink
key={item.to}
to={item.to}
@@ -945,7 +945,7 @@ function AppShell() {
<NavLink
key={item.to}
to={item.to}
end={item.to === '/' || item.to === '/user/dashboard' || item.to === '/settings'}
end={item.to === '/dashboard' || item.to === '/user/dashboard' || item.to === '/settings'}
className={({ isActive }) => `sidebar-item ${isActive ? 'active' : ''}`}
data-tooltip={sidebarCollapsed ? t(item.label) : undefined}
aria-label={sidebarCollapsed ? t(item.label) : undefined}
@@ -968,7 +968,7 @@ function AppShell() {
<PageTransition>
<Suspense fallback={<RouteLoadingFallback />}>
<Routes>
<Route path="/" element={<Dashboard adminName={displayName} />} />
<Route path="/dashboard" element={<Dashboard adminName={displayName} />} />
<Route path="/sites" element={<Sites />} />
<Route path="/site-announcements" element={<SiteAnnouncements />} />
<Route path="/accounts" element={<Accounts />} />
@@ -1013,7 +1013,7 @@ function AppShell() {
<Route path="/user/workspace" element={<Workspace />} />
<Route path="/user/about" element={<About />} />
<Route path="*" element={<Navigate to={isUserPage ? "/user/dashboard" : "/"} />} />
<Route path="*" element={<Navigate to={isUserPage ? "/user/dashboard" : "/dashboard"} />} />
</Routes>
</Suspense>
</PageTransition>