diff options
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/web/app/dashboard/bookmarks/components/LinkCard.tsx | 6 | ||||
| -rw-r--r-- | packages/web/app/dashboard/components/Sidebar.tsx | 2 | ||||
| -rwxr-xr-x | packages/web/bun.lockb | bin | 158558 -> 0 bytes | |||
| -rw-r--r-- | packages/web/components/ui/form.tsx | 101 | ||||
| -rw-r--r-- | packages/web/components/ui/label.tsx | 20 | ||||
| -rw-r--r-- | packages/workers/index.ts | 9 | ||||
| -rw-r--r-- | packages/workers/package.json | 11 |
7 files changed, 83 insertions, 66 deletions
diff --git a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx index da59d9da..b5a051e8 100644 --- a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx +++ b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx @@ -76,7 +76,11 @@ export default function LinkCard({ link }: { link: ZBookmarkedLink }) { </ImageCardTitle> <ImageCardBody className="py-2 overflow-clip"> {link.tags.map((t) => ( - <Badge variant="default" className="bg-gray-300 text-gray-500" key={t.id}> + <Badge + variant="default" + className="bg-gray-300 text-gray-500" + key={t.id} + > #{t.name} </Badge> ))} diff --git a/packages/web/app/dashboard/components/Sidebar.tsx b/packages/web/app/dashboard/components/Sidebar.tsx index 0ed87daf..f2ead71a 100644 --- a/packages/web/app/dashboard/components/Sidebar.tsx +++ b/packages/web/app/dashboard/components/Sidebar.tsx @@ -1,6 +1,6 @@ import { Button } from "@/components/ui/button"; import { authOptions } from "@/lib/auth"; -import { Archive, MoreHorizontal, Star, Tag, Home, Brain} from "lucide-react"; +import { Archive, MoreHorizontal, Star, Tag, Home, Brain } from "lucide-react"; import { getServerSession } from "next-auth"; import Link from "next/link"; import { redirect } from "next/navigation"; diff --git a/packages/web/bun.lockb b/packages/web/bun.lockb Binary files differdeleted file mode 100755 index 7925e942..00000000 --- a/packages/web/bun.lockb +++ /dev/null diff --git a/packages/web/components/ui/form.tsx b/packages/web/components/ui/form.tsx index 4603f8b3..497718a9 100644 --- a/packages/web/components/ui/form.tsx +++ b/packages/web/components/ui/form.tsx @@ -1,6 +1,6 @@ -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { Slot } from "@radix-ui/react-slot" +import * as React from "react"; +import * as LabelPrimitive from "@radix-ui/react-label"; +import { Slot } from "@radix-ui/react-slot"; import { Controller, ControllerProps, @@ -8,27 +8,27 @@ import { FieldValues, FormProvider, useFormContext, -} from "react-hook-form" +} from "react-hook-form"; -import { cn } from "@/lib/utils" -import { Label } from "@/components/ui/label" +import { cn } from "@/lib/utils"; +import { Label } from "@/components/ui/label"; -const Form = FormProvider +const Form = FormProvider; type FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues> + TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, > = { - name: TName -} + name: TName; +}; const FormFieldContext = React.createContext<FormFieldContextValue>( - {} as FormFieldContextValue -) + {} as FormFieldContextValue, +); const FormField = < TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues> + TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, >({ ...props }: ControllerProps<TFieldValues, TName>) => { @@ -36,21 +36,21 @@ const FormField = < <FormFieldContext.Provider value={{ name: props.name }}> <Controller {...props} /> </FormFieldContext.Provider> - ) -} + ); +}; const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() + const fieldContext = React.useContext(FormFieldContext); + const itemContext = React.useContext(FormItemContext); + const { getFieldState, formState } = useFormContext(); - const fieldState = getFieldState(fieldContext.name, formState) + const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { - throw new Error("useFormField should be used within <FormField>") + throw new Error("useFormField should be used within <FormField>"); } - const { id } = itemContext + const { id } = itemContext; return { id, @@ -59,36 +59,36 @@ const useFormField = () => { formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, - } -} + }; +}; type FormItemContextValue = { - id: string -} + id: string; +}; const FormItemContext = React.createContext<FormItemContextValue>( - {} as FormItemContextValue -) + {} as FormItemContextValue, +); const FormItem = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> >(({ className, ...props }, ref) => { - const id = React.useId() + const id = React.useId(); return ( <FormItemContext.Provider value={{ id }}> <div ref={ref} className={cn("space-y-2", className)} {...props} /> </FormItemContext.Provider> - ) -}) -FormItem.displayName = "FormItem" + ); +}); +FormItem.displayName = "FormItem"; const FormLabel = React.forwardRef< React.ElementRef<typeof LabelPrimitive.Root>, React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> >(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField() + const { error, formItemId } = useFormField(); return ( <Label @@ -97,15 +97,16 @@ const FormLabel = React.forwardRef< htmlFor={formItemId} {...props} /> - ) -}) -FormLabel.displayName = "FormLabel" + ); +}); +FormLabel.displayName = "FormLabel"; const FormControl = React.forwardRef< React.ElementRef<typeof Slot>, React.ComponentPropsWithoutRef<typeof Slot> >(({ ...props }, ref) => { - const { error, formItemId, formDescriptionId, formMessageId } = useFormField() + const { error, formItemId, formDescriptionId, formMessageId } = + useFormField(); return ( <Slot @@ -119,15 +120,15 @@ const FormControl = React.forwardRef< aria-invalid={!!error} {...props} /> - ) -}) -FormControl.displayName = "FormControl" + ); +}); +FormControl.displayName = "FormControl"; const FormDescription = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement> >(({ className, ...props }, ref) => { - const { formDescriptionId } = useFormField() + const { formDescriptionId } = useFormField(); return ( <p @@ -136,19 +137,19 @@ const FormDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> - ) -}) -FormDescription.displayName = "FormDescription" + ); +}); +FormDescription.displayName = "FormDescription"; const FormMessage = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement> >(({ className, children, ...props }, ref) => { - const { error, formMessageId } = useFormField() - const body = error ? String(error?.message) : children + const { error, formMessageId } = useFormField(); + const body = error ? String(error?.message) : children; if (!body) { - return null + return null; } return ( @@ -160,9 +161,9 @@ const FormMessage = React.forwardRef< > {body} </p> - ) -}) -FormMessage.displayName = "FormMessage" + ); +}); +FormMessage.displayName = "FormMessage"; export { useFormField, @@ -173,4 +174,4 @@ export { FormDescription, FormMessage, FormField, -} +}; diff --git a/packages/web/components/ui/label.tsx b/packages/web/components/ui/label.tsx index 53418217..84f8b0c7 100644 --- a/packages/web/components/ui/label.tsx +++ b/packages/web/components/ui/label.tsx @@ -1,14 +1,14 @@ -"use client" +"use client"; -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react"; +import * as LabelPrimitive from "@radix-ui/react-label"; +import { cva, type VariantProps } from "class-variance-authority"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const labelVariants = cva( - "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" -) + "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", +); const Label = React.forwardRef< React.ElementRef<typeof LabelPrimitive.Root>, @@ -20,7 +20,7 @@ const Label = React.forwardRef< className={cn(labelVariants(), className)} {...props} /> -)) -Label.displayName = LabelPrimitive.Root.displayName +)); +Label.displayName = LabelPrimitive.Root.displayName; -export { Label } +export { Label }; diff --git a/packages/workers/index.ts b/packages/workers/index.ts index bf092953..d16c42eb 100644 --- a/packages/workers/index.ts +++ b/packages/workers/index.ts @@ -1,5 +1,7 @@ import { Worker } from "bullmq"; +import dotenv from "dotenv"; + import { LinkCrawlerQueue, OpenAIQueue, @@ -55,4 +57,9 @@ function openaiWorker() { return worker; } -await Promise.all([crawlerWorker().run(), openaiWorker().run()]); +async function main() { + dotenv.config(); + await Promise.all([crawlerWorker().run(), openaiWorker().run()]); +} + +main(); diff --git a/packages/workers/package.json b/packages/workers/package.json index e1407912..c9ec1a10 100644 --- a/packages/workers/package.json +++ b/packages/workers/package.json @@ -4,17 +4,22 @@ "version": "0.1.0", "private": true, "dependencies": { - "@remember/shared": "workspace:packages/*", + "@remember/shared": "0.1.0", + "dotenv": "^16.4.1", "metascraper": "^5.43.4", "metascraper-description": "^5.43.4", "metascraper-image": "^5.43.4", "metascraper-logo": "^5.43.4", + "metascraper-logo-favicon": "^5.43.4", "metascraper-title": "^5.43.4", "metascraper-url": "^5.43.4", - "metascraper-logo-favicon": "^5.43.4", "openai": "^4.26.1" }, "devDependencies": { - "@types/metascraper": "^5.14.3" + "@types/metascraper": "^5.14.3", + "ts-node": "^10.9.2" + }, + "scripts": { + "start": "ts-node index.ts" } } |
