Deal with missing pages

This commit is contained in:
Tanner Collin 2020-01-09 09:15:01 +00:00
parent 58a00f58a9
commit 3762f3458d

View File

@ -409,47 +409,50 @@ function TransactionDetail(props) {
const t = user.transactions.find(x => x.id == id); const t = user.transactions.find(x => x.id == id);
return ( return (
<Container> t ?
<Header size='large'>Transaction Receipt</Header> <Container>
<Header size='large'>Transaction Receipt</Header>
<Table unstackable basic='very'> <Table unstackable basic='very'>
<Table.Body> <Table.Body>
<Table.Row> <Table.Row>
<Table.Cell>Date:</Table.Cell> <Table.Cell>Date:</Table.Cell>
<Table.Cell>{t.date}</Table.Cell> <Table.Cell>{t.date}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>ID:</Table.Cell> <Table.Cell>ID:</Table.Cell>
<Table.Cell>{t.id}</Table.Cell> <Table.Cell>{t.id}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Amount:</Table.Cell> <Table.Cell>Amount:</Table.Cell>
<Table.Cell>${t.amount}</Table.Cell> <Table.Cell>${t.amount}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Category:</Table.Cell> <Table.Cell>Category:</Table.Cell>
<Table.Cell>{t.category}</Table.Cell> <Table.Cell>{t.category}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Account:</Table.Cell> <Table.Cell>Account:</Table.Cell>
<Table.Cell>{t.account}</Table.Cell> <Table.Cell>{t.account}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Info Source:</Table.Cell> <Table.Cell>Info Source:</Table.Cell>
<Table.Cell>{t.info_source}</Table.Cell> <Table.Cell>{t.info_source}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Reference:</Table.Cell> <Table.Cell>Reference:</Table.Cell>
<Table.Cell>{t.reference_number}</Table.Cell> <Table.Cell>{t.reference_number}</Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Memo:</Table.Cell> <Table.Cell>Memo:</Table.Cell>
<Table.Cell>{t.memo}</Table.Cell> <Table.Cell>{t.memo}</Table.Cell>
</Table.Row> </Table.Row>
</Table.Body> </Table.Body>
</Table> </Table>
</Container> </Container>
:
<NotFound />
); );
} }
@ -464,6 +467,17 @@ function PleaseLogin() {
); );
}; };
function NotFound() {
return (
<Container text>
<Message warning>
<Message.Header style={{ padding: 0 }}>The page you requested can't be found!</Message.Header>
<p>Visit our <Link to='/'>home page</Link> if you are lost.</p>
</Message>
</Container>
);
};
function App() { function App() {
const [token, setToken] = useState(localStorage.getItem('token', '')); const [token, setToken] = useState(localStorage.getItem('token', ''));
const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false'))); const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false')));
@ -563,6 +577,9 @@ function App() {
<Transactions user={user} /> <Transactions user={user} />
</Route> </Route>
<Route path='/:page'>
<NotFound />
</Route>
</Switch> </Switch>
: :
<Route path='/:page'> <Route path='/:page'>