feat: add a search modal using the database (wip)

This commit is contained in:
Sonny
2024-05-25 03:40:08 +02:00
committed by Sonny
parent b28499a69a
commit 56c05f1bf6
21 changed files with 535 additions and 621 deletions

View File

@@ -105,19 +105,28 @@ function DashboardProviders(
const favoritesContextValue = useMemo(() => ({ favorites }), [favorites]);
const globalHotkeysContextValue = useMemo(
() => ({
globalHotkeysEnabled: globalHotkeysEnabled,
globalHotkeysEnabled,
setGlobalHotkeysEnabled,
}),
[globalHotkeysEnabled]
);
useShortcut('OPEN_CREATE_LINK_KEY', () =>
router.visit(
appendCollectionId(route('link.create-form').url, activeCollection?.id)
)
useShortcut(
'OPEN_CREATE_LINK_KEY',
() =>
router.visit(
appendCollectionId(route('link.create-form').url, activeCollection?.id)
),
{
enabled: globalHotkeysEnabled,
}
);
useShortcut('OPEN_CREATE_COLLECTION_KEY', () =>
router.visit(route('collection.create-form').url)
useShortcut(
'OPEN_CREATE_COLLECTION_KEY',
() => router.visit(route('collection.create-form').url),
{
enabled: globalHotkeysEnabled,
}
);
return (
<CollectionsContext.Provider value={collectionsContextValue}>

View File

@@ -13,7 +13,8 @@ export default function CreateLinkPage({
collections: Collection[];
}) {
const { t } = useTranslation('common');
const collectionId = useSearchParam('collectionId') ?? collections[0].id;
const collectionId =
Number(useSearchParam('collectionId')) ?? collections[0].id;
const { data, setData, submit, processing } = useForm({
name: '',
description: '',