mirror of
https://github.com/diced/zipline.git
synced 2025-12-12 07:40:45 -08:00
fix: small stuff
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { Button, Center, Group, Pagination, Paper, SimpleGrid, Skeleton, Stack, Title } from '@mantine/core';
|
import { Button, Center, Group, Pagination, Paper, SimpleGrid, Skeleton, Stack, Title } from '@mantine/core';
|
||||||
import { IconFileUpload, IconFilesOff } from '@tabler/icons-react';
|
import { IconFileUpload, IconFilesOff } from '@tabler/icons-react';
|
||||||
|
import dynamic from 'next/dynamic';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useApiPagination } from '../useApiPagination';
|
import { useApiPagination } from '../useApiPagination';
|
||||||
import dynamic from 'next/dynamic';
|
|
||||||
|
|
||||||
const DashboardFile = dynamic(() => import('@/components/file/DashboardFile'), {
|
const DashboardFile = dynamic(() => import('@/components/file/DashboardFile'), {
|
||||||
loading: () => <Skeleton height={350} animate />,
|
loading: () => <Skeleton height={350} animate />,
|
||||||
@@ -19,6 +19,14 @@ export default function Files({ id }: { id?: string }) {
|
|||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [cachedPages, setCachedPages] = useState<number>(1);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data?.pages) {
|
||||||
|
setCachedPages(data.pages);
|
||||||
|
}
|
||||||
|
}, [data?.pages]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
router.replace(
|
router.replace(
|
||||||
{
|
{
|
||||||
@@ -74,7 +82,7 @@ export default function Files({ id }: { id?: string }) {
|
|||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<Pagination my='sm' value={page} onChange={setPage} total={data?.pages ?? 1} />
|
<Pagination my='sm' value={page} onChange={setPage} total={cachedPages} />
|
||||||
</Center>
|
</Center>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import DashboardFile from '@/components/file/DashboardFile';
|
import DashboardFile from '@/components/file/DashboardFile';
|
||||||
import { Folder } from '@/lib/db/models/folder';
|
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({
|
export default function ViewFilesModal({
|
||||||
folder,
|
folder,
|
||||||
@@ -20,11 +20,7 @@ export default function ViewFilesModal({
|
|||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
>
|
>
|
||||||
{folder?.files?.length === 0 ? (
|
{folder?.files?.length === 0 ? null : (
|
||||||
<Paper p='lg' withBorder>
|
|
||||||
No files found
|
|
||||||
</Paper>
|
|
||||||
) : (
|
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
my='sm'
|
my='sm'
|
||||||
spacing='md'
|
spacing='md'
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export default function ServerSettingsOauth({
|
|||||||
<TextInput label='Discord Client Secret' {...form.getInputProps('oauthDiscordClientSecret')} />
|
<TextInput label='Discord Client Secret' {...form.getInputProps('oauthDiscordClientSecret')} />
|
||||||
<TextInput
|
<TextInput
|
||||||
label='Discord Redirect URL'
|
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')}
|
{...form.getInputProps('oauthDiscordRedirectUri')}
|
||||||
/>
|
/>
|
||||||
</Paper>
|
</Paper>
|
||||||
@@ -145,7 +145,7 @@ export default function ServerSettingsOauth({
|
|||||||
<TextInput label='Google Client Secret' {...form.getInputProps('oauthGoogleClientSecret')} />
|
<TextInput label='Google Client Secret' {...form.getInputProps('oauthGoogleClientSecret')} />
|
||||||
<TextInput
|
<TextInput
|
||||||
label='Google Redirect URL'
|
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')}
|
{...form.getInputProps('oauthGoogleRedirectUri')}
|
||||||
/>
|
/>
|
||||||
</Paper>
|
</Paper>
|
||||||
@@ -163,7 +163,7 @@ export default function ServerSettingsOauth({
|
|||||||
<TextInput label='GitHub Client Secret' {...form.getInputProps('oauthGithubClientSecret')} />
|
<TextInput label='GitHub Client Secret' {...form.getInputProps('oauthGithubClientSecret')} />
|
||||||
<TextInput
|
<TextInput
|
||||||
label='GitHub Redirect URL'
|
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')}
|
{...form.getInputProps('oauthGithubRedirectUri')}
|
||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
@@ -180,7 +180,7 @@ export default function ServerSettingsOauth({
|
|||||||
<TextInput label='OIDC Userinfo URL' {...form.getInputProps('oauthOidcUserinfoUrl')} />
|
<TextInput label='OIDC Userinfo URL' {...form.getInputProps('oauthOidcUserinfoUrl')} />
|
||||||
<TextInput
|
<TextInput
|
||||||
label='OIDC Redirect URL'
|
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')}
|
{...form.getInputProps('oauthOidcRedirectUri')}
|
||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Response } from '@/lib/api/response';
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ColorInput,
|
ColorInput,
|
||||||
|
Group,
|
||||||
LoadingOverlay,
|
LoadingOverlay,
|
||||||
Paper,
|
Paper,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
@@ -11,7 +12,7 @@ import {
|
|||||||
Title,
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useForm } from '@mantine/form';
|
import { useForm } from '@mantine/form';
|
||||||
import { IconDeviceFloppy } from '@tabler/icons-react';
|
import { IconDeviceFloppy, IconRefresh } from '@tabler/icons-react';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { settingsOnSubmit } from '../settingsOnSubmit';
|
import { settingsOnSubmit } from '../settingsOnSubmit';
|
||||||
@@ -122,9 +123,14 @@ export default function ServerSettingsPWA({
|
|||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
|
|
||||||
<Button type='submit' mt='md' loading={isLoading} leftSection={<IconDeviceFloppy size='1rem' />}>
|
<Group mt='md'>
|
||||||
Save
|
<Button type='submit' loading={isLoading} leftSection={<IconDeviceFloppy size='1rem' />}>
|
||||||
</Button>
|
Save
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => router.reload()} leftSection={<IconRefresh size='1rem' />}>
|
||||||
|
Refresh
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
</form>
|
</form>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export async function deleteUser(user: User) {
|
|||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
confirm: 'Delete',
|
confirm: 'Delete',
|
||||||
},
|
},
|
||||||
|
confirmProps: { color: 'red' },
|
||||||
onConfirm: () =>
|
onConfirm: () =>
|
||||||
modals.openConfirmModal({
|
modals.openConfirmModal({
|
||||||
centered: true,
|
centered: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user