Skip to content

Commit 827176c

Browse files
vcarlclaude
andcommitted
Redesign /jobs with sidebar filters and styled cards
Port the prod visual design: two-column layout with filter sidebar (type, page size, 5 tag checkboxes), stylized cyan+pink wordmark hero, and job cards with pink border, pill tags, reactions, and show-more collapse. Add a `wide` prop to BaseLayout for the roomier page width. Add a 5-minute in-process cache to discordIdentity to avoid Discord API rate limits during development. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 483a2a4 commit 827176c

4 files changed

Lines changed: 290 additions & 94 deletions

File tree

netlify/functions/discordIdentity.mts

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import type { Context } from "@netlify/functions";
22

3+
const CACHE_TTL_MS = 5 * 60 * 1000;
4+
const cache = new Map<
5+
string,
6+
{ expiresAt: number; status: number; body: string }
7+
>();
8+
39
const handler = async (request: Request, context: Context) => {
410
// Inexplicably `$ netlify dev` seems to hard crash if an `Authentication`
511
// header is present on an incoming request. So, hack
612
const Authorization = request.headers.get("x-auth")!;
13+
14+
const cached = cache.get(Authorization);
15+
if (cached && cached.expiresAt > Date.now()) {
16+
return new Response(cached.body, {
17+
status: cached.status,
18+
headers: { "Content-Type": "application/json", "x-cache": "HIT" },
19+
});
20+
}
21+
722
try {
823
const [userRes, memberRes] = await Promise.all([
924
fetch("https://discord.com/api/users/@me", {
@@ -33,15 +48,20 @@ const handler = async (request: Request, context: Context) => {
3348
);
3449
}
3550
}
36-
return new Response(
37-
JSON.stringify({
38-
user,
39-
isMember: memberRes.ok,
40-
}),
41-
{
42-
headers: { "Content-Type": "application/json" },
43-
},
44-
);
51+
const body = JSON.stringify({
52+
user,
53+
isMember: memberRes.ok,
54+
});
55+
if (userRes.ok) {
56+
cache.set(Authorization, {
57+
expiresAt: Date.now() + CACHE_TTL_MS,
58+
status: 200,
59+
body,
60+
});
61+
}
62+
return new Response(body, {
63+
headers: { "Content-Type": "application/json", "x-cache": "MISS" },
64+
});
4565
} catch (e) {
4666
console.error("[DIS_ID]", e);
4767
return new Response(JSON.stringify(e), { status: 400 });

0 commit comments

Comments
 (0)