mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-28 22:55:15 -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.
84 lines
2.7 KiB
TypeScript
84 lines
2.7 KiB
TypeScript
import { Link, useMatchRoute } from '@tanstack/react-router';
|
|
import { Box, BookOpen, Loader2, Mic, Server, Speaker, Volume2 } from 'lucide-react';
|
|
import voiceboxLogo from '@/assets/voicebox-logo.png';
|
|
import { cn } from '@/lib/utils/cn';
|
|
import { useGenerationStore } from '@/stores/generationStore';
|
|
import { usePlayerStore } from '@/stores/playerStore';
|
|
|
|
interface SidebarProps {
|
|
isMacOS?: boolean;
|
|
}
|
|
|
|
const tabs = [
|
|
{ id: 'main', path: '/', icon: Volume2, label: 'Generate' },
|
|
{ id: 'stories', path: '/stories', icon: BookOpen, label: 'Stories' },
|
|
{ id: 'voices', path: '/voices', icon: Mic, label: 'Voices' },
|
|
{ id: 'audio', path: '/audio', icon: Speaker, label: 'Audio' },
|
|
{ id: 'models', path: '/models', icon: Box, label: 'Models' },
|
|
{ id: 'server', path: '/server', icon: Server, label: 'Server' },
|
|
];
|
|
|
|
export function Sidebar({ isMacOS }: SidebarProps) {
|
|
const isGenerating = useGenerationStore((state) => state.isGenerating);
|
|
const audioUrl = usePlayerStore((state) => state.audioUrl);
|
|
const isPlayerVisible = !!audioUrl;
|
|
const matchRoute = useMatchRoute();
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'fixed left-0 top-0 h-full w-20 bg-sidebar border-r border-border flex flex-col items-center py-6 gap-6',
|
|
isMacOS && 'pt-14',
|
|
)}
|
|
>
|
|
{/* Logo */}
|
|
<div className="mb-2">
|
|
<img src={voiceboxLogo} alt="Voicebox" className="w-12 h-12 object-contain" />
|
|
</div>
|
|
|
|
{/* Navigation Buttons */}
|
|
<div className="flex flex-col gap-3">
|
|
{tabs.map((tab) => {
|
|
const Icon = tab.icon;
|
|
// For index route, use exact match; for others, use default matching
|
|
const isActive =
|
|
tab.path === '/'
|
|
? matchRoute({ to: '/', exact: true })
|
|
: matchRoute({ to: tab.path });
|
|
|
|
return (
|
|
<Link
|
|
key={tab.id}
|
|
to={tab.path}
|
|
className={cn(
|
|
'w-12 h-12 rounded-full flex items-center justify-center transition-all duration-200',
|
|
'hover:bg-muted/50',
|
|
isActive ? 'bg-muted/50 text-foreground shadow-lg' : 'text-muted-foreground',
|
|
)}
|
|
title={tab.label}
|
|
aria-label={tab.label}
|
|
>
|
|
<Icon className="h-5 w-5" />
|
|
</Link>
|
|
);
|
|
})}
|
|
</div>
|
|
|
|
{/* Spacer to push loader to bottom */}
|
|
<div className="flex-1" />
|
|
|
|
{/* Generation Loader */}
|
|
{isGenerating && (
|
|
<div
|
|
className={cn(
|
|
'w-full flex items-center justify-center transition-all duration-200',
|
|
isPlayerVisible ? 'mb-[120px]' : 'mb-0',
|
|
)}
|
|
>
|
|
<Loader2 className="h-6 w-6 text-accent animate-spin" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|