From d386902c715e71fb59e8fd7d6cbe69de1dae1b15 Mon Sep 17 00:00:00 2001 From: "Thomas \"ajnart\" Camlong" Date: Tue, 3 May 2022 19:52:09 +0200 Subject: [PATCH] Fix UI and Add shelf item button --- components/AppShelf/AddAppShelfItem.tsx | 5 +-- components/AppShelf/AppShelf.tsx | 1 + components/calendar/CalendarComponent.tsx | 42 ++++++++++++++--------- components/layout/Layout.tsx | 24 +++++++++++-- pages/index.tsx | 2 +- 5 files changed, 52 insertions(+), 22 deletions(-) diff --git a/components/AppShelf/AddAppShelfItem.tsx b/components/AppShelf/AddAppShelfItem.tsx index 1c53b7bfe..886b661dc 100644 --- a/components/AppShelf/AddAppShelfItem.tsx +++ b/components/AppShelf/AddAppShelfItem.tsx @@ -17,10 +17,11 @@ import { useForm } from '@mantine/hooks'; import { motion } from 'framer-motion'; import { useState } from 'react'; import { Apps } from 'tabler-icons-react'; +import { useConfig } from '../../tools/state'; import { ServiceType, ServiceTypeList } from '../../tools/types'; export default function AddItemShelfItem(props: any) { - const { additem: addItem } = props; + const { config, addService } = useConfig(); const [opened, setOpened] = useState(false); const theme = useMantineTheme(); const form = useForm({ @@ -53,7 +54,7 @@ export default function AddItemShelfItem(props: any) {
{ - addItem(form.values); + addService(form.values); setOpened(false); form.reset(); })} diff --git a/components/AppShelf/AppShelf.tsx b/components/AppShelf/AppShelf.tsx index f1b8ff006..7a0b66927 100644 --- a/components/AppShelf/AppShelf.tsx +++ b/components/AppShelf/AppShelf.tsx @@ -93,6 +93,7 @@ const AppShelf = (props: any) => { ))} + ); }; diff --git a/components/calendar/CalendarComponent.tsx b/components/calendar/CalendarComponent.tsx index 716cb0879..88cc85a64 100644 --- a/components/calendar/CalendarComponent.tsx +++ b/components/calendar/CalendarComponent.tsx @@ -1,4 +1,14 @@ -import { Group, Indicator, Popover, Box, Container, Text, Avatar, ActionIcon } from '@mantine/core'; +import { + Group, + Indicator, + Popover, + Box, + Container, + Text, + Avatar, + ActionIcon, + Center, +} from '@mantine/core'; import { useEffect, useState } from 'react'; import { Calendar } from '@mantine/dates'; import dayjs from 'dayjs'; @@ -20,7 +30,6 @@ async function GetCalendars(endDate: Date) { fetch(`${service.url}/api/v3/calendar?end=${endDate}?apikey=${service.apiKey}`) ) ); - console.log(Calendars); } export default function CalendarComponent(props: any) { @@ -28,7 +37,6 @@ export default function CalendarComponent(props: any) { // const [medias, setMedias] = useState(); const dates = medias.map((media) => media.inCinemas); const parsedDates = dates.map((date) => dayjs(date)); - console.log(parsedDates); // useEffect(() => { // const { services } = props; @@ -78,23 +86,25 @@ function DayComponent(props: any) { if (match > -1) { return ( - { setOpened(true); - console.log(); }} - color="teal" - variant="light" + style={{ height: '100%', width: '100%' }} > - setOpened(false)} - opened={opened} - target={day} - children={} - /> - +
+ + setOpened(false)} + opened={opened} + target={day} + children={} + /> + +
+ ); } return
{day}
; diff --git a/components/layout/Layout.tsx b/components/layout/Layout.tsx index 7d10794d7..35594a0fb 100644 --- a/components/layout/Layout.tsx +++ b/components/layout/Layout.tsx @@ -1,6 +1,7 @@ -import { AppShell, Center, createStyles } from '@mantine/core'; +import { AppShell, Aside, Center, createStyles } from '@mantine/core'; import { Header } from './Header'; import { Footer } from './Footer'; +import CalendarComponent from '../calendar/CalendarComponent'; const useStyles = createStyles((theme) => ({ main: { @@ -13,10 +14,27 @@ const useStyles = createStyles((theme) => ({ export default function Layout({ children, style }: any) { const { classes, cx } = useStyles(); return ( - } footer={