improvements
This commit is contained in:
@@ -26,7 +26,6 @@ const BadgeIcon = ({ badge, earned, size = 48 }: BadgeIconProps & { size?: numbe
|
|||||||
const imagePath = `/static/img/${badge.key}.png`;
|
const imagePath = `/static/img/${badge.key}.png`;
|
||||||
|
|
||||||
if (imageError) {
|
if (imageError) {
|
||||||
// Fallback to icon if image fails to load
|
|
||||||
return earned ? (
|
return earned ? (
|
||||||
<MedalIcon
|
<MedalIcon
|
||||||
size={size}
|
size={size}
|
||||||
@@ -142,7 +141,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
|||||||
<Box
|
<Box
|
||||||
px="md"
|
px="md"
|
||||||
style={{
|
style={{
|
||||||
maxHeight: '220px',
|
maxHeight: '240px',
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
overflowX: 'hidden',
|
overflowX: 'hidden',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -180,15 +179,15 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
|||||||
<Box
|
<Box
|
||||||
key={i}
|
key={i}
|
||||||
style={{
|
style={{
|
||||||
width: '85px',
|
width: '100px',
|
||||||
height: '85px',
|
height: '100px',
|
||||||
borderRadius: '12px',
|
borderRadius: '12px',
|
||||||
background: 'transparent',
|
background: 'light-dark(var(--mantine-color-white), var(--mantine-color-dark-7))',
|
||||||
border: '2px solid var(--mantine-primary-color-5)',
|
border: '2px solid var(--mantine-primary-color-5)',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: `${(i + 1) * 3}px`,
|
top: `${(i + 1) * 4}px`,
|
||||||
left: `${(i + 1) * 3}px`,
|
left: `${(i + 1) * 4}px`,
|
||||||
opacity: 0.4 - (i * 0.15),
|
opacity: 0.3 - (i * 0.1),
|
||||||
zIndex: -(i + 1),
|
zIndex: -(i + 1),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -210,6 +209,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
gap: '4px',
|
gap: '4px',
|
||||||
|
padding: 'var(--mantine-spacing-sm)',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
boxShadow: display.earned
|
boxShadow: display.earned
|
||||||
? '0 0 0 1px color-mix(in srgb, var(--mantine-primary-color-6) 20%, transparent)'
|
? '0 0 0 1px color-mix(in srgb, var(--mantine-primary-color-6) 20%, transparent)'
|
||||||
@@ -242,6 +242,7 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
|||||||
|
|
||||||
<Text
|
<Text
|
||||||
size="xs"
|
size="xs"
|
||||||
|
px={4}
|
||||||
fw={display.earned ? 600 : 500}
|
fw={display.earned ? 600 : 500}
|
||||||
ta="center"
|
ta="center"
|
||||||
c={display.earned ? undefined : 'dimmed'}
|
c={display.earned ? undefined : 'dimmed'}
|
||||||
|
|||||||
@@ -105,11 +105,17 @@ export const associatePlayer = createServerFn()
|
|||||||
const userAuthId = context.userAuthId;
|
const userAuthId = context.userAuthId;
|
||||||
if (!userAuthId) return;
|
if (!userAuthId) return;
|
||||||
|
|
||||||
|
const p = await pbAdmin.getPlayer(data);
|
||||||
|
|
||||||
await pbAdmin.updatePlayer(data, {
|
await pbAdmin.updatePlayer(data, {
|
||||||
auth_id: userAuthId
|
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);
|
const player = await pbAdmin.getPlayer(data);
|
||||||
logger.info('Associated player', player);
|
logger.info('Associated player', player);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import UserMetadata from "supertokens-node/recipe/usermetadata";
|
|||||||
import { getSessionForStart } from "@/lib/supertokens/recipes/start-session";
|
import { getSessionForStart } from "@/lib/supertokens/recipes/start-session";
|
||||||
import { Logger } from "@/lib/logger";
|
import { Logger } from "@/lib/logger";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
import { serverFnLoggingMiddleware } from "./activities";
|
||||||
const logger = new Logger("Middleware");
|
const logger = new Logger("Middleware");
|
||||||
|
|
||||||
const verifySuperTokensSession = async (
|
const verifySuperTokensSession = async (
|
||||||
@@ -190,7 +191,7 @@ export const setUserMetadata = createServerFn({ method: "POST" })
|
|||||||
|
|
||||||
export const updateUserColorScheme = createServerFn({ method: "POST" })
|
export const updateUserColorScheme = createServerFn({ method: "POST" })
|
||||||
.inputValidator((data: string) => data)
|
.inputValidator((data: string) => data)
|
||||||
.middleware([superTokensFunctionMiddleware])
|
.middleware([superTokensFunctionMiddleware, serverFnLoggingMiddleware])
|
||||||
.handler(async ({ context, data }) => {
|
.handler(async ({ context, data }) => {
|
||||||
const { userAuthId, metadata } = context;
|
const { userAuthId, metadata } = context;
|
||||||
if (!userAuthId) return;
|
if (!userAuthId) return;
|
||||||
@@ -209,7 +210,7 @@ export const updateUserColorScheme = createServerFn({ method: "POST" })
|
|||||||
|
|
||||||
export const updateUserAccentColor = createServerFn({ method: "POST" })
|
export const updateUserAccentColor = createServerFn({ method: "POST" })
|
||||||
.inputValidator((data: string) => data)
|
.inputValidator((data: string) => data)
|
||||||
.middleware([superTokensFunctionMiddleware])
|
.middleware([superTokensFunctionMiddleware, serverFnLoggingMiddleware])
|
||||||
.handler(async ({ context, data }) => {
|
.handler(async ({ context, data }) => {
|
||||||
const { userAuthId, metadata } = context;
|
const { userAuthId, metadata } = context;
|
||||||
if (!userAuthId) return;
|
if (!userAuthId) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user