mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-19 05:52:18 +01:00
refactor: optimize imports
This commit is contained in:
@@ -29,7 +29,7 @@ export const WidgetElementType = ({ id, image, disabled, widget }: WidgetElement
|
||||
const getLowestWrapper = () => config?.wrappers.sort((a, b) => a.position - b.position)[0];
|
||||
|
||||
const handleAddition = async () => {
|
||||
updateConfig(
|
||||
await updateConfig(
|
||||
configName,
|
||||
(prev) => ({
|
||||
...prev,
|
||||
|
||||
@@ -28,7 +28,7 @@ export const CategoryEditModal = ({
|
||||
});
|
||||
|
||||
const handleSubmit = async (values: FormType) => {
|
||||
innerProps.onSuccess({ ...innerProps.category, name: values.name });
|
||||
await innerProps.onSuccess({ ...innerProps.category, name: values.name });
|
||||
context.closeModal(id);
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export const useCategoryActions = (configName: string | undefined, category: Cat
|
||||
};
|
||||
|
||||
// Adding category and wrapper and moving other items down
|
||||
updateConfig(
|
||||
await updateConfig(
|
||||
configName,
|
||||
(previous) => {
|
||||
const aboveWrappers = previous.wrappers.filter((x) => x.position <= abovePosition);
|
||||
@@ -87,7 +87,7 @@ export const useCategoryActions = (configName: string | undefined, category: Cat
|
||||
};
|
||||
|
||||
// Adding category and wrapper and moving other items down
|
||||
updateConfig(
|
||||
await updateConfig(
|
||||
configName,
|
||||
(previous) => {
|
||||
const aboveWrappers = previous.wrappers.filter((x) => x.position < belowPosition);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ReactNode, createContext, useContext, useEffect, useState } from 'react';
|
||||
import { createContext, ReactNode, useContext, useEffect, useState } from 'react';
|
||||
import { shallow } from 'zustand/shallow';
|
||||
import { useColorTheme } from '~/tools/color';
|
||||
import { ConfigType } from '~/types/config';
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 39 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -1,30 +0,0 @@
|
||||
// This interface is to be used in all the modules of the project
|
||||
// Each module should have its own interface and call the following function:
|
||||
// TODO: Add a function to register a module
|
||||
import { Icon } from '@tabler/icons-react';
|
||||
|
||||
// Note: Maybe use context to keep track of the modules
|
||||
// TODO: Remove this old component and the entire file
|
||||
export type IModule = {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: Icon;
|
||||
component: React.ComponentType;
|
||||
options?: Option;
|
||||
padding?: PaddingOptions;
|
||||
};
|
||||
|
||||
interface PaddingOptions {
|
||||
top: number;
|
||||
right: number;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
[x: string]: OptionValues;
|
||||
}
|
||||
|
||||
export interface OptionValues {
|
||||
name: string;
|
||||
value: boolean | string | string[];
|
||||
options?: string[];
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Button, Center, Stack, Title, Text, createStyles } from "@mantine/core";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import Image from "next/image";
|
||||
import Head from "next/head";
|
||||
import { MainLayout } from "~/components/layout/Templates/MainLayout";
|
||||
import Link from "next/link";
|
||||
import { Button, Center, createStyles, Stack, Text, Title } from '@mantine/core';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Image from 'next/image';
|
||||
import Head from 'next/head';
|
||||
import { MainLayout } from '~/components/layout/Templates/MainLayout';
|
||||
import Link from 'next/link';
|
||||
|
||||
import imageAccessDenied from '~/images/undraw_secure_login_pdn4.svg';
|
||||
import { pageAccessDeniedNamespaces } from "~/tools/server/translation-namespaces";
|
||||
import { getServerSideTranslations } from "~/tools/server/getServerSideTranslations";
|
||||
import { GetServerSidePropsContext } from "next";
|
||||
import { pageAccessDeniedNamespaces } from '~/tools/server/translation-namespaces';
|
||||
import { getServerSideTranslations } from '~/tools/server/getServerSideTranslations';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
|
||||
export default function Custom401() {
|
||||
const { classes } = useStyles();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Center, Stack, Text, Title, createStyles } from '@mantine/core';
|
||||
import { Button, Center, createStyles, Stack, Text, Title } from '@mantine/core';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Head from 'next/head';
|
||||
|
||||
@@ -10,7 +10,7 @@ import utc from 'dayjs/plugin/utc';
|
||||
import 'flag-icons/css/flag-icons.min.css';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { Session } from 'next-auth';
|
||||
import { SessionProvider, getSession } from 'next-auth/react';
|
||||
import { getSession, SessionProvider } from 'next-auth/react';
|
||||
import { appWithTranslation } from 'next-i18next';
|
||||
import { AppProps } from 'next/app';
|
||||
import Script from 'next/script';
|
||||
@@ -24,10 +24,7 @@ import { modals } from '~/modals';
|
||||
import { usePackageAttributesStore } from '~/tools/client/zustands/usePackageAttributesStore';
|
||||
import { ColorTheme } from '~/tools/color';
|
||||
import { getLanguageByCode } from '~/tools/language';
|
||||
import {
|
||||
ServerSidePackageAttributesType,
|
||||
getServiceSidePackageAttributes,
|
||||
} from '~/tools/server/getPackageVersion';
|
||||
import { getServiceSidePackageAttributes, ServerSidePackageAttributesType } from '~/tools/server/getPackageVersion';
|
||||
import { theme } from '~/tools/server/theme/theme';
|
||||
import { ConfigType } from '~/types/config';
|
||||
import { api } from '~/utils/api';
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
Accordion,
|
||||
Center,
|
||||
Group,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
createStyles,
|
||||
useMantineTheme,
|
||||
} from '@mantine/core';
|
||||
import { Accordion, Center, createStyles, Group, Stack, Text, Title, useMantineTheme } from '@mantine/core';
|
||||
import { IconDeviceDesktop, IconInfoCircle, IconServer } from '@tabler/icons-react';
|
||||
import { NextPageContext } from 'next';
|
||||
import Head from 'next/head';
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Flex,
|
||||
PasswordInput,
|
||||
Popover,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from '@mantine/core';
|
||||
import { Button, Card, Flex, PasswordInput, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { useForm } from '@mantine/form';
|
||||
import { showNotification, updateNotification } from '@mantine/notifications';
|
||||
import { IconCheck, IconX } from '@tabler/icons-react';
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Flex,
|
||||
PasswordInput,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from '@mantine/core';
|
||||
import { Alert, Button, Card, Flex, PasswordInput, Stack, Text, TextInput, Title } from '@mantine/core';
|
||||
import { useForm } from '@mantine/form';
|
||||
import { IconAlertTriangle } from '@tabler/icons-react';
|
||||
import { GetServerSideProps, InferGetServerSidePropsType } from 'next';
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
import {
|
||||
Affix,
|
||||
Button,
|
||||
Card,
|
||||
Container,
|
||||
Group,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
Transition,
|
||||
rem,
|
||||
} from '@mantine/core';
|
||||
import { Affix, Button, Card, Container, Group, Paper, rem, Stack, Text, Title, Transition } from '@mantine/core';
|
||||
import { showNotification, updateNotification } from '@mantine/notifications';
|
||||
import {
|
||||
IconArrowLeft,
|
||||
@@ -35,10 +23,7 @@ import { AppearanceCustomization } from '~/components/Board/Customize/Appearance
|
||||
import { GridstackCustomization } from '~/components/Board/Customize/Gridstack/GridstackCustomization';
|
||||
import { LayoutCustomization } from '~/components/Board/Customize/Layout/LayoutCustomization';
|
||||
import { PageMetadataCustomization } from '~/components/Board/Customize/PageMetadata/PageMetadataCustomization';
|
||||
import {
|
||||
BoardCustomizationFormProvider,
|
||||
useBoardCustomizationForm,
|
||||
} from '~/components/Board/Customize/form';
|
||||
import { BoardCustomizationFormProvider, useBoardCustomizationForm } from '~/components/Board/Customize/form';
|
||||
import { useBoardLink } from '~/components/layout/Templates/BoardLayout';
|
||||
import { MainLayout } from '~/components/layout/Templates/MainLayout';
|
||||
import { createTrpcServersideHelpers } from '~/server/api/helper';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';
|
||||
import { SSRConfig } from 'next-i18next';
|
||||
import { Dashboard } from '~/components/Dashboard/Dashboard';
|
||||
import { BoardLayout } from '~/components/layout/Templates/BoardLayout';
|
||||
import { useInitConfig } from '~/config/init';
|
||||
@@ -10,7 +9,6 @@ import { getFrontendConfig } from '~/tools/config/getFrontendConfig';
|
||||
import { getServerSideTranslations } from '~/tools/server/getServerSideTranslations';
|
||||
import { checkForSessionOrAskForLogin } from '~/tools/server/loginBuilder';
|
||||
import { boardNamespaces } from '~/tools/server/translation-namespaces';
|
||||
import { ConfigType } from '~/types/config';
|
||||
import { api } from '~/utils/api';
|
||||
|
||||
export default function BoardPage({
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
ActionIcon,
|
||||
Anchor,
|
||||
Badge,
|
||||
createStyles,
|
||||
Divider,
|
||||
Group,
|
||||
HoverCard,
|
||||
@@ -10,20 +11,12 @@ import {
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
createStyles,
|
||||
} from '@mantine/core';
|
||||
import {
|
||||
IconAnchor,
|
||||
IconKey,
|
||||
IconLanguage,
|
||||
IconSchema,
|
||||
IconVersions,
|
||||
IconVocabulary,
|
||||
} from '@tabler/icons-react';
|
||||
import { IconAnchor, IconKey, IconLanguage, IconSchema, IconVersions, IconVocabulary } from '@tabler/icons-react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { InitOptions } from 'i18next';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { Trans, i18n, useTranslation } from 'next-i18next';
|
||||
import { i18n, Trans, useTranslation } from 'next-i18next';
|
||||
import Head from 'next/head';
|
||||
import { ReactNode } from 'react';
|
||||
import { ManageLayout } from '~/components/layout/Templates/ManageLayout';
|
||||
|
||||
@@ -5,7 +5,8 @@ import {
|
||||
Card,
|
||||
Group,
|
||||
LoadingOverlay,
|
||||
Menu, Modal,
|
||||
Menu,
|
||||
Modal,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
@@ -15,7 +16,8 @@ import { useDisclosure, useListState } from '@mantine/hooks';
|
||||
import {
|
||||
IconBox,
|
||||
IconCategory,
|
||||
IconCopy, IconCursorText,
|
||||
IconCopy,
|
||||
IconCursorText,
|
||||
IconDeviceFloppy,
|
||||
IconDotsVertical,
|
||||
IconFolderFilled,
|
||||
@@ -40,7 +42,6 @@ import { getServerSideTranslations } from '~/tools/server/getServerSideTranslati
|
||||
import { checkForSessionOrAskForLogin } from '~/tools/server/loginBuilder';
|
||||
import { manageNamespaces } from '~/tools/server/translation-namespaces';
|
||||
import { api } from '~/utils/api';
|
||||
import { modals } from '@mantine/modals';
|
||||
import { notifications } from '@mantine/notifications';
|
||||
import { RenameBoardModal } from '~/components/Dashboard/Modals/RenameBoard/RenameBoardModal';
|
||||
import { useState } from 'react';
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
import {
|
||||
Box,
|
||||
Card,
|
||||
Group,
|
||||
Image,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
UnstyledButton,
|
||||
createStyles,
|
||||
} from '@mantine/core';
|
||||
import { Box, Card, createStyles, Group, Image, SimpleGrid, Stack, Text, Title, UnstyledButton } from '@mantine/core';
|
||||
import { IconArrowRight } from '@tabler/icons-react';
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GetServerSidePropsContext, NextPage } from 'next';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import dynamic from 'next/dynamic';
|
||||
import 'swagger-ui-react/swagger-ui.css';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
@@ -15,14 +15,7 @@ import {
|
||||
} from '@mantine/core';
|
||||
import { useForm, zodResolver } from '@mantine/form';
|
||||
import { useDebouncedValue } from '@mantine/hooks';
|
||||
import {
|
||||
IconPencil,
|
||||
IconUser,
|
||||
IconUserPlus,
|
||||
IconUserShield,
|
||||
IconUserStar,
|
||||
IconX,
|
||||
} from '@tabler/icons-react';
|
||||
import { IconPencil, IconUser, IconUserPlus, IconUserShield, IconUserStar, IconX } from '@tabler/icons-react';
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Head from 'next/head';
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Pagination,
|
||||
Table,
|
||||
Text,
|
||||
Title,
|
||||
createStyles,
|
||||
} from '@mantine/core';
|
||||
import { ActionIcon, Button, Center, createStyles, Flex, Pagination, Table, Text, Title } from '@mantine/core';
|
||||
import { modals } from '@mantine/modals';
|
||||
import { IconPlus, IconTrash } from '@tabler/icons-react';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
import {
|
||||
Button,
|
||||
Container,
|
||||
Group,
|
||||
LoadingOverlay,
|
||||
Paper,
|
||||
Select,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from '@mantine/core';
|
||||
import { Button, Container, Group, LoadingOverlay, Paper, Select, Stack, Text, Title } from '@mantine/core';
|
||||
import { createFormContext } from '@mantine/form';
|
||||
import { IconArrowLeft } from '@tabler/icons-react';
|
||||
import { GetServerSideProps } from 'next';
|
||||
@@ -24,7 +14,7 @@ import { createTrpcServersideHelpers } from '~/server/api/helper';
|
||||
import { getServerAuthSession } from '~/server/auth';
|
||||
import { languages } from '~/tools/language';
|
||||
import { getServerSideTranslations } from '~/tools/server/getServerSideTranslations';
|
||||
import { RouterOutputs, api } from '~/utils/api';
|
||||
import { api, RouterOutputs } from '~/utils/api';
|
||||
import { useI18nZodResolver } from '~/utils/i18n-zod-resolver';
|
||||
import { updateSettingsValidationSchema } from '~/validations/user';
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ import { eq } from 'drizzle-orm';
|
||||
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
|
||||
import { Session, User } from 'next-auth';
|
||||
import { v4 } from 'uuid';
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { db, sqlite } from '~/server/db';
|
||||
import { invites, users } from '~/server/db/schema';
|
||||
|
||||
import { rootRouter } from '../../root';
|
||||
import { inviteRouter } from './invite-router';
|
||||
|
||||
const sessionMock = (user?: Partial<User>): Session => ({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { humanFileSize } from '../humanFileSize';
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
AbstractIconRepository,
|
||||
NormalizedIcon,
|
||||
NormalizedIconRepositoryResult,
|
||||
} from './abstract-icons-repository';
|
||||
import { AbstractIconRepository, NormalizedIcon, NormalizedIconRepositoryResult } from './abstract-icons-repository';
|
||||
|
||||
export class GitHubIconsRepository extends AbstractIconRepository {
|
||||
static readonly walkxcode = {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
AbstractIconRepository,
|
||||
NormalizedIcon,
|
||||
NormalizedIconRepositoryResult,
|
||||
} from './abstract-icons-repository';
|
||||
import { AbstractIconRepository, NormalizedIcon, NormalizedIconRepositoryResult } from './abstract-icons-repository';
|
||||
|
||||
export class JsdelivrIconsRepository extends AbstractIconRepository {
|
||||
static readonly papirusRepository = {
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import fs from 'fs';
|
||||
|
||||
import {
|
||||
AbstractIconRepository,
|
||||
NormalizedIcon,
|
||||
NormalizedIconRepositoryResult,
|
||||
} from './abstract-icons-repository';
|
||||
import { AbstractIconRepository, NormalizedIcon, NormalizedIconRepositoryResult } from './abstract-icons-repository';
|
||||
|
||||
export class LocalIconsRepository extends AbstractIconRepository {
|
||||
constructor() {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
AbstractIconRepository,
|
||||
NormalizedIcon,
|
||||
NormalizedIconRepositoryResult,
|
||||
} from './abstract-icons-repository';
|
||||
import { AbstractIconRepository, NormalizedIcon, NormalizedIconRepositoryResult } from './abstract-icons-repository';
|
||||
|
||||
export class UnpkgIconsRepository extends AbstractIconRepository {
|
||||
static tablerRepository = 'https://unpkg.com/@tabler/icons-png@2.0.0-beta/icons/';
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
GetServerSidePropsContext,
|
||||
GetServerSidePropsResult,
|
||||
PreviewData,
|
||||
Redirect
|
||||
} from 'next';
|
||||
import { GetServerSidePropsContext, GetServerSidePropsResult, PreviewData } from 'next';
|
||||
|
||||
import { Session } from 'next-auth';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* We also create a few inference helpers for input and output types.
|
||||
*/
|
||||
import { createTRPCProxyClient, httpBatchLink, loggerLink } from '@trpc/client';
|
||||
import { WithTRPCConfig, createTRPCNext } from '@trpc/next';
|
||||
import { createTRPCNext } from '@trpc/next';
|
||||
import { type inferRouterInputs, type inferRouterOutputs } from '@trpc/server';
|
||||
import superjson from 'superjson';
|
||||
import { env } from '~/env';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { zodResolver } from '@mantine/form';
|
||||
import { TFunction } from 'i18next';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { ErrorMapCtx, ZodIssueCode, ZodSchema, ZodTooBigIssue, ZodTooSmallIssue, z } from 'zod';
|
||||
import { ErrorMapCtx, z, ZodIssueCode, ZodSchema, ZodTooBigIssue, ZodTooSmallIssue } from 'zod';
|
||||
|
||||
export const useI18nZodResolver = () => {
|
||||
const { t } = useTranslation('zod');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { IncomingMessage } from 'http';
|
||||
import { ServerResponse } from 'http';
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { SSRConfig } from 'next-i18next';
|
||||
import { ParsedUrlQuery } from 'querystring';
|
||||
|
||||
Reference in New Issue
Block a user