mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-24 03:55:49 -05:00
Show badges in nav but don't show any on the page
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
[
|
||||
{ "name": "badges", "displayName": "Badges", "url": "badges" },
|
||||
{
|
||||
"name": "plus",
|
||||
"displayName": "Plus Server",
|
||||
|
||||
@@ -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<Badge, "id" | "displayName" | "code">
|
||||
>;
|
||||
export type All = Array<Pick<Badge, "id" | "displayName" | "code">>;
|
||||
|
||||
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<
|
||||
|
||||
@@ -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<BadgesLoaderData>(
|
||||
{ badges: db.badges.allWithAtLeastOneOwner() },
|
||||
120
|
||||
);
|
||||
return jsonCached<BadgesLoaderData>({ badges: db.badges.all() }, 120);
|
||||
};
|
||||
|
||||
// xxx: https://web.dev/replace-gifs-with-videos/ check possibility to replace gif
|
||||
|
||||
Reference in New Issue
Block a user