diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/navbar.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/api-navbar.tsx similarity index 100% rename from apps/web/app/(authenticated)/(app)/app/[apiId]/navbar.tsx rename to apps/web/app/(authenticated)/(app)/app/[apiId]/api-navbar.tsx diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/CreateKey.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/create-key.tsx similarity index 98% rename from apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/CreateKey.tsx rename to apps/web/app/(authenticated)/(app)/app/[apiId]/create-key.tsx index b50f5cff11..7bd897e496 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/CreateKey.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/create-key.tsx @@ -9,8 +9,8 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/Form"; -import { Loading } from "@/components/loading"; +} from "@/components/ui/form"; +import { Loading } from "@/components/dashboard/loading"; import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; import { @@ -20,18 +20,17 @@ import { AccordionTrigger, } from "@/components/ui/accordion"; import { Input } from "@/components/ui/input"; -import { CopyButton } from "@/components/CopyButton"; +import { CopyButton } from "@/components/dashboard/copy-button"; import { trpc } from "@/lib/trpc/client"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { useState } from "react"; -import { VisibleButton } from "@/components/VisibleButton"; +import { VisibleButton } from "@/components/dashboard/visible-button"; import Link from "next/link"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { AlertCircle } from "lucide-react"; import { Code } from "@/components/ui/code"; -import { Card, CardContent } from "@/components/ui/card"; import { Textarea } from "@/components/ui/textarea"; const formSchema = z.object({ diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/DeleteApi.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/delete-api-button.tsx similarity index 96% rename from apps/web/app/(authenticated)/(app)/app/[apiId]/DeleteApi.tsx rename to apps/web/app/(authenticated)/(app)/app/[apiId]/delete-api-button.tsx index a5c851516c..9d4359294d 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/DeleteApi.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/delete-api-button.tsx @@ -3,7 +3,7 @@ import { useToast } from "@/components/ui/use-toast"; import { useRouter } from "next/navigation"; -import { Loading } from "@/components/loading"; +import { Loading } from "../../../../../components/dashboard/loading"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { trpc } from "@/lib/trpc/client"; diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/[keyId]/page.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/[keyId]/page.tsx index 65f3829c3e..bf40e567c3 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/[keyId]/page.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/[keyId]/page.tsx @@ -2,9 +2,8 @@ import { getTenantId } from "@/lib/auth"; import { db, schema, eq } from "@unkey/db"; import { notFound } from "next/navigation"; import { getDailyUsage } from "@/lib/tinybird"; -import { env } from "@/lib/env"; import { fillRange } from "@/lib/utils"; -import { ColumnChart } from "@/components/charts"; +import { ColumnChart } from "@/components/dashboard/charts"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; export const revalidate = 0; diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/page.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/page.tsx index 83e6b40dd7..b487302725 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/page.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/new/page.tsx @@ -1,7 +1,7 @@ import { getTenantId } from "@/lib/auth"; import { db, schema, eq } from "@unkey/db"; import { redirect } from "next/navigation"; -import { CreateKey } from "./CreateKey"; +import { CreateKey } from "@/app/(authenticated)/(app)/app/[apiId]/create-key"; export default async function ApiPage(props: { params: { apiId: string } }) { const tenantId = getTenantId(); diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/page.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/page.tsx index 389f66da40..96c32f11af 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/page.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/keys/page.tsx @@ -1,14 +1,8 @@ -import { PageHeader } from "@/components/PageHeader"; import { getTenantId } from "@/lib/auth"; import { db, schema, eq, type Key } from "@unkey/db"; -import { notFound, redirect } from "next/navigation"; -import { DeleteApiButton } from "../DeleteApi"; -import { Separator } from "@/components/ui/separator"; -import Link from "next/link"; -import { ApiKeyTable } from "@/components/ApiKeyTable"; -import { Badge } from "@/components/ui/badge"; -import { CopyButton } from "@/components/CopyButton"; -import { Button } from "@/components/ui/button"; +import { redirect } from "next/navigation"; + +import { ApiKeyTable } from "@/components/dashboard/api-key-table"; export const revalidate = 0; export default async function ApiPage(props: { params: { apiId: string } }) { diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/layout.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/layout.tsx index c14d3cacb0..ff2629afb6 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/layout.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/layout.tsx @@ -1,5 +1,5 @@ -import { CopyButton } from "@/components/CopyButton"; -import { PageHeader } from "@/components/PageHeader"; +import { CopyButton } from "@/components/dashboard/copy-button"; +import { PageHeader } from "@/components/dashboard/page-header"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; @@ -8,8 +8,8 @@ import { db, eq, schema } from "@unkey/db"; import Link from "next/link"; import { redirect } from "next/navigation"; import { PropsWithChildren } from "react"; -import { DeleteApiButton } from "./DeleteApi"; -import { NavLink } from "./navbar"; +import { DeleteApiButton } from "./delete-api-button"; +import { NavLink } from "./api-navbar"; type Props = PropsWithChildren<{ params: { diff --git a/apps/web/app/(authenticated)/(app)/app/[apiId]/page.tsx b/apps/web/app/(authenticated)/(app)/app/[apiId]/page.tsx index a18eb51653..ab75328d99 100644 --- a/apps/web/app/(authenticated)/(app)/app/[apiId]/page.tsx +++ b/apps/web/app/(authenticated)/(app)/app/[apiId]/page.tsx @@ -1,4 +1,4 @@ -import { ColumnChart } from "@/components/charts"; +import { ColumnChart } from "@/components/dashboard/charts"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { getTenantId } from "@/lib/auth"; import { fillRange } from "@/lib/utils"; diff --git a/apps/web/app/(authenticated)/(app)/app/AppLink.tsx b/apps/web/app/(authenticated)/(app)/app/api-link.tsx similarity index 100% rename from apps/web/app/(authenticated)/(app)/app/AppLink.tsx rename to apps/web/app/(authenticated)/(app)/app/api-link.tsx diff --git a/apps/web/app/(authenticated)/(app)/app/apis/DeleteAPI.tsx b/apps/web/app/(authenticated)/(app)/app/apis/DeleteAPI.tsx deleted file mode 100644 index c32c3df475..0000000000 --- a/apps/web/app/(authenticated)/(app)/app/apis/DeleteAPI.tsx +++ /dev/null @@ -1,68 +0,0 @@ -"use client"; - -import { useToast } from "@/components/ui/use-toast"; -import { useRouter } from "next/navigation"; -import React, { PropsWithChildren } from "react"; - -import { Loading } from "@/components/loading"; -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; -import { trpc } from "@/lib/trpc/client"; - -type Props = { - apiId: string; -}; -export const DeleteAPIButton: React.FC> = ({ apiId, children }) => { - const deleteAPI = trpc.api.delete.useMutation(); - - const { toast } = useToast(); - const router = useRouter(); - - return ( - <> - - {children} - - - Delete API - - Are you sure you want to delete this API? This action cannot be undone. - - - - - - - - - ); -}; diff --git a/apps/web/app/(authenticated)/(app)/app/apis/CreateAPI.tsx b/apps/web/app/(authenticated)/(app)/app/apis/create-api-button.tsx similarity index 89% rename from apps/web/app/(authenticated)/(app)/app/apis/CreateAPI.tsx rename to apps/web/app/(authenticated)/(app)/app/apis/create-api-button.tsx index 570bb6bb87..144485c381 100644 --- a/apps/web/app/(authenticated)/(app)/app/apis/CreateAPI.tsx +++ b/apps/web/app/(authenticated)/(app)/app/apis/create-api-button.tsx @@ -7,8 +7,8 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/Form"; -import { Loading } from "@/components/loading"; +} from "@/components/ui/form"; +import { Loading } from "@/components/dashboard/loading"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -47,7 +47,11 @@ export const CreateApiButton: React.FC = () => { }, onError(err) { console.error(err); - toast({ title: "Error", description: err.message, variant: "destructive" }); + toast({ + title: "Error", + description: err.message, + variant: "destructive", + }); }, }); async function onSubmit(values: z.infer) { @@ -84,10 +88,10 @@ export const CreateApiButton: React.FC = () => { )} /> - + diff --git a/apps/web/components/Form.tsx b/apps/web/components/Form.tsx deleted file mode 100644 index 22a320be62..0000000000 --- a/apps/web/components/Form.tsx +++ /dev/null @@ -1,165 +0,0 @@ -import * as React from "react"; -import * as LabelPrimitive from "@radix-ui/react-label"; -import { Slot } from "@radix-ui/react-slot"; -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext, -} from "react-hook-form"; - -import { cn } from "@/lib/utils"; -import { Label } from "@/components/ui/label"; - -const Form = FormProvider; - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, -> = { - name: TName; -}; - -const FormFieldContext = React.createContext({} as FormFieldContextValue); - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, ->({ ...props }: ControllerProps) => { - return ( - - - - ); -}; - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext); - const itemContext = React.useContext(FormItemContext); - const { getFieldState, formState } = useFormContext(); - - const fieldState = getFieldState(fieldContext.name, formState); - - if (!fieldContext) { - throw new Error("useFormField should be used within "); - } - - const { id } = itemContext; - - return { - id, - name: fieldContext.name, - formItemId: `${id}-form-item`, - formDescriptionId: `${id}-form-item-description`, - formMessageId: `${id}-form-item-message`, - ...fieldState, - }; -}; - -type FormItemContextValue = { - id: string; -}; - -const FormItemContext = React.createContext({} as FormItemContextValue); - -const FormItem = React.forwardRef>( - ({ className, ...props }, ref) => { - const id = React.useId(); - - return ( - -
- - ); - }, -); -FormItem.displayName = "FormItem"; - -const FormLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField(); - - return ( -
    {(actions ?? []).map((action, i) => ( + // rome-ignore lint/suspicious/noArrayIndexKey:
  • {action}
  • ))}
diff --git a/apps/web/components/particles.tsx b/apps/web/components/dashboard/particles.tsx similarity index 97% rename from apps/web/components/particles.tsx rename to apps/web/components/dashboard/particles.tsx index 8879ba62c5..184a0d1c8a 100644 --- a/apps/web/components/particles.tsx +++ b/apps/web/components/dashboard/particles.tsx @@ -39,11 +39,8 @@ interface ParticlesProps { vy?: number; } function hexToRgb(hex: string): number[] { - // Remove the "#" character from the beginning of the hex color code - hex = hex.replace("#", ""); - // Convert the hex color code to an integer - const hexInt = parseInt(hex, 16); + const hexInt = parseInt(hex.replace("#", ""), 16); // Extract the red, green, and blue components from the hex color code const red = (hexInt >> 16) & 255; @@ -67,7 +64,7 @@ export const Particles: React.FC = ({ const canvasRef = useRef(null); const canvasContainerRef = useRef(null); const context = useRef(null); - const circles = useRef([]); + const circles = useRef([]); const mousePosition = useMousePosition(); const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 }); const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 }); diff --git a/apps/web/components/text.tsx b/apps/web/components/dashboard/text.tsx similarity index 100% rename from apps/web/components/text.tsx rename to apps/web/components/dashboard/text.tsx diff --git a/apps/web/components/VisibleButton.tsx b/apps/web/components/dashboard/visible-button.tsx similarity index 98% rename from apps/web/components/VisibleButton.tsx rename to apps/web/components/dashboard/visible-button.tsx index 4804127b8e..cd9db2c118 100644 --- a/apps/web/components/VisibleButton.tsx +++ b/apps/web/components/dashboard/visible-button.tsx @@ -1,5 +1,3 @@ -"use client"; - import * as React from "react"; import { cn } from "@/lib/utils"; diff --git a/apps/web/components/landing-components/block-quote.tsx b/apps/web/components/landing/block-quote.tsx similarity index 97% rename from apps/web/components/landing-components/block-quote.tsx rename to apps/web/components/landing/block-quote.tsx index ba81791f7b..05aeb18e88 100644 --- a/apps/web/components/landing-components/block-quote.tsx +++ b/apps/web/components/landing/block-quote.tsx @@ -1,7 +1,7 @@ import Image, { ImageProps } from "next/image"; import clsx from "clsx"; -import { Border } from "@/components/landing-components/border"; +import { Border } from "@/components/landing/border"; interface Author { name: string; diff --git a/apps/web/components/landing-components/border.tsx b/apps/web/components/landing/border.tsx similarity index 100% rename from apps/web/components/landing-components/border.tsx rename to apps/web/components/landing/border.tsx diff --git a/apps/web/components/landing-components/button.tsx b/apps/web/components/landing/button.tsx similarity index 100% rename from apps/web/components/landing-components/button.tsx rename to apps/web/components/landing/button.tsx diff --git a/apps/web/components/landing-components/container.tsx b/apps/web/components/landing/container.tsx similarity index 100% rename from apps/web/components/landing-components/container.tsx rename to apps/web/components/landing/container.tsx diff --git a/apps/web/components/landing-components/fade-in.tsx b/apps/web/components/landing/fade-in.tsx similarity index 100% rename from apps/web/components/landing-components/fade-in.tsx rename to apps/web/components/landing/fade-in.tsx diff --git a/apps/web/components/landing-components/footer.tsx b/apps/web/components/landing/footer.tsx similarity index 95% rename from apps/web/components/landing-components/footer.tsx rename to apps/web/components/landing/footer.tsx index 015d526a63..810c0d780b 100644 --- a/apps/web/components/landing-components/footer.tsx +++ b/apps/web/components/landing/footer.tsx @@ -1,9 +1,9 @@ import Link from "next/link"; -import { Container } from "@/components/landing-components/container"; -import { FadeIn } from "@/components/landing-components/fade-in"; -import { socialMediaProfiles } from "@/components/landing-components/social-media"; -import { NewsletterForm } from "@/components/landing-components/newsletter"; +import { Container } from "@/components/landing/container"; +import { FadeIn } from "@/components/landing/fade-in"; +import { socialMediaProfiles } from "@/components/landing/social-media"; +import { NewsletterForm } from "@/components/landing/newsletter"; const navigation = [ { diff --git a/apps/web/components/landing-components/grayscale-transition-image.tsx b/apps/web/components/landing/grayscale-transition-image.tsx similarity index 100% rename from apps/web/components/landing-components/grayscale-transition-image.tsx rename to apps/web/components/landing/grayscale-transition-image.tsx diff --git a/apps/web/components/landing-components/grid-list.tsx b/apps/web/components/landing/grid-list.tsx similarity index 88% rename from apps/web/components/landing-components/grid-list.tsx rename to apps/web/components/landing/grid-list.tsx index 8bcba1b7bb..13137bcd67 100644 --- a/apps/web/components/landing-components/grid-list.tsx +++ b/apps/web/components/landing/grid-list.tsx @@ -1,7 +1,7 @@ import clsx from "clsx"; -import { Border } from "@/components/landing-components/border"; -import { FadeIn, FadeInStagger } from "@/components/landing-components/fade-in"; +import { Border } from "@/components/landing/border"; +import { FadeIn, FadeInStagger } from "@/components/landing/fade-in"; export function GridList({ className, diff --git a/apps/web/components/landing-components/grid-pattern.tsx b/apps/web/components/landing/grid-pattern.tsx similarity index 100% rename from apps/web/components/landing-components/grid-pattern.tsx rename to apps/web/components/landing/grid-pattern.tsx diff --git a/apps/web/components/landing-components/list.tsx b/apps/web/components/landing/list.tsx similarity index 83% rename from apps/web/components/landing-components/list.tsx rename to apps/web/components/landing/list.tsx index 7deaeb3c6b..d0efa7a6ad 100644 --- a/apps/web/components/landing-components/list.tsx +++ b/apps/web/components/landing/list.tsx @@ -1,7 +1,7 @@ import clsx from "clsx"; -import { Border } from "@/components/landing-components/border"; -import { FadeIn, FadeInStagger } from "@/components/landing-components/fade-in"; +import { Border } from "@/components/landing/border"; +import { FadeIn, FadeInStagger } from "@/components/landing/fade-in"; export function List({ className, diff --git a/apps/web/components/landing-components/newsletter.tsx b/apps/web/components/landing/newsletter.tsx similarity index 100% rename from apps/web/components/landing-components/newsletter.tsx rename to apps/web/components/landing/newsletter.tsx diff --git a/apps/web/components/landing-components/page-intro.tsx b/apps/web/components/landing/page-intro.tsx similarity index 87% rename from apps/web/components/landing-components/page-intro.tsx rename to apps/web/components/landing/page-intro.tsx index 571403daeb..8dd4d02690 100644 --- a/apps/web/components/landing-components/page-intro.tsx +++ b/apps/web/components/landing/page-intro.tsx @@ -1,7 +1,7 @@ import clsx from "clsx"; -import { Container } from "@/components/landing-components/container"; -import { FadeIn } from "@/components/landing-components/fade-in"; +import { Container } from "@/components/landing/container"; +import { FadeIn } from "@/components/landing/fade-in"; export function PageIntro({ eyebrow, diff --git a/apps/web/components/landing-components/page-links.tsx b/apps/web/components/landing/page-links.tsx similarity index 79% rename from apps/web/components/landing-components/page-links.tsx rename to apps/web/components/landing/page-links.tsx index 856d1ffc2c..7c0ceee229 100644 --- a/apps/web/components/landing-components/page-links.tsx +++ b/apps/web/components/landing/page-links.tsx @@ -1,11 +1,11 @@ import Link from "next/link"; import clsx from "clsx"; -import { Border } from "@/components/landing-components/border"; -import { Container } from "@/components/landing-components/container"; -import { FadeIn, FadeInStagger } from "@/components/landing-components/fade-in"; -import { GridPattern } from "@/components/landing-components/grid-pattern"; -import { SectionIntro } from "@/components/landing-components/section-intro"; +import { Border } from "@/components/landing/border"; +import { Container } from "@/components/landing/container"; +import { FadeIn, FadeInStagger } from "@/components/landing/fade-in"; +import { GridPattern } from "@/components/landing/grid-pattern"; +import { SectionIntro } from "@/components/landing/section-intro"; import { formatDate } from "@/lib/formatDate"; interface Page { @@ -34,11 +34,11 @@ function PageLink({ page }: { page: Page }) {

{page.description}

Read more - + diff --git a/apps/web/components/landing-components/root-layout.tsx b/apps/web/components/landing/root-layout.tsx similarity index 91% rename from apps/web/components/landing-components/root-layout.tsx rename to apps/web/components/landing/root-layout.tsx index 1394da5785..bedc3c86f9 100644 --- a/apps/web/components/landing-components/root-layout.tsx +++ b/apps/web/components/landing/root-layout.tsx @@ -6,10 +6,10 @@ import { usePathname } from "next/navigation"; import clsx from "clsx"; import { motion, MotionConfig, useReducedMotion } from "framer-motion"; -import { Button } from "@/components/landing-components/button"; -import { Container } from "@/components/landing-components/container"; -import { Footer } from "@/components/landing-components/footer"; -import { GridPattern } from "@/components/landing-components/grid-pattern"; +import { Button } from "@/components/landing/button"; +import { Container } from "@/components/landing/container"; +import { Footer } from "@/components/landing/footer"; +import { GridPattern } from "@/components/landing/grid-pattern"; const RootLayoutContext = createContext({}); @@ -123,7 +123,7 @@ function Header({
- {/* @ts-expect-error */} @@ -178,17 +178,17 @@ function NavigationItem({ return ( {children} - + ); } function Navigation() { return ( -