diff --git a/.env b/.env index 021615e..8f46d6a 100644 --- a/.env +++ b/.env @@ -1,24 +1,11 @@ -# When adding additional environment variables, the schema in "/src/env.js" -# should be updated accordingly. - -# Drizzle DATABASE_URL="postgresql://postgres:hackme@localhost:5432/opengifame" -# Next Auth -# You can generate a new secret on the command line with: -# openssl rand -base64 32 -# https://next-auth.js.org/configuration/options#secret NEXTAUTH_SECRET="tAOVgxpY1U0BsnPCr6Gf8WVkmRMkp06ztUfwMhBKMQ4=" -NEXTAUTH_URL="http://localhost:3000" - -# Next Auth Discord Provider -DISCORD_CLIENT_ID="" -DISCORD_CLIENT_SECRET="" - +NEXTAUTH_URL="https://opengifame.dev.fergl.ie:3000" NEXT_PUBLIC_SITE_NAME=Open Gifame NEXT_PUBLIC_SITE_DESCRIPTION=Robot powered giffage -NEXT_PUBLIC_SITE_URL=https://gifs.ferg.al, -NEXT_PUBLIC_SITE_OG_IMAGE=http://localhost:3000/icon.png +NEXT_PUBLIC_SITE_URL=https://opengifame.dev.fergl.ie:3000 +NEXT_PUBLIC_SITE_OG_IMAGE=https://opengifame.dev.fergl.ie:3000/icon.png NEXT_PUBLIC_SITE_TWITTER=https://twitter.com/opengifame NEXT_PUBLIC_SITE_GITHUB=https://github.com/fergalmoran/opengifame diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 88c180d..e59a9b2 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,61 +1,53 @@ /** @type {import("eslint").Linter.Config} */ const config = { - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": true + parser: "@typescript-eslint/parser", + parserOptions: { + project: true, }, - "plugins": [ - "@typescript-eslint", - "drizzle" - ], - "extends": [ + plugins: ["@typescript-eslint", "drizzle"], + extends: [ "next/core-web-vitals", "plugin:@typescript-eslint/recommended-type-checked", - "plugin:@typescript-eslint/stylistic-type-checked" + "plugin:@typescript-eslint/stylistic-type-checked", ], - "rules": { + rules: { + "@typescript-eslint/prefer-nullish-coalescing": "off", "@typescript-eslint/array-type": "off", "@typescript-eslint/consistent-type-definitions": "off", "@typescript-eslint/consistent-type-imports": [ "warn", { - "prefer": "type-imports", - "fixStyle": "inline-type-imports" - } + prefer: "type-imports", + fixStyle: "inline-type-imports", + }, ], "@typescript-eslint/no-unused-vars": [ "warn", { - "argsIgnorePattern": "^_" - } + argsIgnorePattern: "^_", + }, ], "@typescript-eslint/require-await": "off", "@typescript-eslint/no-misused-promises": [ "error", { - "checksVoidReturn": { - "attributes": false - } - } + checksVoidReturn: { + attributes: false, + }, + }, ], "drizzle/enforce-delete-with-where": [ "error", { - "drizzleObjectName": [ - "db", - "ctx.db" - ] - } + drizzleObjectName: ["db", "ctx.db"], + }, ], "drizzle/enforce-update-with-where": [ "error", { - "drizzleObjectName": [ - "db", - "ctx.db" - ] - } - ] - } -} -module.exports = config; \ No newline at end of file + drizzleObjectName: ["db", "ctx.db"], + }, + ], + }, +}; +module.exports = config; diff --git a/.vscode/settings.json b/.vscode/settings.json index cae72af..b3b431b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "workbench.colorTheme": "Tinacious Design (High Contrast)" + // "workbench.colorTheme": "Tinacious Design (High Contrast)" + "workbench.colorTheme": "Cyberpunk 2077 rebuild", } \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 6fda6fe..bb94666 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index fc178a2..aeb404c 100644 --- a/package.json +++ b/package.json @@ -90,14 +90,15 @@ "zod": "^3.23.8" }, "devDependencies": { - "@types/eslint": "^9.6.1", + "@faker-js/faker": "^9.0.0", + "@types/eslint": "^8.56.12", "@types/node": "^22.5.4", "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^8.4.0", "@typescript-eslint/parser": "^8.4.0", "drizzle-kit": "^0.24.2", - "eslint": "^9.10.0", + "eslint": "^8.57.0", "eslint-config-next": "^14.2.8", "eslint-plugin-drizzle": "^0.2.3", "postcss": "^8.4.45", diff --git a/src/app/(site)/(auth)/register/page.tsx b/src/app/(site)/(auth)/register/page.tsx index 39066b8..964ae53 100644 --- a/src/app/(site)/(auth)/register/page.tsx +++ b/src/app/(site)/(auth)/register/page.tsx @@ -1,12 +1,10 @@ "use client"; import React from "react"; -import RegistrationForm from "@/components/forms/auth/RegistrationForm"; -import SocialLogin from "@/components/widgets/login/SocialLogin"; +import RegistrationForm from "@/components/forms/auth/registration-form"; +import SocialLogin from "@/components/widgets/login/social-login-button"; import Link from "next/link"; import { Icons } from "@/components/icons"; -import { cn } from "@/lib/utils"; -import { buttonVariants } from "@/components/ui/button"; const RegisterPage: React.FC = () => { return ( diff --git a/src/app/(site)/(auth)/signin/page.tsx b/src/app/(site)/(auth)/signin/page.tsx index f2e7d82..36092e6 100644 --- a/src/app/(site)/(auth)/signin/page.tsx +++ b/src/app/(site)/(auth)/signin/page.tsx @@ -1,11 +1,9 @@ "use client"; -import SocialLogin from "@/components/widgets/login/SocialLogin"; +import SocialLogin from "@/components/widgets/login/social-login-button"; import Link from "next/link"; import React from "react"; import { Icons } from "@/components/icons"; -import { cn } from "@/lib/utils"; -import { buttonVariants } from "@/components/ui/button"; -import SignInForm from "@/components/forms/auth/SignInForm"; +import SignInForm from "@/components/forms/auth/signin-form"; const SignInPage = () => { return ( diff --git a/src/app/_components/trending-images.tsx b/src/app/_components/trending-images.tsx deleted file mode 100644 index dcb3285..0000000 --- a/src/app/_components/trending-images.tsx +++ /dev/null @@ -1,10 +0,0 @@ -"use client"; - -import { useState } from "react"; - -import { api } from "@/trpc/react"; - -export function TrendingImages() { - const [name, setName] = useState(""); - return
Trending Images
; -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1baf2a5..c0e40ea 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,7 +1,7 @@ -import { Inter as FontSans } from "next/font/google"; +import { Roboto as font } from "next/font/google"; import "@/styles/globals.css"; -import { type Metadata, Viewport } from "next"; +import { type Metadata, type Viewport } from "next"; import { TRPCReactProvider } from "@/trpc/react"; import { cn } from "@/lib/utils"; @@ -12,17 +12,18 @@ import React from "react"; import TopNavbar from "@/components/navbar/top-navbar"; import { dashboardConfig } from "@/config/top-nav.config"; import { siteConfig } from "@/config/site.config"; +import { getServerSession } from "next-auth"; -const fontSans = FontSans({ - subsets: ["latin"], - variable: "--font-sans", -}); export const viewport: Viewport = { themeColor: [ { media: "(prefers-color-scheme: light)", color: "white" }, { media: "(prefers-color-scheme: dark)", color: "black" }, ], }; +const f = font({ + weight: "400", + subsets: ["latin"], +}); export const metadata: Metadata = { title: "Open Gifame", @@ -30,9 +31,10 @@ export const metadata: Metadata = { icons: [{ rel: "icon", url: "/favicon.ico" }], }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode }>) { + const session = await getServerSession(); return ( @@ -45,15 +47,15 @@ export default function RootLayout({ - - {children} + +
{children}
diff --git a/src/app/page.tsx b/src/app/page.tsx index fbb0cdd..427b17a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,5 @@ -import { TrendingImages } from "@/app/_components/trending-images"; import LandingPage from "@/components/pages/landing-page"; +import { TrendingImages } from "@/components/trending-images"; import { getServerAuthSession } from "@/server/auth"; import { HydrateClient } from "@/trpc/server"; diff --git a/src/components/forms/auth/RegistrationForm.tsx b/src/components/forms/auth/registration-form.tsx similarity index 100% rename from src/components/forms/auth/RegistrationForm.tsx rename to src/components/forms/auth/registration-form.tsx diff --git a/src/components/forms/auth/SignInForm.tsx b/src/components/forms/auth/signin-form.tsx similarity index 100% rename from src/components/forms/auth/SignInForm.tsx rename to src/components/forms/auth/signin-form.tsx diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 5d79b19..3cfe83e 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -25,6 +25,7 @@ import { X, type Icon as LucideIcon, Terminal, + LogIn, } from "lucide-react"; export type Icon = typeof LucideIcon; @@ -46,9 +47,9 @@ export const Icons = { user: User, arrowRight: ArrowRight, help: HelpCircle, + login: LogIn, logo: ({ ...props }: LucideProps) => ( - {/* Background */} - - {/* Abstract prism shape - significantly enlarged */} - - {/* Color refraction lines - adjusted for new size */} - - {/* Circular highlight - adjusted position and size */} = ({ items }) => { +const TopNavbar: React.FC = ({ items, session }) => { + const segment = useSelectedLayoutSegment(); return ( -
-
-
- - - - {siteConfig.name} - - -
+
+
+
+
+ + + + {siteConfig.name} + + - {/* */} + {items?.length ? ( + + ) : null} +
+
+
+
+
+
+ +
+
+
+
+
+ Mobile menu +
+
+ +
- +
); }; diff --git a/src/components/pages/landing-page.tsx b/src/components/pages/landing-page.tsx index 8886c1f..b58d3cb 100644 --- a/src/components/pages/landing-page.tsx +++ b/src/components/pages/landing-page.tsx @@ -3,11 +3,11 @@ import React from "react"; const LandingPage: React.FC = () => { return (
-

- Warning contains Gifs -

-
- Sign In +
+

+ Warning contains{" "} + Gifs +

); diff --git a/src/components/trending-images.tsx b/src/components/trending-images.tsx index f99ab54..2429f78 100644 --- a/src/components/trending-images.tsx +++ b/src/components/trending-images.tsx @@ -21,28 +21,21 @@ export function TrendingImages() { {latestPost ? (

Your most recent post: {latestPost.name}

) : ( -

You have no posts yet.

+

No images yet.

)}
{ e.preventDefault(); createPost.mutate({ name }); }} - className="flex flex-col gap-2" + className="flex flex-col gap-2 my-4" > - setName(e.target.value)} - className="w-full rounded-full px-4 py-2 text-black" - />
diff --git a/src/components/widgets/CopyTextInput.tsx b/src/components/widgets/copy-text-input.tsx similarity index 100% rename from src/components/widgets/CopyTextInput.tsx rename to src/components/widgets/copy-text-input.tsx diff --git a/src/components/widgets/GifContainer.tsx b/src/components/widgets/gif-container.tsx similarity index 100% rename from src/components/widgets/GifContainer.tsx rename to src/components/widgets/gif-container.tsx diff --git a/src/components/widgets/ImageUpload.tsx b/src/components/widgets/image-upload.tsx similarity index 100% rename from src/components/widgets/ImageUpload.tsx rename to src/components/widgets/image-upload.tsx diff --git a/src/components/widgets/Loading.tsx b/src/components/widgets/loading.tsx similarity index 100% rename from src/components/widgets/Loading.tsx rename to src/components/widgets/loading.tsx diff --git a/src/components/widgets/login/LoginButton.tsx b/src/components/widgets/login/login-button.tsx similarity index 52% rename from src/components/widgets/login/LoginButton.tsx rename to src/components/widgets/login/login-button.tsx index 3102993..6ca06fa 100644 --- a/src/components/widgets/login/LoginButton.tsx +++ b/src/components/widgets/login/login-button.tsx @@ -3,23 +3,23 @@ import React from "react"; import { signIn } from "next-auth/react"; import { RiLoginCircleLine } from "react-icons/ri"; -import UserNavDropdown from "../UserNavDropdown"; +import UserNavDropdown from "../user-nav-dropdown"; +import { type Session } from "next-auth"; +import { Button } from "@/components/ui/button"; +import { Icons } from "@/components/icons"; interface ILoginButtonProps { - session: any; + session: Session | null; } const LoginButton: React.FC = ({ session }) => { return session ? ( ) : ( - + ); }; diff --git a/src/components/widgets/login/SocialLogin.tsx b/src/components/widgets/login/social-login-button.tsx similarity index 100% rename from src/components/widgets/login/SocialLogin.tsx rename to src/components/widgets/login/social-login-button.tsx diff --git a/src/components/widgets/TaggedInput.tsx b/src/components/widgets/tagged-input.tsx similarity index 100% rename from src/components/widgets/TaggedInput.tsx rename to src/components/widgets/tagged-input.tsx diff --git a/src/components/widgets/UserNavDropdown.tsx b/src/components/widgets/user-nav-dropdown.tsx similarity index 64% rename from src/components/widgets/UserNavDropdown.tsx rename to src/components/widgets/user-nav-dropdown.tsx index 3f32092..119c9ab 100644 --- a/src/components/widgets/UserNavDropdown.tsx +++ b/src/components/widgets/user-nav-dropdown.tsx @@ -1,28 +1,25 @@ -'use client'; -import { logger } from '@lib/logger'; -import React, { Fragment } from 'react'; -import { Menu, Transition } from '@headlessui/react'; -import { signOut } from 'next-auth/react'; +"use client"; +import React, { Fragment } from "react"; +import { Menu, Transition } from "@headlessui/react"; +import { signOut } from "next-auth/react"; +import { logger } from "@/lib/logger"; interface IUserNavDropdownProps { session: any; } const UserNavDropdown: React.FC = ({ session }) => { React.useEffect(() => { - logger.debug('UserNavDropdown', 'session', session); + logger.debug("UserNavDropdown", "session", session); }, [session]); return (
- +
- + Open user menu Profile image @@ -37,7 +34,7 @@ const UserNavDropdown: React.FC = ({ session }) => { leaveFrom="transform opacity-100 scale-100" leaveTo="transform opacity-0 scale-95" > - + {({ active }) => (