diff --git a/package-lock.json b/package-lock.json index 0cb81e1..0b781c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "AGPL-3.0", "dependencies": { "@hookform/resolvers": "^3.2.0", + "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", @@ -1059,6 +1060,36 @@ } } }, + "node_modules/@radix-ui/react-checkbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.0.4.tgz", + "integrity": "sha512-CBuGQa52aAYnADZVt/KBQzXrwx6TqnlwtcIPGtVt5JkkzQwMOLJjPukimhfKEr4GQNd43C+djUh5Ikopj8pSLg==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-previous": "1.0.1", + "@radix-ui/react-use-size": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-collection": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz", diff --git a/package.json b/package.json index 7bb97d3..39ba0c0 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "@hookform/resolvers": "^3.2.0", + "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", diff --git a/src/@/components/BookmarkForm.tsx b/src/@/components/BookmarkForm.tsx index 4423364..4c8bea1 100644 --- a/src/@/components/BookmarkForm.tsx +++ b/src/@/components/BookmarkForm.tsx @@ -132,9 +132,9 @@ const BookmarkForm = () => { const { handleSubmit, control } = form; useEffect(() => { - getCurrentTabInfo().then((tabInfo) => { - form.setValue('url', tabInfo.url); - form.setValue('description', tabInfo.title); + getCurrentTabInfo().then(({ url, title }) => { + form.setValue('url', url); + form.setValue('description', title); }); const getConfig = async () => { configured = await isConfigured(); @@ -264,15 +264,15 @@ const BookmarkForm = () => { aria-expanded={openCollections} className={cn( 'w-full justify-between', - !field.value.name && 'text-muted-foreground' + !field.value?.name && 'text-muted-foreground' )} > {loadingCollections ? 'Loading' - : field.value.name + : field.value?.name ? collections.response?.find( - (collection: { name: any }) => - collection.name === field.value.name + (collection: { name: string }) => + collection.name === field.value?.name )?.name || 'Unorganized' : 'Select a collection...'} diff --git a/src/@/components/OptionsForm.tsx b/src/@/components/OptionsForm.tsx index 32e0177..7c0e119 100644 --- a/src/@/components/OptionsForm.tsx +++ b/src/@/components/OptionsForm.tsx @@ -33,6 +33,7 @@ import { getSession, performLoginOrLogout, } from '../lib/auth/auth.ts'; +import { Checkbox } from './ui/CheckBox.tsx'; let HAD_PREVIOUS_SESSION = false; const OptionsForm = () => { @@ -42,6 +43,7 @@ const OptionsForm = () => { baseUrl: '', username: '', password: '', + syncBookmarks: false, }, }); @@ -230,6 +232,25 @@ const OptionsForm = () => { )} /> + ( + + Sync Bookmarks + + Sync your bookmarks with Linkwarden. + + + + + + + )} + />
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} @@ -237,7 +258,7 @@ const OptionsForm = () => {