You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

3 years ago
import { useUserContext } from '../contexts/UserContext'
3 years ago
import { Route, Switch } from 'react-router'
3 years ago
import { Link } from 'react-router-dom'
3 years ago
import { Dashboard } from './pages/Dashboard'
3 years ago
import { UserForm } from './components/UserForm'
import { TransactionList } from './components/TransactionList'
import { AccountForm } from './components/AccountForm'
3 years ago
import { Login } from './components/Login'
3 years ago
import { AppHeader } from './layout/AppHeader'
import { AppFooter } from './layout/AppFooter'
3 years ago
export const CoreLayout = () => {
3 years ago
const { user, selectedAccount } = useUserContext()
3 years ago
3 years ago
if (!user) return <Login />
3 years ago
return (
3 years ago
<div className="app">
3 years ago
<AppHeader>
3 years ago
<Link to="/">Home</Link>
<Link to="/select">Select Budget</Link>
<Link to="/account">Budget Details</Link>
<Link to="/details">Transactions</Link>
<Link to="/user">Profile</Link>
3 years ago
</AppHeader>
3 years ago
<Switch>
<Route path="/user" component={UserForm} />
<Route path="/details" component={TransactionList} />
<Route path="/account/new" component={AccountForm} />
<Route path="/account" component={AccountForm} />
<Route path="/" component={Dashboard} />
</Switch>
3 years ago
<AppFooter />
3 years ago
{/* {showingModal && <TransactionModal account={account} />} */}
</div>
3 years ago
)
}