diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..025bea8 --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +NEXTAUTH_URL=http://localhost:3000 +NEXTAUTH_SECRET=SOME_RANDOM_SECRET + +DATABASE_URL="DATABASE_URL" + +NEXT_PUBLIC_SITE_URL=http://localhost:3000 + +GOOGLE_CLIENT_ID=GOOGLE_CLIENT_ID +GOOGLE_CLIENT_SECRET=GOOGLE_CLIENT_SECRET + +MAXIMUM_PLAYERS_PER_BOARD=99999 \ No newline at end of file diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml new file mode 100644 index 0000000..9e36997 --- /dev/null +++ b/.github/workflows/build-lint-test.yml @@ -0,0 +1,28 @@ +name: Build, Lint and Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run lint + run: npm run lint + + - name: Setup Environment + run: cp .env.example .env + + - name: Build + run: npm run build --if-present diff --git a/.github/workflows/release-it.yml b/.github/workflows/release-it.yml new file mode 100644 index 0000000..e81048f --- /dev/null +++ b/.github/workflows/release-it.yml @@ -0,0 +1,29 @@ +name: Release It + +on: workflow_dispatch + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'npm' + + - name: git config + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + + - name: Release + run: npm install --global release-it @release-it/conventional-changelog && release-it + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 0000000..e6e7dec --- /dev/null +++ b/.release-it.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://unpkg.com/release-it@17/schema/release-it.json", + "git": { + "commitMessage": "chore(release): v${version}", + "tagName": "v${version}", + "requireCommits": true + }, + "github": { + "release": true, + "releaseName": "v${version}", + "releaseNotes": { + "filePath": "CHANGELOG.md" + } + }, + "npm": { + "publish": false + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": "angular", + "infile": "CHANGELOG.md" + } + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c80a575 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,42 @@ + + +# 0.2.0 (2024-07-20) + + +### Features + +* add creation time ([796b3dd](https://github.com/ItaloMedici/pontim/commit/796b3dd157a7051f99e89c66385c7ae0e7d2fcc7)) +* add dashboard page ([4cd9459](https://github.com/ItaloMedici/pontim/commit/4cd9459ecd5210b0a1a6f420e97fb5a60d2e3be0)) +* add email to player schema ([7d489d0](https://github.com/ItaloMedici/pontim/commit/7d489d054f41d3e7e236af3e02105e9ffcbc19e3)) +* add empty message ([79edbcd](https://github.com/ItaloMedici/pontim/commit/79edbcdc7e36eac622c05b07e47ec9e77c8aa862)) +* add labels and skeleton to room card ([5a63c0c](https://github.com/ItaloMedici/pontim/commit/5a63c0cf484dc17ab614f55a26b8fee1f6dffe86)) +* add shadcn ui components ([160102f](https://github.com/ItaloMedici/pontim/commit/160102f1c056f68ed08c572b3e6576d53fac7c48)) +* add skeleton while rooms are loaded ([96daa7b](https://github.com/ItaloMedici/pontim/commit/96daa7b93524db5cd927d4a1c687770fe8018030)) +* add user button on board navbar ([c758f06](https://github.com/ItaloMedici/pontim/commit/c758f0640133479b97fbd8dfb2594cd55b7fd41e)) +* copy invite link in room actions ([22979ee](https://github.com/ItaloMedici/pontim/commit/22979ee4250c96258a70c6e58310c3d2ffa5148d)) +* create auth component ([c64a91f](https://github.com/ItaloMedici/pontim/commit/c64a91ff7ddc896949af968355ebcc58fa055a1e)) +* create convex client provider ([95a0330](https://github.com/ItaloMedici/pontim/commit/95a0330f87cba0e5d891e83e0628196e5e9abc37)) +* create error page ([ea20534](https://github.com/ItaloMedici/pontim/commit/ea205345d692f43460513d7044161e2597f4d232)) +* create home page ([7c6ae3c](https://github.com/ItaloMedici/pontim/commit/7c6ae3c27097766b18996880dd7c774b0edb67c3)) +* create http handler ([b640313](https://github.com/ItaloMedici/pontim/commit/b640313789ba424ab5c41249dc0998900fb471c7)) +* create invite page ([3b7789f](https://github.com/ItaloMedici/pontim/commit/3b7789f6efc13e98fa45efed62f4fdb9fa79a132)) +* create make choice endpoint ([9918813](https://github.com/ItaloMedici/pontim/commit/9918813a4ff2e441033487ec6208d7ee98af0bbe)) +* create middleware ([9295f00](https://github.com/ItaloMedici/pontim/commit/9295f0041c593e43be6da947d5acf79ce1d5b988)) +* create reset board event ([59639ff](https://github.com/ItaloMedici/pontim/commit/59639ff5ef682d32d5ea7f22a48c7c91d8a9f5b8)) +* create reveal cards endpoint ([c988d12](https://github.com/ItaloMedici/pontim/commit/c988d124071929bb52d4eab3ffbb88ce991f0f91)) +* create reveal cards event ([77e646e](https://github.com/ItaloMedici/pontim/commit/77e646e82e9c9516528adf3a8955b12db56ddd2b)) +* create schemas and validators ([bf333ed](https://github.com/ItaloMedici/pontim/commit/bf333ed1f063893dc92883ee421c40abedc42eef)) +* create search and favorite ([536edd5](https://github.com/ItaloMedici/pontim/commit/536edd52c3866208c1ded7af3c29d3329973990a)) +* create search params constant ([8e8618d](https://github.com/ItaloMedici/pontim/commit/8e8618dfe6baaad9c1d9e77b5992f56c3e7a8e54)) +* create use api mutation hook ([2fd5cef](https://github.com/ItaloMedici/pontim/commit/2fd5cef5d1e6c67d205c2fafc030f6822b1fa9d9)) +* create user schema ([e382563](https://github.com/ItaloMedici/pontim/commit/e382563a24ff9b0a95d77257e514ddf2f43008ca)) +* disconnect user on timeout ([41873a5](https://github.com/ItaloMedici/pontim/commit/41873a56e3d1282c1b84bd346eda2d58ed59115d)) +* hide players choice until reveal event ([db19ca4](https://github.com/ItaloMedici/pontim/commit/db19ca415a5c51f988d287b2d634ca2e8cd50133)) +* implementing board rules ([999979d](https://github.com/ItaloMedici/pontim/commit/999979dad3a3fd48ecbd94ee4e623cbd8e8b2c74)) +* implements sonner toast ([6ab3dc6](https://github.com/ItaloMedici/pontim/commit/6ab3dc6a4555a07d8a536b6a09d6c4ce996d7292)) +* init board page ([0ae169c](https://github.com/ItaloMedici/pontim/commit/0ae169c756c1d6c8015eb329eab37bf645749597)) +* redirect to room page ([da6c1a0](https://github.com/ItaloMedici/pontim/commit/da6c1a0e04db47a929cce1dd749f8fa4afb7daca)) +* redirect user when room is created ([fd93d2e](https://github.com/ItaloMedici/pontim/commit/fd93d2eb379cf0d1128c141cf75a9dcd09394ee9)) +* setup convex ([39be99a](https://github.com/ItaloMedici/pontim/commit/39be99afebb7627f8d4032b09df608a7b4656a6b)) +* setup next-auth ([ed00c0b](https://github.com/ItaloMedici/pontim/commit/ed00c0b2e05824fe75cf085ae7468b4754ff9c1a)) +* setup prisma ([ca74daf](https://github.com/ItaloMedici/pontim/commit/ca74daf99a1bc645bfc4ed0c10db6163877e3ab4)) diff --git a/app/(dashboard)/(home)/_components/create-room-form.tsx b/app/(dashboard)/(home)/_components/create-room-form.tsx index 24ee9f8..de9b9fa 100644 --- a/app/(dashboard)/(home)/_components/create-room-form.tsx +++ b/app/(dashboard)/(home)/_components/create-room-form.tsx @@ -1,5 +1,6 @@ "use client"; +import { toast } from "@/components/toast"; import { Button } from "@/components/ui/button"; import { Form, @@ -17,7 +18,6 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; import { useForm } from "react-hook-form"; -import { toast } from "sonner"; export function CreateRoomForm() { const router = useRouter(); @@ -43,7 +43,7 @@ export function CreateRoomForm() { toast.success("Sala criada com sucesso!", { icon: "🥳", }); - // router.push(`/room/${room}`); + router.push(`/room/${room.id}`); }) .catch(() => { toast.error("Algo deu errado ao criar a sala", { diff --git a/app/(dashboard)/(home)/_components/nav-bar.tsx b/app/(dashboard)/(home)/_components/nav-bar.tsx index 7efeabd..65b4d3f 100644 --- a/app/(dashboard)/(home)/_components/nav-bar.tsx +++ b/app/(dashboard)/(home)/_components/nav-bar.tsx @@ -1,8 +1,8 @@ +import { UserButton } from "@/components/user-button"; import { cn } from "@/lib/utils"; import { Poppins } from "next/font/google"; import Image from "next/image"; import Link from "next/link"; -import { UserButton } from "./user-buttom"; const poppins = Poppins({ subsets: ["latin"], weight: ["600"] }); diff --git a/app/(dashboard)/(home)/_components/room-card.tsx b/app/(dashboard)/(home)/_components/room-card.tsx index f738ffc..adc2895 100644 --- a/app/(dashboard)/(home)/_components/room-card.tsx +++ b/app/(dashboard)/(home)/_components/room-card.tsx @@ -1,6 +1,7 @@ "use client"; -import { Actions } from "@/components/actions"; +import { RoomActions } from "@/components/room-actions"; +import { toast } from "@/components/toast"; import { Skeleton } from "@/components/ui/skeleton"; import { useAction } from "@/hooks/use-action"; import { Room } from "@/lib/schemas/room"; @@ -11,7 +12,6 @@ import { ptBR } from "date-fns/locale"; import { MoreHorizontal, Star } from "lucide-react"; import { useSession } from "next-auth/react"; import Image from "next/image"; -import { toast } from "sonner"; export function RoomCard({ room }: { room: Room }) { const { data } = useSession(); @@ -40,7 +40,7 @@ export function RoomCard({ room }: { room: Room }) { favorite: !room.favorite, user: data?.user, }).catch(() => { - toast.error("Ops, algo deu errado", { icon: "🚨" }); + toast.error(); }); }; @@ -55,7 +55,7 @@ export function RoomCard({ room }: { room: Room }) { className="h-[100px] w-full object-cover group-hover:blur-sm group-hover:scale-105 group-hover:brightness-95 transition-all" /> - - + + + Voltar + + + ); +} diff --git a/app/(dashboard)/invite/page.tsx b/app/(dashboard)/(home)/invite/page.tsx similarity index 100% rename from app/(dashboard)/invite/page.tsx rename to app/(dashboard)/(home)/invite/page.tsx diff --git a/app/(dashboard)/(home)/page.tsx b/app/(dashboard)/(home)/page.tsx index 295f821..617f555 100644 --- a/app/(dashboard)/(home)/page.tsx +++ b/app/(dashboard)/(home)/page.tsx @@ -23,8 +23,6 @@ async function DashBoardPage({ user: session.user, }); - console.log(rooms); - return (
diff --git a/app/(dashboard)/room/[roomId]/_components/board-navbar.tsx b/app/(dashboard)/room/[roomId]/_components/board-navbar.tsx index 799ddd4..79ec12a 100644 --- a/app/(dashboard)/room/[roomId]/_components/board-navbar.tsx +++ b/app/(dashboard)/room/[roomId]/_components/board-navbar.tsx @@ -1,12 +1,14 @@ "use client"; +import { toast } from "@/components/toast"; import { Button, buttonVariants } from "@/components/ui/button"; +import { UserButton } from "@/components/user-button"; +import { cn } from "@/lib/utils"; import { buildInviteUrl } from "@/use-cases/invite/build-invite-url"; import { CheckIcon, ChevronLeft, PlusIcon } from "lucide-react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { useEffect, useState } from "react"; -import { toast } from "sonner"; export const BoardNavbar = () => { const params = useParams<{ roomId: string }>(); @@ -30,15 +32,20 @@ export const BoardNavbar = () => { setCopiedInvite(true); - toast("Link de convite copiado para a área de transferência 🚀"); + toast("Link de convite copiado para a área de transferência", { + icon: "📋", + }); }; const Icon = copiedInvite ? CheckIcon : PlusIcon; return ( -