improvements

This commit is contained in:
yohlo
2025-10-06 09:03:50 -05:00
parent b458872ac1
commit 147dc4e744
3 changed files with 19 additions and 11 deletions

View File

@@ -26,7 +26,6 @@ const BadgeIcon = ({ badge, earned, size = 48 }: BadgeIconProps & { size?: numbe
const imagePath = `/static/img/${badge.key}.png`;
if (imageError) {
// Fallback to icon if image fails to load
return earned ? (
<MedalIcon
size={size}
@@ -142,7 +141,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
<Box
px="md"
style={{
maxHeight: '220px',
maxHeight: '240px',
overflowY: 'auto',
overflowX: 'hidden',
width: '100%',
@@ -180,15 +179,15 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
<Box
key={i}
style={{
width: '85px',
height: '85px',
width: '100px',
height: '100px',
borderRadius: '12px',
background: 'transparent',
background: 'light-dark(var(--mantine-color-white), var(--mantine-color-dark-7))',
border: '2px solid var(--mantine-primary-color-5)',
position: 'absolute',
top: `${(i + 1) * 3}px`,
left: `${(i + 1) * 3}px`,
opacity: 0.4 - (i * 0.15),
top: `${(i + 1) * 4}px`,
left: `${(i + 1) * 4}px`,
opacity: 0.3 - (i * 0.1),
zIndex: -(i + 1),
}}
/>
@@ -210,6 +209,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
justifyContent: 'center',
flexDirection: 'column',
gap: '4px',
padding: 'var(--mantine-spacing-sm)',
position: 'relative',
boxShadow: display.earned
? '0 0 0 1px color-mix(in srgb, var(--mantine-primary-color-6) 20%, transparent)'
@@ -242,6 +242,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
<Text
size="xs"
px={4}
fw={display.earned ? 600 : 500}
ta="center"
c={display.earned ? undefined : 'dimmed'}

View File

@@ -105,11 +105,17 @@ export const associatePlayer = createServerFn()
const userAuthId = context.userAuthId;
if (!userAuthId) return;
const p = await pbAdmin.getPlayer(data);
await pbAdmin.updatePlayer(data, {
auth_id: userAuthId
});
await setUserMetadata({ data: { player_id: data } });
await setUserMetadata({ data: {
player_id: data,
first_name: p?.first_name,
last_name: p?.last_name
}});
const player = await pbAdmin.getPlayer(data);
logger.info('Associated player', player);

View File

@@ -10,6 +10,7 @@ import UserMetadata from "supertokens-node/recipe/usermetadata";
import { getSessionForStart } from "@/lib/supertokens/recipes/start-session";
import { Logger } from "@/lib/logger";
import z from "zod";
import { serverFnLoggingMiddleware } from "./activities";
const logger = new Logger("Middleware");
const verifySuperTokensSession = async (
@@ -190,7 +191,7 @@ export const setUserMetadata = createServerFn({ method: "POST" })
export const updateUserColorScheme = createServerFn({ method: "POST" })
.inputValidator((data: string) => data)
.middleware([superTokensFunctionMiddleware])
.middleware([superTokensFunctionMiddleware, serverFnLoggingMiddleware])
.handler(async ({ context, data }) => {
const { userAuthId, metadata } = context;
if (!userAuthId) return;
@@ -209,7 +210,7 @@ export const updateUserColorScheme = createServerFn({ method: "POST" })
export const updateUserAccentColor = createServerFn({ method: "POST" })
.inputValidator((data: string) => data)
.middleware([superTokensFunctionMiddleware])
.middleware([superTokensFunctionMiddleware, serverFnLoggingMiddleware])
.handler(async ({ context, data }) => {
const { userAuthId, metadata } = context;
if (!userAuthId) return;