Skip to content

Commit db23ccc

Browse files
committed
integrated signame->sigid to mainscreen
1 parent 84366a9 commit db23ccc

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

src/api/functions/siglead.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import {
44
ScanCommand,
55
} from "@aws-sdk/client-dynamodb";
66
import { unmarshall } from "@aws-sdk/util-dynamodb";
7+
import { OrganizationList } from "common/orgs.js";
78
import {
89
SigDetailRecord,
910
SigMemberCount,
1011
SigMemberRecord,
1112
} from "common/types/siglead.js";
13+
import { transformSigLeadToURI } from "common/utils.js";
14+
import { string } from "zod";
1215

1316
export async function fetchMemberRecords(
1417
sigid: string,
@@ -81,18 +84,29 @@ export async function fetchSigCounts(
8184

8285
const result = await dynamoClient.send(scan);
8386

84-
const counts: Record<string, number> = {};
87+
const ids2Name: Record<string, string> = {};
88+
OrganizationList.forEach((org) => {
89+
const sigid = transformSigLeadToURI(org);
90+
ids2Name[sigid] = org;
91+
});
8592

93+
const counts: Record<string, number> = {};
8694
(result.Items || []).forEach((item) => {
8795
const sigGroupId = item.sigGroupId?.S;
8896
if (sigGroupId) {
8997
counts[sigGroupId] = (counts[sigGroupId] || 0) + 1;
9098
}
9199
});
92100

93-
const countsArray: SigMemberCount[] = Object.entries(counts).map(
94-
([sigid, count]) => ({
101+
const joined: Record<string, [string, number]> = {};
102+
Object.keys(counts).forEach((sigid) => {
103+
joined[sigid] = [ids2Name[sigid], counts[sigid]];
104+
});
105+
106+
const countsArray: SigMemberCount[] = Object.entries(joined).map(
107+
([sigid, [signame, count]]) => ({
95108
sigid,
109+
signame,
96110
count,
97111
}),
98112
);

src/common/orgs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const SIGList = [
44
"GameBuilders",
55
"SIGAIDA",
66
"SIGGRAPH",
7-
"ICPC",
7+
"SIGICPC",
88
"SIGMobile",
99
"SIGMusic",
1010
"GLUG",

src/common/types/siglead.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ export type SigleadGetRequest = {
1919

2020
export type SigMemberCount = {
2121
sigid: string;
22+
signame: string;
2223
count: number;
2324
};

src/ui/pages/siglead/SigScreenComponents.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import { SigMemberCount } from '@common/types/siglead';
88
const renderSigLink = (sigMemCount: SigMemberCount, index: number) => {
99
const color = 'light-dark(var(--mantine-color-black), var(--mantine-color-white))';
1010
const size = '18px';
11-
const org = sigMemCount.sigid;
11+
const name = sigMemCount.signame;
12+
const id = sigMemCount.sigid;
1213
const count = sigMemCount.count;
1314
return (
1415
<NavLink
15-
href={`${useLocation().pathname}/${org}`}
16+
href={`${useLocation().pathname}/${id}`}
1617
active={index % 2 === 0}
17-
label={org}
18+
label={name}
1819
color="var(--mantine-color-blue-light)"
1920
variant="filled"
2021
rightSection={

0 commit comments

Comments
 (0)