Blame view

泰额版/Food Labeling Management Platform/src/App.tsx 2.14 KB
884054fb   “wangming”   项目初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  import { useState } from 'react';
  import { Layout } from './components/layout/Layout';
  import { PlaceholderView } from './components/PlaceholderView';
  
  import { LabelsView } from './components/labels/LabelsView';
  import { TrainingView } from './components/training/TrainingView';
  import { AlertsView } from './components/alerts/AlertsView';
  import { ProductsView } from './components/products/ProductsView';
  import { PeopleView } from './components/people/PeopleView';
  import { ReportsView } from './components/reports/ReportsView';
  import { LocationsView } from './components/locations/LocationsView';
  import { DevicesView } from './components/devices/DevicesView';
  import { InvoicesView } from './components/invoices/InvoicesView';
  import { QRCodesView } from './components/qrcodes/QRCodesView';
  import { Dashboard } from './components/dashboard/Dashboard';
  
  const blankViews = ['Tasks', 'Sensors', 'Food Waste', 'E-Label', 'API'];
  
  export default function App() {
    const [currentView, setCurrentView] = useState('Dashboard');
  
    const renderView = () => {
      if (blankViews.includes(currentView)) {
        return <div className="min-h-[200px]" />;
      }
      switch (currentView) {
        case 'Dashboard':
          return <Dashboard />;
        case 'Training':
          return <TrainingView />;
        case 'Alerts':
          return <AlertsView />;
        case 'Menu Manager':
          return <ProductsView />;
        case 'Account Management':
          return <PeopleView />;
        case 'Reports':
          return <ReportsView />;
        case 'Location Manager':
          return <LocationsView />;
        case 'Devices':
          return <DevicesView />;
        case 'Invoices':
          return <InvoicesView />;
        case 'QR Codes':
          return <QRCodesView />;
        case 'Labels':
        case 'Label Categories':
        case 'Label Types':
        case 'Label Templates':
        case 'Multiple Options':
          return <LabelsView currentView={currentView} onViewChange={setCurrentView} />;
        default:
          return <PlaceholderView title={currentView} />;
      }
    };
  
    return (
      <Layout currentView={currentView} setCurrentView={setCurrentView}>
        {renderView()}
      </Layout>
    );
  }