mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-16 21:30:39 -07:00
- Introduced story management functionality, including creating, listing, and managing story items. - Added new components for story display and interaction, including StoriesTab, StoryList, and StoryContent. - Integrated drag-and-drop functionality for reordering story items using @dnd-kit. - Updated dependencies for @dnd-kit packages to enhance drag-and-drop capabilities. - Bumped version for @voicebox/app, @voicebox/landing, @voicebox/tauri, and @voicebox/web to 0.1.5. - Enhanced audio playback features to support story mode with auto-play functionality. - Improved error handling and user feedback through toast notifications in story-related actions.
135 lines
3.3 KiB
TypeScript
135 lines
3.3 KiB
TypeScript
import { createRootRoute, createRoute, createRouter, Outlet } from '@tanstack/react-router';
|
|
import { AppFrame } from '@/components/AppFrame/AppFrame';
|
|
import { AudioTab } from '@/components/AudioTab/AudioTab';
|
|
import { MainEditor } from '@/components/MainEditor/MainEditor';
|
|
import { ModelsTab } from '@/components/ModelsTab/ModelsTab';
|
|
import { ServerTab } from '@/components/ServerTab/ServerTab';
|
|
import { Sidebar } from '@/components/Sidebar';
|
|
import { StoriesTab } from '@/components/StoriesTab/StoriesTab';
|
|
import { Toaster } from '@/components/ui/toaster';
|
|
import { VoicesTab } from '@/components/VoicesTab/VoicesTab';
|
|
import { useModelDownloadToast } from '@/lib/hooks/useModelDownloadToast';
|
|
import { MODEL_DISPLAY_NAMES, useRestoreActiveTasks } from '@/lib/hooks/useRestoreActiveTasks';
|
|
import { isMacOS } from '@/lib/tauri';
|
|
|
|
// Root layout component
|
|
function RootLayout() {
|
|
// Monitor active downloads/generations and show toasts for them
|
|
const activeDownloads = useRestoreActiveTasks();
|
|
|
|
return (
|
|
<AppFrame>
|
|
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
<Sidebar isMacOS={isMacOS()} />
|
|
|
|
<main className="flex-1 ml-20 overflow-hidden flex flex-col">
|
|
<div className="container mx-auto px-8 max-w-[1800px] h-full overflow-hidden flex flex-col">
|
|
<Outlet />
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
{/* Show download toasts for any active downloads (from anywhere) */}
|
|
{activeDownloads.map((download) => {
|
|
const displayName = MODEL_DISPLAY_NAMES[download.model_name] || download.model_name;
|
|
return (
|
|
<DownloadToastRestorer
|
|
key={download.model_name}
|
|
modelName={download.model_name}
|
|
displayName={displayName}
|
|
/>
|
|
);
|
|
})}
|
|
|
|
<Toaster />
|
|
</AppFrame>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Component that restores a download toast for a specific model.
|
|
*/
|
|
function DownloadToastRestorer({
|
|
modelName,
|
|
displayName,
|
|
}: {
|
|
modelName: string;
|
|
displayName: string;
|
|
}) {
|
|
// Use the download toast hook to restore the toast
|
|
useModelDownloadToast({
|
|
modelName,
|
|
displayName,
|
|
enabled: true,
|
|
});
|
|
|
|
return null;
|
|
}
|
|
|
|
// Root route with layout
|
|
const rootRoute = createRootRoute({
|
|
component: RootLayout,
|
|
});
|
|
|
|
// Index route (main/generate)
|
|
const indexRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/',
|
|
component: MainEditor,
|
|
});
|
|
|
|
// Stories route
|
|
const storiesRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/stories',
|
|
component: StoriesTab,
|
|
});
|
|
|
|
// Voices route
|
|
const voicesRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/voices',
|
|
component: VoicesTab,
|
|
});
|
|
|
|
// Audio route
|
|
const audioRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/audio',
|
|
component: AudioTab,
|
|
});
|
|
|
|
// Models route
|
|
const modelsRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/models',
|
|
component: ModelsTab,
|
|
});
|
|
|
|
// Server route
|
|
const serverRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/server',
|
|
component: ServerTab,
|
|
});
|
|
|
|
// Route tree
|
|
const routeTree = rootRoute.addChildren([
|
|
indexRoute,
|
|
storiesRoute,
|
|
voicesRoute,
|
|
audioRoute,
|
|
modelsRoute,
|
|
serverRoute,
|
|
]);
|
|
|
|
// Create router
|
|
export const router = createRouter({ routeTree });
|
|
|
|
// Register router for type safety
|
|
declare module '@tanstack/react-router' {
|
|
interface Register {
|
|
router: typeof router;
|
|
}
|
|
}
|