diff --git a/CHANGELOG.md b/CHANGELOG.md
index f027da8..cd885c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## [Unreleased]
+### Added
+
+- The website uses your Google or Discord picture as your profile picture when you sign in with one of them.
+- While the console is still sending images, the website shows how many have arrived (in the sync badge and on the profile), and they appear as they arrive.
+
+### Changed
+
+- Images the console has not sent yet show the placeholder instead of a broken image.
+
### Security
- The console's pairing QR code puts the code in the URL fragment (`/link#code=…`), which browsers never send, so the code no longer reaches the server or its logs. The website still accepts `/link?code=…` from older consoles.
diff --git a/contract/api.ts b/contract/api.ts
index d64df22..f6b84f1 100644
--- a/contract/api.ts
+++ b/contract/api.ts
@@ -57,6 +57,11 @@ export interface Trophy {
iconUrl: string | null;
}
+export interface ImageSync {
+ total: number;
+ stored: number;
+}
+
export interface EarnedTrophy {
setId: string;
setName: string;
diff --git a/web/src/app/(app)/(profile)/_components/image-sync-banner.tsx b/web/src/app/(app)/(profile)/_components/image-sync-banner.tsx
new file mode 100644
index 0000000..d844c20
--- /dev/null
+++ b/web/src/app/(app)/(profile)/_components/image-sync-banner.tsx
@@ -0,0 +1,21 @@
+import type { ImageSync } from '@openpsapp/contract/api';
+import { ImageIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import { Card } from '@/components/ui/card';
+import { Progress } from '@/components/ui/progress';
+
+export function ImageSyncBanner({ images, className }: { images: ImageSync; className?: string }) {
+ const { t } = useTranslation();
+ return (
+
+
+
+
+
{t('images.title')}
+
{t('images.description', { stored: images.stored, total: images.total })}
+
+
+
+
+ );
+}
diff --git a/web/src/app/(app)/(profile)/_components/profile-hero.tsx b/web/src/app/(app)/(profile)/_components/profile-hero.tsx
index b5f88e3..33d10ed 100644
--- a/web/src/app/(app)/(profile)/_components/profile-hero.tsx
+++ b/web/src/app/(app)/(profile)/_components/profile-hero.tsx
@@ -1,9 +1,10 @@
import type { ReactNode } from 'react';
-import { Avatar, AvatarFallback } from '@/components/ui/avatar';
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
export function ProfileHero({
name,
initial,
+ avatarUrl,
summary,
summaryShort,
heroUrl,
@@ -11,6 +12,7 @@ export function ProfileHero({
}: {
name: string;
initial: string;
+ avatarUrl: string | null;
summary: string;
summaryShort: string;
heroUrl: string | null;
@@ -26,6 +28,7 @@ export function ProfileHero({
+ {avatarUrl && }
{initial}
diff --git a/web/src/app/(app)/(profile)/page.tsx b/web/src/app/(app)/(profile)/page.tsx
index c6498be..29e3ec5 100644
--- a/web/src/app/(app)/(profile)/page.tsx
+++ b/web/src/app/(app)/(profile)/page.tsx
@@ -1,3 +1,4 @@
+import { useUser } from '@clerk/react';
import { formatDuration } from '@openpsapp/core';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -6,10 +7,12 @@ import { PageLoader } from '@/components/page-loader';
import { useDevices } from '@/hooks/use-devices';
import { useEarnedTrophies } from '@/hooks/use-earned-trophies';
import { useGames } from '@/hooks/use-games';
+import { useImageSync } from '@/hooks/use-image-sync';
import { useProfile } from '@/hooks/use-profile';
import { useTrophySets } from '@/hooks/use-trophy-sets';
import { paths } from '@/lib/links';
-import { describeSync } from '../_lib/sync-status';
+import { avatarUrl, describeSync, pendingImages } from '../_lib/sync-status';
+import { ImageSyncBanner } from './_components/image-sync-banner';
import { LatestTrophies } from './_components/latest-trophies';
import { MonthRecap } from './_components/month-recap';
import { PlatinumCard } from './_components/platinum-card';
@@ -29,6 +32,8 @@ export default function ProfilePage() {
const sets = useTrophySets();
const earned = useEarnedTrophies();
const devices = useDevices();
+ const images = pendingImages(useImageSync());
+ const { user: account } = useUser();
const [expanded, setExpanded] = useState(false);
const recap = useMonthRecap(earned.data ?? NO_ITEMS, games.data ?? NO_ITEMS, sets.data ?? NO_ITEMS);
@@ -64,12 +69,14 @@ export default function ProfilePage() {
}
/>
+ {images &&
}
- {initial}
+
diff --git a/web/src/app/(app)/_components/mobile-header.tsx b/web/src/app/(app)/_components/mobile-header.tsx
index 4411f7d..c4ebf1c 100644
--- a/web/src/app/(app)/_components/mobile-header.tsx
+++ b/web/src/app/(app)/_components/mobile-header.tsx
@@ -4,17 +4,20 @@ import { useTranslation } from 'react-i18next';
import { Link } from 'react-router';
import { LogoMark } from '@/components/brand/logo';
import { Button } from '@/components/ui/button';
+import { UserAvatar } from './user-avatar';
export function MobileHeader({
homeTo,
accountTo,
initial,
+ avatarUrl,
status,
onSearch,
}: {
homeTo: string;
accountTo: string;
initial: string;
+ avatarUrl: string | null;
status: ReactNode;
onSearch: () => void;
}) {
@@ -31,9 +34,9 @@ export function MobileHeader({
- {initial}
+
);
diff --git a/web/src/app/(app)/_components/sync-badge.tsx b/web/src/app/(app)/_components/sync-badge.tsx
index cd59c6e..3e17e20 100644
--- a/web/src/app/(app)/_components/sync-badge.tsx
+++ b/web/src/app/(app)/_components/sync-badge.tsx
@@ -1,12 +1,21 @@
+import type { ImageSync } from '@openpsapp/contract/api';
import { formatTimeAgo } from '@openpsapp/core';
import { cn } from 'cn';
import { useTranslation } from 'react-i18next';
import { Badge } from '@/components/ui/badge';
import type { SyncState } from '../_types/sync';
-export function SyncBadge({ sync, now }: { sync: SyncState; now: Date }) {
+export function SyncBadge({ sync, images, now }: { sync: SyncState; images: ImageSync | null; now: Date }) {
const { t, i18n } = useTranslation();
if (sync.kind === 'none') return null;
+ if (sync.kind === 'synced' && images) {
+ return (
+
+
+ {t('images.badge', { stored: images.stored, total: images.total })}
+
+ );
+ }
if (sync.kind === 'waiting') {
return (
@@ -22,15 +31,28 @@ export function SyncBadge({ sync, now }: { sync: SyncState; now: Date }) {
);
}
-export function SyncPill({ sync, now, className }: { sync: SyncState; now: Date; className?: string }) {
+export function SyncPill({ sync, images, now, className }: { sync: SyncState; images: ImageSync | null; now: Date; className?: string }) {
const { t, i18n } = useTranslation();
if (sync.kind === 'none') return null;
- const text = sync.kind === 'waiting' ? t('sync.waiting') : t('sync.short', { ago: formatTimeAgo(sync.at, now, i18n.language) });
+ const sending = sync.kind === 'synced' && images;
+ const text =
+ sync.kind === 'waiting'
+ ? t('sync.waiting')
+ : sending
+ ? t('images.badge', { stored: images.stored, total: images.total })
+ : t('sync.short', { ago: formatTimeAgo(sync.at, now, i18n.language) });
return (
-
+
{text}
);
diff --git a/web/src/app/(app)/_components/user-avatar.tsx b/web/src/app/(app)/_components/user-avatar.tsx
new file mode 100644
index 0000000..7f261ae
--- /dev/null
+++ b/web/src/app/(app)/_components/user-avatar.tsx
@@ -0,0 +1,20 @@
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
+
+export function UserAvatar({
+ initial,
+ imageUrl,
+ className,
+ fallbackClassName,
+}: {
+ initial: string;
+ imageUrl: string | null;
+ className?: string;
+ fallbackClassName?: string;
+}) {
+ return (
+
+ {imageUrl && }
+ {initial}
+
+ );
+}
diff --git a/web/src/app/(app)/_hooks/use-shell.ts b/web/src/app/(app)/_hooks/use-shell.ts
index e733fbb..21b10a0 100644
--- a/web/src/app/(app)/_hooks/use-shell.ts
+++ b/web/src/app/(app)/_hooks/use-shell.ts
@@ -1,16 +1,18 @@
import { useClerk, useUser } from '@clerk/react';
import { useLocation, useMatches } from 'react-router';
import { useDevices } from '@/hooks/use-devices';
+import { useImageSync } from '@/hooks/use-image-sync';
import { useNow } from '@/hooks/use-now';
import { useProfile } from '@/hooks/use-profile';
import { isFocusedRoute, sectionFor } from '../_lib/navigation';
-import { describeSync } from '../_lib/sync-status';
+import { avatarUrl, describeSync, pendingImages } from '../_lib/sync-status';
export function useShell() {
const location = useLocation();
const matches = useMatches();
const profile = useProfile();
const devices = useDevices();
+ const images = useImageSync();
const { user } = useUser();
const clerk = useClerk();
const now = useNow();
@@ -22,6 +24,8 @@ export function useShell() {
name,
email,
initial: (name ?? '?').slice(0, 1).toUpperCase(),
+ avatarUrl: avatarUrl(user),
+ images: pendingImages(images),
sync: describeSync(devices.data),
now,
signOut: () => void clerk.signOut(),
diff --git a/web/src/app/(app)/_lib/sync-status.test.ts b/web/src/app/(app)/_lib/sync-status.test.ts
index 191c252..a13ce97 100644
--- a/web/src/app/(app)/_lib/sync-status.test.ts
+++ b/web/src/app/(app)/_lib/sync-status.test.ts
@@ -1,6 +1,6 @@
import type { DeviceInfo } from '@openpsapp/contract/pairing';
import { describe, expect, it } from 'vitest';
-import { currentDevice, describeSync } from './sync-status';
+import { avatarUrl, currentDevice, describeSync, pendingImages } from './sync-status';
const device = (id: string, createdAt: string, lastSyncAt: string | null): DeviceInfo => ({
id,
@@ -28,3 +28,20 @@ describe('describeSync', () => {
expect(describeSync(devices)).toEqual({ kind: 'synced', deviceId: '2', name: 'P2', at: '2026-11-14T16:37:00Z' });
});
});
+
+describe('pendingImages', () => {
+ it('reports images only while some are still on their way', () => {
+ expect(pendingImages({ total: 83, stored: 16 })).toEqual({ total: 83, stored: 16 });
+ expect(pendingImages({ total: 83, stored: 83 })).toBeNull();
+ expect(pendingImages({ total: 0, stored: 0 })).toBeNull();
+ expect(pendingImages(undefined)).toBeNull();
+ });
+});
+
+describe('avatarUrl', () => {
+ it('uses the sign-in picture only when the account has one', () => {
+ expect(avatarUrl({ hasImage: true, imageUrl: 'https://img.clerk.com/a' })).toBe('https://img.clerk.com/a');
+ expect(avatarUrl({ hasImage: false, imageUrl: 'https://img.clerk.com/default' })).toBeNull();
+ expect(avatarUrl(null)).toBeNull();
+ });
+});
diff --git a/web/src/app/(app)/_lib/sync-status.ts b/web/src/app/(app)/_lib/sync-status.ts
index 4ea8055..df98e5f 100644
--- a/web/src/app/(app)/_lib/sync-status.ts
+++ b/web/src/app/(app)/_lib/sync-status.ts
@@ -1,3 +1,4 @@
+import type { ImageSync } from '@openpsapp/contract/api';
import type { DeviceInfo } from '@openpsapp/contract/pairing';
import type { SyncState } from '../_types/sync';
@@ -12,3 +13,11 @@ export function describeSync(devices: DeviceInfo[] | undefined): SyncState {
if (!device.lastSyncAt) return { kind: 'waiting', deviceId: device.id, name: device.profileName };
return { kind: 'synced', deviceId: device.id, name: device.profileName, at: device.lastSyncAt };
}
+
+export function pendingImages(images: ImageSync | null | undefined): ImageSync | null {
+ return images && images.stored < images.total ? images : null;
+}
+
+export function avatarUrl(user: { hasImage: boolean; imageUrl: string } | null | undefined): string | null {
+ return user?.hasImage ? user.imageUrl : null;
+}
diff --git a/web/src/app/(app)/layout.tsx b/web/src/app/(app)/layout.tsx
index 945c102..8dbd30c 100644
--- a/web/src/app/(app)/layout.tsx
+++ b/web/src/app/(app)/layout.tsx
@@ -26,10 +26,11 @@ export default function AppLayout() {
section={shell.section}
homeTo={paths.profile}
onSearch={() => search.setOpen(true)}
- status={ }
+ status={ }
menu={
}
+ avatarUrl={shell.avatarUrl}
+ status={ }
onSearch={() => search.setOpen(true)}
/>
)}
diff --git a/web/src/hooks/use-image-sync.ts b/web/src/hooks/use-image-sync.ts
new file mode 100644
index 0000000..d943912
--- /dev/null
+++ b/web/src/hooks/use-image-sync.ts
@@ -0,0 +1,25 @@
+import type { ImageSync } from '@openpsapp/contract/api';
+import { useQuery, useQueryClient } from '@tanstack/react-query';
+import { useEffect, useRef } from 'react';
+import { api } from '@/lib/api';
+import { queryKeys } from '@/lib/query-keys';
+
+export const IMAGE_SYNC_POLL_MS = 3000;
+
+export function useImageSync() {
+ const queryClient = useQueryClient();
+ const query = useQuery({
+ queryKey: queryKeys.images,
+ queryFn: () => api('/images'),
+ refetchInterval: (q) => (q.state.data && q.state.data.stored < q.state.data.total ? IMAGE_SYNC_POLL_MS : false),
+ });
+ const stored = query.data?.stored;
+ const seen = useRef(stored);
+ useEffect(() => {
+ if (stored === undefined || stored === seen.current) return;
+ const first = seen.current === undefined;
+ seen.current = stored;
+ if (!first) void queryClient.invalidateQueries({ queryKey: queryKeys.library });
+ }, [stored, queryClient]);
+ return query.data ?? null;
+}
diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json
index 3f83c4d..22853ed 100644
--- a/web/src/i18n/locales/en.json
+++ b/web/src/i18n/locales/en.json
@@ -37,6 +37,11 @@
"waiting": "Waiting for the first sync",
"none": "No PS5 connected"
},
+ "images": {
+ "title": "Images on their way",
+ "description": "Your PS5 is sending game and trophy images: {{stored}} of {{total}}. They show up here as they arrive.",
+ "badge": "Sending images {{stored}}/{{total}}"
+ },
"footer": {
"data": "Data from {{name}}'s PS5 · last sync {{date}}",
"dataNever": "Data from {{name}}'s PS5 · not synced yet",
diff --git a/web/src/i18n/locales/es.json b/web/src/i18n/locales/es.json
index 4c61c5c..83f7e3e 100644
--- a/web/src/i18n/locales/es.json
+++ b/web/src/i18n/locales/es.json
@@ -37,6 +37,11 @@
"waiting": "Esperando la primera sincronización",
"none": "Ninguna PS5 conectada"
},
+ "images": {
+ "title": "Imágenes en camino",
+ "description": "Tu PS5 está enviando las imágenes de juegos y trofeos: {{stored}} de {{total}}. Aparecen aquí a medida que llegan.",
+ "badge": "Enviando imágenes {{stored}}/{{total}}"
+ },
"footer": {
"data": "Datos de la PS5 de {{name}} · última sincronización {{date}}",
"dataNever": "Datos de la PS5 de {{name}} · aún no se sincronizó",
diff --git a/web/src/i18n/locales/pt-BR.json b/web/src/i18n/locales/pt-BR.json
index 3634542..83c8515 100644
--- a/web/src/i18n/locales/pt-BR.json
+++ b/web/src/i18n/locales/pt-BR.json
@@ -37,6 +37,11 @@
"waiting": "Aguardando a primeira sincronização",
"none": "Nenhum PS5 conectado"
},
+ "images": {
+ "title": "Imagens a caminho",
+ "description": "Seu PS5 está enviando as imagens dos jogos e troféus: {{stored}} de {{total}}. Elas aparecem aqui conforme chegam.",
+ "badge": "Enviando imagens {{stored}}/{{total}}"
+ },
"footer": {
"data": "Dados do PS5 de {{name}} · última sincronização {{date}}",
"dataNever": "Dados do PS5 de {{name}} · ainda não sincronizou",
diff --git a/web/src/lib/query-keys.ts b/web/src/lib/query-keys.ts
index 2268d2c..75e1734 100644
--- a/web/src/lib/query-keys.ts
+++ b/web/src/lib/query-keys.ts
@@ -9,4 +9,5 @@ export const queryKeys = {
trophies: (setId: string) => ['library', 'trophy-sets', setId, 'trophies'] as const,
earned: ['library', 'earned'] as const,
devices: ['devices'] as const,
+ images: ['images'] as const,
};