Skip to content

Commit

Permalink
Update packages and fix single fetch types
Browse files Browse the repository at this point in the history
  • Loading branch information
brookslybrand committed Sep 20, 2024
1 parent 1d31705 commit 03fa0b6
Show file tree
Hide file tree
Showing 4 changed files with 6,686 additions and 5,287 deletions.
53 changes: 28 additions & 25 deletions app/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { LoaderFunctionArgs, type MetaFunction } from "@remix-run/node";
import { 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, Stats } from "~/modules/stats";
import { getStats } from "~/modules/stats";
import { getRootMatchData } from "~/ui/meta";

export function loader(_: LoaderFunctionArgs) {
return { stats: getStats() };
}
export let loader = async () => {
const stats = await getStats();
// replace with something better, just fixing types
if (!stats) {
throw new Error("Failed to load stats");
}
return { stats };
};

export const meta: MetaFunction = ({ data, matches }) => {
let { isProductionHost } = getRootMatchData(matches);
Expand Down Expand Up @@ -139,26 +144,24 @@ export default function Home() {
{(stats) => (
<ul className="mt-8 grid grid-cols-1 gap-8 md:grid md:grid-cols-2">
{/* 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>
)
)}
{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
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"dependencies": {
"@docsearch/css": "^3.6.0",
"@docsearch/react": "^3.6.0",
"@remix-run/node": "0.0.0-nightly-4083f718a-20240906",
"@remix-run/react": "0.0.0-nightly-4083f718a-20240906",
"@remix-run/serve": "0.0.0-nightly-4083f718a-20240906",
"@remix-run/node": "2.12.1",
"@remix-run/react": "2.12.1",
"@remix-run/serve": "2.12.1",
"bcryptjs": "^2.4.3",
"cheerio": "^1.0.0-rc.12",
"classnames": "^2.3.2",
Expand All @@ -33,7 +33,6 @@
"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 @@ -57,18 +56,17 @@
"tiny-invariant": "^1.3.1",
"typedoc": "^0.26.5",
"unified": "^11.0.4",
"unist": "^0.0.1",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@remix-run/dev": "0.0.0-nightly-4083f718a-20240906",
"@remix-run/eslint-config": "0.0.0-nightly-4083f718a-20240906",
"@remix-run/dev": "2.12.1",
"@remix-run/eslint-config": "2.12.1",
"@testing-library/jest-dom": "^5.16.5",
"@types/bcryptjs": "^2.4.2",
"@types/eslint": "^8.56.6",
"@types/follow-redirects": "^1.14.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/hast": "^3.0.4",
"@types/hast": "^2.3.4",
"@types/lodash.merge": "^4.6.7",
"@types/node": "^18.16.3",
"@types/parse-link-header": "^2.0.1",
Expand All @@ -77,7 +75,7 @@
"@types/semver": "^7.3.13",
"@types/tar": "^6.1.4",
"@types/tar-stream": "^2.2.2",
"@types/unist": "^3.0.3",
"@types/unist": "^2.0.6",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.4.0",
"autoprefixer": "^10.4.19",
Expand Down
Loading

0 comments on commit 03fa0b6

Please sign in to comment.