feat(profile): set a display name and greet with it on the dashboard

Settings: new Profil card with display name and Steam ID. Registration: optional display name. The dashboard falls back to the email prefix when no display name is set.
This commit is contained in:
lobo committed 2026-09-24 10:45:56 +02:00
1 parent 6773040d59
commit 7b676f0a1e
7 files changed
+90 -13

No files matched your search

+17
View File
@@ -28,3 +28,20 @@ describe('steamId validation', () => {
expect(result.steamId).toBe('76561198005679788');
});
});
describe('displayName validation', () => {
const withName = (displayName) => ({...settings('76561198005679788'), displayName});
it('turns an empty field into null (no display name)', () => {
expect(settingsSchema.parse(withName(' ')).displayName).toBeNull();
});
it('trims and keeps a valid name', () => {
expect(settingsSchema.parse(withName(' Lobo Corp_1 ')).displayName).toBe('Lobo Corp_1');
});
it.each(['ab', '<script>', 'a'.repeat(25)])('rejects %j', (displayName) => {
expect(settingsSchema.safeParse(withName(displayName)).success).toBe(false);
});
});