diff --git a/.eslintrc.json b/.eslintrc.json index 1e346ec..d4d0bee 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,12 +1,36 @@ { - "extends": ["next", "next/core-web-vitals"], + "extends": [ + "next", + "next/core-web-vitals" + ], "rules": { - "indent": ["error", 2, { "SwitchCase": 1 }], - "linebreak-style": ["error", "unix"], - "quotes": ["error", "single"], - "semi": ["error", "always"], - "comma-dangle": ["error", "always-multiline"], - "jsx-quotes": ["error", "prefer-single"], + "indent": [ + "error", + 2, + { + "SwitchCase": 1 + } + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "comma-dangle": [ + "error", + "always-multiline" + ], + "jsx-quotes": [ + "error", + "prefer-single" + ], "react/prop-types": "off", "react-hooks/rules-of-hooks": "off", "react-hooks/exhaustive-deps": "off", @@ -20,6 +44,8 @@ "react/react-in-jsx-scope": "off", "react/require-render-return": "error", "react/style-prop-object": "warn", - "@next/next/no-img-element": "off" + "@next/next/no-img-element": "off", + "jsx-a11y/alt-text": "off", + "react/display-name": "off" } } \ No newline at end of file diff --git a/src/components/File.tsx b/src/components/File.tsx index 12a249e..d358744 100644 --- a/src/components/File.tsx +++ b/src/components/File.tsx @@ -1,35 +1,49 @@ -import { Button, Card, Group, Image as MImage, Modal, Title } from '@mantine/core'; +import { Button, Card, Grid, Group, Image as MImage, Modal, Stack, Text, Title, useMantineTheme } from '@mantine/core'; import { useClipboard } from '@mantine/hooks'; import { useNotifications } from '@mantine/notifications'; import useFetch from 'hooks/useFetch'; import { useState } from 'react'; -import { CopyIcon, CrossIcon, DeleteIcon, StarIcon } from './icons'; +import Type from './Type'; +import { CalendarIcon, CopyIcon, CrossIcon, DeleteIcon, FileIcon, HashIcon, ImageIcon, StarIcon } from './icons'; +import MutedText from './MutedText'; + +export function FileMeta({ Icon, title, subtitle }) { + return ( + + + + {title} + {subtitle} + + + ); +} export default function File({ image, updateImages }) { const [open, setOpen] = useState(false); - const [t] = useState(image.mimetype.split('/')[0]); const notif = useNotifications(); const clipboard = useClipboard(); - + const theme = useMantineTheme(); + const handleDelete = async () => { const res = await useFetch('/api/user/files', 'DELETE', { id: image.id }); if (!res.error) { updateImages(true); notif.showNotification({ - title: 'Image Deleted', + title: 'File Deleted', message: '', color: 'green', icon: , }); } else { notif.showNotification({ - title: 'Failed to delete image', + title: 'Failed to delete file', message: res.error, color: 'red', icon: , }); } - + setOpen(false); }; @@ -53,13 +67,6 @@ export default function File({ image, updateImages }) { }); }; - const Type = (props) => { - return { - 'video':