fix: small stuff

This commit is contained in:
diced 2025-02-13 21:52:35 -08:00
parent cbd9191488
commit 7bd889ebd9
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
5 changed files with 27 additions and 16 deletions

View file

@ -1,10 +1,10 @@
import { Button, Center, Group, Pagination, Paper, SimpleGrid, Skeleton, Stack, Title } from '@mantine/core';
import { IconFileUpload, IconFilesOff } from '@tabler/icons-react';
import dynamic from 'next/dynamic';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import { useApiPagination } from '../useApiPagination';
import dynamic from 'next/dynamic';
const DashboardFile = dynamic(() => import('@/components/file/DashboardFile'), {
loading: () => <Skeleton height={350} animate />,
@ -19,6 +19,14 @@ export default function Files({ id }: { id?: string }) {
id,
});
const [cachedPages, setCachedPages] = useState<number>(1);
useEffect(() => {
if (data?.pages) {
setCachedPages(data.pages);
}
}, [data?.pages]);
useEffect(() => {
router.replace(
{
@ -74,7 +82,7 @@ export default function Files({ id }: { id?: string }) {
</SimpleGrid>
<Center>
<Pagination my='sm' value={page} onChange={setPage} total={data?.pages ?? 1} />
<Pagination my='sm' value={page} onChange={setPage} total={cachedPages} />
</Center>
</>
);

View file

@ -1,6 +1,6 @@
import DashboardFile from '@/components/file/DashboardFile';
import { Folder } from '@/lib/db/models/folder';
import { Group, Modal, Paper, SimpleGrid, Text } from '@mantine/core';
import { Group, Modal, SimpleGrid, Text } from '@mantine/core';
export default function ViewFilesModal({
folder,
@ -20,11 +20,7 @@ export default function ViewFilesModal({
opened={opened}
onClose={onClose}
>
{folder?.files?.length === 0 ? (
<Paper p='lg' withBorder>
No files found
</Paper>
) : (
{folder?.files?.length === 0 ? null : (
<SimpleGrid
my='sm'
spacing='md'

View file

@ -130,7 +130,7 @@ export default function ServerSettingsOauth({
<TextInput label='Discord Client Secret' {...form.getInputProps('oauthDiscordClientSecret')} />
<TextInput
label='Discord Redirect URL'
description='The redirect URL to use instead of the host when logging in. This must end with /api/auth/oauth/discord'
description='The redirect URL to use instead of the host when logging in. This is not required if the URL generated by Zipline works as intended.'
{...form.getInputProps('oauthDiscordRedirectUri')}
/>
</Paper>
@ -145,7 +145,7 @@ export default function ServerSettingsOauth({
<TextInput label='Google Client Secret' {...form.getInputProps('oauthGoogleClientSecret')} />
<TextInput
label='Google Redirect URL'
description='The redirect URL to use instead of the host when logging in. This must end with /api/auth/oauth/google'
description='The redirect URL to use instead of the host when logging in. This is not required if the URL generated by Zipline works as intended.'
{...form.getInputProps('oauthGoogleRedirectUri')}
/>
</Paper>
@ -163,7 +163,7 @@ export default function ServerSettingsOauth({
<TextInput label='GitHub Client Secret' {...form.getInputProps('oauthGithubClientSecret')} />
<TextInput
label='GitHub Redirect URL'
description='The redirect URL to use instead of the host when logging in. This must end with /api/auth/oauth/github'
description='The redirect URL to use instead of the host when logging in. This is not required if the URL generated by Zipline works as intended.'
{...form.getInputProps('oauthGithubRedirectUri')}
/>
</SimpleGrid>
@ -180,7 +180,7 @@ export default function ServerSettingsOauth({
<TextInput label='OIDC Userinfo URL' {...form.getInputProps('oauthOidcUserinfoUrl')} />
<TextInput
label='OIDC Redirect URL'
description='The redirect URL to use instead of the host when logging in. This must end with /api/auth/oauth/oidc'
description='The redirect URL to use instead of the host when logging in. This is not required if the URL generated by Zipline works as intended.'
{...form.getInputProps('oauthOidcRedirectUri')}
/>
</SimpleGrid>

View file

@ -2,6 +2,7 @@ import { Response } from '@/lib/api/response';
import {
Button,
ColorInput,
Group,
LoadingOverlay,
Paper,
SimpleGrid,
@ -11,7 +12,7 @@ import {
Title,
} from '@mantine/core';
import { useForm } from '@mantine/form';
import { IconDeviceFloppy } from '@tabler/icons-react';
import { IconDeviceFloppy, IconRefresh } from '@tabler/icons-react';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { settingsOnSubmit } from '../settingsOnSubmit';
@ -122,9 +123,14 @@ export default function ServerSettingsPWA({
/>
</SimpleGrid>
<Button type='submit' mt='md' loading={isLoading} leftSection={<IconDeviceFloppy size='1rem' />}>
Save
</Button>
<Group mt='md'>
<Button type='submit' loading={isLoading} leftSection={<IconDeviceFloppy size='1rem' />}>
Save
</Button>
<Button onClick={() => router.reload()} leftSection={<IconRefresh size='1rem' />}>
Refresh
</Button>
</Group>
</form>
</Paper>
);

View file

@ -15,6 +15,7 @@ export async function deleteUser(user: User) {
cancel: 'Cancel',
confirm: 'Delete',
},
confirmProps: { color: 'red' },
onConfirm: () =>
modals.openConfirmModal({
centered: true,