mirror of
				https://github.com/ajnart/homarr.git
				synced 2025-11-03 20:15:57 +01:00 
			
		
		
		
	Fix UI and Add shelf item button
This commit is contained in:
		@@ -17,10 +17,11 @@ import { useForm } from '@mantine/hooks';
 | 
				
			|||||||
import { motion } from 'framer-motion';
 | 
					import { motion } from 'framer-motion';
 | 
				
			||||||
import { useState } from 'react';
 | 
					import { useState } from 'react';
 | 
				
			||||||
import { Apps } from 'tabler-icons-react';
 | 
					import { Apps } from 'tabler-icons-react';
 | 
				
			||||||
 | 
					import { useConfig } from '../../tools/state';
 | 
				
			||||||
import { ServiceType, ServiceTypeList } from '../../tools/types';
 | 
					import { ServiceType, ServiceTypeList } from '../../tools/types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function AddItemShelfItem(props: any) {
 | 
					export default function AddItemShelfItem(props: any) {
 | 
				
			||||||
  const { additem: addItem } = props;
 | 
					  const { config, addService } = useConfig();
 | 
				
			||||||
  const [opened, setOpened] = useState(false);
 | 
					  const [opened, setOpened] = useState(false);
 | 
				
			||||||
  const theme = useMantineTheme();
 | 
					  const theme = useMantineTheme();
 | 
				
			||||||
  const form = useForm({
 | 
					  const form = useForm({
 | 
				
			||||||
@@ -53,7 +54,7 @@ export default function AddItemShelfItem(props: any) {
 | 
				
			|||||||
        </Center>
 | 
					        </Center>
 | 
				
			||||||
        <form
 | 
					        <form
 | 
				
			||||||
          onSubmit={form.onSubmit(() => {
 | 
					          onSubmit={form.onSubmit(() => {
 | 
				
			||||||
            addItem(form.values);
 | 
					            addService(form.values);
 | 
				
			||||||
            setOpened(false);
 | 
					            setOpened(false);
 | 
				
			||||||
            form.reset();
 | 
					            form.reset();
 | 
				
			||||||
          })}
 | 
					          })}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,6 +93,7 @@ const AppShelf = (props: any) => {
 | 
				
			|||||||
          </Box>
 | 
					          </Box>
 | 
				
			||||||
        </motion.div>
 | 
					        </motion.div>
 | 
				
			||||||
      ))}
 | 
					      ))}
 | 
				
			||||||
 | 
					      <AddItemShelfItem/>
 | 
				
			||||||
    </SimpleGrid>
 | 
					    </SimpleGrid>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 { useEffect, useState } from 'react';
 | 
				
			||||||
import { Calendar } from '@mantine/dates';
 | 
					import { Calendar } from '@mantine/dates';
 | 
				
			||||||
import dayjs from 'dayjs';
 | 
					import dayjs from 'dayjs';
 | 
				
			||||||
@@ -20,7 +30,6 @@ async function GetCalendars(endDate: Date) {
 | 
				
			|||||||
      fetch(`${service.url}/api/v3/calendar?end=${endDate}?apikey=${service.apiKey}`)
 | 
					      fetch(`${service.url}/api/v3/calendar?end=${endDate}?apikey=${service.apiKey}`)
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
  console.log(Calendars);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function CalendarComponent(props: any) {
 | 
					export default function CalendarComponent(props: any) {
 | 
				
			||||||
@@ -28,7 +37,6 @@ export default function CalendarComponent(props: any) {
 | 
				
			|||||||
  // const [medias, setMedias] = useState();
 | 
					  // const [medias, setMedias] = useState();
 | 
				
			||||||
  const dates = medias.map((media) => media.inCinemas);
 | 
					  const dates = medias.map((media) => media.inCinemas);
 | 
				
			||||||
  const parsedDates = dates.map((date) => dayjs(date));
 | 
					  const parsedDates = dates.map((date) => dayjs(date));
 | 
				
			||||||
  console.log(parsedDates);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // useEffect(() => {
 | 
					  // useEffect(() => {
 | 
				
			||||||
  //   const { services } = props;
 | 
					  //   const { services } = props;
 | 
				
			||||||
@@ -78,23 +86,25 @@ function DayComponent(props: any) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (match > -1) {
 | 
					  if (match > -1) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <ActionIcon
 | 
					      <Box
 | 
				
			||||||
        onClick={() => {
 | 
					        onClick={() => {
 | 
				
			||||||
          setOpened(true);
 | 
					          setOpened(true);
 | 
				
			||||||
          console.log();
 | 
					 | 
				
			||||||
        }}
 | 
					        }}
 | 
				
			||||||
        color="teal"
 | 
					        style={{ height: '100%', width: '100%' }}
 | 
				
			||||||
        variant="light"
 | 
					 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
 | 
					        <Center>
 | 
				
			||||||
 | 
					          <Indicator size={10} color="red">
 | 
				
			||||||
            <Popover
 | 
					            <Popover
 | 
				
			||||||
          position="right"
 | 
					              position="left"
 | 
				
			||||||
              width={700}
 | 
					              width={700}
 | 
				
			||||||
              onClose={() => setOpened(false)}
 | 
					              onClose={() => setOpened(false)}
 | 
				
			||||||
              opened={opened}
 | 
					              opened={opened}
 | 
				
			||||||
              target={day}
 | 
					              target={day}
 | 
				
			||||||
              children={<MediaDisplay media={medias[match]} />}
 | 
					              children={<MediaDisplay media={medias[match]} />}
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
      </ActionIcon>
 | 
					          </Indicator>
 | 
				
			||||||
 | 
					        </Center>
 | 
				
			||||||
 | 
					      </Box>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return <div>{day}</div>;
 | 
					  return <div>{day}</div>;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
import { AppShell, Center, createStyles } from '@mantine/core';
 | 
					import { AppShell, Aside, Center, createStyles } from '@mantine/core';
 | 
				
			||||||
import { Header } from './Header';
 | 
					import { Header } from './Header';
 | 
				
			||||||
import { Footer } from './Footer';
 | 
					import { Footer } from './Footer';
 | 
				
			||||||
 | 
					import CalendarComponent from '../calendar/CalendarComponent';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const useStyles = createStyles((theme) => ({
 | 
					const useStyles = createStyles((theme) => ({
 | 
				
			||||||
  main: {
 | 
					  main: {
 | 
				
			||||||
@@ -13,10 +14,27 @@ const useStyles = createStyles((theme) => ({
 | 
				
			|||||||
export default function Layout({ children, style }: any) {
 | 
					export default function Layout({ children, style }: any) {
 | 
				
			||||||
  const { classes, cx } = useStyles();
 | 
					  const { classes, cx } = useStyles();
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <AppShell header={<Header links={[]} />} footer={<Footer links={[]} />}>
 | 
					    <AppShell
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      aside={
 | 
				
			||||||
 | 
					        <Aside
 | 
				
			||||||
 | 
					        height={'auto'}
 | 
				
			||||||
 | 
					        width={{
 | 
				
			||||||
 | 
					          xs: 'auto',
 | 
				
			||||||
 | 
					          md: 'auto',
 | 
				
			||||||
 | 
					          lg: 'auto',
 | 
				
			||||||
 | 
					          xl: 'auto',
 | 
				
			||||||
 | 
					        }}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <CalendarComponent />
 | 
				
			||||||
 | 
					        </Aside>
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      header={<Header links={[]} />}
 | 
				
			||||||
 | 
					      footer={<Footer links={[]} />}
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
      <Center>
 | 
					      <Center>
 | 
				
			||||||
        <main
 | 
					        <main
 | 
				
			||||||
          className={cx(classes.main)}
 | 
					          // className={cx(classes.main)}
 | 
				
			||||||
          style={{
 | 
					          style={{
 | 
				
			||||||
            ...style,
 | 
					            ...style,
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ export default function HomePage() {
 | 
				
			|||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <>
 | 
					    <>
 | 
				
			||||||
      <SearchBar />
 | 
					      <SearchBar />
 | 
				
			||||||
      <Group align={"start"} position="apart" noWrap>
 | 
					      <Group align={'start'} position="apart" noWrap>
 | 
				
			||||||
        <AppShelf />
 | 
					        <AppShelf />
 | 
				
			||||||
        <CalendarComponent />
 | 
					        <CalendarComponent />
 | 
				
			||||||
      </Group>
 | 
					      </Group>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user