Skip to content

Commit e8980a7

Browse files
committed
Proper presentation page for the new API
1 parent f85aa24 commit e8980a7

12 files changed

Lines changed: 965 additions & 67 deletions

File tree

aiarena/frontend-spa/package-lock.json

Lines changed: 161 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aiarena/frontend-spa/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"rehype-sanitize": "^6.0.0",
4141
"relay-compiler": "^18.2.0",
4242
"relay-runtime": "^18.2.0",
43+
"shiki": "^4.1.0",
4344
"tailwindcss": "^4.1.4",
4445
"vite-plugin-relay": "^2.1.0"
4546
},

aiarena/frontend-spa/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import BotPage from "./_pages/Rework/Bot/Page";
2020
import RoundsPage from "./_pages/Rework/_Round/Page";
2121
import AuthorPage from "./_pages/Rework/_Author/Page";
2222
import MatchPage from "./_pages/Rework/_Match/Page";
23+
import DevelopersPage from "./_pages/Developers/Page";
2324
import Maps from "./_pages/Rework/CompetitionParticipation/Pages/Maps";
2425
import EloGraph from "./_pages/Rework/CompetitionParticipation/Pages/EloGraph";
2526
import WinsByRace from "./_pages/Rework/CompetitionParticipation/Pages/WinsByRace";
@@ -47,6 +48,7 @@ export default function App() {
4748
<Route path="bots" element={<BotsPage />} />
4849
<Route path="bots/:botId" element={<BotPage />} />
4950
<Route path="matches/:matchId" element={<MatchPage />} />
51+
<Route path="developers" element={<DevelopersPage />} />
5052
<Route
5153
path="competitions/stats/:id"
5254
element={<CompetitionParticipationSideNav />}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { useState } from "react";
2+
import {
3+
ClipboardDocumentIcon,
4+
EyeIcon,
5+
EyeSlashIcon,
6+
} from "@heroicons/react/20/solid";
7+
import { useSnackbar } from "notistack";
8+
9+
interface TokenRevealProps {
10+
token: string | null | undefined;
11+
className?: string;
12+
}
13+
14+
const MASK = "•••••••••••••••••••••••••••••••••••••••";
15+
16+
export default function TokenReveal({ token, className }: TokenRevealProps) {
17+
const { enqueueSnackbar } = useSnackbar();
18+
const [visible, setVisible] = useState(false);
19+
20+
const handleCopy = () => {
21+
navigator.clipboard.writeText(token ?? "");
22+
enqueueSnackbar("API token copied to clipboard!");
23+
};
24+
25+
return (
26+
<div
27+
className={
28+
"flex items-center gap-2 bg-black text-gray-300 px-2 py-1 rounded font-mono text-xs break-words " +
29+
(className ?? "")
30+
}
31+
>
32+
<span className="flex-1 truncate">{visible ? token : MASK}</span>
33+
34+
<button
35+
onClick={() => setVisible(!visible)}
36+
className="text-white hover:text-gray-400 p-1"
37+
title={visible ? "Hide token" : "Show token"}
38+
>
39+
{visible ? (
40+
<EyeSlashIcon className="h-4 w-4" />
41+
) : (
42+
<EyeIcon className="h-4 w-4" />
43+
)}
44+
</button>
45+
46+
<button
47+
onClick={handleCopy}
48+
className="text-white hover:text-gray-400 p-1"
49+
title="Copy token"
50+
>
51+
<ClipboardDocumentIcon className="h-4 w-4" />
52+
</button>
53+
</div>
54+
);
55+
}

0 commit comments

Comments
 (0)