diff --git a/apps/www/src/client/App.tsx b/apps/www/src/client/App.tsx index d13a93c..ae4b65f 100644 --- a/apps/www/src/client/App.tsx +++ b/apps/www/src/client/App.tsx @@ -20,6 +20,7 @@ import { call, hasToken, isAdmin, + isDeveloper, setHosts, setToken, useAction, @@ -1184,129 +1185,134 @@ function StaffPlayerActions({ account, navigate }: { account: PublicAccount; nav return (

Staff

-
{ - e.preventDefault() - void gift.run(async () => { - const amount = Number(tokens) - const res = await call<{ balance: number }>(`${base}/gift-tokens`, { - authed: true, - json: { amount }, - }) - setTokens('') - const what = - amount < 0 - ? `Took ${Math.abs(amount).toLocaleString()} tokens back` - : amount === 0 - ? 'Sent an empty box' - : `Sent ${amount.toLocaleString()} tokens` - return `${what}. @${account.username} now has ${res.balance.toLocaleString()}.` - }) - }} - > - - {gift.error &&

{gift.error}

} - {gift.done &&

{gift.done}

} -
+ {/* The gifts are developer-only; www refuses them to moderators. */} + {isDeveloper() && ( + <> +
{ + e.preventDefault() + void gift.run(async () => { + const amount = Number(tokens) + const res = await call<{ balance: number }>(`${base}/gift-tokens`, { + authed: true, + json: { amount }, + }) + setTokens('') + const what = + amount < 0 + ? `Took ${Math.abs(amount).toLocaleString()} tokens back` + : amount === 0 + ? 'Sent an empty box' + : `Sent ${amount.toLocaleString()} tokens` + return `${what}. @${account.username} now has ${res.balance.toLocaleString()}.` + }) + }} + > + + {gift.error &&

{gift.error}

} + {gift.done &&

{gift.done}

} +
-
{ - e.preventDefault() - void xpGift.run(async () => { - const amount = Number(xp) - const res = await call<{ level: number; levelsGained: number }>(`${base}/gift-xp`, { - authed: true, - json: { amount }, - }) - setXp('') - const levels = - res.levelsGained > 0 - ? ` They went up ${res.levelsGained} level${res.levelsGained === 1 ? '' : 's'}, to ${res.level}.` - : ` They're level ${res.level}.` - return `Sent ${amount.toLocaleString()} XP.${levels}` - }) - }} - > - - {xpGift.error &&

{xpGift.error}

} - {xpGift.done &&

{xpGift.done}

} -
+
{ + e.preventDefault() + void xpGift.run(async () => { + const amount = Number(xp) + const res = await call<{ level: number; levelsGained: number }>(`${base}/gift-xp`, { + authed: true, + json: { amount }, + }) + setXp('') + const levels = + res.levelsGained > 0 + ? ` They went up ${res.levelsGained} level${res.levelsGained === 1 ? '' : 's'}, to ${res.level}.` + : ` They're level ${res.level}.` + return `Sent ${amount.toLocaleString()} XP.${levels}` + }) + }} + > + + {xpGift.error &&

{xpGift.error}

} + {xpGift.done &&

{xpGift.done}

} +
-
{ - e.preventDefault() - void customGift.run(async () => { - const res = await call<{ name: string }>(`${base}/gift-custom-item`, { - authed: true, - json: { customAvatarItemId: customItemId.trim() }, - }) - setCustomItemId('') - return `Sent “${res.name}” to @${account.username}.` - }) - }} - > - - {customGift.error &&

{customGift.error}

} - {customGift.done &&

{customGift.done}

} -
+
{ + e.preventDefault() + void customGift.run(async () => { + const res = await call<{ name: string }>(`${base}/gift-custom-item`, { + authed: true, + json: { customAvatarItemId: customItemId.trim() }, + }) + setCustomItemId('') + return `Sent “${res.name}” to @${account.username}.` + }) + }} + > + + {customGift.error &&

{customGift.error}

} + {customGift.done &&

{customGift.done}

} +
+ + )}