1
This commit is contained in:
@@ -506,6 +506,7 @@ function buildMockPuzzleRun(
|
||||
currentLevel: {
|
||||
runId: `run-${profileId}`,
|
||||
levelIndex: 1,
|
||||
levelId: 'puzzle-level-1',
|
||||
gridSize,
|
||||
profileId,
|
||||
levelName,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -3235,7 +3235,7 @@ export function RpgEntryHomeView({
|
||||
<ProfileStatCard
|
||||
cardKey="playedWorks"
|
||||
label="玩过"
|
||||
value={formatDashboardCount(playedWorkCount)}
|
||||
value={`${formatDashboardCount(playedWorkCount)}个`}
|
||||
icon={BookOpen}
|
||||
onClick={onOpenProfileDashboardCard}
|
||||
/>
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user