diff --git a/client/src/App.tsx b/client/src/App.tsx index 723fc54..c304321 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -22,7 +22,7 @@ const App = (): JSX.Element => { - + diff --git a/client/src/components/Apps/Apps.module.css b/client/src/components/Apps/Apps.module.css index 09810e1..4b6d917 100644 --- a/client/src/components/Apps/Apps.module.css +++ b/client/src/components/Apps/Apps.module.css @@ -1,4 +1,13 @@ .ActionsContainer { display: flex; align-items: center; +} + +.AppsMessage { + color: var(--color-primary); +} + +.AppsMessage a { + color: var(--color-accent); + font-weight: 600; } \ No newline at end of file diff --git a/client/src/components/Apps/Apps.tsx b/client/src/components/Apps/Apps.tsx index afe4290..4921497 100644 --- a/client/src/components/Apps/Apps.tsx +++ b/client/src/components/Apps/Apps.tsx @@ -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 ( - + Go back)} /> @@ -75,7 +77,9 @@ const Apps = (props: ComponentProps): JSX.Element => { {props.loading ? : (!isInEdit - ? + ? props.apps.length > 0 + ? + :

You don't have any applications. You can a new one from /application menu

: ) } diff --git a/client/src/components/UI/Icons/WeatherIcon/WeatherIcon.tsx b/client/src/components/UI/Icons/WeatherIcon/WeatherIcon.tsx index 6e25363..a72c6b2 100644 --- a/client/src/components/UI/Icons/WeatherIcon/WeatherIcon.tsx +++ b/client/src/components/UI/Icons/WeatherIcon/WeatherIcon.tsx @@ -7,10 +7,13 @@ import { IconMapping, TimeOfDay } from './IconMapping'; interface ComponentProps { theme: Theme; weatherStatusCode: number; + isDay: number; } const WeatherIcon = (props: ComponentProps): JSX.Element => { - const icon = (new IconMapping).mapIcon(props.weatherStatusCode, TimeOfDay.day); + const icon = props.isDay + ? (new IconMapping).mapIcon(props.weatherStatusCode, TimeOfDay.day) + : (new IconMapping).mapIcon(props.weatherStatusCode, TimeOfDay.night); useEffect(() => { const delay = setTimeout(() => { diff --git a/client/src/components/UI/Modal/Modal.tsx b/client/src/components/UI/Modal/Modal.tsx index 5f458ee..b8b86eb 100644 --- a/client/src/components/UI/Modal/Modal.tsx +++ b/client/src/components/UI/Modal/Modal.tsx @@ -1,15 +1,25 @@ +import { MouseEvent, useRef, useEffect } from 'react'; + import classes from './Modal.module.css'; interface ComponentProps { isOpen: boolean; + setIsOpen: Function; children: JSX.Element; } const Modal = (props: ComponentProps): JSX.Element => { + const modalRef = useRef(null); const modalClasses = [classes.Modal, props.isOpen ? classes.ModalOpen : classes.ModalClose].join(' '); + const clickHandler = (e: MouseEvent) => { + if (e.target === modalRef.current) { + props.setIsOpen(false); + } + } + return ( -
+
{props.children}
) diff --git a/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx b/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx index c3cf36b..67fa7fe 100644 --- a/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx +++ b/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx @@ -36,7 +36,10 @@ const WeatherWidget = (): JSX.Element => { : (
- +
{weather.tempC}°C