mirror of
https://github.com/jeffvli/feishin.git
synced 2025-12-22 13:17:31 +00:00
add wrapper for mantine useForm
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -50,6 +50,7 @@
|
|||||||
"@mantine/modals",
|
"@mantine/modals",
|
||||||
"@mantine/dates",
|
"@mantine/dates",
|
||||||
"@mantine/hooks",
|
"@mantine/hooks",
|
||||||
|
"@mantine/form",
|
||||||
"@radix-ui/react-context-menu"
|
"@radix-ui/react-context-menu"
|
||||||
],
|
],
|
||||||
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import { nanoid } from 'nanoid/non-secure';
|
import { nanoid } from 'nanoid/non-secure';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -22,6 +21,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
|||||||
import { TextInput } from '/@/shared/components/text-input/text-input';
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types';
|
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types';
|
||||||
import { ServerType, toServerType } from '/@/shared/types/types';
|
import { ServerType, toServerType } from '/@/shared/types/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { openModal } from '@mantine/modals';
|
import { openModal } from '@mantine/modals';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
@@ -17,6 +16,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
|||||||
import { TextInput } from '/@/shared/components/text-input/text-input';
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { useDebouncedValue } from '/@/shared/hooks/use-debounced-value';
|
import { useDebouncedValue } from '/@/shared/hooks/use-debounced-value';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import {
|
import {
|
||||||
InternetProviderLyricSearchResponse,
|
InternetProviderLyricSearchResponse,
|
||||||
LyricSource,
|
LyricSource,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { closeModal, ContextModalProps } from '@mantine/modals';
|
import { closeModal, ContextModalProps } from '@mantine/modals';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
||||||
@@ -31,6 +30,7 @@ import { Table } from '/@/shared/components/table/table';
|
|||||||
import { TextInput } from '/@/shared/components/text-input/text-input';
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import {
|
import {
|
||||||
Playlist,
|
Playlist,
|
||||||
PlaylistListSort,
|
PlaylistListSort,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ import { TextInput } from '/@/shared/components/text-input/text-input';
|
|||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { Textarea } from '/@/shared/components/textarea/textarea';
|
import { Textarea } from '/@/shared/components/textarea/textarea';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import { CreatePlaylistBody, ServerType, SongListSort } from '/@/shared/types/domain-types';
|
import { CreatePlaylistBody, ServerType, SongListSort } from '/@/shared/types/domain-types';
|
||||||
import { ServerFeature } from '/@/shared/types/features-types';
|
import { ServerFeature } from '/@/shared/types/features-types';
|
||||||
|
|
||||||
@@ -168,7 +168,6 @@ export const CreatePlaylistForm = ({ onCancel }: CreatePlaylistFormProps) => {
|
|||||||
<Stack pt="1rem">
|
<Stack pt="1rem">
|
||||||
<Text>Query Editor</Text>
|
<Text>Query Editor</Text>
|
||||||
<PlaylistQueryBuilder
|
<PlaylistQueryBuilder
|
||||||
isSaving={mutation.isPending}
|
|
||||||
limit={undefined}
|
limit={undefined}
|
||||||
query={undefined}
|
query={undefined}
|
||||||
ref={queryBuilderRef}
|
ref={queryBuilderRef}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import clone from 'lodash/clone';
|
import clone from 'lodash/clone';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
@@ -34,6 +33,7 @@ import { NumberInput } from '/@/shared/components/number-input/number-input';
|
|||||||
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
|
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
|
||||||
import { Select } from '/@/shared/components/select/select';
|
import { Select } from '/@/shared/components/select/select';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import { PlaylistListSort, SongListSort, SortOrder } from '/@/shared/types/domain-types';
|
import { PlaylistListSort, SongListSort, SortOrder } from '/@/shared/types/domain-types';
|
||||||
import { QueryBuilderGroup, QueryBuilderRule } from '/@/shared/types/types';
|
import { QueryBuilderGroup, QueryBuilderRule } from '/@/shared/types/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { useCreatePlaylist } from '/@/renderer/features/playlists/mutations/create-playlist-mutation';
|
import { useCreatePlaylist } from '/@/renderer/features/playlists/mutations/create-playlist-mutation';
|
||||||
@@ -10,6 +9,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
|||||||
import { Switch } from '/@/shared/components/switch/switch';
|
import { Switch } from '/@/shared/components/switch/switch';
|
||||||
import { TextInput } from '/@/shared/components/text-input/text-input';
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import {
|
import {
|
||||||
CreatePlaylistBody,
|
CreatePlaylistBody,
|
||||||
CreatePlaylistResponse,
|
CreatePlaylistResponse,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { closeAllModals, openModal } from '@mantine/modals';
|
import { closeAllModals, openModal } from '@mantine/modals';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
@@ -16,6 +15,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
|||||||
import { Switch } from '/@/shared/components/switch/switch';
|
import { Switch } from '/@/shared/components/switch/switch';
|
||||||
import { TextInput } from '/@/shared/components/text-input/text-input';
|
import { TextInput } from '/@/shared/components/text-input/text-input';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import {
|
import {
|
||||||
PlaylistDetailResponse,
|
PlaylistDetailResponse,
|
||||||
ServerListItem,
|
ServerListItem,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { closeAllModals } from '@mantine/modals';
|
import { closeAllModals } from '@mantine/modals';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import { nanoid } from 'nanoid/non-secure';
|
import { nanoid } from 'nanoid/non-secure';
|
||||||
@@ -21,6 +20,7 @@ import { TextInput } from '/@/shared/components/text-input/text-input';
|
|||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
import { useFocusTrap } from '/@/shared/hooks/use-focus-trap';
|
import { useFocusTrap } from '/@/shared/hooks/use-focus-trap';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types';
|
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types';
|
||||||
import { DiscoveredServerItem, ServerType, toServerType } from '/@/shared/types/types';
|
import { DiscoveredServerItem, ServerType, toServerType } from '/@/shared/types/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { closeAllModals } from '@mantine/modals';
|
import { closeAllModals } from '@mantine/modals';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -18,6 +17,7 @@ import { TextInput } from '/@/shared/components/text-input/text-input';
|
|||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
import { Tooltip } from '/@/shared/components/tooltip/tooltip';
|
import { Tooltip } from '/@/shared/components/tooltip/tooltip';
|
||||||
import { useFocusTrap } from '/@/shared/hooks/use-focus-trap';
|
import { useFocusTrap } from '/@/shared/hooks/use-focus-trap';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
import {
|
import {
|
||||||
AuthenticationResponse,
|
AuthenticationResponse,
|
||||||
ServerListItem,
|
ServerListItem,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useForm } from '@mantine/form';
|
|
||||||
import { closeModal, ContextModalProps } from '@mantine/modals';
|
import { closeModal, ContextModalProps } from '@mantine/modals';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -12,6 +11,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
|||||||
import { Switch } from '/@/shared/components/switch/switch';
|
import { Switch } from '/@/shared/components/switch/switch';
|
||||||
import { Textarea } from '/@/shared/components/textarea/textarea';
|
import { Textarea } from '/@/shared/components/textarea/textarea';
|
||||||
import { toast } from '/@/shared/components/toast/toast';
|
import { toast } from '/@/shared/components/toast/toast';
|
||||||
|
import { useForm } from '/@/shared/hooks/use-form';
|
||||||
|
|
||||||
export const ShareItemContextModal = ({
|
export const ShareItemContextModal = ({
|
||||||
id,
|
id,
|
||||||
|
|||||||
3
src/shared/hooks/use-form.ts
Normal file
3
src/shared/hooks/use-form.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { useForm as useMantineForm } from '@mantine/form';
|
||||||
|
|
||||||
|
export const useForm = useMantineForm;
|
||||||
Reference in New Issue
Block a user