Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Upgrade Packages and Add Video to Homepage #116

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@
"test:e2e": "playwright test"
},
"dependencies": {
"@auth/drizzle-adapter": "^0.3.3",
"@sentry/nextjs": "^7.73.0",
"@tanstack/react-query": "^4.36.1",
"@auth/drizzle-adapter": "^0.3.6",
"@sentry/nextjs": "^7.80.1",
"@tanstack/react-query": "^5.8.4",
"@upstash/ratelimit": "^0.4.4",
"@upstash/redis": "^1.23.3",
"@vercel/analytics": "^1.1.0",
"@upstash/redis": "^1.25.1",
"@vercel/analytics": "^1.1.1",
"@xstate/react": "^3.2.2",
"autoprefixer": "10.4.16",
"clsx": "^2.0.0",
"database": "workspace:*",
"drizzle-orm": "^0.28.6",
"framer-motion": "^10.16.4",
"next": "^13.5.4",
"next-auth": "^4.23.2",
"drizzle-orm": "^0.29.0",
"framer-motion": "^10.16.5",
"next": "^14.0.2",
"next-auth": "^4.24.5",
"postcss": "8.4.31",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.11.0",
"react-icons": "^4.12.0",
"server-only": "^0.0.1",
"sharp": "^0.32.6",
"socket.io-client": "^4.7.2",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.3",
"tailwind-merge": "^2.0.0",
"tailwindcss": "^3.3.5",
"typescript": "5.2.2",
"use-sound": "^4.0.1",
"xstate": "^4.38.2"
"xstate": "^4.38.3"
},
"devDependencies": {
"@playwright/test": "^1.39.0",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@types/node": "^20.9.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"eslint-config-custom": "workspace:*",
"prettier-plugin-tailwindcss": "^0.5.5",
"prettier-plugin-tailwindcss": "^0.5.7",
"tsconfig": "workspace:*"
},
"engines": {
"node": "18"
},
"optionalDependencies": {
"bufferutil": "^4.0.7",
"bufferutil": "^4.0.8",
"utf-8-validate": "^6.0.3"
}
}
18 changes: 14 additions & 4 deletions apps/client/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default async function Home() {
return (
<>
<Header session={session} />
<main className="relative flex min-h-[100dvh] flex-col justify-center">
<section className="container mx-auto flex flex-col-reverse items-start justify-center gap-8 px-4 lg:flex-row lg:items-center lg:gap-24">
<main className="relative">
<section className="container mx-auto flex min-h-[100dvh] flex-col-reverse items-start justify-center gap-8 px-4 md:items-center lg:flex-row lg:gap-24">
{runningGame && (
<div className=" absolute left-1/2 top-16 mx-auto w-full -translate-x-1/2 sm:top-8">
<LinkSecondaryButton
Expand All @@ -40,13 +40,23 @@ export default async function Home() {
)}
<div>
<p className="mb-2">The AI Image Party Game</p>
<h1 className="mb-8 text-4xl md:text-6xl">
<h1 className="mb-8 text-4xl md:text-5xl lg:text-6xl">
artif<span className="ml-0.5 inline-block">i</span>cial <br />{" "}
unintelligence
</h1>
<SignInForm session={session} submitLabel="Host Game" type="HOME" />
</div>
<Friend className="w-32 scale-x-[-1] transform lg:w-1/4 lg:scale-x-100" />
<div className="group relative">
<Friend className="absolute right-8 w-32 transform transition group-focus-within:-translate-y-16 group-hover:-translate-y-16" />
<video
src="/artificial-unintelligence-promo.mp4"
controls
autoPlay
muted
playsInline
className="relative aspect-video w-full max-w-md rounded-2xl shadow-2xl shadow-indigo-500 lg:max-w-full"
/>
</div>
</section>
</main>
<Footer />
Expand Down
38 changes: 17 additions & 21 deletions apps/client/src/app/room/[code]/game/[gameId]/game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,23 @@ export default function Game({ gameInfo, session }: GameProps) {

const gameId = gameInfo.game.id;
const round = state.context.round;
const { data: faceOffs, isLoading: faceOffsLoading } = useQuery(
["faceOffs", "gameId", gameId, "round", round],
() => getFaceOffs({ gameId, round }),
{
enabled:
!!gameId &&
!!round &&
(state.matches("faceOff") || state.matches("faceOffResults")),
},
);
const { data: leaderboard } = useQuery(
["leaderboard", "gameId", gameId],
() => getLeaderboardById({ gameId }),
{
enabled:
!!gameId &&
(state.matches("winnerLeadUp") ||
state.matches("winner") ||
state.matches("leaderboard")),
},
);
const { data: faceOffs, isLoading: faceOffsLoading } = useQuery({
queryKey: ["faceOffs", "gameId", gameId, "round", round],
queryFn: () => getFaceOffs({ gameId, round }),
enabled:
!!gameId &&
!!round &&
(state.matches("faceOff") || state.matches("faceOffResults")),
});
const { data: leaderboard } = useQuery({
queryKey: ["leaderboard", "gameId", gameId],
queryFn: () => getLeaderboardById({ gameId }),
enabled:
!!gameId &&
(state.matches("winnerLeadUp") ||
state.matches("winner") ||
state.matches("leaderboard")),
});

const currFaceOffQuestion =
!faceOffsLoading && faceOffs && faceOffs.length > 0
Expand Down
22 changes: 11 additions & 11 deletions apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org alexander-grattan --project artificial-unintelligence-server ./dist && sentry-cli sourcemaps upload --org alexander-grattan --project artificial-unintelligence-server ./dist"
},
"dependencies": {
"@sentry/node": "^7.73.0",
"@sentry/node": "^7.80.1",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"database": "workspace:*",
"dotenv": "^16.3.1",
"drizzle-orm": "^0.28.6",
"drizzle-orm": "^0.29.0",
"express": "^4.18.2",
"helmet": "^7.0.0",
"helmet": "^7.1.0",
"ioredis": "^5.3.2",
"morgan": "^1.10.0",
"replicate": "^0.20.1",
"replicate": "^0.21.1",
"socket.io": "^4.7.2"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@sentry/cli": "^2.21.2",
"@types/cookie-parser": "^1.4.4",
"@types/cors": "^2.8.14",
"@types/express": "^4.17.19",
"@types/morgan": "^1.9.6",
"@types/node": "^20.8.4",
"@sentry/cli": "^2.21.5",
"@types/cookie-parser": "^1.4.6",
"@types/cors": "^2.8.16",
"@types/express": "^4.17.21",
"@types/morgan": "^1.9.9",
"@types/node": "^20.9.0",
"cross-env": "^7.0.3",
"eslint-config-custom": "workspace:*",
"jest": "^29.7.0",
Expand All @@ -48,7 +48,7 @@
"node": "18"
},
"optionalDependencies": {
"bufferutil": "^4.0.7",
"bufferutil": "^4.0.8",
"utf-8-validate": "^6.0.3"
}
}
22 changes: 12 additions & 10 deletions apps/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ export function buildServer() {
// Based on https://redis.io/commands/incr#pattern-rate-limiter-1
app.use(async (req, res, next) => {
let redisIncr: number;
try {
redisIncr = await redis.incr(req.ip);
} catch (error) {
console.error(`Could not increment rate limit key for ${req.ip}`);
throw error;
}
if (redisIncr > 10) {
res.status(429).send("Too many requests - try again later");
return;
if (req.ip) {
try {
redisIncr = await redis.incr(req.ip);
} catch (error) {
console.error(`Could not increment rate limit key for ${req.ip}`);
throw error;
}
if (redisIncr > 10) {
res.status(429).send("Too many requests - try again later");
return;
}
await redis.expire(req.ip, 10);
}
await redis.expire(req.ip, 10);

next();
});
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"eslint": "^8.51.0",
"prettier": "^3.0.3",
"eslint": "^8.53.0",
"prettier": "^3.1.0",
"tsconfig": "workspace:*",
"turbo": "^1.10.15"
"turbo": "^1.10.16"
},
"engines": {
"node": "18"
Expand Down
8 changes: 4 additions & 4 deletions packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"dependencies": {
"dotenv": "^16.3.1",
"drizzle-orm": "^0.28.6",
"postgres": "^3.4.0"
"drizzle-orm": "^0.29.0",
"postgres": "^3.4.3"
},
"devDependencies": {
"@auth/core": "^0.16.1",
"drizzle-kit": "^0.19.13",
"@auth/core": "^0.18.1",
"drizzle-kit": "^0.20.2",
"eslint-config-custom": "workspace:*",
"ts-node": "^10.9.1",
"tsconfig": "workspace:*",
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint-config-next": "13.5.4",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint-config-next": "14.0.2",
"eslint-config-prettier": "^9.0.0",
"eslint-config-turbo": "^1.10.15"
"eslint-config-turbo": "^1.10.16"
}
}
Loading