diff --git a/backend/app/graphql/types/query_type.rb b/backend/app/graphql/types/query_type.rb
index cef1995..8ed6aca 100644
--- a/backend/app/graphql/types/query_type.rb
+++ b/backend/app/graphql/types/query_type.rb
@@ -17,7 +17,7 @@ def me
end
def game(id:)
- GlobalID::Locator.locate(id)
+ GlobalID::Locator.locate(id) || Game.find(id)
end
diff --git a/backend/config/initializers/cors.rb b/backend/config/initializers/cors.rb
index 41d913c..252d1f4 100644
--- a/backend/config/initializers/cors.rb
+++ b/backend/config/initializers/cors.rb
@@ -7,7 +7,8 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
- origins "http://localhost:3001", "https://clip-games.com", "https://clip-games-web.vercel.app"
+ origins "http://localhost:3001", "https://clip-games.com",
+ /\Ahttps:\/\/clip-games.+\.vercel\.app\z/
resource "*",
headers: :any,
diff --git a/frontend/components/GameList.tsx b/frontend/components/GameList.tsx
index 5059a14..81ca215 100644
--- a/frontend/components/GameList.tsx
+++ b/frontend/components/GameList.tsx
@@ -1,69 +1,67 @@
-import { GamesQuery } from "@/graphql/generated/graphql";
+"use client";
+
import { classNames } from "@/lib/classNames";
import { StarIcon } from "@heroicons/react/20/solid";
+
import Image from "next/image";
import Link from "next/link";
+import { useHits } from "react-instantsearch-hooks-web";
-type Props = {
- games: GamesQuery["games"]["nodes"];
-};
-
-export default function GameList({ games }: Props) {
- if (!games) {
- return
loading...
;
- }
+export function GameList() {
+ const { hits } = useHits();
return (
-
Products
+
games
- {games.map(
- (game) =>
- game && (
-
-
-
-
-
-
-
-
- {game.ratingAverage} out of 5 stars
-
-
-
- {game.reviewsCount || 0} reviews
-
-
- {game.clipsCount || 0} reviews
-
-
-
-
- )
- )}
+ {hits.map((game) => (
+
+ ))}
);
}
+function Hit({ hit: game }: { hit: any }) {
+ return (
+
+
+
+
+
+
+
+
{game.ratingAverage} out of 5 stars
+
+
+ {game.reviewCount || 0} reviews
+
+
+ {game.clipCount || 0} clips
+
+
+
+
+ );
+}
function RatingStars({ ratingAverage }: { ratingAverage: number }) {
return (
@@ -71,7 +69,9 @@ function RatingStars({ ratingAverage }: { ratingAverage: number }) {
rating ? "text-yellow-400" : "text-gray-100",
+ Math.floor(ratingAverage) > rating
+ ? "text-yellow-400"
+ : "text-gray-100",
"h-5 w-5 flex-shrink-0"
)}
aria-hidden="true"
diff --git a/frontend/components/ProfileMenuIcon.tsx b/frontend/components/ProfileMenuIcon.tsx
index 608124d..2218166 100644
--- a/frontend/components/ProfileMenuIcon.tsx
+++ b/frontend/components/ProfileMenuIcon.tsx
@@ -17,7 +17,6 @@ function ProfileMenuIcon() {
: { name: "Sign in", href: "/signin" },
];
- console.log({ me, loading });
return loading ? null : (