From cc225fae80be18523d6052fef257739bb9c29906 Mon Sep 17 00:00:00 2001 From: Gib Date: Mon, 9 Jun 2025 06:59:38 -0500 Subject: [PATCH] Getting started on Tech Tracker. Added TV Context --- package.json | 2 +- pnpm-lock.yaml | 38 ++++----- public/icons/tv/enter.svg | 63 +++++++++++++++ public/icons/tv/exit.svg | 63 +++++++++++++++ src/app/(auth-pages)/auth/callback/route.ts | 2 +- src/app/(auth-pages)/auth/success/page.tsx | 4 +- src/app/(auth-pages)/forgot-password/page.tsx | 2 +- src/app/(auth-pages)/profile/page.tsx | 2 +- src/app/(auth-pages)/sign-in/page.tsx | 2 +- src/app/(auth-pages)/sign-up/page.tsx | 8 +- src/app/global-error.tsx | 18 +---- src/app/layout.tsx | 33 ++++---- src/app/page.tsx | 2 +- src/components/context/{auth.tsx => Auth.tsx} | 2 +- src/components/context/TVMode.tsx | 79 +++++++++++++++++++ .../context/{theme.tsx => Theme.tsx} | 5 +- src/components/context/index.tsx | 3 + .../default/auth/SignInWithApple.tsx | 4 +- .../default/auth/SignInWithMicrosoft.tsx | 4 +- .../navigation/auth/AvatarDropdown.tsx | 2 +- src/components/default/navigation/index.tsx | 3 +- .../default/profile/AvatarUpload.tsx | 2 +- .../default/profile/ProfileForm.tsx | 2 +- .../default/profile/ResetPasswordForm.tsx | 21 +++-- src/components/default/profile/SignOut.tsx | 2 +- src/lib/actions/auth.ts | 4 +- src/lib/hooks/index.ts | 1 - src/lib/hooks/useFileUpload.ts | 2 +- 28 files changed, 284 insertions(+), 91 deletions(-) create mode 100644 public/icons/tv/enter.svg create mode 100644 public/icons/tv/exit.svg rename src/components/context/{auth.tsx => Auth.tsx} (98%) create mode 100644 src/components/context/TVMode.tsx rename src/components/context/{theme.tsx => Theme.tsx} (94%) create mode 100644 src/components/context/index.tsx diff --git a/package.json b/package.json index 25522ee..64e8050 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@hookform/resolvers": "^5.1.0", + "@hookform/resolvers": "^5.1.1", "@radix-ui/react-avatar": "^1.1.10", "@radix-ui/react-checkbox": "^1.3.2", "@radix-ui/react-dropdown-menu": "^2.1.15", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d1f5d93..f789e45 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@hookform/resolvers': - specifier: ^5.1.0 - version: 5.1.0(react-hook-form@7.57.0(react@19.1.0)) + specifier: ^5.1.1 + version: 5.1.1(react-hook-form@7.57.0(react@19.1.0)) '@radix-ui/react-avatar': specifier: ^1.1.10 version: 1.1.10(@types/react-dom@19.1.6(@types/react@19.1.6))(@types/react@19.1.6)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -274,8 +274,8 @@ packages: '@floating-ui/utils@0.2.9': resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==} - '@hookform/resolvers@5.1.0': - resolution: {integrity: sha512-A5tY8gxqvvR0lFfropqpy/gUDOxjwT7LZCxJ8lNA9puK7nFNRl/O0egGKxzdF4JSz/pnnT1O8g76P/YMyTBEFw==} + '@hookform/resolvers@5.1.1': + resolution: {integrity: sha512-J/NVING3LMAEvexJkyTLjruSm7aOFx7QX21pzkiJfMoNG0wl5aFEjLTl7ay7IQb9EWY6AkrBy7tHL2Alijpdcg==} peerDependencies: react-hook-form: ^7.55.0 @@ -1723,8 +1723,8 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn@8.14.1: - resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==} + acorn@8.15.0: + resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} engines: {node: '>=0.4.0'} hasBin: true @@ -3697,7 +3697,7 @@ snapshots: '@floating-ui/utils@0.2.9': {} - '@hookform/resolvers@5.1.0(react-hook-form@7.57.0(react@19.1.0))': + '@hookform/resolvers@5.1.1(react-hook-form@7.57.0(react@19.1.0))': dependencies: '@standard-schema/utils': 0.3.0 react-hook-form: 7.57.0(react@19.1.0) @@ -5157,15 +5157,15 @@ snapshots: '@xtuc/long@4.2.2': {} - acorn-import-attributes@1.9.5(acorn@8.14.1): + acorn-import-attributes@1.9.5(acorn@8.15.0): dependencies: - acorn: 8.14.1 + acorn: 8.15.0 - acorn-jsx@5.3.2(acorn@8.14.1): + acorn-jsx@5.3.2(acorn@8.15.0): dependencies: - acorn: 8.14.1 + acorn: 8.15.0 - acorn@8.14.1: {} + acorn@8.15.0: {} agent-base@6.0.2: dependencies: @@ -5789,8 +5789,8 @@ snapshots: espree@10.3.0: dependencies: - acorn: 8.14.1 - acorn-jsx: 5.3.2(acorn@8.14.1) + acorn: 8.15.0 + acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 4.2.0 esquery@1.6.0: @@ -5997,8 +5997,8 @@ snapshots: import-in-the-middle@1.14.0: dependencies: - acorn: 8.14.1 - acorn-import-attributes: 1.9.5(acorn@8.14.1) + acorn: 8.15.0 + acorn-import-attributes: 1.9.5(acorn@8.15.0) cjs-module-lexer: 1.4.3 module-details-from-path: 1.0.4 @@ -6908,7 +6908,7 @@ snapshots: terser@5.41.0: dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.14.1 + acorn: 8.15.0 commander: 2.20.3 source-map-support: 0.5.21 @@ -7000,7 +7000,7 @@ snapshots: unplugin@1.0.1: dependencies: - acorn: 8.14.1 + acorn: 8.15.0 chokidar: 3.6.0 webpack-sources: 3.3.2 webpack-virtual-modules: 0.5.0 @@ -7077,7 +7077,7 @@ snapshots: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/wasm-edit': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 - acorn: 8.14.1 + acorn: 8.15.0 browserslist: 4.25.0 chrome-trace-event: 1.0.4 enhanced-resolve: 5.18.1 diff --git a/public/icons/tv/enter.svg b/public/icons/tv/enter.svg new file mode 100644 index 0000000..0ec0d06 --- /dev/null +++ b/public/icons/tv/enter.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + diff --git a/public/icons/tv/exit.svg b/public/icons/tv/exit.svg new file mode 100644 index 0000000..658a81c --- /dev/null +++ b/public/icons/tv/exit.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + diff --git a/src/app/(auth-pages)/auth/callback/route.ts b/src/app/(auth-pages)/auth/callback/route.ts index 8d1d901..e810e51 100644 --- a/src/app/(auth-pages)/auth/callback/route.ts +++ b/src/app/(auth-pages)/auth/callback/route.ts @@ -35,7 +35,7 @@ export const GET = async (request: NextRequest) => { if (type === 'invite') return redirect('/sign-up'); } return redirect( - `/?error=${encodeURIComponent(error?.message || 'Unknown error')}`, + `/?error=${encodeURIComponent(error?.message ?? 'Unknown error')}`, ); } diff --git a/src/app/(auth-pages)/auth/success/page.tsx b/src/app/(auth-pages)/auth/success/page.tsx index b3953ca..e6660ab 100644 --- a/src/app/(auth-pages)/auth/success/page.tsx +++ b/src/app/(auth-pages)/auth/success/page.tsx @@ -1,12 +1,12 @@ 'use client'; -import { useAuth } from '@/components/context/auth'; +import { useAuth } from '@/components/context'; import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; import { Loader2 } from 'lucide-react'; const AuthSuccessPage = () => { - const { refreshUserData, isAuthenticated } = useAuth(); + const { refreshUserData } = useAuth(); const router = useRouter(); useEffect(() => { diff --git a/src/app/(auth-pages)/forgot-password/page.tsx b/src/app/(auth-pages)/forgot-password/page.tsx index ccbbce6..aae4fd2 100644 --- a/src/app/(auth-pages)/forgot-password/page.tsx +++ b/src/app/(auth-pages)/forgot-password/page.tsx @@ -19,7 +19,7 @@ import { import Link from 'next/link'; import { forgotPassword } from '@/lib/actions'; import { useRouter } from 'next/navigation'; -import { useAuth } from '@/components/context/auth'; +import { useAuth } from '@/components/context'; import { useEffect, useState } from 'react'; import { StatusMessage, SubmitButton } from '@/components/default'; diff --git a/src/app/(auth-pages)/profile/page.tsx b/src/app/(auth-pages)/profile/page.tsx index 75c7dc9..9b5ae2f 100644 --- a/src/app/(auth-pages)/profile/page.tsx +++ b/src/app/(auth-pages)/profile/page.tsx @@ -1,5 +1,5 @@ 'use client'; -import { useAuth } from '@/components/context/auth'; +import { useAuth } from '@/components/context'; import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; import { diff --git a/src/app/(auth-pages)/sign-in/page.tsx b/src/app/(auth-pages)/sign-in/page.tsx index a6c4fc0..4baa919 100644 --- a/src/app/(auth-pages)/sign-in/page.tsx +++ b/src/app/(auth-pages)/sign-in/page.tsx @@ -20,7 +20,7 @@ import { import Link from 'next/link'; import { signIn } from '@/lib/actions'; import { useRouter } from 'next/navigation'; -import { useAuth } from '@/components/context/auth'; +import { useAuth } from '@/components/context'; import { useEffect, useState } from 'react'; import { StatusMessage, SubmitButton } from '@/components/default'; import { Separator } from '@/components/ui'; diff --git a/src/app/(auth-pages)/sign-up/page.tsx b/src/app/(auth-pages)/sign-up/page.tsx index b62894a..8f9028c 100644 --- a/src/app/(auth-pages)/sign-up/page.tsx +++ b/src/app/(auth-pages)/sign-up/page.tsx @@ -7,7 +7,7 @@ import Link from 'next/link'; import { signUp } from '@/lib/actions'; import { StatusMessage, SubmitButton } from '@/components/default'; import { useRouter } from 'next/navigation'; -import { useAuth } from '@/components/context/auth'; +import { useAuth } from '@/components/context'; import { Card, CardContent, @@ -26,7 +26,7 @@ import { import { useEffect, useState } from 'react'; import { SignInWithApple, - SignInWithMicrosoft + SignInWithMicrosoft, } from '@/components/default/auth'; const formSchema = z @@ -201,8 +201,8 @@ const SignUp = () => { or - - + + ); diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx index c7e89c5..354dbfe 100644 --- a/src/app/global-error.tsx +++ b/src/app/global-error.tsx @@ -2,8 +2,7 @@ import '@/styles/globals.css'; import { cn } from '@/lib/utils'; -import { ThemeProvider } from '@/components/context/theme'; -import { AuthProvider } from '@/components/context/auth'; +import { AuthProvider, ThemeProvider } from '@/components/context'; import Navigation from '@/components/default/navigation'; import Footer from '@/components/default/footer'; import { Button, Toaster } from '@/components/ui'; @@ -60,21 +59,6 @@ const GlobalError = ({ error, reset = undefined }: GlobalErrorProps) => { ); - - return ( - - - {/* `NextError` is the default Next.js error page component. Its type - definition requires a `statusCode` prop. However, since the App Router - does not expose status codes for errors, we simply pass 0 to render a - generic error message. */} - - {reset !== undefined && ( - - )} - - - ); }; export default GlobalError; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2e23e3e..63982de 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,8 +2,11 @@ import type { Metadata } from 'next'; import '@/styles/globals.css'; import { Geist } from 'next/font/google'; import { cn } from '@/lib/utils'; -import { ThemeProvider } from '@/components/context/theme'; -import { AuthProvider } from '@/components/context/auth'; +import { + AuthProvider, + ThemeProvider, + TVModeProvider, +} from '@/components/context'; import Navigation from '@/components/default/navigation'; import Footer from '@/components/default/footer'; import { Toaster } from '@/components/ui'; @@ -357,19 +360,21 @@ const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => { disableTransitionOnChange > -
-
- -
- {children} + +
+
+ +
+ {children} +
-
-
-
- +