mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
integration of ChartJS and refactors
This commit is contained in:
16
src/App.tsx
16
src/App.tsx
@@ -1,12 +1,24 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Header } from './screens';
|
||||
import { Header, SpendScreen } from './screens';
|
||||
import { type Tab } from './types';
|
||||
import { SPEND_SCREEN_ID, SPEND_SCREEN_NAME } from './constants';
|
||||
|
||||
const appRender = ({ tab }: { tab: Tab }): JSX.Element => {
|
||||
switch (tab.id) {
|
||||
case SPEND_SCREEN_ID:
|
||||
return <SpendScreen />;
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
};
|
||||
|
||||
function App(): JSX.Element {
|
||||
const [tab, setTab] = useState({});
|
||||
const [tab, setTab] = useState({ id: SPEND_SCREEN_ID, title: SPEND_SCREEN_NAME });
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header tab={tab} setTab={setTab} />
|
||||
{appRender({ tab })}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user