A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
[style] Fixing formatting
MohamedBassemb12b964e0617
diff --git a/bun.lockb b/bun.lockbindex 641526b8..4ebd8a9b 100755Binary files a/bun.lockb and b/bun.lockb differdiff --git a/web/components/ui/button.tsx b/web/components/ui/button.tsxindex 0ba42773..57c9fe47 100644--- a/web/components/ui/button.tsx+++ b/web/components/ui/button.tsx@@ -1,8 +1,8 @@-import * as React from "react"-import { Slot } from "@radix-ui/react-slot"-import { cva, type VariantProps } from "class-variance-authority"+import * as React from "react";+import { Slot } from "@radix-ui/react-slot";+import { cva, type VariantProps } from "class-variance-authority";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";const buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",@@ -30,27 +30,27 @@ const buttonVariants = cva(variant: "default",size: "default",},- }-)+ },+);export interface ButtonPropsextends React.ButtonHTMLAttributes<HTMLButtonElement>,VariantProps<typeof buttonVariants> {- asChild?: boolean+ asChild?: boolean;}const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(({ className, variant, size, asChild = false, ...props }, ref) => {- const Comp = asChild ? Slot : "button"+ const Comp = asChild ? Slot : "button";return (<CompclassName={cn(buttonVariants({ variant, size, className }))}ref={ref}{...props}/>- )- }-)-Button.displayName = "Button"+ );+ },+);+Button.displayName = "Button";-export { Button, buttonVariants }+export { Button, buttonVariants };diff --git a/web/components/ui/card.tsx b/web/components/ui/card.tsxindex afa13ecf..dc3b01de 100644--- a/web/components/ui/card.tsx+++ b/web/components/ui/card.tsx@@ -1,6 +1,6 @@-import * as React from "react"+import * as React from "react";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";const Card = React.forwardRef<HTMLDivElement,@@ -10,12 +10,12 @@ const Card = React.forwardRef<ref={ref}className={cn("rounded-lg border bg-card text-card-foreground shadow-sm",- className+ className,)}{...props}/>-))-Card.displayName = "Card"+));+Card.displayName = "Card";const CardHeader = React.forwardRef<HTMLDivElement,@@ -26,8 +26,8 @@ const CardHeader = React.forwardRef<className={cn("flex flex-col space-y-1.5 p-6", className)}{...props}/>-))-CardHeader.displayName = "CardHeader"+));+CardHeader.displayName = "CardHeader";const CardTitle = React.forwardRef<HTMLParagraphElement,@@ -37,12 +37,12 @@ const CardTitle = React.forwardRef<ref={ref}className={cn("text-2xl font-semibold leading-none tracking-tight",- className+ className,)}{...props}/>-))-CardTitle.displayName = "CardTitle"+));+CardTitle.displayName = "CardTitle";const CardDescription = React.forwardRef<HTMLParagraphElement,@@ -53,16 +53,16 @@ const CardDescription = React.forwardRef<className={cn("text-sm text-muted-foreground", className)}{...props}/>-))-CardDescription.displayName = "CardDescription"+));+CardDescription.displayName = "CardDescription";const CardContent = React.forwardRef<HTMLDivElement,React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />-))-CardContent.displayName = "CardContent"+));+CardContent.displayName = "CardContent";const CardFooter = React.forwardRef<HTMLDivElement,@@ -73,7 +73,14 @@ const CardFooter = React.forwardRef<className={cn("flex items-center p-6 pt-0", className)}{...props}/>-))-CardFooter.displayName = "CardFooter"+));+CardFooter.displayName = "CardFooter";-export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }+export {+ Card,+ CardHeader,+ CardFooter,+ CardTitle,+ CardDescription,+ CardContent,+};diff --git a/web/components/ui/dropdown-menu.tsx b/web/components/ui/dropdown-menu.tsxindex f69a0d64..3a0c7fed 100644--- a/web/components/ui/dropdown-menu.tsx+++ b/web/components/ui/dropdown-menu.tsx@@ -1,27 +1,27 @@-"use client"+"use client";-import * as React from "react"-import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"-import { Check, ChevronRight, Circle } from "lucide-react"+import * as React from "react";+import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";+import { Check, ChevronRight, Circle } from "lucide-react";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";-const DropdownMenu = DropdownMenuPrimitive.Root+const DropdownMenu = DropdownMenuPrimitive.Root;-const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger+const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;-const DropdownMenuGroup = DropdownMenuPrimitive.Group+const DropdownMenuGroup = DropdownMenuPrimitive.Group;-const DropdownMenuPortal = DropdownMenuPrimitive.Portal+const DropdownMenuPortal = DropdownMenuPrimitive.Portal;-const DropdownMenuSub = DropdownMenuPrimitive.Sub+const DropdownMenuSub = DropdownMenuPrimitive.Sub;-const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup+const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;const DropdownMenuSubTrigger = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {- inset?: boolean+ inset?: boolean;}>(({ className, inset, children, ...props }, ref) => (<DropdownMenuPrimitive.SubTrigger@@ -29,16 +29,16 @@ const DropdownMenuSubTrigger = React.forwardRef<className={cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",inset && "pl-8",- className+ className,)}{...props}>{children}<ChevronRight className="ml-auto h-4 w-4" /></DropdownMenuPrimitive.SubTrigger>-))+));DropdownMenuSubTrigger.displayName =- DropdownMenuPrimitive.SubTrigger.displayName+ DropdownMenuPrimitive.SubTrigger.displayName;const DropdownMenuSubContent = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,@@ -48,13 +48,13 @@ const DropdownMenuSubContent = React.forwardRef<ref={ref}className={cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",- className+ className,)}{...props}/>-))+));DropdownMenuSubContent.displayName =- DropdownMenuPrimitive.SubContent.displayName+ DropdownMenuPrimitive.SubContent.displayName;const DropdownMenuContent = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.Content>,@@ -66,18 +66,18 @@ const DropdownMenuContent = React.forwardRef<sideOffset={sideOffset}className={cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",- className+ className,)}{...props}/></DropdownMenuPrimitive.Portal>-))-DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName+));+DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;const DropdownMenuItem = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.Item>,React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {- inset?: boolean+ inset?: boolean;}>(({ className, inset, ...props }, ref) => (<DropdownMenuPrimitive.Item@@ -85,12 +85,12 @@ const DropdownMenuItem = React.forwardRef<className={cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",inset && "pl-8",- className+ className,)}{...props}/>-))-DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName+));+DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;const DropdownMenuCheckboxItem = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,@@ -100,7 +100,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<ref={ref}className={cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",- className+ className,)}checked={checked}{...props}@@ -112,9 +112,9 @@ const DropdownMenuCheckboxItem = React.forwardRef<</span>{children}</DropdownMenuPrimitive.CheckboxItem>-))+));DropdownMenuCheckboxItem.displayName =- DropdownMenuPrimitive.CheckboxItem.displayName+ DropdownMenuPrimitive.CheckboxItem.displayName;const DropdownMenuRadioItem = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,@@ -124,7 +124,7 @@ const DropdownMenuRadioItem = React.forwardRef<ref={ref}className={cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",- className+ className,)}{...props}>@@ -135,13 +135,13 @@ const DropdownMenuRadioItem = React.forwardRef<</span>{children}</DropdownMenuPrimitive.RadioItem>-))-DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName+));+DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;const DropdownMenuLabel = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.Label>,React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {- inset?: boolean+ inset?: boolean;}>(({ className, inset, ...props }, ref) => (<DropdownMenuPrimitive.Label@@ -149,12 +149,12 @@ const DropdownMenuLabel = React.forwardRef<className={cn("px-2 py-1.5 text-sm font-semibold",inset && "pl-8",- className+ className,)}{...props}/>-))-DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName+));+DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;const DropdownMenuSeparator = React.forwardRef<React.ElementRef<typeof DropdownMenuPrimitive.Separator>,@@ -165,8 +165,8 @@ const DropdownMenuSeparator = React.forwardRef<className={cn("-mx-1 my-1 h-px bg-muted", className)}{...props}/>-))-DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName+));+DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;const DropdownMenuShortcut = ({className,@@ -177,9 +177,9 @@ const DropdownMenuShortcut = ({className={cn("ml-auto text-xs tracking-widest opacity-60", className)}{...props}/>- )-}-DropdownMenuShortcut.displayName = "DropdownMenuShortcut"+ );+};+DropdownMenuShortcut.displayName = "DropdownMenuShortcut";export {DropdownMenu,@@ -197,4 +197,4 @@ export {DropdownMenuSubContent,DropdownMenuSubTrigger,DropdownMenuRadioGroup,-}+};diff --git a/web/components/ui/input.tsx b/web/components/ui/input.tsxindex 677d05fd..9d631e7f 100644--- a/web/components/ui/input.tsx+++ b/web/components/ui/input.tsx@@ -1,6 +1,6 @@-import * as React from "react"+import * as React from "react";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";export interface InputPropsextends React.InputHTMLAttributes<HTMLInputElement> {}@@ -12,14 +12,14 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(type={type}className={cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",- className+ className,)}ref={ref}{...props}/>- )- }-)-Input.displayName = "Input"+ );+ },+);+Input.displayName = "Input";-export { Input }+export { Input };diff --git a/web/components/ui/toast.tsx b/web/components/ui/toast.tsxindex a8224775..2bc23c1f 100644--- a/web/components/ui/toast.tsx+++ b/web/components/ui/toast.tsx@@ -1,11 +1,11 @@-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+const ToastProvider = ToastPrimitives.Provider;const ToastViewport = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Viewport>,@@ -15,12 +15,12 @@ const ToastViewport = React.forwardRef<ref={ref}className={cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",- className+ className,)}{...props}/>-))-ToastViewport.displayName = ToastPrimitives.Viewport.displayName+));+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",@@ -35,8 +35,8 @@ const toastVariants = cva(defaultVariants: {variant: "default",},- }-)+ },+);const Toast = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Root>,@@ -49,9 +49,9 @@ const Toast = React.forwardRef<className={cn(toastVariants({ variant }), className)}{...props}/>- )-})-Toast.displayName = ToastPrimitives.Root.displayName+ );+});+Toast.displayName = ToastPrimitives.Root.displayName;const ToastAction = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Action>,@@ -61,12 +61,12 @@ const ToastAction = React.forwardRef<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",- className+ className,)}{...props}/>-))-ToastAction.displayName = ToastPrimitives.Action.displayName+));+ToastAction.displayName = ToastPrimitives.Action.displayName;const ToastClose = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Close>,@@ -76,15 +76,15 @@ const ToastClose = React.forwardRef<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",- className+ className,)}toast-close=""{...props}><X className="h-4 w-4" /></ToastPrimitives.Close>-))-ToastClose.displayName = ToastPrimitives.Close.displayName+));+ToastClose.displayName = ToastPrimitives.Close.displayName;const ToastTitle = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Title>,@@ -95,8 +95,8 @@ const ToastTitle = React.forwardRef<className={cn("text-sm font-semibold", className)}{...props}/>-))-ToastTitle.displayName = ToastPrimitives.Title.displayName+));+ToastTitle.displayName = ToastPrimitives.Title.displayName;const ToastDescription = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Description>,@@ -107,12 +107,12 @@ const ToastDescription = React.forwardRef<className={cn("text-sm opacity-90", className)}{...props}/>-))-ToastDescription.displayName = ToastPrimitives.Description.displayName+));+ToastDescription.displayName = ToastPrimitives.Description.displayName;-type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>+type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;-type ToastActionElement = React.ReactElement<typeof ToastAction>+type ToastActionElement = React.ReactElement<typeof ToastAction>;export {type ToastProps,@@ -124,4 +124,4 @@ export {ToastDescription,ToastClose,ToastAction,-}+};diff --git a/web/components/ui/toaster.tsx b/web/components/ui/toaster.tsxindex e2233852..7d82ed55 100644--- a/web/components/ui/toaster.tsx+++ b/web/components/ui/toaster.tsx@@ -1,4 +1,4 @@-"use client"+"use client";import {Toast,@@ -7,11 +7,11 @@ import {ToastProvider,ToastTitle,ToastViewport,-} from "@/components/ui/toast"-import { useToast } from "@/components/ui/use-toast"+} from "@/components/ui/toast";+import { useToast } from "@/components/ui/use-toast";export function Toaster() {- const { toasts } = useToast()+ const { toasts } = useToast();return (<ToastProvider>@@ -27,9 +27,9 @@ export function Toaster() {{action}<ToastClose /></Toast>- )+ );})}<ToastViewport /></ToastProvider>- )+ );}diff --git a/web/components/ui/use-toast.ts b/web/components/ui/use-toast.tsindex 16713070..5491e140 100644--- a/web/components/ui/use-toast.ts+++ b/web/components/ui/use-toast.ts@@ -1,76 +1,73 @@// Inspired by react-hot-toast library-import * as React from "react"+import * as React from "react";-import type {- ToastActionElement,- ToastProps,-} from "@/components/ui/toast"+import type { ToastActionElement, ToastProps } from "@/components/ui/toast";-const TOAST_LIMIT = 1-const TOAST_REMOVE_DELAY = 1000000+const TOAST_LIMIT = 1;+const TOAST_REMOVE_DELAY = 1000000;type ToasterToast = ToastProps & {- id: string- title?: React.ReactNode- description?: React.ReactNode- action?: ToastActionElement-}+ id: string;+ title?: React.ReactNode;+ description?: React.ReactNode;+ action?: ToastActionElement;+};const actionTypes = {ADD_TOAST: "ADD_TOAST",UPDATE_TOAST: "UPDATE_TOAST",DISMISS_TOAST: "DISMISS_TOAST",REMOVE_TOAST: "REMOVE_TOAST",-} as const+} as const;-let count = 0+let count = 0;function genId() {- count = (count + 1) % Number.MAX_SAFE_INTEGER- return count.toString()+ count = (count + 1) % Number.MAX_SAFE_INTEGER;+ return count.toString();}-type ActionType = typeof actionTypes+type ActionType = typeof actionTypes;type Action =| {- type: ActionType["ADD_TOAST"]- toast: ToasterToast+ type: ActionType["ADD_TOAST"];+ toast: ToasterToast;}| {- type: ActionType["UPDATE_TOAST"]- toast: Partial<ToasterToast>+ type: ActionType["UPDATE_TOAST"];+ toast: Partial<ToasterToast>;}| {- type: ActionType["DISMISS_TOAST"]- toastId?: ToasterToast["id"]+ type: ActionType["DISMISS_TOAST"];+ toastId?: ToasterToast["id"];}| {- type: ActionType["REMOVE_TOAST"]- toastId?: ToasterToast["id"]- }+ type: ActionType["REMOVE_TOAST"];+ toastId?: ToasterToast["id"];+ };interface State {- toasts: ToasterToast[]+ toasts: ToasterToast[];}-const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()+const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();const addToRemoveQueue = (toastId: string) => {if (toastTimeouts.has(toastId)) {- return+ return;}const timeout = setTimeout(() => {- toastTimeouts.delete(toastId)+ toastTimeouts.delete(toastId);dispatch({type: "REMOVE_TOAST",toastId: toastId,- })- }, TOAST_REMOVE_DELAY)+ });+ }, TOAST_REMOVE_DELAY);- toastTimeouts.set(toastId, timeout)-}+ toastTimeouts.set(toastId, timeout);+};export const reducer = (state: State, action: Action): State => {switch (action.type) {@@ -78,27 +75,27 @@ export const reducer = (state: State, action: Action): State => {return {...state,toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),- }+ };case "UPDATE_TOAST":return {...state,toasts: state.toasts.map((t) =>- t.id === action.toast.id ? { ...t, ...action.toast } : t+ t.id === action.toast.id ? { ...t, ...action.toast } : t,),- }+ };case "DISMISS_TOAST": {- const { toastId } = action+ const { toastId } = action;// ! Side effects ! - This could be extracted into a dismissToast() action,// but I'll keep it here for simplicityif (toastId) {- addToRemoveQueue(toastId)+ addToRemoveQueue(toastId);} else {state.toasts.forEach((toast) => {- addToRemoveQueue(toast.id)- })+ addToRemoveQueue(toast.id);+ });}return {@@ -109,46 +106,46 @@ export const reducer = (state: State, action: Action): State => {...t,open: false,}- : t+ : t,),- }+ };}case "REMOVE_TOAST":if (action.toastId === undefined) {return {...state,toasts: [],- }+ };}return {...state,toasts: state.toasts.filter((t) => t.id !== action.toastId),- }+ };}-}+};-const listeners: Array<(state: State) => void> = []+const listeners: Array<(_state: State) => void> = [];-let memoryState: State = { toasts: [] }+let memoryState: State = { toasts: [] };function dispatch(action: Action) {- memoryState = reducer(memoryState, action)+ memoryState = reducer(memoryState, action);listeners.forEach((listener) => {- listener(memoryState)- })+ listener(memoryState);+ });}-type Toast = Omit<ToasterToast, "id">+type Toast = Omit<ToasterToast, "id">;function toast({ ...props }: Toast) {- const id = genId()+ const id = genId();const update = (props: ToasterToast) =>dispatch({type: "UPDATE_TOAST",toast: { ...props, id },- })- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })+ });+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });dispatch({type: "ADD_TOAST",@@ -157,36 +154,36 @@ function toast({ ...props }: Toast) {id,open: true,onOpenChange: (open) => {- if (!open) dismiss()+ if (!open) dismiss();},},- })+ });return {id: id,dismiss,update,- }+ };}function useToast() {- const [state, setState] = React.useState<State>(memoryState)+ const [state, setState] = React.useState<State>(memoryState);React.useEffect(() => {- listeners.push(setState)+ listeners.push(setState);return () => {- const index = listeners.indexOf(setState)+ const index = listeners.indexOf(setState);if (index > -1) {- listeners.splice(index, 1)+ listeners.splice(index, 1);}- }- }, [state])+ };+ }, [state]);return {...state,toast,dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),- }+ };}-export { useToast, toast }+export { useToast, toast };diff --git a/web/lib/api.ts b/web/lib/api.tsindex 12ce9464..2304826b 100644--- a/web/lib/api.ts+++ b/web/lib/api.ts@@ -35,8 +35,8 @@ async function doRequest<T>(opts?: RequestInit,): Promise<| (InputSchema<T> extends ZodTypeAny- ? [z.infer<InputSchema<T>>, undefined]- : [undefined, undefined])+ ? [z.infer<InputSchema<T>>, undefined]+ : [undefined, undefined])| [undefined, FetchError]> {try {