diff --git a/app/components/layout/nav-items.json b/app/components/layout/nav-items.json index 218458b09..13c6ea72a 100644 --- a/app/components/layout/nav-items.json +++ b/app/components/layout/nav-items.json @@ -1,4 +1,5 @@ [ + { "name": "badges", "displayName": "Badges", "url": "badges" }, { "name": "plus", "displayName": "Plus Server", diff --git a/app/db/models/badges.server.ts b/app/db/models/badges.server.ts index e6b41c6ae..7ce1a6ab7 100644 --- a/app/db/models/badges.server.ts +++ b/app/db/models/badges.server.ts @@ -19,17 +19,16 @@ export function countsByUserId(userId: User["id"]) { return countsByUserIdStm.all({ userId }) as CountsByUserId; } -const allWithAtLeastOneOwnerStm = sql.prepare(` +const allStm = sql.prepare(` select "Badge"."id", "Badge"."code", "Badge"."displayName" from "Badge" `); -export type AllWithAtLeastOneOwner = Array< - Pick ->; +export type All = Array>; -export function allWithAtLeastOneOwner() { - return allWithAtLeastOneOwnerStm.all() as AllWithAtLeastOneOwner; +export function all() { + return []; // TODO: remove when page is done + return allStm.all() as All; } export type OwnersByBadge = Array< diff --git a/app/routes/badges.tsx b/app/routes/badges.tsx index d49f66362..a222d00b9 100644 --- a/app/routes/badges.tsx +++ b/app/routes/badges.tsx @@ -2,7 +2,7 @@ import type { LinksFunction, LoaderFunction } from "@remix-run/node"; import { Link, Outlet, useLoaderData, useParams } from "@remix-run/react"; import { Main } from "~/components/Main"; import { db } from "~/db"; -import type { AllWithAtLeastOneOwner } from "~/db/models/badges.server"; +import type { All } from "~/db/models/badges.server"; import styles from "~/styles/badges.css"; import { jsonCached } from "~/utils/remix"; @@ -11,14 +11,11 @@ export const links: LinksFunction = () => { }; export interface BadgesLoaderData { - badges: AllWithAtLeastOneOwner; + badges: All; } export const loader: LoaderFunction = () => { - return jsonCached( - { badges: db.badges.allWithAtLeastOneOwner() }, - 120 - ); + return jsonCached({ badges: db.badges.all() }, 120); }; // xxx: https://web.dev/replace-gifs-with-videos/ check possibility to replace gif