1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-23 21:29:37 +02:00

Some changes on how application list is being rendered. Added isDay property on WeatherIcon to render icon accordingly to time of day. Modal can now be closed by clicking on backdrop

This commit is contained in:
unknown 2021-05-21 18:55:21 +02:00
parent e170f56a03
commit 28683e7511
6 changed files with 37 additions and 8 deletions

View file

@ -36,7 +36,9 @@ const Apps = (props: ComponentProps): JSX.Element => {
const [isInEdit, setIsInEdit] = useState(false);
useEffect(() => {
props.getApps();
if (props.apps.length === 0) {
props.getApps();
}
}, [props.getApps]);
const toggleModal = (): void => {
@ -49,12 +51,12 @@ const Apps = (props: ComponentProps): JSX.Element => {
return (
<Container>
<Modal isOpen={modalIsOpen}>
<Modal isOpen={modalIsOpen} setIsOpen={setModalIsOpen}>
<AppForm modalHandler={toggleModal} />
</Modal>
<Headline
title='All Apps'
title='All Applications'
subtitle={(<Link to='/'>Go back</Link>)}
/>
@ -75,7 +77,9 @@ const Apps = (props: ComponentProps): JSX.Element => {
{props.loading
? <Spinner />
: (!isInEdit
? <AppGrid apps={props.apps} />
? props.apps.length > 0
? <AppGrid apps={props.apps} />
: <p className={classes.AppsMessage}>You don't have any applications. You can a new one from <Link to='/applications'>/application</Link> menu</p>
: <AppTable />)
}
</div>