From 6acf6e8635325774c6e1defce852c2d8f699ffd6 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 19 Oct 2023 05:21:35 +0100 Subject: [PATCH] first commit --- .env-example | 3 + next.config.js | 15 +- package-lock.json | 113 +- package.json | 24 +- prettier.config.js | 3 + src/app/api/player/add/route.ts | 18 + src/app/api/trigger/route.ts | 7 + src/app/layout.tsx | 20 +- src/app/page.tsx | 113 -- src/app/search/page.tsx | 45 + src/components/Avatar.tsx | 27 + src/components/Button.tsx | 24 + src/components/Container.tsx | 12 + src/components/Navbar.tsx | 73 + src/jobs/index.ts | 3 + src/jobs/setupUser.ts | 16 + src/middleware.ts | 13 + src/trigger.ts | 7 + tailwind.config.ts | 24 +- yarn.lock | 2672 +++++++++++++++++++++++++++++++ 20 files changed, 3089 insertions(+), 143 deletions(-) create mode 100644 .env-example create mode 100644 prettier.config.js create mode 100644 src/app/api/player/add/route.ts create mode 100644 src/app/api/trigger/route.ts delete mode 100644 src/app/page.tsx create mode 100644 src/app/search/page.tsx create mode 100644 src/components/Avatar.tsx create mode 100644 src/components/Button.tsx create mode 100644 src/components/Container.tsx create mode 100644 src/components/Navbar.tsx create mode 100644 src/jobs/index.ts create mode 100644 src/jobs/setupUser.ts create mode 100644 src/middleware.ts create mode 100644 src/trigger.ts create mode 100644 yarn.lock diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..c64db44 --- /dev/null +++ b/.env-example @@ -0,0 +1,3 @@ +TRIGGER_API_KEY=set me +TRIGGER_API_URL=https://trigger.example.com +NEXT_PUBLIC_TRIGGER_PUBLIC_API_KEY=set me \ No newline at end of file diff --git a/next.config.js b/next.config.js index 767719f..ab3fce1 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,15 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {} +const nextConfig = { + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "cdn.fascinated.cc", + port: "", + pathname: "/**", + }, + ], + }, +}; -module.exports = nextConfig +module.exports = nextConfig; diff --git a/package-lock.json b/package-lock.json index 03b9dcc..1fd1d81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,8 @@ "name": "scoresaber-reloadedv2", "version": "0.1.0", "dependencies": { + "@heroicons/react": "^2.0.18", + "clsx": "^2.0.0", "next": "13.5.5", "react": "^18", "react-dom": "^18" @@ -16,11 +18,13 @@ "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", - "autoprefixer": "^10", + "autoprefixer": "^10.4.16", "eslint": "^8", "eslint-config-next": "13.5.5", - "postcss": "^8", - "tailwindcss": "^3", + "postcss": "^8.4.31", + "prettier": "^3.0.3", + "prettier-plugin-tailwindcss": "^0.5.6", + "tailwindcss": "^3.3.3", "typescript": "^5" } }, @@ -113,6 +117,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@heroicons/react": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz", + "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==", + "peerDependencies": { + "react": ">= 16" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -1044,6 +1056,14 @@ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, + "node_modules/clsx": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.0.0.tgz", + "integrity": "sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==", + "engines": { + "node": ">=6" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -3362,6 +3382,93 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-tailwindcss": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.6.tgz", + "integrity": "sha512-2Xgb+GQlkPAUCFi3sV+NOYcSI5XgduvDBL2Zt/hwJudeKXkyvRS65c38SB0yb9UB40+1rL83I6m0RtlOQ8eHdg==", + "dev": true, + "engines": { + "node": ">=14.21.3" + }, + "peerDependencies": { + "@ianvs/prettier-plugin-sort-imports": "*", + "@prettier/plugin-pug": "*", + "@shopify/prettier-plugin-liquid": "*", + "@shufo/prettier-plugin-blade": "*", + "@trivago/prettier-plugin-sort-imports": "*", + "prettier": "^3.0", + "prettier-plugin-astro": "*", + "prettier-plugin-css-order": "*", + "prettier-plugin-import-sort": "*", + "prettier-plugin-jsdoc": "*", + "prettier-plugin-organize-attributes": "*", + "prettier-plugin-organize-imports": "*", + "prettier-plugin-style-order": "*", + "prettier-plugin-svelte": "*" + }, + "peerDependenciesMeta": { + "@ianvs/prettier-plugin-sort-imports": { + "optional": true + }, + "@prettier/plugin-pug": { + "optional": true + }, + "@shopify/prettier-plugin-liquid": { + "optional": true + }, + "@shufo/prettier-plugin-blade": { + "optional": true + }, + "@trivago/prettier-plugin-sort-imports": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + }, + "prettier-plugin-css-order": { + "optional": true + }, + "prettier-plugin-import-sort": { + "optional": true + }, + "prettier-plugin-jsdoc": { + "optional": true + }, + "prettier-plugin-marko": { + "optional": true + }, + "prettier-plugin-organize-attributes": { + "optional": true + }, + "prettier-plugin-organize-imports": { + "optional": true + }, + "prettier-plugin-style-order": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "prettier-plugin-twig-melody": { + "optional": true + } + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", diff --git a/package.json b/package.json index 2fb381b..cd018f5 100644 --- a/package.json +++ b/package.json @@ -9,19 +9,29 @@ "lint": "next lint" }, "dependencies": { + "@heroicons/react": "^2.0.18", + "clsx": "^2.0.0", + "next": "13.5.5", "react": "^18", "react-dom": "^18", - "next": "13.5.5" + "@trigger.dev/sdk": "^2.2.0", + "@trigger.dev/nextjs": "^2.2.0", + "@trigger.dev/react": "^2.2.0" }, "devDependencies": { - "typescript": "^5", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", - "autoprefixer": "^10", - "postcss": "^8", - "tailwindcss": "^3", + "autoprefixer": "^10.4.16", "eslint": "^8", - "eslint-config-next": "13.5.5" + "eslint-config-next": "13.5.5", + "postcss": "^8.4.31", + "prettier": "^3.0.3", + "prettier-plugin-tailwindcss": "^0.5.6", + "tailwindcss": "^3.3.3", + "typescript": "^5" + }, + "trigger.dev": { + "endpointId": "scoresaber-reloaded-3SPH" } -} +} \ No newline at end of file diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..d573118 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["prettier-plugin-tailwindcss"], +}; diff --git a/src/app/api/player/add/route.ts b/src/app/api/player/add/route.ts new file mode 100644 index 0000000..b6097ed --- /dev/null +++ b/src/app/api/player/add/route.ts @@ -0,0 +1,18 @@ +import { triggerClient } from "@/trigger"; + +export async function GET(request: Request) { + const { searchParams } = new URL(request.url); + const id = searchParams.get("id"); + if (!id) { + return Response.json({ message: "No player provided" }); + } + + triggerClient.sendEvent({ + name: "user.add", + payload: { + id: id, + }, + }); + + return Response.json({ message: "Hello from Next.js!" }); +} diff --git a/src/app/api/trigger/route.ts b/src/app/api/trigger/route.ts new file mode 100644 index 0000000..f5da304 --- /dev/null +++ b/src/app/api/trigger/route.ts @@ -0,0 +1,7 @@ +import { triggerClient } from "@/trigger"; +import { createAppRoute } from "@trigger.dev/nextjs"; + +import "@/jobs"; + +//this route is used to send and receive data with Trigger.dev +export const { POST, dynamic } = createAppRoute(triggerClient); diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 40e027f..844b1aa 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,22 +1,24 @@ -import type { Metadata } from 'next' -import { Inter } from 'next/font/google' -import './globals.css' +import type { Metadata } from "next"; +import { Inter } from "next/font/google"; +import "./globals.css"; -const inter = Inter({ subsets: ['latin'] }) +const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', -} + title: { + template: "Scoresaber Reloaded - %s", + default: "Scoresaber Reloaded", + }, +}; export default function RootLayout({ children, }: { - children: React.ReactNode + children: React.ReactNode; }) { return ( {children} - ) + ); } diff --git a/src/app/page.tsx b/src/app/page.tsx deleted file mode 100644 index e38c626..0000000 --- a/src/app/page.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import Image from 'next/image' - -export default function Home() { - return ( -
-
-

- Get started by editing  - src/app/page.tsx -

-
- - By{' '} - Vercel Logo - -
-
- -
- Next.js Logo -
- -
- -

- Docs{' '} - - -> - -

-

- Find in-depth information about Next.js features and API. -

-
- - -

- Learn{' '} - - -> - -

-

- Learn about Next.js in an interactive course with quizzes! -

-
- - -

- Templates{' '} - - -> - -

-

- Explore the Next.js 13 playground. -

-
- - -

- Deploy{' '} - - -> - -

-

- Instantly deploy your Next.js site to a shareable URL with Vercel. -

-
-
-
- ) -} diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx new file mode 100644 index 0000000..3809eef --- /dev/null +++ b/src/app/search/page.tsx @@ -0,0 +1,45 @@ +import Avatar from "@/components/Avatar"; +import Container from "@/components/Container"; +import { MagnifyingGlassIcon } from "@heroicons/react/24/solid"; + +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: "Search", +}; + +export default function Home() { + return ( +
+ +
+ + +

Stranger

+

Find a player profile

+ +
+ + +
+ +
+
+
+
+ ); +} diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx new file mode 100644 index 0000000..705f9e0 --- /dev/null +++ b/src/components/Avatar.tsx @@ -0,0 +1,27 @@ +import clsx from "clsx"; +import Image from "next/image"; + +interface AvatarProps { + label: string; + url: string; + className: string; +} + +export default function Avatar({ + label = "Avatar", + url, + className, +}: AvatarProps) { + return ( + <> + {label} + + ); +} diff --git a/src/components/Button.tsx b/src/components/Button.tsx new file mode 100644 index 0000000..edefd6e --- /dev/null +++ b/src/components/Button.tsx @@ -0,0 +1,24 @@ +import clsx from "clsx"; + +interface ButtonProps { + text: string; + url: string; + icon?: JSX.Element; + className?: string; +} + +export default function Button({ text, url, icon, className }: ButtonProps) { + return ( + +

+ {icon} + {text} +

+
+ ); +} diff --git a/src/components/Container.tsx b/src/components/Container.tsx new file mode 100644 index 0000000..350ea54 --- /dev/null +++ b/src/components/Container.tsx @@ -0,0 +1,12 @@ +import Navbar from "./Navbar"; + +export default function Container({ children }: { children: React.ReactNode }) { + return ( + <> +
+ + {children} +
+ + ); +} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx new file mode 100644 index 0000000..ca69f8b --- /dev/null +++ b/src/components/Navbar.tsx @@ -0,0 +1,73 @@ +import { + CogIcon, + MagnifyingGlassIcon, + UserIcon, +} from "@heroicons/react/20/solid"; +import { GlobeAltIcon } from "@heroicons/react/24/outline"; +import Button from "./Button"; + +interface ButtonProps { + text: string; + icon?: JSX.Element; + href?: string; + children?: React.ReactNode; +} + +function NavbarButton({ text, icon, href, children }: ButtonProps) { + return ( +
+ + <> + {icon} +

{text}

+ +
+ + {children && ( +
+
{children}
+
+ )} +
+ ); +} + +export default function Navbar() { + return ( + <> +
+ }> +

No friends, add someone!

+ +