diff --git a/src/app/_analytics/provider.tsx b/src/app/_analytics/provider.tsx index 2a0be13..990c30a 100644 --- a/src/app/_analytics/provider.tsx +++ b/src/app/_analytics/provider.tsx @@ -3,34 +3,35 @@ import { useAuth, useUser } from "@clerk/nextjs"; import posthog from "posthog-js"; import { PostHogProvider } from "posthog-js/react"; import { useEffect } from "react"; +import { env } from "~/env"; if (typeof window !== "undefined") { - posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { - api_host: "/ingest", - ui_host: "https://app.posthog.com", - }); + posthog.init(env.NEXT_PUBLIC_POSTHOG_KEY, { + api_host: "/ingest", + ui_host: "https://app.posthog.com", + }); } export function CSPostHogProvider({ children }: { children: React.ReactNode }) { - return ( - - {children} - - ); + return ( + + {children} + + ); } function PostHogAuthWrapper({ children }: { children: React.ReactNode }) { - const auth = useAuth(); - const userInfo = useUser(); + const auth = useAuth(); + const userInfo = useUser(); - useEffect(() => { - if (userInfo.user) { - posthog.identify(userInfo.user.id, { - email: userInfo.user.emailAddresses[0]?.emailAddress, - }); - } else if (!auth.isSignedIn) { - posthog.reset(); - } - }, [auth, userInfo]); + useEffect(() => { + if (userInfo.user) { + posthog.identify(userInfo.user.id, { + email: userInfo.user.emailAddresses[0]?.emailAddress, + }); + } else if (!auth.isSignedIn) { + posthog.reset(); + } + }, [auth, userInfo]); - return children; + return children; } diff --git a/src/app/_components/side-nav.tsx b/src/app/_components/side-nav.tsx index 727d73d..c304334 100644 --- a/src/app/_components/side-nav.tsx +++ b/src/app/_components/side-nav.tsx @@ -1,150 +1,147 @@ "use client"; +import { SignedIn, SignedOut, UserButton, useAuth } from "@clerk/nextjs"; import React from "react"; -import { useAuth, SignedIn, SignedOut, UserButton } from "@clerk/nextjs"; import Link from "next/link"; import { - Brain, - Camera, - Home, - Pencil, - User, - CircleEllipsis, + Brain, + Camera, + CircleEllipsis, + Home, + Pencil, + User, } from "lucide-react"; function SideUserActions() { - return ( -
-
- - -
-
- ); + return ( +
+
+ + +
+
+ ); } export function SideNav() { - const items = [ - { - name: "Inicio", - icon: Home, - href: "/", - }, - { - name: "Pensamientos", - icon: Pencil, - href: "/penin", - }, - { - name: "Galeria", - icon: Camera, - href: "/galeria", - }, - { - name: "Perfil", - icon: User, - href: "/perfil", - }, - { - name: "Mas opciones", - icon: CircleEllipsis, - href: "/opciones", - }, - ]; + const items = [ + { + name: "Inicio", + icon: Home, + href: "/", + }, + { + name: "Pensamientos", + icon: Pencil, + href: "/penin", + }, + { + name: "Galeria", + icon: Camera, + href: "/galeria", + }, + { + name: "Perfil", + icon: User, + href: "/perfil", + }, + { + name: "Mas opciones", + icon: CircleEllipsis, + href: "/opciones", + }, + ]; - return ( -
-
-
-
-
- {/* Logo */} -
-

- - - -

-
- {/* Navigation */} -
- -
- {/* Escribir btn */} -
- -
- - - Escribir - -
- -
-
- {/* User Menu */} -
- -
-
-
-
-
- ); + return ( +
+
+
+
+
+ {/* Logo */} +
+

+ + + +

+
+ {/* Navigation */} +
+ +
+ {/* Escribir btn */} +
+ +
+ + + Escribir + +
+ +
+
+ {/* User Menu */} +
+ +
+
+
+
+
+ ); } diff --git a/src/app/_components/topnav.tsx b/src/app/_components/topnav.tsx index a81b939..b137ee5 100644 --- a/src/app/_components/topnav.tsx +++ b/src/app/_components/topnav.tsx @@ -1,18 +1,18 @@ import { SignInButton, SignedIn, SignedOut, UserButton } from "@clerk/nextjs"; export function TopNav() { - return ( - + ); } diff --git a/src/app/api/uploadthing/core.ts b/src/app/api/uploadthing/core.ts index 86c9788..0f93728 100644 --- a/src/app/api/uploadthing/core.ts +++ b/src/app/api/uploadthing/core.ts @@ -1,5 +1,5 @@ import { auth } from "@clerk/nextjs/server"; -import { createUploadthing, type FileRouter } from "uploadthing/next"; +import { type FileRouter, createUploadthing } from "uploadthing/next"; import { UploadThingError } from "uploadthing/server"; import { db } from "~/server/db"; import { images } from "~/server/db/schema"; @@ -7,23 +7,23 @@ import { images } from "~/server/db/schema"; const f = createUploadthing(); export const ourFileRouter = { - imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 3 } }) - .middleware(async ({ req }) => { - const user = await auth(); + imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 3 } }) + .middleware(async ({ req }) => { + const user = await auth(); - if (!user.userId) throw new UploadThingError("Unauthorized"); + if (!user.userId) throw new UploadThingError("Unauthorized"); - return { userId: user.userId }; - }) - .onUploadComplete(async ({ metadata, file }) => { - await db.insert(images).values({ - name: file.name, - url: file.url, - userId: metadata.userId, - }); + return { userId: user.userId }; + }) + .onUploadComplete(async ({ metadata, file }) => { + await db.insert(images).values({ + name: file.name, + url: file.url, + userId: metadata.userId, + }); - return { uploadedBy: metadata.userId }; - }), + return { uploadedBy: metadata.userId }; + }), } satisfies FileRouter; export type OurFileRouter = typeof ourFileRouter; diff --git a/src/app/api/uploadthing/route.ts b/src/app/api/uploadthing/route.ts index 81af864..e2e8085 100644 --- a/src/app/api/uploadthing/route.ts +++ b/src/app/api/uploadthing/route.ts @@ -4,8 +4,8 @@ import { ourFileRouter } from "./core"; // Export routes for Next App Router export const { GET, POST } = createRouteHandler({ - router: ourFileRouter, + router: ourFileRouter, - // Apply an (optional) custom config: - // config: { ... }, + // Apply an (optional) custom config: + // config: { ... }, }); diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx index 87937b7..4c6048f 100644 --- a/src/app/global-error.tsx +++ b/src/app/global-error.tsx @@ -1,19 +1,20 @@ "use client"; import * as Sentry from "@sentry/nextjs"; +// biome-ignore lint/suspicious/noShadowRestrictedNames: import Error from "next/error"; import { useEffect } from "react"; export default function GlobalError(props: { error: unknown }) { - useEffect(() => { - Sentry.captureException(props.error); - }, [props.error]); + useEffect(() => { + Sentry.captureException(props.error); + }, [props.error]); - return ( - - - - - - ); + return ( + + + + + + ); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index c4b2c10..7ae0783 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,51 +1,51 @@ import "~/styles/globals.css"; import { ClerkProvider } from "@clerk/nextjs"; -import { GeistSans } from "geist/font/sans"; import { NextSSRPlugin } from "@uploadthing/react/next-ssr-plugin"; +import { GeistSans } from "geist/font/sans"; import { extractRouterConfig } from "uploadthing/server"; -import { ourFileRouter } from "./api/uploadthing/core"; -import { CSPostHogProvider } from "./_analytics/provider"; -import { SideNav } from "./_components/side-nav"; import { TailwindIndicator } from "~/components/tailwind-indicator"; import { cn } from "~/lib/utils"; +import { CSPostHogProvider } from "./_analytics/provider"; +import { SideNav } from "./_components/side-nav"; +import { ourFileRouter } from "./api/uploadthing/core"; export const metadata = { - title: "PENIN - Pensamientos Intrusivos", - description: - "Generated by a loyal suscriber by theo on youtube and making his own t3 app", - icons: [{ rel: "icon", url: "/favicon.ico" }], + title: "PENIN - Pensamientos Intrusivos", + description: + "Generated by a loyal suscriber by theo on youtube and making his own t3 app", + icons: [{ rel: "icon", url: "/favicon.ico" }], }; export default function RootLayout({ - children, + children, }: { - children: React.ReactNode; - modal: React.ReactNode; + children: React.ReactNode; + modal: React.ReactNode; }) { - return ( - - - - - -
-
-
- -
- {children} -
-
-
-
- - - -
-
- ); + return ( + + + + + +
+
+
+ +
+ {children} +
+
+
+
+ + + +
+
+ ); } diff --git a/src/app/page.tsx b/src/app/page.tsx index 3d88054..a67fdeb 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,131 +1,131 @@ "use client"; -import { useState, useEffect } from "react"; +import { useEffect, useState } from "react"; import { Button } from "~/components/ui/button"; -import { Label } from "~/components/ui/label"; -import { Textarea } from "~/components/ui/textarea"; import { Card, CardContent } from "~/components/ui/card"; import { - Carousel, - CarouselContent, - CarouselItem, - CarouselNext, - CarouselPrevious, - type CarouselApi, + Carousel, + type CarouselApi, + CarouselContent, + CarouselItem, + CarouselNext, + CarouselPrevious, } from "~/components/ui/carousel"; +import { Label } from "~/components/ui/label"; +import { Textarea } from "~/components/ui/textarea"; export default function HomePage() { - const [api, setApi] = useState(); - const [current, setCurrent] = useState(0); - const [count, setCount] = useState(0); - - useEffect(() => { - if (!api) return; - - setCount(api.scrollSnapList().length); - setCurrent(api.selectedScrollSnap() + 1); - - api.on("select", () => { - setCurrent(api.selectedScrollSnap() + 1); - }); - }, [api]); - - return ( -
-
-
- {/* Main Form Content */} -
- - {/* Sidebar Main */} -
-
-
- -
-
-
-
- {/* Premium Aside */} -
-
- -
-
-
-
-
-
-
-
-
-
-
-

Hola, Natalia.

-
-
- - - -
- - -