Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

refactor(extension): improved UX + bug fix

daniel31x139528e300bb3e
diff --git a/apps/extension/package.json b/apps/extension/package.json
index 0a1917e2..e8855b81 100644
--- a/apps/extension/package.json
+++ b/apps/extension/package.json
@@ -20,7 +20,6 @@
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.15",
"@radix-ui/react-popover": "^1.1.23",
- "@radix-ui/react-select": "^2.3.7",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-toast": "^1.2.23",
diff --git a/apps/extension/src/@/components/BookmarkForm.tsx b/apps/extension/src/@/components/BookmarkForm.tsx
index 7818257d..d5dbb2ab 100644
--- a/apps/extension/src/@/components/BookmarkForm.tsx
+++ b/apps/extension/src/@/components/BookmarkForm.tsx
@@ -117,6 +117,7 @@ const BookmarkForm = () => {
toast({
title: "Success",
description: "Link saved successfully!",
+ variant: "success",
});
},
});
diff --git a/apps/extension/src/@/components/OptionsForm.tsx b/apps/extension/src/@/components/OptionsForm.tsx
index 3c811c63..a2f80c49 100644
--- a/apps/extension/src/@/components/OptionsForm.tsx
+++ b/apps/extension/src/@/components/OptionsForm.tsx
@@ -26,43 +26,59 @@ import {
isConfigured,
saveConfig,
} from "../lib/config.ts";
+import { configType } from "../lib/validators/config.ts";
import { Toaster } from "./ui/Toaster.tsx";
import { toast } from "../../hooks/useToast.ts";
import { AxiosError } from "axios";
import { clearBookmarksMetadata } from "../lib/cache.ts";
import { getSession } from "../lib/auth/auth.ts";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "./ui/Select.tsx";
+import SelectInput, { SelectOption } from "./SelectInput.tsx";
interface OptionsFormProps {
onSaved?: () => void;
onCleared?: () => void;
+ initialConfig?: configType;
}
+const EMPTY_FORM: optionsFormInput = {
+ baseUrl: "https://cloud.linkwarden.app",
+ method: "username",
+ username: "",
+ password: "",
+ apiKey: "",
+ syncBookmarks: false,
+ defaultCollection: "Unorganized",
+};
+
+const METHOD_OPTIONS: SelectOption[] = [
+ { value: "username", label: "Username and Password" },
+ { value: "apiKey", label: "API Key" },
+];
+
const displayInstance = (baseUrl: string) =>
baseUrl.replace(/^https?:\/\//, "").replace(/\/$/, "");
-const OptionsForm = ({ onSaved, onCleared }: OptionsFormProps) => {
+const signedInInstance = (config: configType | undefined) => {
+ if (config === undefined) return undefined;
+ return config.baseUrl && config.apiKey ? config.baseUrl : null;
+};
+
+const OptionsForm = ({
+ onSaved,
+ onCleared,
+ initialConfig,
+}: OptionsFormProps) => {
+ const initialSignedInTo = signedInInstance(initialConfig);
+
const [signedInTo, setSignedInTo] = useState<string | undefined | null>(
- undefined
+ initialSignedInTo
);
const form = useForm<optionsFormInput, unknown, optionsFormValues>({
resolver: zodResolver(optionsFormSchema),
- defaultValues: {
- baseUrl: "https://cloud.linkwarden.app",
- method: "username",
- username: "",
- password: "",
- apiKey: "",
- syncBookmarks: false,
- defaultCollection: "Unorganized",
- },
+ defaultValues: initialSignedInTo
+ ? { ...EMPTY_FORM, ...initialConfig }
+ : EMPTY_FORM,
});
const { mutate: onSignOut, isPending: signOutLoading } = useMutation({
@@ -183,7 +199,7 @@ const OptionsForm = ({ onSaved, onCleared }: OptionsFormProps) => {
toast({
title: "Saved",
description: "Your settings have been saved.",
- variant: "default",
+ variant: "success",
});
onSaved?.();
@@ -191,17 +207,15 @@ const OptionsForm = ({ onSaved, onCleared }: OptionsFormProps) => {
});
useEffect(() => {
+ if (initialSignedInTo !== undefined) return;
+
(async () => {
- const configured = await isConfigured();
- if (configured) {
- const cachedOptions = await getConfig();
- form.reset(cachedOptions);
- setSignedInTo(cachedOptions.baseUrl);
- } else {
- setSignedInTo(null);
- }
+ const cachedOptions = await getConfig();
+ const instance = signedInInstance(cachedOptions);
+ if (instance) form.reset({ ...EMPTY_FORM, ...cachedOptions });
+ setSignedInTo(instance);
})();
- }, [form]);
+ }, [form, initialSignedInTo]);
const { handleSubmit, control, watch } = form;
const method = watch("method");
@@ -268,19 +282,12 @@ const OptionsForm = ({ onSaved, onCleared }: OptionsFormProps) => {
<FormDescription>
Choose your preferred authentication method.
</FormDescription>
- <FormControl>
- <Select value={field.value} onValueChange={field.onChange}>
- <SelectTrigger className="w-full justify-between bg-neutral-100 dark:bg-neutral-900 outline-none focus:outline-none ring-0 focus:ring-0">
- <SelectValue placeholder="Select authentication method" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="username">
- Username and Password
- </SelectItem>
- <SelectItem value="apiKey">API Key</SelectItem>
- </SelectContent>
- </Select>
- </FormControl>
+ <SelectInput
+ value={field.value ?? ""}
+ onChange={field.onChange}
+ options={METHOD_OPTIONS}
+ placeholder="Select authentication method"
+ />
<FormMessage />
</FormItem>
)}
diff --git a/apps/extension/src/@/components/SelectInput.tsx b/apps/extension/src/@/components/SelectInput.tsx
new file mode 100644
index 00000000..cb584523
--- /dev/null
+++ b/apps/extension/src/@/components/SelectInput.tsx
@@ -0,0 +1,94 @@
+import { useState } from "react";
+import { CaretSortIcon } from "@radix-ui/react-icons";
+import { Check } from "lucide-react";
+import { Button } from "./ui/Button.tsx";
+import { FormControl } from "./ui/Form.tsx";
+import { Popover, PopoverContent, PopoverTrigger } from "./ui/Popover.tsx";
+import { useListboxKeys } from "../../hooks/useListboxKeys.ts";
+
+export type SelectOption = { value: string; label: string };
+
+type Props = {
+ value: string;
+ onChange: (value: string) => void;
+ options: SelectOption[];
+ placeholder?: string;
+};
+
+export default function SelectInput({
+ value,
+ onChange,
+ options,
+ placeholder = "Select...",
+}: Props) {
+ const [open, setOpen] = useState(false);
+
+ const handleSelect = (option: SelectOption) => {
+ onChange(option.value);
+ setOpen(false);
+ };
+
+ const { activeIndex, listId, optionId, handleKeyDown } = useListboxKeys({
+ options,
+ onEnter: (option) => option && handleSelect(option),
+ onClose: () => setOpen(false),
+ });
+
+ const selected = options.find((option) => option.value === value);
+
+ return (
+ <div className="min-w-full">
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <FormControl>
+ <Button
+ variant="outline"
+ aria-haspopup="listbox"
+ aria-expanded={open}
+ className="w-full justify-between bg-neutral-100 dark:bg-neutral-900"
+ >
+ {selected?.label || placeholder}
+ <CaretSortIcon
+ aria-hidden
+ className="ml-2 h-4 w-4 shrink-0 opacity-50"
+ />
+ </Button>
+ </FormControl>
+ </PopoverTrigger>
+
+ {open && (
+ <PopoverContent
+ className="w-[var(--radix-popper-anchor-width)] p-0"
+ onKeyDown={handleKeyDown}
+ >
+ <div
+ id={listId}
+ role="listbox"
+ className="w-full overflow-y-auto p-1 text-foreground"
+ >
+ {options.map((option, index) => (
+ <div
+ key={option.value}
+ id={optionId(index)}
+ role="option"
+ aria-selected={option.value === value}
+ onClick={() => handleSelect(option)}
+ className={`relative flex cursor-pointer select-none items-center justify-between rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground ${
+ index === activeIndex
+ ? "bg-accent text-accent-foreground"
+ : ""
+ }`}
+ >
+ {option.label}
+ {option.value === value && (
+ <Check aria-hidden className="ml-2 h-4 w-4 shrink-0" />
+ )}
+ </div>
+ ))}
+ </div>
+ </PopoverContent>
+ )}
+ </Popover>
+ </div>
+ );
+}
diff --git a/apps/extension/src/@/components/ui/Select.tsx b/apps/extension/src/@/components/ui/Select.tsx
deleted file mode 100644
index d415e8e6..00000000
--- a/apps/extension/src/@/components/ui/Select.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import * as React from 'react';
-import * as SelectPrimitive from '@radix-ui/react-select';
-import { Check, ChevronDown } from 'lucide-react';
-
-import { cn } from '../../lib/utils.ts';
-
-const Select = SelectPrimitive.Root;
-
-const SelectGroup = SelectPrimitive.Group;
-
-const SelectValue = SelectPrimitive.Value;
-
-const SelectTrigger = React.forwardRef<
- React.ElementRef<typeof SelectPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
->(({ className, children, ...props }, ref) => (
- <SelectPrimitive.Trigger
- ref={ref}
- className={cn(
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
- className,
- )}
- {...props}
- >
- {children}
- <SelectPrimitive.Icon asChild>
- <ChevronDown className='h-4 w-4 opacity-50' />
- </SelectPrimitive.Icon>
- </SelectPrimitive.Trigger>
-));
-SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
-
-const SelectContent = React.forwardRef<
- React.ElementRef<typeof SelectPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
->(({ className, children, position = 'popper', ...props }, ref) => (
- <SelectPrimitive.Portal>
- <SelectPrimitive.Content
- ref={ref}
- className={cn(
- 'relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
- position === 'popper' &&
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
- className,
- )}
- position={position}
- {...props}
- >
- <SelectPrimitive.Viewport
- className={cn(
- 'p-1',
- position === 'popper' &&
- 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
- )}
- >
- {children}
- </SelectPrimitive.Viewport>
- </SelectPrimitive.Content>
- </SelectPrimitive.Portal>
-));
-SelectContent.displayName = SelectPrimitive.Content.displayName;
-
-const SelectLabel = React.forwardRef<
- React.ElementRef<typeof SelectPrimitive.Label>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
->(({ className, ...props }, ref) => (
- <SelectPrimitive.Label
- ref={ref}
- className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
- {...props}
- />
-));
-SelectLabel.displayName = SelectPrimitive.Label.displayName;
-
-const SelectItem = React.forwardRef<
- React.ElementRef<typeof SelectPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
->(({ className, children, ...props }, ref) => (
- <SelectPrimitive.Item
- ref={ref}
- className={cn(
- 'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
- className,
- )}
- {...props}
- >
- <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
- <SelectPrimitive.ItemIndicator>
- <Check className='h-4 w-4' />
- </SelectPrimitive.ItemIndicator>
- </span>
-
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
- </SelectPrimitive.Item>
-));
-SelectItem.displayName = SelectPrimitive.Item.displayName;
-
-const SelectSeparator = React.forwardRef<
- React.ElementRef<typeof SelectPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
->(({ className, ...props }, ref) => (
- <SelectPrimitive.Separator
- ref={ref}
- className={cn('-mx-1 my-1 h-px bg-muted', className)}
- {...props}
- />
-));
-SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
-
-export {
- Select,
- SelectGroup,
- SelectValue,
- SelectTrigger,
- SelectContent,
- SelectLabel,
- SelectItem,
- SelectSeparator,
-};
diff --git a/apps/extension/src/@/components/ui/Toast.tsx b/apps/extension/src/@/components/ui/Toast.tsx
index 562487bd..a0e06d6d 100644
--- a/apps/extension/src/@/components/ui/Toast.tsx
+++ b/apps/extension/src/@/components/ui/Toast.tsx
@@ -1,9 +1,9 @@
-import * as React from 'react';
-import * as ToastPrimitives from '@radix-ui/react-toast';
-import { cva, type VariantProps } from 'class-variance-authority';
-import { X } from 'lucide-react';
+import * as React from "react";
+import * as ToastPrimitives from "@radix-ui/react-toast";
+import { cva, type VariantProps } from "class-variance-authority";
+import { X } from "lucide-react";
-import { cn } from '../../lib/utils';
+import { cn } from "../../lib/utils";
const ToastProvider = ToastPrimitives.Provider;
@@ -14,7 +14,7 @@ const ToastViewport = React.forwardRef<
<ToastPrimitives.Viewport
ref={ref}
className={cn(
- 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 mx-auto right-0 left-0 sm:top-auto sm:flex-col md:max-w-[420px]',
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 mx-auto right-0 left-0 sm:top-auto sm:flex-col md:max-w-[420px]",
className
)}
{...props}
@@ -23,17 +23,19 @@ const ToastViewport = React.forwardRef<
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
const toastVariants = cva(
- 'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
{
variants: {
variant: {
- default: 'border bg-background',
+ default: "border bg-background",
destructive:
- 'destructive group border-destructive bg-destructive text-destructive-foreground',
+ "destructive group border-destructive bg-destructive text-destructive-foreground",
+ success:
+ "success group border-green-600/60 bg-background text-foreground",
},
},
defaultVariants: {
- variant: 'default',
+ variant: "default",
},
}
);
@@ -60,7 +62,7 @@ const ToastAction = React.forwardRef<
<ToastPrimitives.Action
ref={ref}
className={cn(
- 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive',
+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
className
)}
{...props}
@@ -75,7 +77,7 @@ const ToastClose = React.forwardRef<
<ToastPrimitives.Close
ref={ref}
className={cn(
- 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
+ "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
className
)}
toast-close=""
@@ -92,7 +94,7 @@ const ToastTitle = React.forwardRef<
>(({ className, ...props }, ref) => (
<ToastPrimitives.Title
ref={ref}
- className={cn('text-sm font-semibold', className)}
+ className={cn("text-sm font-semibold", className)}
{...props}
/>
));
@@ -104,7 +106,7 @@ const ToastDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<ToastPrimitives.Description
ref={ref}
- className={cn('text-sm opacity-90', className)}
+ className={cn("text-sm opacity-90", className)}
{...props}
/>
));
diff --git a/apps/extension/src/@/components/ui/Toaster.tsx b/apps/extension/src/@/components/ui/Toaster.tsx
index 56091b07..bf8c803a 100644
--- a/apps/extension/src/@/components/ui/Toaster.tsx
+++ b/apps/extension/src/@/components/ui/Toaster.tsx
@@ -6,6 +6,7 @@ import {
ToastTitle,
ToastViewport,
} from "../ui/Toast";
+import { CheckCircle2 } from "lucide-react";
import { useToast } from "../../../hooks/useToast";
export function Toaster() {
@@ -13,14 +14,29 @@ export function Toaster() {
return (
<ToastProvider>
- {toasts.map(function ({ id, title, description, action, ...props }) {
+ {toasts.map(function ({
+ id,
+ title,
+ description,
+ action,
+ variant,
+ ...props
+ }) {
return (
- <Toast key={id} {...props}>
- <div className="grid gap-1">
- {title && <ToastTitle>{title}</ToastTitle>}
- {description && (
- <ToastDescription>{description}</ToastDescription>
+ <Toast key={id} variant={variant} {...props}>
+ <div className="flex items-start gap-3">
+ {variant === "success" && (
+ <CheckCircle2
+ aria-hidden
+ className="mt-0.5 h-5 w-5 shrink-0 text-green-600"
+ />
)}
+ <div className="grid gap-1">
+ {title && <ToastTitle>{title}</ToastTitle>}
+ {description && (
+ <ToastDescription>{description}</ToastDescription>
+ )}
+ </div>
</div>
{action}
<ToastClose />
diff --git a/apps/extension/src/hooks/useToast.ts b/apps/extension/src/hooks/useToast.ts
index b15e8e48..2733af54 100644
--- a/apps/extension/src/hooks/useToast.ts
+++ b/apps/extension/src/hooks/useToast.ts
@@ -8,6 +8,8 @@ import type {
const TOAST_LIMIT = 1;
const TOAST_REMOVE_DELAY = 1000000;
+const SUCCESS_TOAST_DURATION = 1000;
+
type ToasterToast = ToastProps & {
id: string;
title?: React.ReactNode;
@@ -150,6 +152,8 @@ function toast({ ...props }: Toast) {
dispatch({
type: "ADD_TOAST",
toast: {
+ duration:
+ props.variant === "success" ? SUCCESS_TOAST_DURATION : undefined,
...props,
id,
open: true,
diff --git a/apps/extension/src/pages/Options/App.tsx b/apps/extension/src/pages/Options/App.tsx
index abbbec46..ad6bb594 100644
--- a/apps/extension/src/pages/Options/App.tsx
+++ b/apps/extension/src/pages/Options/App.tsx
@@ -2,8 +2,9 @@ import WholeContainer from "../../@/components/WholeContainer.tsx";
import Container from "../../@/components/Container.tsx";
import { Separator } from "../../@/components/ui/Separator.tsx";
import OptionsForm from "../../@/components/OptionsForm.tsx";
+import { configType } from "../../@/lib/validators/config.ts";
-const App = () => {
+const App = ({ initialConfig }: { initialConfig: configType }) => {
return (
<WholeContainer className="max-h-[750px]">
<Container>
@@ -13,10 +14,10 @@ const App = () => {
<div>
<Separator />
</div>
- <OptionsForm />
+ <OptionsForm initialConfig={initialConfig} />
</Container>
</WholeContainer>
);
};
-export default App;
+export default App;
\ No newline at end of file
diff --git a/apps/extension/src/pages/Options/Options.tsx b/apps/extension/src/pages/Options/Options.tsx
index 76f8184e..62b0d369 100644
--- a/apps/extension/src/pages/Options/Options.tsx
+++ b/apps/extension/src/pages/Options/Options.tsx
@@ -1,17 +1,21 @@
-import React from 'react';
-import ReactDOM from 'react-dom/client';
-import '../Popup/index.css';
-import App from './App.tsx';
-import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
-import { ThemeProvider } from '../../@/components/ThemeProvider.tsx';
+import React from "react";
+import ReactDOM from "react-dom/client";
+import "../Popup/index.css";
+import App from "./App.tsx";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { ThemeProvider } from "../../@/components/ThemeProvider.tsx";
+import { getConfig } from "../../@/lib/config.ts";
const queryClient = new QueryClient();
-ReactDOM.createRoot(document.getElementById('options')!).render(
- <React.StrictMode>
- <QueryClientProvider client={queryClient}>
- <ThemeProvider defaultTheme="system" storageKey="vite-ui-theme">
- <App />
- </ThemeProvider>
- </QueryClientProvider>
- </React.StrictMode>,
-);
+
+getConfig().then((config) => {
+ ReactDOM.createRoot(document.getElementById("options")!).render(
+ <React.StrictMode>
+ <QueryClientProvider client={queryClient}>
+ <ThemeProvider defaultTheme="system" storageKey="vite-ui-theme">
+ <App initialConfig={config} />
+ </ThemeProvider>
+ </QueryClientProvider>
+ </React.StrictMode>
+ );
+});
diff --git a/yarn.lock b/yarn.lock
index 8e656632..8d5141a1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6008,7 +6008,6 @@ __metadata:
"@radix-ui/react-icons": "npm:^1.3.2"
"@radix-ui/react-label": "npm:^2.1.15"
"@radix-ui/react-popover": "npm:^1.1.23"
- "@radix-ui/react-select": "npm:^2.3.7"
"@radix-ui/react-separator": "npm:^1.1.7"
"@radix-ui/react-slot": "npm:^1.2.3"
"@radix-ui/react-toast": "npm:^1.2.23"
@@ -6781,13 +6780,6 @@ __metadata:
languageName: node
linkType: hard
-"@radix-ui/number@npm:1.1.3":
- version: 1.1.3
- resolution: "@radix-ui/number@npm:1.1.3"
- checksum: 10c0/da682127b62196a617d30d8b085a0b422b067a6155982aa313d33824cbeae16b95547a41ec74e0cf8cb67b30f5f825b3e9222abf6871b2ae0bf12badad4310d6
- languageName: node
- linkType: hard
-
"@radix-ui/primitive@npm:1.1.0":
version: 1.1.0
resolution: "@radix-ui/primitive@npm:1.1.0"
@@ -7145,19 +7137,6 @@ __metadata:
languageName: node
linkType: hard
-"@radix-ui/react-direction@npm:1.1.4":
- version: 1.1.4
- resolution: "@radix-ui/react-direction@npm:1.1.4"
- peerDependencies:
- "@types/react": "*"
- react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- peerDependenciesMeta:
- "@types/react":
- optional: true
- checksum: 10c0/505e6e45b53f2b6a98c82895e1fe0b04c048bf70dbcabe2e3a4bbc05e3cf4759a5e7d9865360eac78da5c56ed3fdd82efce1511179f397525d14de614181de61
- languageName: node
- linkType: hard
-
"@radix-ui/react-dismissable-layer@npm:1.1.1":
version: 1.1.1
resolution: "@radix-ui/react-dismissable-layer@npm:1.1.1"
@@ -7994,46 +7973,6 @@ __metadata:
languageName: node
linkType: hard
-"@radix-ui/react-select@npm:^2.3.7":
- version: 2.3.7
- resolution: "@radix-ui/react-select@npm:2.3.7"
- dependencies:
- "@radix-ui/number": "npm:1.1.3"
- "@radix-ui/primitive": "npm:1.1.7"
- "@radix-ui/react-collection": "npm:1.1.15"
- "@radix-ui/react-compose-refs": "npm:1.1.5"
- "@radix-ui/react-context": "npm:1.2.2"
- "@radix-ui/react-direction": "npm:1.1.4"
- "@radix-ui/react-dismissable-layer": "npm:1.1.19"
- "@radix-ui/react-focus-guards": "npm:1.1.6"
- "@radix-ui/react-focus-scope": "npm:1.1.16"
- "@radix-ui/react-id": "npm:1.1.4"
- "@radix-ui/react-popper": "npm:1.3.7"
- "@radix-ui/react-portal": "npm:1.1.17"
- "@radix-ui/react-presence": "npm:1.1.10"
- "@radix-ui/react-primitive": "npm:2.1.10"
- "@radix-ui/react-slot": "npm:1.3.3"
- "@radix-ui/react-use-callback-ref": "npm:1.1.4"
- "@radix-ui/react-use-controllable-state": "npm:1.2.6"
- "@radix-ui/react-use-layout-effect": "npm:1.1.4"
- "@radix-ui/react-use-previous": "npm:1.1.4"
- "@radix-ui/react-visually-hidden": "npm:1.2.11"
- aria-hidden: "npm:^1.2.4"
- react-remove-scroll: "npm:^2.7.2"
- peerDependencies:
- "@types/react": "*"
- "@types/react-dom": "*"
- react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- peerDependenciesMeta:
- "@types/react":
- optional: true
- "@types/react-dom":
- optional: true
- checksum: 10c0/122316803c98b6c49bc0c2f7207e5d1b129ed886f1d085feee53fb9640550d604ae9328783c2f0837e4f99776adfe728f4296affd4661c2efb12be12a7db4830
- languageName: node
- linkType: hard
-
"@radix-ui/react-separator@npm:^1.1.7":
version: 1.1.7
resolution: "@radix-ui/react-separator@npm:1.1.7"
@@ -8398,19 +8337,6 @@ __metadata:
languageName: node
linkType: hard
-"@radix-ui/react-use-previous@npm:1.1.4":
- version: 1.1.4
- resolution: "@radix-ui/react-use-previous@npm:1.1.4"
- peerDependencies:
- "@types/react": "*"
- react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- peerDependenciesMeta:
- "@types/react":
- optional: true
- checksum: 10c0/e291d635ef2ec1813ad499aa4d14b6da81042831549140e8a71ab982540322a9abbe629ebffb175258b9c60e77fd0736b9b4fe1cd76066912fd5270783030778
- languageName: node
- linkType: hard
-
"@radix-ui/react-use-rect@npm:1.1.1":
version: 1.1.1
resolution: "@radix-ui/react-use-rect@npm:1.1.1"