mirror of
https://github.com/MrLowPr/overdrive.git
synced 2026-10-26 17:04:08 +01:00
42 lines
1.4 KiB
React
42 lines
1.4 KiB
React
// ../pub-game-store/native/browse/RecentRow.jsx
|
|
// reconstructed from the esbuild bundle in eboot.bin
|
|
|
|
import { jsx } from 'react/jsx-runtime';
|
|
import { memo, useRef } from 'react';
|
|
import { GameRail } from './GameRail.jsx';
|
|
import { useT } from '../i18n/index.js';
|
|
import { getGame, listedId } from '../state/catalog.js';
|
|
import { useNavActions, useNavState } from '../state/nav.jsx';
|
|
import { useRecent } from '../state/recent.js';
|
|
import { GameCard } from '../ui/GameCard.jsx';
|
|
|
|
function RecentRow() {
|
|
return /* @__PURE__ */ (0, jsx)(Recent, { shown: useNavState().top.name === "browse" });
|
|
}
|
|
var Recent = (0, memo)(function Recent2({ shown }) {
|
|
const t2 = useT();
|
|
const recent2 = useRecent();
|
|
const kept = (0, useRef)(recent2);
|
|
if (shown) kept.current = recent2;
|
|
const { openGame } = useNavActions();
|
|
const games2 = [...new Set(kept.current.map(listedId))].map(getGame).filter(Boolean);
|
|
if (!games2.length) return null;
|
|
return /* @__PURE__ */ (0, jsx)(GameRail, { title: t2("browse.recentlyViewed"), children: games2.map((game, index) => {
|
|
const key = `recent:${game.id}`;
|
|
return /* @__PURE__ */ (0, jsx)(
|
|
GameCard,
|
|
{
|
|
game,
|
|
width: 152,
|
|
detailed: true,
|
|
focusKey: key,
|
|
rowEnd: index === games2.length - 1,
|
|
onPress: () => openGame(game.id, key)
|
|
},
|
|
game.id
|
|
);
|
|
}) });
|
|
});
|
|
|
|
export { RecentRow };
|