Skip to content

Commit

Permalink
Merge pull request #9 from ItaloMedici/release/1.0.0
Browse files Browse the repository at this point in the history
Release/1.0.0
  • Loading branch information
ItaloMedici authored Jul 20, 2024
2 parents aaf187c + b5aa622 commit 1c156bb
Show file tree
Hide file tree
Showing 37 changed files with 472 additions and 96 deletions.
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions .github/workflows/release-it.yml
Original file line number Diff line number Diff line change
@@ -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 }}
24 changes: 24 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
4 changes: 2 additions & 2 deletions app/(dashboard)/(home)/_components/create-room-form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { toast } from "@/components/toast";
import { Button } from "@/components/ui/button";
import {
Form,
Expand All @@ -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();
Expand All @@ -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", {
Expand Down
2 changes: 1 addition & 1 deletion app/(dashboard)/(home)/_components/nav-bar.tsx
Original file line number Diff line number Diff line change
@@ -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"] });

Expand Down
10 changes: 5 additions & 5 deletions app/(dashboard)/(home)/_components/room-card.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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();
Expand Down Expand Up @@ -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();
});
};

Expand All @@ -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"
/>
</div>
<Actions
<RoomActions
id={room.id}
name={room.name}
roomOwnerEmail={room.ownerEmail}
Expand All @@ -64,7 +64,7 @@ export function RoomCard({ room }: { room: Room }) {
<button className="absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity outline-none px-2 py-2 bg-black/25 rounded-sm">
<MoreHorizontal className="text-white w-4 h-4" />
</button>
</Actions>
</RoomActions>
<button
className={cn(
"absolute top-1 left-1 transition-opacity outline-none bg-black/10 px-2 py-2 rounded-sm",
Expand Down
31 changes: 31 additions & 0 deletions app/(dashboard)/(home)/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use client";

import { Button, buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import Link from "next/link";
import { useEffect } from "react";

export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error(error);
}, [error]);

return (
<div className="mx-auto w-6/12 flex flex-col items-center space-y-4 p-6 rounded-lg border border-gray-200">
<span className="text-4xl w-full text-center">🙁</span>
<h2 className="text-lg font-semibold">Eita não! Algo deu errado.</h2>
<Button className="w-full" variant={"secondary"} onClick={() => reset()}>
Tente novamente
</Button>
<Link href={"/"} className={cn(buttonVariants({ variant: "link" }))}>
Voltar
</Link>
</div>
);
}
File renamed without changes.
2 changes: 0 additions & 2 deletions app/(dashboard)/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ async function DashBoardPage({
user: session.user,
});

console.log(rooms);

return (
<div className="space-y-10">
<DashboardFilters />
Expand Down
18 changes: 13 additions & 5 deletions app/(dashboard)/room/[roomId]/_components/board-navbar.tsx
Original file line number Diff line number Diff line change
@@ -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 }>();
Expand All @@ -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 (
<nav className="fixed top-0 right-0 left-0 max-w-screen-lg">
<div className="flex items-center justify-between p-4 mx-auto">
<Link className={buttonVariants({ variant: "ghost" })} href={"/"}>
<nav className="fixed top-0 right-0 left-0 mx-auto">
<div className="flex items-center justify-end p-4 gap-6 mx-auto">
<Link
className={cn(buttonVariants({ variant: "ghost" }), "mr-auto")}
href={"/"}
>
<ChevronLeft className="w-4 h-4 mr-2" />
Voltar
</Link>
Expand All @@ -51,6 +58,7 @@ export const BoardNavbar = () => {
<Icon className="w-4 h-4 mr-2" />
Convidar jogadores
</Button>
<UserButton />
</div>
</nav>
);
Expand Down
18 changes: 16 additions & 2 deletions app/(dashboard)/room/[roomId]/_components/players-cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useBoard } from "@/context/board";
import { PlayerCard } from "./player-card";

export const PlayersCards = () => {
const { others, self, handleRevealCards, revealCards } = useBoard();
const { others, self, handleRevealCards, revealCards, handleReset } =
useBoard();

const players = [self, ...others];

Expand All @@ -16,16 +17,29 @@ export const PlayersCards = () => {
);
}

const onRevealClick = () => {
if (revealCards) {
handleReset();
}
handleRevealCards();
};

return (
<div className="flex flex-col gap-6">
<div className="flex items-center justify-center flex-wrap gap-4">
{players.map((player) => (
<PlayerCard key={player.id} player={player} />
))}
</div>
<Button onClick={handleRevealCards}>
{/* <div className="flex items-center gap-2"> */}
<Button onClick={onRevealClick}>
{revealCards ? "Iniciar outro jogo" : "Revelar cartas 👀"}
</Button>

{/* </div> */}
<Button variant={"ghost"} onClick={handleReset}>
Limpar
</Button>
</div>
);
};
29 changes: 2 additions & 27 deletions app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
import { env } from "@/env";
import NextAuth, { AuthOptions } from "next-auth";
import GoogleProvider from "next-auth/providers/google";

export const authOptions: AuthOptions = {
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
],
pages: {
signIn: "/login",
},
callbacks: {
async jwt({ token, account }) {
if (account) {
token.accessToken = account.access_token;
}
return token;
},
async session({ session, token, user }) {
(session as any).accessToken = token.accessToken;
return session;
},
},
};
import { authOptions } from "@/authOptions";
import NextAuth from "next-auth";

const handler = NextAuth(authOptions);

Expand Down
2 changes: 1 addition & 1 deletion app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Toaster } from "@/components/ui/sonner";
import { SessionProvider } from "next-auth/react";
import { Toaster } from "sonner";

export function Providers({
children,
Expand Down
Loading

0 comments on commit 1c156bb

Please sign in to comment.