Create base account route
This commit is contained in:
27
moneymgr_web/src/routes/AccountRoute.tsx
Normal file
27
moneymgr_web/src/routes/AccountRoute.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { useParams } from "react-router-dom";
|
||||
import { MoneyMgrWebRouteContainer } from "../widgets/MoneyMgrWebRouteContainer";
|
||||
import { useAccounts } from "../hooks/AccountsListProvider";
|
||||
import { NotFoundRoute } from "./NotFound";
|
||||
import { AccountWidget } from "../widgets/AccountWidget";
|
||||
|
||||
export function AccountRoute(): React.ReactElement {
|
||||
const { accountId } = useParams();
|
||||
|
||||
const accounts = useAccounts();
|
||||
const account = accounts.get(Number(accountId));
|
||||
|
||||
if (account === null) return <NotFoundRoute />;
|
||||
|
||||
return (
|
||||
<MoneyMgrWebRouteContainer
|
||||
label={
|
||||
<span style={{ display: "inline-flex", alignItems: "center" }}>
|
||||
<AccountWidget account={account} />
|
||||
{account.name}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
TODO : table
|
||||
</MoneyMgrWebRouteContainer>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user