This commit is contained in:
2026-05-01 01:30:02 +08:00
parent aabad6407f
commit 2e9d0f4640
92 changed files with 4548 additions and 248 deletions

View File

@@ -506,6 +506,7 @@ function buildMockPuzzleRun(
currentLevel: {
runId: `run-${profileId}`,
levelIndex: 1,
levelId: 'puzzle-level-1',
gridSize,
profileId,
levelName,

View File

@@ -505,6 +505,18 @@ test('profile total play time card always uses hours', () => {
expect(within(playTimeCard).queryByText('90分')).toBeNull();
});
test('profile played works card shows count unit', () => {
renderProfileView(vi.fn(), {
playedWorldCount: 1,
});
const playedCard = screen.getByRole('button', {
name: /\s*1/u,
});
expect(within(playedCard).getByText('1个')).toBeTruthy();
});
test('desktop account entry uses saved avatar image when available', () => {
mockDesktopLayout();
const avatarUrl = 'data:image/png;base64,AAAA';

View File

@@ -3235,7 +3235,7 @@ export function RpgEntryHomeView({
<ProfileStatCard
cardKey="playedWorks"
label="玩过"
value={formatDashboardCount(playedWorkCount)}
value={`${formatDashboardCount(playedWorkCount)}`}
icon={BookOpen}
onClick={onOpenProfileDashboardCard}
/>

View File

@@ -136,6 +136,25 @@ export function useRpgEntryBootstrap(
return nextEntries;
}, [canReadProtectedData, user]);
const refreshSaveArchives = useCallback(async () => {
if (!user || !canReadProtectedData) {
setSaveEntries([]);
setSaveError(null);
return [];
}
setSaveError(null);
try {
const nextEntries = await listRpgProfileSaveArchives();
setSaveEntries(nextEntries);
return nextEntries;
} catch (error) {
setSaveError(resolveRpgEntryErrorMessage(error, '读取存档列表失败。'));
return [];
}
}, [canReadProtectedData, user]);
const appendBrowseHistoryEntry = useCallback(
async (entry: PlatformBrowseHistoryWriteEntry) => {
setHistoryError(null);
@@ -371,6 +390,7 @@ export function useRpgEntryBootstrap(
refreshCustomWorldWorks,
refreshPublishedGallery,
refreshSavedCustomWorldLibrary,
refreshSaveArchives,
appendBrowseHistoryEntry,
handleResumeSaveEntry,
};