import { Flex, HStack, Text } from '@chakra-ui/react';
import { useNavigate } from 'react-router-dom';

import { PageLayout } from '@/components/Layout/PageLayout';
import { TopBar } from '@/components/TopBar/TopBar';
import { useColorModeValue } from '@/components/ui/color-mode';

export const alphabet = [
  'a',
  'b',
  'c',
  'd',
  'e',
  'f',
  'g',
  'h',
  'i',
  'j',
  'k',
  'l',
  'm',
  'n',
  'o',
  'p',
  'q',
  'r',
  's',
  't',
  'u',
  'v',
  'w',
  'x',
  'y',
  'z',
];
const possibilities = [...alphabet, '^^'];

export const MediaSelectionPage = () => {
  const navigate = useNavigate();
  const onSelectItem = (data: string) => {
    navigate(`/Media/${data}`);
  };
  return (
    <>
      <TopBar title="All Medias" />
      <PageLayout>
        <HStack
          wrap="wrap"
          /*spacing="20px"*/ marginX="auto"
          padding="20px"
          justify="center"
        >
          {possibilities.map((data) => (
            <Flex
              align="flex-start"
              width="75px"
              height="75px"
              border="1px"
              borderColor="brand.900"
              backgroundColor={useColorModeValue('#FFFFFF88', '#00000088')}
              key={data}
              padding="5px"
              as="button"
              _hover={{
                boxShadow: 'outline-over',
                bgColor: useColorModeValue('#FFFFFFF7', '#000000F7'),
              }}
              onClick={() => onSelectItem(data)}
            >
              <Flex direction="column" width="full" height="full">
                <Text
                  margin="auto"
                  fontSize="25px"
                  fontWeight="bold"
                  textTransform="uppercase"
                  userSelect="none"
                >
                  {data.toUpperCase()}
                </Text>
              </Flex>
            </Flex>
          ))}
        </HStack>
      </PageLayout>
    </>
  );
};
