Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
diced committed Oct 23, 2024
1 parent 727c8bd commit 0deeb0f
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 21 deletions.
10 changes: 5 additions & 5 deletions src/components/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ export default function Theming({
state.settings.themeLight,
]);
const systemTheme = useColorScheme();
const currentTheme = user ? userTheme : defaultTheme?.default ?? 'system';
const currentTheme = user ? userTheme : (defaultTheme?.default ?? 'system');

let theme = findTheme(currentTheme, themes);

if (currentTheme === 'system') {
theme =
systemTheme === 'dark'
? findTheme(user ? preferredDark : defaultTheme?.dark ?? '', themes) ??
findTheme('builtin:dark_gray', themes)
: findTheme(user ? preferredLight : defaultTheme?.light ?? '', themes) ??
findTheme('builtin:light_gray', themes);
? (findTheme(user ? preferredDark : (defaultTheme?.dark ?? ''), themes) ??
findTheme('builtin:dark_gray', themes))
: (findTheme(user ? preferredLight : (defaultTheme?.light ?? ''), themes) ??
findTheme('builtin:light_gray', themes));
}

if (!theme) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/files/useApiPagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function useApiPagination(
) {
const { data, error, isLoading, mutate } = useSWR<Response['/api/user/files']>(
{ key: '/api/user/files', options },
fetcher,
{ fetcher },
);

return {
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/files/views/FavoriteFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function FavoriteFiles() {
cols={{
base: 1,
md: 2,
lg: data?.page.length ?? 0 > 0 ? 3 : 1,
lg: (data?.page.length ?? 0 > 0) ? 3 : 1,
}}
spacing='md'
pos='relative'
Expand All @@ -73,7 +73,7 @@ export default function FavoriteFiles() {
<Paper withBorder h={200}>
<LoadingOverlay visible />
</Paper>
) : data?.page.length ?? 0 > 0 ? (
) : (data?.page.length ?? 0 > 0) ? (
data?.page.map((file) => <DashboardFile key={file.id} file={file} />)
) : (
<Paper withBorder p='sm'>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/files/views/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Files({ id }: { id?: string }) {
cols={{
base: 1,
md: 2,
lg: data?.page.length ?? 0 > 0 ? 3 : 1,
lg: (data?.page.length ?? 0 > 0) ? 3 : 1,
}}
spacing='md'
pos='relative'
Expand All @@ -54,7 +54,7 @@ export default function Files({ id }: { id?: string }) {
<Paper withBorder h={200}>
<LoadingOverlay visible />
</Paper>
) : data?.page?.length ?? 0 > 0 ? (
) : (data?.page?.length ?? 0 > 0) ? (
data?.page.map((file) => <DashboardFile key={file.id} file={file} />)
) : (
<Paper withBorder p='sm'>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/folders/FavoriteFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export default function FavoriteFiles() {
cols={{
base: 1,
md: 2,
lg: data?.page.length ?? 0 > 0 ? 3 : 1,
lg: (data?.page.length ?? 0 > 0) ? 3 : 1,
}}
>
{isLoading ? (
<Paper withBorder h={200}>
<LoadingOverlay visible />
</Paper>
) : data?.page.length ?? 0 > 0 ? (
) : (data?.page.length ?? 0 > 0) ? (
data?.page.map((file) => <DashboardFile key={file.id} file={file} />)
) : (
<Paper withBorder p='sm'>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/invites/views/InviteGridView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function InviteGridView() {
<Paper withBorder h={200}>
<LoadingOverlay visible />
</Paper>
) : folders?.length ?? 0 !== 0 ? (
) : (folders?.length ?? 0 !== 0) ? (
<SimpleGrid
my='sm'
spacing='md'
Expand Down
7 changes: 4 additions & 3 deletions src/components/pages/metrics/useStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ export function useApiStats(options: ApiStatsOptions = {}) {
if (!options.from && !options.to)
return { data: undefined, error: undefined, isLoading: false, mutate: () => {} };

const { data, error, isLoading, mutate } = useSWR<Response['/api/stats']>(
{ key: '/api/stats', options },
const { data, error, isLoading, mutate } = useSWR<Response['/api/stats']>({
key: '/api/stats',
options,
fetcher,
);
});

return {
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function TwoFAButton() {
width={180}
height={180}
src={twoData?.qrcode}
alt={'qr code ' + twoData?.secret ?? ''}
alt={'qr code ' + twoData?.secret}
/>
</Center>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/settings/parts/SettingsSessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function SettingsSessions() {
<Title order={2}>Sessions</Title>

<Text c='dimmed' mt='sm'>
You are currently logged into {isLoading ? '...' : data?.other?.length ?? '...'} other devices
You are currently logged into {isLoading ? '...' : (data?.other?.length ?? '...')} other devices
</Text>

<Button
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/users/views/UserGridView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function UserGridView() {
<Paper withBorder h={200}>
<LoadingOverlay visible />
</Paper>
) : users?.length ?? 0 !== 0 ? (
) : (users?.length ?? 0 !== 0) ? (
<SimpleGrid
my='sm'
spacing='md'
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/api/user/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default fastifyPlugin(
if (isNaN(Number(perpage))) return res.badRequest('Perpage must be a number');

const searchQuery = req.query.searchQuery
? decodeURIComponent(req.query.searchQuery.trim()) ?? null
? (decodeURIComponent(req.query.searchQuery.trim()) ?? null)
: null;

const { page, filter, favorite } = req.query;
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/api/user/urls/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default fastifyPlugin(

server.get<{ Querystring: Query }>(PATH, { preHandler: [userMiddleware] }, async (req, res) => {
const searchQuery = req.query.searchQuery
? decodeURIComponent(req.query.searchQuery.trim()) ?? null
? (decodeURIComponent(req.query.searchQuery.trim()) ?? null)
: null;
const searchField = validateSearchField.safeParse(req.query.searchField || 'destination');
if (!searchField.success) return res.badRequest('Invalid searchField value');
Expand Down

0 comments on commit 0deeb0f

Please sign in to comment.