mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-26 13:22:50 -05:00
leaderboards public ver
This commit is contained in:
@@ -51,9 +51,14 @@ export function useSalmonRunRecords() {
|
||||
}
|
||||
);
|
||||
|
||||
const userIds = new Set<number>();
|
||||
|
||||
const data = (recordsData ?? []).filter((record) => {
|
||||
if (record.rotation.stage !== state.stage) return false;
|
||||
if (record.category !== state.category) return false;
|
||||
if (record.roster.every((user) => userIds.has(user.id))) return false;
|
||||
|
||||
record.roster.forEach((user) => userIds.add(user.id));
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -21,9 +21,6 @@ const postHandler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getMySession(req);
|
||||
|
||||
if (!user) return res.status(401).end();
|
||||
if (!SALMON_RUN_ADMIN_DISCORD_IDS.includes(user.discordId)) {
|
||||
return res.status(401).end();
|
||||
}
|
||||
|
||||
const parsed = salmonRunRecordSchema.safeParse(req.body);
|
||||
if (!parsed.success) {
|
||||
|
||||
@@ -110,7 +110,7 @@ const SalmonRunLeaderboardsPage = ({}) => {
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableHeader />
|
||||
<TableHeader>
|
||||
<TableHeader textAlign="center">
|
||||
<Image
|
||||
src="/images/salmonRunIcons/Golden%20Egg.png"
|
||||
width={32}
|
||||
@@ -118,16 +118,16 @@ const SalmonRunLeaderboardsPage = ({}) => {
|
||||
aria-label="Golden eggs count"
|
||||
/>
|
||||
</TableHeader>
|
||||
<TableHeader>
|
||||
<TableHeader textAlign="center">
|
||||
<Trans>Weapons</Trans>
|
||||
</TableHeader>
|
||||
<TableHeader>
|
||||
<TableHeader textAlign="center">
|
||||
<Trans>Players</Trans>
|
||||
</TableHeader>
|
||||
<TableHeader>
|
||||
<TableHeader textAlign="center">
|
||||
<Trans>Rotation Dates</Trans>
|
||||
</TableHeader>
|
||||
<TableHeader>
|
||||
<TableHeader textAlign="center">
|
||||
<Trans>Links</Trans>
|
||||
</TableHeader>
|
||||
</TableRow>
|
||||
@@ -143,11 +143,11 @@ const SalmonRunLeaderboardsPage = ({}) => {
|
||||
return (
|
||||
<TableRow key={record.id}>
|
||||
<TableCell>{getRankingString(placement)}</TableCell>
|
||||
<TableCell fontWeight="bold">
|
||||
<TableCell fontWeight="bold" textAlign="center">
|
||||
{record.goldenEggCount}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Flex flexDir={["column", null, "row"]}>
|
||||
<Flex flexDir={["column", null, "row"]} justify="center">
|
||||
{record.rotation.weapons.map((wpn) => (
|
||||
<Box key={wpn} mx={1}>
|
||||
<WeaponImage size={32} name={wpn} />
|
||||
@@ -158,7 +158,12 @@ const SalmonRunLeaderboardsPage = ({}) => {
|
||||
|
||||
<TableCell>
|
||||
{record.roster.map((user) => (
|
||||
<Flex key={user.id} align="center" my={4}>
|
||||
<Flex
|
||||
key={user.id}
|
||||
align="center"
|
||||
my={4}
|
||||
justify="center"
|
||||
>
|
||||
<UserAvatar isSmall user={user} mr={2} />
|
||||
{user.username}#{user.discriminator}
|
||||
</Flex>
|
||||
@@ -166,28 +171,32 @@ const SalmonRunLeaderboardsPage = ({}) => {
|
||||
</TableCell>
|
||||
|
||||
<TableCell>
|
||||
<Box
|
||||
as="time"
|
||||
dateTime={
|
||||
(record.rotation.startTime as unknown) as string
|
||||
}
|
||||
>
|
||||
{new Date(
|
||||
record.rotation.startTime
|
||||
).toLocaleDateString()}
|
||||
</Box>
|
||||
<Box>-</Box>
|
||||
<Box
|
||||
as="time"
|
||||
dateTime={
|
||||
(record.rotation.endTime as unknown) as string
|
||||
}
|
||||
>
|
||||
{new Date(record.rotation.endTime).toLocaleDateString()}
|
||||
</Box>
|
||||
<Flex flexDir="column" align="center">
|
||||
<Box
|
||||
as="time"
|
||||
dateTime={
|
||||
(record.rotation.startTime as unknown) as string
|
||||
}
|
||||
>
|
||||
{new Date(
|
||||
record.rotation.startTime
|
||||
).toLocaleDateString()}
|
||||
</Box>
|
||||
<Box>-</Box>
|
||||
<Box
|
||||
as="time"
|
||||
dateTime={
|
||||
(record.rotation.endTime as unknown) as string
|
||||
}
|
||||
>
|
||||
{new Date(
|
||||
record.rotation.endTime
|
||||
).toLocaleDateString()}
|
||||
</Box>
|
||||
</Flex>
|
||||
</TableCell>
|
||||
|
||||
<TableCell>
|
||||
<TableCell textAlign="center">
|
||||
{record.links.map((link) => (
|
||||
<IconButton
|
||||
key={link}
|
||||
|
||||
Reference in New Issue
Block a user