A full-featured CRM built with React, shadcn/ui, and Supabase.
Fix prettier config to avoid formatting issues with shadcn ui
fzaninotto18176e07ace4
diff --git a/.github/workflows/check.yml b/.github/workflows/check.ymlindex 64646e55..bb494c08 100644--- a/.github/workflows/check.yml+++ b/.github/workflows/check.yml@@ -43,7 +43,7 @@ jobs:eslint: trueeslint_args: "**/*.{mjs,ts,tsx}"prettier: true- prettier_args: "--config ./.prettierrc.mjs \"**/*.{js,json,ts,tsx,css,md,html}\""+ prettier_args: "--config ./.prettierrc.json \"**/*.{js,json,ts,tsx,css,md,html}\""test:name: 🔎 Testdiff --git a/.prettierrc.json b/.prettierrc.jsonnew file mode 100644index 00000000..93b8e06a--- /dev/null+++ b/.prettierrc.json@@ -0,0 +1,21 @@+{+ "overrides": [+ {+ "files": ["*.md", "*.mdx"],+ "options": {+ "singleQuote": true,+ "tabWidth": 4+ }+ },+ {+ "files": ["src/components/ui/*.tsx"],+ "options": {+ "endOfLine": "lf",+ "semi": false,+ "singleQuote": false,+ "tabWidth": 2,+ "trailingComma": "es5"+ }+ }+ ]+}diff --git a/.prettierrc.mjs b/.prettierrc.mjsdeleted file mode 100644index ff8b4c56..00000000--- a/.prettierrc.mjs+++ /dev/null@@ -1 +0,0 @@-export default {};diff --git a/makefile b/makefileindex 12c581ca..49381e71 100644--- a/makefile+++ b/makefile@@ -94,4 +94,4 @@ registry-deploy: registry-build ## Deploy the shadcn registry (Automatically donregistry-gen: ## Generate the shadcn registry (ran automatically by a pre-commit hook)npm run registry:gen- npx prettier --config ./.prettierrc.mjs --write "registry.json"+ npx prettier --config ./.prettierrc.json --write "registry.json"diff --git a/package.json b/package.jsonindex c972433b..295b9d1b 100644--- a/package.json+++ b/package.json@@ -11,8 +11,8 @@"preview": "vite preview","lint:apply": "eslint **/*.{mjs,ts,tsx} --fix","lint:check": "eslint **/*.{mjs,ts,tsx}",- "prettier:apply": "prettier --config ./.prettierrc.mjs --write --list-different \"**/*.{js,json,ts,tsx,css,md,html}\"",- "prettier:check": "prettier --config ./.prettierrc.mjs --check \"**/*.{js,json,ts,tsx,css,md,html}\"",+ "prettier:apply": "prettier --config ./.prettierrc.json --write --list-different \"**/*.{js,json,ts,tsx,css,md,html}\"",+ "prettier:check": "prettier --config ./.prettierrc.json --check \"**/*.{js,json,ts,tsx,css,md,html}\"","registry:build": "npx shadcn build","registry:gen": "node ./scripts/generate-registry.mjs","ghpages:deploy": "node ./scripts/ghpages-deploy.mjs",diff --git a/scripts/supabase-remote-init.mjs b/scripts/supabase-remote-init.mjsindex 1f198df9..1f3ebb94 100644--- a/scripts/supabase-remote-init.mjs+++ b/scripts/supabase-remote-init.mjs@@ -1,228 +1,225 @@-import { input } from '@inquirer/prompts';-import { execa } from 'execa';-import fs from 'node:fs';+import { input } from "@inquirer/prompts";+import { execa } from "execa";+import fs from "node:fs";(async () => {- await loginToSupabase();- const projectName = await input({- message: 'Enter the name of the project:',- default: 'Atomic CRM',- });- const databasePassword = await input({- message: 'Enter a database password:',- default: generatePassword(16),- });-- const projectRef = await createProject({ projectName, databasePassword });- await waitForProjectToBeReady({ projectRef });-- // This also ensures the project is ready- const { anonKey } = await fetchApiKeys({- projectRef,- });-- await linkProject({- projectRef,- databasePassword,- });-- await setupDatabase({- databasePassword,- });-- await persistSupabaseEnv({- projectRef,- anonKey,- });+ await loginToSupabase();+ const projectName = await input({+ message: "Enter the name of the project:",+ default: "Atomic CRM",+ });+ const databasePassword = await input({+ message: "Enter a database password:",+ default: generatePassword(16),+ });++ const projectRef = await createProject({ projectName, databasePassword });+ await waitForProjectToBeReady({ projectRef });++ // This also ensures the project is ready+ const { anonKey } = await fetchApiKeys({+ projectRef,+ });++ await linkProject({+ projectRef,+ databasePassword,+ });++ await setupDatabase({+ databasePassword,+ });++ await persistSupabaseEnv({+ projectRef,+ anonKey,+ });})();async function loginToSupabase() {- await execa('npx', ['supabase', 'login'], { stdio: 'inherit' });+ await execa("npx", ["supabase", "login"], { stdio: "inherit" });}async function createProject({ projectName, databasePassword }) {- const { stdout } = await execa(- 'npx',- [- 'supabase',- 'projects',- 'create',- '--interactive',- '--output',- 'json',- '--db-password',- databasePassword,- projectName,- ],- {- stdin: 'inherit',- stdout: ['inherit', 'pipe'],- }- );-- try {- const matchJSON = stdout.match(new RegExp('{.*}', 's'));- if (!matchJSON) {- throw new Error('Invalid JSON output');- }- const jsonOuput = JSON.parse(matchJSON[0]);- return jsonOuput.id;- } catch (e) {- console.error('Failed to create project');- console.error(e);- throw e;+ const { stdout } = await execa(+ "npx",+ [+ "supabase",+ "projects",+ "create",+ "--interactive",+ "--output",+ "json",+ "--db-password",+ databasePassword,+ projectName,+ ],+ {+ stdin: "inherit",+ stdout: ["inherit", "pipe"],+ },+ );++ try {+ const matchJSON = stdout.match(new RegExp("{.*}", "s"));+ if (!matchJSON) {+ throw new Error("Invalid JSON output");}+ const jsonOuput = JSON.parse(matchJSON[0]);+ return jsonOuput.id;+ } catch (e) {+ console.error("Failed to create project");+ console.error(e);+ throw e;+ }}async function waitForProjectToBeReady({ projectRef }) {- console.log('Waiting for project to be ready...');- const { stdout } = await execa(- 'npx',- ['supabase', 'projects', 'list', '--output', 'json'],- {- stdout: 'pipe',- }- );-- try {- // The response is an Array of objects- const matchJSON = stdout.match(new RegExp('\\[.*\\]', 's'));- if (!matchJSON) {- throw new Error('Invalid JSON output');- }- const jsonOuput = JSON.parse(matchJSON[0]);- const project = jsonOuput.find(project => project.id === projectRef);- if (project.status !== 'ACTIVE_HEALTHY') {- await sleep(1000);- return waitForProjectToBeReady({ projectRef });- }- } catch (e) {- console.error('Failed to create project');- console.error(e);- throw e;+ console.log("Waiting for project to be ready...");+ const { stdout } = await execa(+ "npx",+ ["supabase", "projects", "list", "--output", "json"],+ {+ stdout: "pipe",+ },+ );++ try {+ // The response is an Array of objects+ const matchJSON = stdout.match(new RegExp("\\[.*\\]", "s"));+ if (!matchJSON) {+ throw new Error("Invalid JSON output");+ }+ const jsonOuput = JSON.parse(matchJSON[0]);+ const project = jsonOuput.find((project) => project.id === projectRef);+ if (project.status !== "ACTIVE_HEALTHY") {+ await sleep(1000);+ return waitForProjectToBeReady({ projectRef });}+ } catch (e) {+ console.error("Failed to create project");+ console.error(e);+ throw e;+ }}let retry = 0;async function linkProject({ projectRef, databasePassword }) {- await execa(- 'npx',- [- 'supabase',- 'link',- '--project-ref',- projectRef,- '--password',- databasePassword,- ],- {- stdout: 'ignore',- stderr: 'ignore',- }- ).catch(() => {- retry++;- if (retry === 1) {- console.log('Waiting for project to be ready...');- }- return sleep(1000).then(() =>- linkProject({ projectRef, databasePassword })- );- });+ await execa(+ "npx",+ [+ "supabase",+ "link",+ "--project-ref",+ projectRef,+ "--password",+ databasePassword,+ ],+ {+ stdout: "ignore",+ stderr: "ignore",+ },+ ).catch(() => {+ retry++;+ if (retry === 1) {+ console.log("Waiting for project to be ready...");+ }+ return sleep(1000).then(() =>+ linkProject({ projectRef, databasePassword }),+ );+ });}async function setupDatabase({ databasePassword }) {- await execa(- 'npx',- [- 'supabase',- 'db',- 'push',- '--linked',- '--include-roles',- '--password',- databasePassword,- ],- {- stdio: 'inherit',- }- );+ await execa(+ "npx",+ [+ "supabase",+ "db",+ "push",+ "--linked",+ "--include-roles",+ "--password",+ databasePassword,+ ],+ {+ stdio: "inherit",+ },+ );}async function fetchApiKeys({ projectRef }) {- let anonKey = '';- try {- const { stdout, exitCode } = await execa(- 'npx',- [- 'supabase',- 'projects',- 'api-keys',- '--output',- 'json',- '--project-ref',- projectRef,- ],- {- stdout: 'pipe',- stderr: 'ignore',- }- );- // If the exitCode is not 0, the command failed most probably because the project is not ready- if (exitCode === 0) {- // The response is an Array of objects- const matchJSON = stdout.match(new RegExp('\\[.*\\]', 's'));- if (!matchJSON) {- throw new Error('Invalid JSON output');- }- const jsonOuput = JSON.parse(matchJSON[0]);- anonKey = jsonOuput.find(key => key.name === 'anon')?.api_key;- }- } catch (e) {- console.error('Failed to fetch API keys');- console.error(e);- throw e;- }-- if (anonKey === '') {- await sleep(1000);- return fetchApiKeys({ projectRef });+ let anonKey = "";+ try {+ const { stdout, exitCode } = await execa(+ "npx",+ [+ "supabase",+ "projects",+ "api-keys",+ "--output",+ "json",+ "--project-ref",+ projectRef,+ ],+ {+ stdout: "pipe",+ stderr: "ignore",+ },+ );+ // If the exitCode is not 0, the command failed most probably because the project is not ready+ if (exitCode === 0) {+ // The response is an Array of objects+ const matchJSON = stdout.match(new RegExp("\\[.*\\]", "s"));+ if (!matchJSON) {+ throw new Error("Invalid JSON output");+ }+ const jsonOuput = JSON.parse(matchJSON[0]);+ anonKey = jsonOuput.find((key) => key.name === "anon")?.api_key;}-- return { anonKey };+ } catch (e) {+ console.error("Failed to fetch API keys");+ console.error(e);+ throw e;+ }++ if (anonKey === "") {+ await sleep(1000);+ return fetchApiKeys({ projectRef });+ }++ return { anonKey };}async function persistSupabaseEnv({ projectRef, anonKey }) {- fs.writeFileSync(- `${process.cwd()}/.env.production.local`,- `+ fs.writeFileSync(+ `${process.cwd()}/.env.production.local`,+ `VITE_SUPABASE_URL=https://${projectRef}.supabase.coVITE_SUPABASE_ANON_KEY=${anonKey}`,- { flag: 'a' }- );+ { flag: "a" },+ );}function generatePassword(length) {- const password = crypto- // eslint-disable-next-line no-undef- .getRandomValues(new BigUint64Array(4))- .reduce(- (prev, curr, index) =>- (!index ? prev : prev.toString(36)) +- (index % 2- ? curr.toString(36).toUpperCase()- : curr.toString(36))- )- .split('')- .sort(() => 128 - crypto.getRandomValues(new Uint8Array(1))[0])- .join('');-- if (length) {- return password.slice(0, length);- }-- return password;+ const password = crypto+ .getRandomValues(new BigUint64Array(4))+ .reduce(+ (prev, curr, index) =>+ (!index ? prev : prev.toString(36)) ++ (index % 2 ? curr.toString(36).toUpperCase() : curr.toString(36)),+ )+ .split("")+ .sort(() => 128 - crypto.getRandomValues(new Uint8Array(1))[0])+ .join("");++ if (length) {+ return password.slice(0, length);+ }++ return password;}function sleep(ms) {- return new Promise(resolve => setTimeout(resolve, ms));+ return new Promise((resolve) => setTimeout(resolve, ms));}diff --git a/src/components/admin/field-toggle.tsx b/src/components/admin/field-toggle.tsxindex 216791cd..eb7d7549 100644--- a/src/components/admin/field-toggle.tsx+++ b/src/components/admin/field-toggle.tsx@@ -22,7 +22,7 @@ export const FieldToggle = (props: FieldToggleProps) => {const handleDragStart = () => {document.addEventListener("dragover",- handleDocumentDragOver as EventListener+ handleDocumentDragOver as EventListener,);};@@ -36,7 +36,7 @@ export const FieldToggle = (props: FieldToggleProps) => {}const elementAtDragCoordinates = document.elementFromPoint(x.current,- y.current+ y.current,);let dropItem =elementAtDragCoordinates === null@@ -104,7 +104,7 @@ export const FieldToggle = (props: FieldToggleProps) => {selectedItem.dataset.dragActive = "false";document.removeEventListener("dragover",- handleDocumentDragOver as EventListener+ handleDocumentDragOver as EventListener,);};@@ -125,7 +125,7 @@ export const FieldToggle = (props: FieldToggleProps) => {data-index={index}className={cn("flex justify-between items-center py-1",- "data-[drag-active=true]:bg-transparent data-[drag-active=true]:text-transparent data-[drag-active=true]:outline data-[drag-active=true]:outline-1 data-[drag-active=true]:outline-border"+ "data-[drag-active=true]:bg-transparent data-[drag-active=true]:text-transparent data-[drag-active=true]:outline data-[drag-active=true]:outline-1 data-[drag-active=true]:outline-border",)}><label@@ -155,7 +155,7 @@ export interface FieldToggleProps {onToggle?: (event: boolean) => void;onMove?: (dragIndex: string | number,- dropIndex: string | number | null+ dropIndex: string | number | null,) => void;source: string;index: number | string;diff --git a/src/components/admin/list-pagination.tsx b/src/components/admin/list-pagination.tsxindex da1794b6..d2a537ef 100644--- a/src/components/admin/list-pagination.tsx+++ b/src/components/admin/list-pagination.tsx@@ -49,7 +49,7 @@ export const ListPagination = ({const startPages = range(1, Math.min(boundaryCount, count));const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1),- count+ count,);const siblingsStart = Math.max(@@ -57,10 +57,10 @@ export const ListPagination = ({// Natural startpage - siblingCount,// Lower boundary when page is high- count - boundaryCount - siblingCount * 2 - 1+ count - boundaryCount - siblingCount * 2 - 1,),// Greater than startPages- boundaryCount + 2+ boundaryCount + 2,);const siblingsEnd = Math.min(@@ -68,10 +68,10 @@ export const ListPagination = ({// Natural endpage + siblingCount,// Upper boundary when page is low- boundaryCount + siblingCount * 2 + 2+ boundaryCount + siblingCount * 2 + 2,),// Less than endPages- count - boundaryCount - 1+ count - boundaryCount - 1,);const siblingPages = range(siblingsStart, siblingsEnd);@@ -133,7 +133,7 @@ export const ListPagination = ({onClick={pageChangeHandler(page - 1)}className={cn("gap-1 px-2.5 sm:pr-2.5",- !hasPreviousPage ? "opacity-50 cursor-not-allowed" : ""+ !hasPreviousPage ? "opacity-50 cursor-not-allowed" : "",)}aria-label={translate("ra.navigation.previous", {_: "Previous",@@ -212,7 +212,7 @@ export const ListPagination = ({size="default"className={cn("gap-1 px-2.5 sm:pr-2.5",- !hasNextPage ? "opacity-50 cursor-not-allowed" : ""+ !hasNextPage ? "opacity-50 cursor-not-allowed" : "",)}aria-label={translate("ra.navigation.next", { _: "Next" })}>diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsxindex e0a67c23..54446e18 100644--- a/src/components/ui/avatar.tsx+++ b/src/components/ui/avatar.tsx@@ -1,7 +1,7 @@-import * as React from "react";-import * as AvatarPrimitive from "@radix-ui/react-avatar";+import * as React from "react"+import * as AvatarPrimitive from "@radix-ui/react-avatar"-import { cn } from "@/lib/utils";+import { cn } from "@/lib/utils"function Avatar({className,@@ -12,11 +12,11 @@ function Avatar({data-slot="avatar"className={cn("relative flex size-8 shrink-0 overflow-hidden rounded-full",- className,+ className)}{...props}/>- );+ )}function AvatarImage({@@ -29,19 +29,19 @@ function AvatarImage({className={cn("aspect-square size-full", className)}{...props}/>- );+ )}/*** Simple hash function to generate a number from a string*/function hashString(str: string): number {- let hash = 0;+ let hash = 0for (let i = 0; i < str.length; i++) {- hash = (hash << 5) - hash + str.charCodeAt(i);- hash = hash & hash;+ hash = (hash << 5) - hash + str.charCodeAt(i)+ hash = hash & hash}- return Math.abs(hash);+ return Math.abs(hash)}const colorClasses = [@@ -55,25 +55,25 @@ const colorClasses = ["bg-[color:var(--avatar-7)]","bg-[color:var(--avatar-8)]","bg-[color:var(--avatar-9)]",-];+]function getAvatarColorClass(children: React.ReactNode): string {// Extract text content from children- let childText: string | undefined;+ let childText: string | undefinedif (typeof children === "string") {- childText = children;+ childText = children} else if (Array.isArray(children)) {// Handle array of children (e.g., multiple text nodes)- childText = children.filter((child) => typeof child === "string").join("");+ childText = children.filter((child) => typeof child === "string").join("")} else if (React.isValidElement(children) &&typeof (children.props as any).children === "string") {- childText = (children.props as any).children;+ childText = (children.props as any).children}- if (!childText) return "bg-muted text-muted-foreground";+ if (!childText) return "bg-muted text-muted-foreground"- return colorClasses[hashString(childText) % colorClasses.length];+ return colorClasses[hashString(childText) % colorClasses.length]}function AvatarFallback({@@ -87,13 +87,13 @@ function AvatarFallback({className={cn("flex size-full items-center justify-center rounded-full",className,- getAvatarColorClass(children),+ getAvatarColorClass(children))}{...props}>{children}</AvatarPrimitive.Fallback>- );+ )}-export { Avatar, AvatarImage, AvatarFallback };+export { Avatar, AvatarImage, AvatarFallback }diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsxindex 83750ed1..02054139 100644--- a/src/components/ui/badge.tsx+++ b/src/components/ui/badge.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 badgeVariants = cva("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",@@ -23,7 +23,7 @@ const badgeVariants = cva(variant: "default",},}-);+)function Badge({className,@@ -32,7 +32,7 @@ function Badge({...props}: React.ComponentProps<"span"> &VariantProps<typeof badgeVariants> & { asChild?: boolean }) {- const Comp = asChild ? Slot : "span";+ const Comp = asChild ? Slot : "span"return (<Comp@@ -40,7 +40,7 @@ function Badge({className={cn(badgeVariants({ variant }), className)}{...props}/>- );+ )}-export { Badge, badgeVariants };+export { Badge, badgeVariants }diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsxindex 66ab90e5..a2df8dce 100644--- a/src/components/ui/button.tsx+++ b/src/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 gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",@@ -33,7 +33,7 @@ const buttonVariants = cva(size: "default",},}-);+)function Button({className,@@ -43,9 +43,9 @@ function Button({...props}: React.ComponentProps<"button"> &VariantProps<typeof buttonVariants> & {- asChild?: boolean;+ asChild?: boolean}) {- const Comp = asChild ? Slot : "button";+ const Comp = asChild ? Slot : "button"return (<Comp@@ -53,7 +53,7 @@ function Button({className={cn(buttonVariants({ variant, size, className }))}{...props}/>- );+ )}-export { Button, buttonVariants };+export { Button, buttonVariants }diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsxindex abb84216..32f46430 100644--- a/src/components/ui/card.tsx+++ b/src/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"function Card({ className, ...props }: React.ComponentProps<"div">) {return (@@ -8,11 +8,11 @@ function Card({ className, ...props }: React.ComponentProps<"div">) {data-slot="card"className={cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6",- className,+ className)}{...props}/>- );+ )}function CardHeader({ className, ...props }: React.ComponentProps<"div">) {@@ -21,11 +21,11 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {data-slot="card-header"className={cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",- className,+ className)}{...props}/>- );+ )}function CardTitle({ className, ...props }: React.ComponentProps<"div">) {@@ -35,7 +35,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {className={cn("leading-none font-semibold", className)}{...props}/>- );+ )}function CardDescription({ className, ...props }: React.ComponentProps<"div">) {@@ -45,7 +45,7 @@ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {className={cn("text-muted-foreground text-sm", className)}{...props}/>- );+ )}function CardAction({ className, ...props }: React.ComponentProps<"div">) {@@ -54,11 +54,11 @@ function CardAction({ className, ...props }: React.ComponentProps<"div">) {data-slot="card-action"className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",- className,+ className)}{...props}/>- );+ )}function CardContent({ className, ...props }: React.ComponentProps<"div">) {@@ -68,7 +68,7 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {className={cn("px-6", className)}{...props}/>- );+ )}function CardFooter({ className, ...props }: React.ComponentProps<"div">) {@@ -78,7 +78,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {className={cn("flex items-center px-6 [.border-t]:pt-6", className)}{...props}/>- );+ )}export {@@ -89,4 +89,4 @@ export {CardAction,CardDescription,CardContent,-};+}diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsxindex 62311821..5b899d89 100644--- a/src/components/ui/label.tsx+++ b/src/components/ui/label.tsx@@ -1,9 +1,9 @@-"use client";+"use client"-import * as React from "react";-import * as LabelPrimitive from "@radix-ui/react-label";+import * as React from "react"+import * as LabelPrimitive from "@radix-ui/react-label"-import { cn } from "@/lib/utils";+import { cn } from "@/lib/utils"function Label({className,@@ -14,11 +14,11 @@ function Label({data-slot="label"className={cn("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",- className,+ className)}{...props}/>- );+ )}-export { Label };+export { Label }diff --git a/src/components/ui/progress.tsx b/src/components/ui/progress.tsxindex d683666e..10af7e63 100644--- a/src/components/ui/progress.tsx+++ b/src/components/ui/progress.tsx@@ -1,7 +1,7 @@-import * as React from "react";-import * as ProgressPrimitive from "@radix-ui/react-progress";+import * as React from "react"+import * as ProgressPrimitive from "@radix-ui/react-progress"-import { cn } from "@/lib/utils";+import { cn } from "@/lib/utils"function Progress({className,@@ -13,7 +13,7 @@ function Progress({data-slot="progress"className={cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",- className,+ className)}{...props}>@@ -23,7 +23,7 @@ function Progress({style={{ transform: `translateX(-${100 - (value || 0)}%)` }}/></ProgressPrimitive.Root>- );+ )}-export { Progress };+export { Progress }diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsxindex 4fd907c0..22393149 100644--- a/src/components/ui/sidebar.tsx+++ b/src/components/ui/sidebar.tsx@@ -1,54 +1,54 @@-import * as React from "react";-import { Slot } from "@radix-ui/react-slot";-import { VariantProps, cva } from "class-variance-authority";-import { PanelLeftIcon } from "lucide-react";--import { useIsMobile } from "@/hooks/use-mobile";-import { cn } from "@/lib/utils";-import { Button } from "@/components/ui/button";-import { Input } from "@/components/ui/input";-import { Separator } from "@/components/ui/separator";+import * as React from "react"+import { Slot } from "@radix-ui/react-slot"+import { VariantProps, cva } from "class-variance-authority"+import { PanelLeftIcon } from "lucide-react"++import { useIsMobile } from "@/hooks/use-mobile"+import { cn } from "@/lib/utils"+import { Button } from "@/components/ui/button"+import { Input } from "@/components/ui/input"+import { Separator } from "@/components/ui/separator"import {Sheet,SheetContent,SheetDescription,SheetHeader,SheetTitle,-} from "@/components/ui/sheet";-import { Skeleton } from "@/components/ui/skeleton";+} from "@/components/ui/sheet"+import { Skeleton } from "@/components/ui/skeleton"import {Tooltip,TooltipContent,TooltipProvider,TooltipTrigger,-} from "@/components/ui/tooltip";+} from "@/components/ui/tooltip"-const SIDEBAR_COOKIE_NAME = "sidebar_state";-const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;-const SIDEBAR_WIDTH = "16rem";-const SIDEBAR_WIDTH_MOBILE = "18rem";-const SIDEBAR_WIDTH_ICON = "3rem";-const SIDEBAR_KEYBOARD_SHORTCUT = "b";+const SIDEBAR_COOKIE_NAME = "sidebar_state"+const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7+const SIDEBAR_WIDTH = "16rem"+const SIDEBAR_WIDTH_MOBILE = "18rem"+const SIDEBAR_WIDTH_ICON = "3rem"+const SIDEBAR_KEYBOARD_SHORTCUT = "b"type SidebarContextProps = {- state: "expanded" | "collapsed";- open: boolean;- setOpen: (open: boolean) => void;- openMobile: boolean;- setOpenMobile: (open: boolean) => void;- isMobile: boolean;- toggleSidebar: () => void;-};+ state: "expanded" | "collapsed"+ open: boolean+ setOpen: (open: boolean) => void+ openMobile: boolean+ setOpenMobile: (open: boolean) => void+ isMobile: boolean+ toggleSidebar: () => void+}-const SidebarContext = React.createContext<SidebarContextProps | null>(null);+const SidebarContext = React.createContext<SidebarContextProps | null>(null)function useSidebar() {- const context = React.useContext(SidebarContext);+ const context = React.useContext(SidebarContext)if (!context) {- throw new Error("useSidebar must be used within a SidebarProvider.");+ throw new Error("useSidebar must be used within a SidebarProvider.")}- return context;+ return context}function SidebarProvider({@@ -60,36 +60,36 @@ function SidebarProvider({children,...props}: React.ComponentProps<"div"> & {- defaultOpen?: boolean;- open?: boolean;- onOpenChange?: (open: boolean) => void;+ defaultOpen?: boolean+ open?: boolean+ onOpenChange?: (open: boolean) => void}) {- const isMobile = useIsMobile();- const [openMobile, setOpenMobile] = React.useState(false);+ const isMobile = useIsMobile()+ const [openMobile, setOpenMobile] = React.useState(false)// This is the internal state of the sidebar.// We use openProp and setOpenProp for control from outside the component.- const [_open, _setOpen] = React.useState(defaultOpen);- const open = openProp ?? _open;+ const [_open, _setOpen] = React.useState(defaultOpen)+ const open = openProp ?? _openconst setOpen = React.useCallback((value: boolean | ((value: boolean) => boolean)) => {- const openState = typeof value === "function" ? value(open) : value;+ const openState = typeof value === "function" ? value(open) : valueif (setOpenProp) {- setOpenProp(openState);+ setOpenProp(openState)} else {- _setOpen(openState);+ _setOpen(openState)}// This sets the cookie to keep the sidebar state.- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`},[setOpenProp, open]- );+ )// Helper to toggle the sidebar.const toggleSidebar = React.useCallback(() => {- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);- }, [isMobile, setOpen, setOpenMobile]);+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)+ }, [isMobile, setOpen, setOpenMobile])// Adds a keyboard shortcut to toggle the sidebar.React.useEffect(() => {@@ -98,18 +98,18 @@ function SidebarProvider({event.key === SIDEBAR_KEYBOARD_SHORTCUT &&(event.metaKey || event.ctrlKey)) {- event.preventDefault();- toggleSidebar();+ event.preventDefault()+ toggleSidebar()}- };+ }- window.addEventListener("keydown", handleKeyDown);- return () => window.removeEventListener("keydown", handleKeyDown);- }, [toggleSidebar]);+ window.addEventListener("keydown", handleKeyDown)+ return () => window.removeEventListener("keydown", handleKeyDown)+ }, [toggleSidebar])// We add a state so that we can do data-state="expanded" or "collapsed".// This makes it easier to style the sidebar with Tailwind classes.- const state = open ? "expanded" : "collapsed";+ const state = open ? "expanded" : "collapsed"const contextValue = React.useMemo<SidebarContextProps>(() => ({@@ -122,7 +122,7 @@ function SidebarProvider({toggleSidebar,}),[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]- );+ )return (<SidebarContext.Provider value={contextValue}>@@ -146,7 +146,7 @@ function SidebarProvider({</div></TooltipProvider></SidebarContext.Provider>- );+ )}function Sidebar({@@ -157,11 +157,11 @@ function Sidebar({children,...props}: React.ComponentProps<"div"> & {- side?: "left" | "right";- variant?: "sidebar" | "floating" | "inset";- collapsible?: "offcanvas" | "icon" | "none";+ side?: "left" | "right"+ variant?: "sidebar" | "floating" | "inset"+ collapsible?: "offcanvas" | "icon" | "none"}) {- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()if (collapsible === "none") {return (@@ -175,7 +175,7 @@ function Sidebar({>{children}</div>- );+ )}if (isMobile) {@@ -200,7 +200,7 @@ function Sidebar({<div className="flex h-full w-full flex-col">{children}</div></SheetContent></Sheet>- );+ )}return (@@ -248,7 +248,7 @@ function Sidebar({</div></div></div>- );+ )}function SidebarTrigger({@@ -256,7 +256,7 @@ function SidebarTrigger({onClick,...props}: React.ComponentProps<typeof Button>) {- const { toggleSidebar } = useSidebar();+ const { toggleSidebar } = useSidebar()return (<Button@@ -266,19 +266,19 @@ function SidebarTrigger({size="icon"className={cn("size-7", className)}onClick={(event) => {- onClick?.(event);- toggleSidebar();+ onClick?.(event)+ toggleSidebar()}}{...props}><PanelLeftIcon /><span className="sr-only">Toggle Sidebar</span></Button>- );+ )}function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {- const { toggleSidebar } = useSidebar();+ const { toggleSidebar } = useSidebar()return (<button@@ -299,7 +299,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {)}{...props}/>- );+ )}function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {@@ -313,7 +313,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {)}{...props}/>- );+ )}function SidebarInput({@@ -327,7 +327,7 @@ function SidebarInput({className={cn("bg-background h-8 w-full shadow-none", className)}{...props}/>- );+ )}function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {@@ -338,7 +338,7 @@ function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {className={cn("flex flex-col gap-2 p-2", className)}{...props}/>- );+ )}function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {@@ -349,7 +349,7 @@ function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {className={cn("flex flex-col gap-2 p-2", className)}{...props}/>- );+ )}function SidebarSeparator({@@ -363,7 +363,7 @@ function SidebarSeparator({className={cn("bg-sidebar-border mx-2 w-auto", className)}{...props}/>- );+ )}function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {@@ -377,7 +377,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {)}{...props}/>- );+ )}function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {@@ -388,7 +388,7 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {className={cn("relative flex w-full min-w-0 flex-col p-2", className)}{...props}/>- );+ )}function SidebarGroupLabel({@@ -396,7 +396,7 @@ function SidebarGroupLabel({asChild = false,...props}: React.ComponentProps<"div"> & { asChild?: boolean }) {- const Comp = asChild ? Slot : "div";+ const Comp = asChild ? Slot : "div"return (<Comp@@ -409,7 +409,7 @@ function SidebarGroupLabel({)}{...props}/>- );+ )}function SidebarGroupAction({@@ -417,7 +417,7 @@ function SidebarGroupAction({asChild = false,...props}: React.ComponentProps<"button"> & { asChild?: boolean }) {- const Comp = asChild ? Slot : "button";+ const Comp = asChild ? Slot : "button"return (<Comp@@ -432,7 +432,7 @@ function SidebarGroupAction({)}{...props}/>- );+ )}function SidebarGroupContent({@@ -446,7 +446,7 @@ function SidebarGroupContent({className={cn("w-full text-sm", className)}{...props}/>- );+ )}function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {@@ -457,7 +457,7 @@ function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {className={cn("flex w-full min-w-0 flex-col gap-1", className)}{...props}/>- );+ )}function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {@@ -468,7 +468,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {className={cn("group/menu-item relative", className)}{...props}/>- );+ )}const sidebarMenuButtonVariants = cva(@@ -491,7 +491,7 @@ const sidebarMenuButtonVariants = cva(size: "default",},}-);+)function SidebarMenuButton({asChild = false,@@ -502,12 +502,12 @@ function SidebarMenuButton({className,...props}: React.ComponentProps<"button"> & {- asChild?: boolean;- isActive?: boolean;- tooltip?: string | React.ComponentProps<typeof TooltipContent>;+ asChild?: boolean+ isActive?: boolean+ tooltip?: string | React.ComponentProps<typeof TooltipContent>} & VariantProps<typeof sidebarMenuButtonVariants>) {- const Comp = asChild ? Slot : "button";- const { isMobile, state } = useSidebar();+ const Comp = asChild ? Slot : "button"+ const { isMobile, state } = useSidebar()const button = (<Comp@@ -518,16 +518,16 @@ function SidebarMenuButton({className={cn(sidebarMenuButtonVariants({ variant, size }), className)}{...props}/>- );+ )if (!tooltip) {- return button;+ return button}if (typeof tooltip === "string") {tooltip = {children: tooltip,- };+ }}return (@@ -540,7 +540,7 @@ function SidebarMenuButton({{...tooltip}/></Tooltip>- );+ )}function SidebarMenuAction({@@ -549,10 +549,10 @@ function SidebarMenuAction({showOnHover = false,...props}: React.ComponentProps<"button"> & {- asChild?: boolean;- showOnHover?: boolean;+ asChild?: boolean+ showOnHover?: boolean}) {- const Comp = asChild ? Slot : "button";+ const Comp = asChild ? Slot : "button"return (<Comp@@ -572,7 +572,7 @@ function SidebarMenuAction({)}{...props}/>- );+ )}function SidebarMenuBadge({@@ -594,7 +594,7 @@ function SidebarMenuBadge({)}{...props}/>- );+ )}function SidebarMenuSkeleton({@@ -602,12 +602,12 @@ function SidebarMenuSkeleton({showIcon = false,...props}: React.ComponentProps<"div"> & {- showIcon?: boolean;+ showIcon?: boolean}) {// Random width between 50 to 90%.const width = React.useMemo(() => {- return `${Math.floor(Math.random() * 40) + 50}%`;- }, []);+ return `${Math.floor(Math.random() * 40) + 50}%`+ }, [])return (<div@@ -632,7 +632,7 @@ function SidebarMenuSkeleton({}/></div>- );+ )}function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {@@ -647,7 +647,7 @@ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {)}{...props}/>- );+ )}function SidebarMenuSubItem({@@ -661,7 +661,7 @@ function SidebarMenuSubItem({className={cn("group/menu-sub-item relative", className)}{...props}/>- );+ )}function SidebarMenuSubButton({@@ -671,11 +671,11 @@ function SidebarMenuSubButton({className,...props}: React.ComponentProps<"a"> & {- asChild?: boolean;- size?: "sm" | "md";- isActive?: boolean;+ asChild?: boolean+ size?: "sm" | "md"+ isActive?: boolean}) {- const Comp = asChild ? Slot : "a";+ const Comp = asChild ? Slot : "a"return (<Comp@@ -693,7 +693,7 @@ function SidebarMenuSubButton({)}{...props}/>- );+ )}export {@@ -721,4 +721,4 @@ export {SidebarSeparator,SidebarTrigger,useSidebar,-};+}diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsxindex 5d848ac8..5421f304 100644--- a/src/components/ui/sonner.tsx+++ b/src/components/ui/sonner.tsx@@ -1,9 +1,9 @@-import { useTheme } from "next-themes";-import type { ToasterProps } from "sonner";-import { Toaster as Sonner } from "sonner";+import { useTheme } from "next-themes"+import type { ToasterProps } from "sonner"+import { Toaster as Sonner } from "sonner"const Toaster = ({ ...props }: ToasterProps) => {- const { theme = "system" } = useTheme();+ const { theme = "system" } = useTheme()return (<Sonner@@ -18,7 +18,7 @@ const Toaster = ({ ...props }: ToasterProps) => {}{...props}/>- );-};+ )+}-export { Toaster };+export { Toaster }diff --git a/src/components/ui/spinner.tsx b/src/components/ui/spinner.tsxindex 00dea5f4..d2c0e604 100644--- a/src/components/ui/spinner.tsx+++ b/src/components/ui/spinner.tsx@@ -1,8 +1,8 @@-import { cn } from "@/lib/utils";-import type { VariantProps } from "class-variance-authority";-import { cva } from "class-variance-authority";-import { Loader2 } from "lucide-react";-import React from "react";+import { cn } from "@/lib/utils"+import type { VariantProps } from "class-variance-authority"+import { cva } from "class-variance-authority"+import { Loader2 } from "lucide-react"+import React from "react"const spinnerVariants = cva("flex-col items-center justify-center", {variants: {@@ -14,7 +14,7 @@ const spinnerVariants = cva("flex-col items-center justify-center", {defaultVariants: {show: true,},-});+})const loaderVariants = cva("animate-spin text-primary", {variants: {@@ -27,13 +27,13 @@ const loaderVariants = cva("animate-spin text-primary", {defaultVariants: {size: "medium",},-});+})interface SpinnerContentPropsextends VariantProps<typeof spinnerVariants>,VariantProps<typeof loaderVariants> {- className?: string;- children?: React.ReactNode;+ className?: string+ children?: React.ReactNode}export function Spinner({@@ -47,5 +47,5 @@ export function Spinner({<Loader2 className={cn(loaderVariants({ size }), className)} />{children}</span>- );+ )}diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsxindex 46295c2f..3d6f3acf 100644--- a/src/components/ui/tabs.tsx+++ b/src/components/ui/tabs.tsx@@ -1,7 +1,7 @@-import * as React from "react";-import * as TabsPrimitive from "@radix-ui/react-tabs";+import * as React from "react"+import * as TabsPrimitive from "@radix-ui/react-tabs"-import { cn } from "@/lib/utils";+import { cn } from "@/lib/utils"function Tabs({className,@@ -13,7 +13,7 @@ function Tabs({className={cn("flex flex-col gap-2", className)}{...props}/>- );+ )}function TabsList({@@ -25,11 +25,11 @@ function TabsList({data-slot="tabs-list"className={cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",- className,+ className)}{...props}/>- );+ )}function TabsTrigger({@@ -41,11 +41,11 @@ function TabsTrigger({data-slot="tabs-trigger"className={cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",- className,+ className)}{...props}/>- );+ )}function TabsContent({@@ -58,7 +58,7 @@ function TabsContent({className={cn("flex-1 outline-none", className)}{...props}/>- );+ )}-export { Tabs, TabsList, TabsTrigger, TabsContent };+export { Tabs, TabsList, TabsTrigger, TabsContent }diff --git a/src/hooks/use-mobile.ts b/src/hooks/use-mobile.tsindex 48fab93c..a93d5839 100644--- a/src/hooks/use-mobile.ts+++ b/src/hooks/use-mobile.ts@@ -4,7 +4,7 @@ const MOBILE_BREAKPOINT = 768;export function useIsMobile() {const [isMobile, setIsMobile] = React.useState<boolean | undefined>(- undefined+ undefined,);React.useEffect(() => {