imports :)
This commit is contained in:
21
src/App.tsx
21
src/App.tsx
@@ -11,12 +11,13 @@ import DetailView from './components/DetailView';
|
||||
import CastView from './components/CastView';
|
||||
import CastDetailView from './components/CastDetailView';
|
||||
import AddMediaView from './components/AddMediaView';
|
||||
import ImporterView from './components/ImporterView';
|
||||
import { MOCK_MEDIA, DETAIL_MEDIA } from './data';
|
||||
import { Media, Staff, MediaCategory } from './types';
|
||||
import { fetchAllMedia, fetchMediaById } from './api';
|
||||
|
||||
export default function App() {
|
||||
const [currentView, setCurrentView] = useState<'browse' | 'detail' | 'cast' | 'castDetail' | 'add'>('browse');
|
||||
const [currentView, setCurrentView] = useState<'browse' | 'detail' | 'cast' | 'castDetail' | 'add' | 'import'>('browse');
|
||||
const [activeCategory, setActiveCategory] = useState<MediaCategory>('Anime');
|
||||
const [selectedMedia, setSelectedMedia] = useState<Media | null>(null);
|
||||
const [selectedPerson, setSelectedPerson] = useState<Staff | null>(null);
|
||||
@@ -67,6 +68,11 @@ export default function App() {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
const handleImporterView = () => {
|
||||
setCurrentView('import');
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
const allMedia = useMemo(() => {
|
||||
// Use API data if available, otherwise fall back to mock data
|
||||
let list: Media[] = [];
|
||||
@@ -199,16 +205,17 @@ export default function App() {
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white font-sans selection:bg-[#6d28d9]/20 selection:text-[#6d28d9]">
|
||||
<Header
|
||||
onBrowse={handleBack}
|
||||
<Header
|
||||
onBrowse={handleBack}
|
||||
onCast={handleCastClick}
|
||||
onAddMedia={handleAddMediaView}
|
||||
onImporter={handleImporterView}
|
||||
onSearch={handleSearch}
|
||||
activeCategory={activeCategory}
|
||||
onCategoryChange={handleCategoryChange}
|
||||
enabledCategories={enabledCategories}
|
||||
onToggleCategory={toggleCategory}
|
||||
transparent={currentView === 'detail' || currentView === 'castDetail'}
|
||||
transparent={currentView === 'detail' || currentView === 'castDetail'}
|
||||
/>
|
||||
|
||||
<main>
|
||||
@@ -237,11 +244,15 @@ export default function App() {
|
||||
/>
|
||||
)
|
||||
) : currentView === 'add' ? (
|
||||
<AddMediaView
|
||||
<AddMediaView
|
||||
activeCategory={activeCategory}
|
||||
onBack={handleBack}
|
||||
onAddComplete={handleAddMedia}
|
||||
/>
|
||||
) : currentView === 'import' ? (
|
||||
<ImporterView
|
||||
onBack={handleBack}
|
||||
/>
|
||||
) : (
|
||||
selectedMedia && (
|
||||
<DetailView
|
||||
|
||||
Reference in New Issue
Block a user