diff --git a/.yarn/releases/yarn-3.2.1.cjs b/.yarn/releases/yarn-3.2.1.cjs old mode 100644 new mode 100755 diff --git a/esbuild.config.js b/esbuild.config.js index 4d5c264..dbd6094 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -37,7 +37,7 @@ const { rm } = require('fs/promises'); write: true, watch, incremental: watch, - sourcemap: false, + sourcemap: true, minify: false, }); })(); \ No newline at end of file diff --git a/next.config.js b/next.config.js index ddfc9de..72c9adc 100644 --- a/next.config.js +++ b/next.config.js @@ -8,9 +8,6 @@ module.exports = { }, ]; }, - api: { - responseLimit: false, - }, poweredByHeader: false, reactStrictMode: true, }; \ No newline at end of file diff --git a/package.json b/package.json index d449857..c64d965 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "3.4.8", "license": "MIT", "scripts": { - "dev": "node esbuild.config.js && REACT_EDITOR=code NODE_ENV=development node dist/server", + "dev": "node esbuild.config.js && REACT_EDITOR=code NODE_ENV=development node --enable-source-maps dist/server", "build": "npm-run-all build:server build:schema build:next", "build:server": "node esbuild.config.js", "build:next": "next build", @@ -16,17 +16,21 @@ "docker:build-dev": "docker-compose --file docker-compose.dev.yml up --build" }, "dependencies": { + "@emotion/react": "^11.9.3", + "@emotion/server": "^11.4.0", "@iarna/toml": "2.2.5", - "@mantine/core": "^4.2.9", - "@mantine/dropzone": "^4.2.9", - "@mantine/hooks": "^4.2.9", - "@mantine/modals": "^4.2.9", - "@mantine/next": "^4.2.9", - "@mantine/notifications": "^4.2.9", - "@mantine/prism": "^4.2.9", - "@prisma/client": "^3.15.2", - "@prisma/migrate": "^3.15.2", - "@prisma/sdk": "^3.15.2", + "@mantine/core": "^5.0.0", + "@mantine/dropzone": "^5.0.0", + "@mantine/form": "^5.0.0", + "@mantine/hooks": "^5.0.0", + "@mantine/modals": "^5.0.0", + "@mantine/next": "^5.0.0", + "@mantine/notifications": "^5.0.0", + "@mantine/nprogress": "^5.0.0", + "@mantine/prism": "^5.0.0", + "@prisma/client": "^4.1.0", + "@prisma/internals": "^4.1.0", + "@prisma/migrate": "^4.1.0", "@reduxjs/toolkit": "^1.8.2", "argon2": "^0.28.5", "colorette": "^2.0.19", @@ -39,7 +43,7 @@ "minio": "^7.0.28", "multer": "^1.4.5-lts.1", "next": "^12.1.6", - "prisma": "^3.15.2", + "prisma": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-feather": "^2.0.10", diff --git a/src/components/File.tsx b/src/components/File.tsx index d358744..8712fdd 100644 --- a/src/components/File.tsx +++ b/src/components/File.tsx @@ -1,6 +1,6 @@ -import { Button, Card, Grid, Group, Image as MImage, Modal, Stack, Text, Title, useMantineTheme } from '@mantine/core'; +import { Button, Card, Group, Modal, Stack, Text, Title, useMantineTheme } from '@mantine/core'; import { useClipboard } from '@mantine/hooks'; -import { useNotifications } from '@mantine/notifications'; +import { showNotification } from '@mantine/notifications'; import useFetch from 'hooks/useFetch'; import { useState } from 'react'; import Type from './Type'; @@ -21,7 +21,6 @@ export function FileMeta({ Icon, title, subtitle }) { export default function File({ image, updateImages }) { const [open, setOpen] = useState(false); - const notif = useNotifications(); const clipboard = useClipboard(); const theme = useMantineTheme(); @@ -29,14 +28,14 @@ export default function File({ image, updateImages }) { const res = await useFetch('/api/user/files', 'DELETE', { id: image.id }); if (!res.error) { updateImages(true); - notif.showNotification({ + showNotification({ title: 'File Deleted', message: '', color: 'green', icon: , }); } else { - notif.showNotification({ + showNotification({ title: 'Failed to delete file', message: res.error, color: 'red', @@ -50,7 +49,7 @@ export default function File({ image, updateImages }) { const handleCopy = () => { clipboard.copy(`${window.location.protocol}//${window.location.host}${image.url}`); setOpen(false); - notif.showNotification({ + showNotification({ title: 'Copied to clipboard', message: '', icon: , @@ -60,7 +59,7 @@ export default function File({ image, updateImages }) { const handleFavorite = async () => { const data = await useFetch('/api/user/files', 'PATCH', { id: image.id, favorite: !image.favorite }); if (!data.error) updateImages(true); - notif.showNotification({ + showNotification({ title: 'Image is now ' + (!image.favorite ? 'favorited' : 'unfavorited'), message: '', icon: , @@ -75,8 +74,6 @@ export default function File({ image, updateImages }) { onClose={() => setOpen(false)} title={{image.file}} size='xl' - overlayBlur={3} - overlayColor={theme.colorScheme === 'dark' ? theme.colors.dark[6] : 'white'} > , + icon: , text: 'Home', link: '/dashboard', }, { - icon: , + icon: , text: 'Files', link: '/dashboard/files', }, { - icon: , + icon: , text: 'Stats', link: '/dashboard/stats', }, { - icon: , + icon: , text: 'URLs', link: '/dashboard/urls', }, { - icon: , + icon: , text: 'Upload', link: '/dashboard/upload', }, { - icon: , + icon: , text: 'Upload Text', link: '/dashboard/text', }, ]; +const admin_items = [ + { + icon: , + text: 'Users', + link: '/dashboard/users', + }, + { + icon: , + text: 'Invites', + link: '/dashboard/invites', + }, +]; + export default function Layout({ children, user, title }) { const [token, setToken] = useState(user?.token); const [systemTheme, setSystemTheme] = useState(user.systemTheme ?? 'system'); @@ -104,7 +117,6 @@ export default function Layout({ children, user, title }) { const dispatch = useStoreDispatch(); const theme = useMantineTheme(); const modals = useModals(); - const notif = useNotifications(); const clipboard = useClipboard(); const handleUpdateTheme = async value => { @@ -116,7 +128,7 @@ export default function Layout({ children, user, title }) { dispatch(updateUser(newUser)); router.replace(router.pathname); - notif.showNotification({ + showNotification({ title: `Theme changed to ${friendlyThemeName[value]}`, message: '', color: 'green', @@ -126,8 +138,6 @@ export default function Layout({ children, user, title }) { const openResetToken = () => modals.openConfirmModal({ title: 'Reset Token', - centered: true, - overlayBlur: 3, children: ( Once you reset your token, you will have to update any uploaders to use this new token. @@ -138,14 +148,14 @@ export default function Layout({ children, user, title }) { const a = await useFetch('/api/user/token', 'PATCH'); if (!a.success) { setToken(a.success); - notif.showNotification({ + showNotification({ title: 'Token Reset Failed', message: a.error, color: 'red', icon: , }); } else { - notif.showNotification({ + showNotification({ title: 'Token Reset', message: 'Your token has been reset. You will need to update any uploaders to use this new token.', color: 'green', @@ -159,8 +169,6 @@ export default function Layout({ children, user, title }) { const openCopyToken = () => modals.openConfirmModal({ title: 'Copy Token', - centered: true, - overlayBlur: 3, children: ( Make sure you don't share this token with anyone as they will be able to upload files on your behalf. @@ -170,7 +178,7 @@ export default function Layout({ children, user, title }) { onConfirm: async () => { clipboard.copy(token); - notif.showNotification({ + showNotification({ title: 'Token Copied', message: 'Your token has been copied to your clipboard.', color: 'green', @@ -187,7 +195,7 @@ export default function Layout({ children, user, title }) { fixed navbar={ @@ -291,75 +252,78 @@ export default function Layout({ children, user, title }) { {title} setOpen(false)} - target={ - setOpen(!open)} - sx={{ - display: 'block', - width: '100%', - padding: theme.spacing.xs, - borderRadius: theme.radius.sm, - color: theme.other.color, - - '&:hover': { - backgroundColor: theme.other.hover, - }, - }} - > - - - - - {user.username} - - - } > - - +