Skip to content

Commit

Permalink
fix some type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanflorence committed Sep 20, 2024
1 parent 5960e4b commit 1d31705
Show file tree
Hide file tree
Showing 3 changed files with 615 additions and 548 deletions.
47 changes: 25 additions & 22 deletions app/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { type MetaFunction } from "@remix-run/node";
import { LoaderFunctionArgs, type MetaFunction } from "@remix-run/node";
import { Await, Link, useLoaderData } from "@remix-run/react";
import { Suspense } from "react";

import iconsHref from "~/icons.svg";
import { getStats } from "~/modules/stats";
import { getStats, Stats } from "~/modules/stats";
import { getRootMatchData } from "~/ui/meta";

export let loader = async () => {
export function loader(_: LoaderFunctionArgs) {
return { stats: getStats() };
};
}

export const meta: MetaFunction = ({ data, matches }) => {
let { isProductionHost } = getRootMatchData(matches);
Expand Down Expand Up @@ -138,24 +138,27 @@ export default function Home() {
<Await resolve={stats} errorElement={null}>
{(stats) => (
<ul className="mt-8 grid grid-cols-1 gap-8 md:grid md:grid-cols-2">
{stats.map(({ svgId, count, label }) => (
<li key={svgId} className="flex gap-4">
<svg
aria-label="TODO GitHub Octocat logo"
className="mt-1 h-8 w-8 text-gray-200 dark:text-gray-600"
>
<use href={`${iconsHref}#${svgId}`} />
</svg>
<p className="flex flex-col">
<span className="text-3xl font-light tracking-tight">
{count?.toLocaleString("en-US")}
</span>
<span className="text-gray-300 dark:text-gray-500">
{label}
</span>
</p>
</li>
))}
{/* TODO: single fetch bug? */}
{(stats as unknown as Stats[]).map(
({ svgId, count, label }) => (
<li key={svgId} className="flex gap-4">
<svg
aria-label="TODO GitHub Octocat logo"
className="mt-1 h-8 w-8 text-gray-200 dark:text-gray-600"
>
<use href={`${iconsHref}#${svgId}`} />
</svg>
<p className="flex flex-col">
<span className="text-3xl font-light tracking-tight">
{count?.toLocaleString("en-US")}
</span>
<span className="text-gray-300 dark:text-gray-500">
{label}
</span>
</p>
</li>
)
)}
</ul>
)}
</Await>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"front-matter": "^4.0.2",
"gray-matter": "^4.0.3",
"gunzip-maybe": "^1.4.2",
"hast": "^1.0.0",
"isbot": "^3.6.10",
"iso-639-1": "^2.1.15",
"lodash.merge": "^4.6.2",
Expand All @@ -56,6 +57,7 @@
"tiny-invariant": "^1.3.1",
"typedoc": "^0.26.5",
"unified": "^11.0.4",
"unist": "^0.0.1",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
Expand All @@ -66,6 +68,7 @@
"@types/eslint": "^8.56.6",
"@types/follow-redirects": "^1.14.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/hast": "^3.0.4",
"@types/lodash.merge": "^4.6.7",
"@types/node": "^18.16.3",
"@types/parse-link-header": "^2.0.1",
Expand All @@ -74,6 +77,7 @@
"@types/semver": "^7.3.13",
"@types/tar": "^6.1.4",
"@types/tar-stream": "^2.2.2",
"@types/unist": "^3.0.3",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.4.0",
"autoprefixer": "^10.4.19",
Expand Down
Loading

0 comments on commit 1d31705

Please sign in to comment.