@tastic/shell 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -115,7 +115,7 @@ the front of an in-app link, so a route starting with a game id equal to the bas
115
115
  | `useSettingsRules?` | A hook returning what goes first in every Settings dialog, above the shell's rows: the rules of the game it's opened in. Null where there's nothing (Home). |
116
116
  | `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
117
117
  | `reducers?` | The pack's own store keys (what `SettingsSections` saves), beside the shell's and the games'. Never a key either already mounts. |
118
- | `StatsSections?` | A section across the pack's games (a calendar of play), first on the stats screen's Stats tab, handed its two filters (`PackStatsSectionsProps`: `profileId`, null for Everyone, and `gameId`, null for All Games). |
118
+ | `StatsSections?` | A section across the pack's games (a calendar of play), first on the stats screen's Stats tab, handed its two filters (`PackStatsSectionsProps`: `profileId`, null for Everyone; `gameId`, the one game picked, else null; and `gameIds`, the games picked: null for All Games, a Home tab's games, or `[gameId]`). |
119
119
 
120
120
  For a pack for one player at a time (CardTastic, from Solitaire), each optional and off when unset, so
121
121
  PuckTastic and DuelTastic draw what they always did:
@@ -144,7 +144,7 @@ PuckTastic and DuelTastic draw what they always did:
144
144
  | `usePickerAlign?` | `(open, contentWidth, contentHeight) => AlignResult` (`PickerAlign`), a hook: where seat 1's menu on Home, both seat buttons' menus in a loadout's one-human row (2 Player keeps each menu in its own player's half) and the stats screen's two pickers open. It was added because hud's own placement measured a button in a frame turned by `@tastic/core`'s drawn rotation against the upright window (Solitaire's `useFrameAutoAlign`); nothing turns since core 0.15, so a pack may no longer need one. (A profile's color swatch used it too, until the swatches moved onto the Edit Profile screen.) Unset is hud's placement. |
145
145
  | `resumeHref?` | `(gameId) => Href \| null`: where a cold launch goes back into a resumable game, for a pack with more than one way to be playing it. Null, or unset, is the game's play screen. |
146
146
  | `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
147
- | `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. |
147
+ | `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. The stats screen's game picker groups its games by them too: All Games, then a row per tab opening its page of an All row (the pill then reads the tab's name) and its games. |
148
148
 
149
149
  ### `GameDefinition`
150
150
 
@@ -400,7 +400,7 @@ what the shell started using (noted in the table).
400
400
  | `@rific/toaster` | >=0.10.1 | toasts |
401
401
  | `@tastic/core` | >=0.16.0 | the seat mode from the window's shape, the root background, the test for a computer behind `useAtComputer` (0.16.0's `useIsTouchPrimaryDevice`) |
402
402
  | `@tastic/hud` | >=0.37.0 | Settings, the stats screen, the loadout's panels (its Skia-free `/lobby` entry, new in 0.26.0; 0.27.1's options for a pack drawn on its own backdrop; 0.28.0's Ready pill; 0.29.0's leading Settings sections), How to Play, and `ScreenFrame` around the stats screen, Profiles, Edit Profile and the toaster (0.34.0, where `RotatedFrame` became `ScreenFrame`), a pack's lettering (0.35.0's `LetteringProvider`), Settings' Profile row (0.37.0's `profilesRow`) |
403
- | `@tastic/profile` | >=0.25.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`), and each profile's Edit Profile screen (0.22.0's `EditProfileScreen`, behind `EditProfileRoute`, with a pack's sections from 0.25.0) |
403
+ | `@tastic/profile` | >=0.26.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`), and each profile's Edit Profile screen (0.22.0's `EditProfileScreen`, behind `EditProfileRoute`, with a pack's sections from 0.25.0) |
404
404
  | `@tastic/achievements` | >=0.6.0 | `createGameStats`, `forgetProfileAchievements` |
405
405
  | `@tastic/split-screen` | >=0.5.5 | the 2 Player loadout's two halves |
406
406
  | `@tastic/edge-guard` | >=0.2.0 | Edge Guard during play (`useEdgeGestureGuard` on iOS, `edgeGuardScreenOptions` on Android) |
package/dist/index.d.mts CHANGED
@@ -243,6 +243,7 @@ interface HeroTitleProps {
243
243
  interface PackStatsSectionsProps {
244
244
  profileId: string | null;
245
245
  gameId: string | null;
246
+ gameIds: readonly string[] | null;
246
247
  }
247
248
  interface HomeTab {
248
249
  label: string;
package/dist/index.d.ts CHANGED
@@ -243,6 +243,7 @@ interface HeroTitleProps {
243
243
  interface PackStatsSectionsProps {
244
244
  profileId: string | null;
245
245
  gameId: string | null;
246
+ gameIds: readonly string[] | null;
246
247
  }
247
248
  interface HomeTab {
248
249
  label: string;
package/dist/index.js CHANGED
@@ -1524,6 +1524,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1524
1524
  var NO_PACK_TABS = [];
1525
1525
  var EVERYONE = "__everyone__";
1526
1526
  var ALL_GAMES = "__all__";
1527
+ var tabGroup = (index) => `__tab-group-${index}__`;
1528
+ var tabGames = (index) => `__tab-${index}__`;
1527
1529
  var PLAYER_PICKER_ID = "stats-player";
1528
1530
  var GAME_PICKER_ID = "stats-game";
1529
1531
  var MANAGE = "__manage__";
@@ -1552,12 +1554,21 @@ function StatsContent({ pickerHost }) {
1552
1554
  const statsPlayer = useStatsPlayer();
1553
1555
  const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1554
1556
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1555
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1557
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1558
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1559
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1560
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1561
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1556
1562
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1557
1563
  const packTab = packTabs.find((t) => t.value === tab);
1558
1564
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1559
1565
  const playerOptions = (0, import_react17.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1560
- const gameOptions = (0, import_react17.useMemo)(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
1566
+ const gameOptions = (0, import_react17.useMemo)(() => {
1567
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1568
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1569
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1570
+ return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];
1571
+ }, [pack.games, homeTabs]);
1561
1572
  const tabButtons = (0, import_react17.useMemo)(() => {
1562
1573
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
1563
1574
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1568,7 +1579,7 @@ function StatsContent({ pickerHost }) {
1568
1579
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1569
1580
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1570
1581
  const playerSize = (0, import_profile10.getOptionPickerContentSize)(playerOptions);
1571
- const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions.length);
1582
+ const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions);
1572
1583
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1573
1584
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1574
1585
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1578,11 +1589,11 @@ function StatsContent({ pickerHost }) {
1578
1589
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1579
1590
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1580
1591
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1581
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1582
- showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1592
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1593
+ showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1583
1594
  ] }),
1584
- tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1585
- PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1595
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1596
+ PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1586
1597
  tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1587
1598
  ] });
1588
1599
  }
package/dist/index.mjs CHANGED
@@ -1445,6 +1445,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1445
1445
  var NO_PACK_TABS = [];
1446
1446
  var EVERYONE = "__everyone__";
1447
1447
  var ALL_GAMES = "__all__";
1448
+ var tabGroup = (index) => `__tab-group-${index}__`;
1449
+ var tabGames = (index) => `__tab-${index}__`;
1448
1450
  var PLAYER_PICKER_ID = "stats-player";
1449
1451
  var GAME_PICKER_ID = "stats-game";
1450
1452
  var MANAGE = "__manage__";
@@ -1473,12 +1475,21 @@ function StatsContent({ pickerHost }) {
1473
1475
  const statsPlayer = useStatsPlayer();
1474
1476
  const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1475
1477
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1476
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1478
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1479
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1480
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1481
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1482
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1477
1483
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1478
1484
  const packTab = packTabs.find((t) => t.value === tab);
1479
1485
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1480
1486
  const playerOptions = useMemo7(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1481
- const gameOptions = useMemo7(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
1487
+ const gameOptions = useMemo7(() => {
1488
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1489
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1490
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1491
+ return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];
1492
+ }, [pack.games, homeTabs]);
1482
1493
  const tabButtons = useMemo7(() => {
1483
1494
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
1484
1495
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1489,7 +1500,7 @@ function StatsContent({ pickerHost }) {
1489
1500
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1490
1501
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1491
1502
  const playerSize = getOptionPickerContentSize2(playerOptions);
1492
- const gameSize = getOptionPickerContentSize2(gameOptions.length);
1503
+ const gameSize = getOptionPickerContentSize2(gameOptions);
1493
1504
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1494
1505
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1495
1506
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1499,11 +1510,11 @@ function StatsContent({ pickerHost }) {
1499
1510
  /* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1500
1511
  /* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1501
1512
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1502
- /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1503
- showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1513
+ /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1514
+ showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1504
1515
  ] }),
1505
- tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1506
- PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1516
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1517
+ PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1507
1518
  tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx18(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx18(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1508
1519
  ] });
1509
1520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "The app around a pack of React Native games, two-seat or for one player: Home, the loadout, the stats screen, Profiles and Settings, the pack's Redux store and its root providers, driven by one PackDefinition",
5
5
  "keywords": [
6
6
  "react-native",
@@ -87,7 +87,7 @@
87
87
  "@tastic/core": "^0.17.0",
88
88
  "@tastic/edge-guard": "^0.2.1",
89
89
  "@tastic/hud": "^0.37.0",
90
- "@tastic/profile": "^0.25.0",
90
+ "@tastic/profile": "^0.26.0",
91
91
  "@tastic/split-screen": "^0.6.0",
92
92
  "@testing-library/react-native": "^14.1.0",
93
93
  "@types/jest": "30.0.0",
@@ -139,7 +139,7 @@
139
139
  "@tastic/core": ">=0.16.0",
140
140
  "@tastic/edge-guard": ">=0.2.0",
141
141
  "@tastic/hud": ">=0.37.0",
142
- "@tastic/profile": ">=0.25.0",
142
+ "@tastic/profile": ">=0.26.0",
143
143
  "@tastic/split-screen": ">=0.5.5",
144
144
  "expo-audio": ">=58.0.11",
145
145
  "expo-blur": ">=58.0.4",
@@ -37,6 +37,9 @@ const NO_PACK_TABS: readonly PackStatsTab[] = []
37
37
  // The pickers' values for Everyone and All Games (neither is ever a profile or game id).
38
38
  const EVERYONE = '__everyone__'
39
39
  const ALL_GAMES = '__all__'
40
+ // A Home tab's games (PackDefinition.homeTabs) on the game picker: the group's row, and its "All" row
41
+ const tabGroup = (index: number) => `__tab-group-${index}__`
42
+ const tabGames = (index: number) => `__tab-${index}__`
40
43
 
41
44
  const PLAYER_PICKER_ID = 'stats-player'
42
45
  const GAME_PICKER_ID = 'stats-game'
@@ -109,7 +112,13 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
109
112
  const [selectedProfileId, setSelectedProfileId] = useState<string | null>(() => (pack.useStatsPlayer ? statsPlayer : pack.guestStats ? (lastSelected[1] ?? GUEST_PLAYER_ID) : null))
110
113
  const profileId = selectedProfileId && profiles.length > 0 && ((pack.guestStats && selectedProfileId === GUEST_PLAYER_ID) || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null
111
114
 
112
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId)
115
+ // With Home's tabs, the game picker groups the games by them (Jay, 2026-11-20: Solitaire and Two Player, a shorter list), and can be
116
+ // on a whole tab's games
117
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null
118
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1
119
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs![pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId)
120
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id)
121
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId
113
122
  const packTabs = pack.statsTabs ?? NO_PACK_TABS
114
123
  const packTab = packTabs.find((t) => t.value === tab)
115
124
  // One achievement list across the pack's games doesn't narrow to a game, so the game picker goes.
@@ -118,7 +127,12 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
118
127
  // Always there (Jay, 2026-11-19), with no profile yet too: Everyone, then each profile, then Manage, which
119
128
  // opens the Profiles screen to make one.
120
129
  const playerOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: EVERYONE, label: 'Everyone', icon: 'account-group' }, ...(pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: 'Guest', icon: 'account-outline' }] : []), ...profiles.map((p) => ({ value: p.id, label: p.name, icon: 'account', color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark])
121
- const gameOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games])
130
+ const gameOptions = useMemo<OptionPickerOption<string>[]>(() => {
131
+ const all = { value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }
132
+ const option = (g: PackGameDefinition) => ({ value: g.id, label: g.title, icon: 'cards-playing-outline' })
133
+ if (!homeTabs) return [all, ...pack.games.map(option)]
134
+ return [all, ...homeTabs.map((tab, index) => ({ value: tabGroup(index), label: tab.label, icon: 'folder-outline', options: [{ value: tabGames(index), label: 'All', triggerLabel: tab.label, icon: 'view-grid-outline' }, ...pack.games.filter((g) => tab.includes(g)).map(option)] }))]
135
+ }, [pack.games, homeTabs])
122
136
  // The pack's label lettering (PackDefinition.labelStyle) on each tab.
123
137
  const tabButtons = useMemo(() => {
124
138
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: 'Stats' }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: 'Achievements' }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS
@@ -136,7 +150,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
136
150
  // The pack's own placement for the pickers' menus (PackDefinition.usePickerAlign), sized from their rows.
137
151
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign
138
152
  const playerSize = getOptionPickerContentSize(playerOptions)
139
- const gameSize = getOptionPickerContentSize(gameOptions.length)
153
+ const gameSize = getOptionPickerContentSize(gameOptions)
140
154
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height)
141
155
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height)
142
156
 
@@ -157,15 +171,15 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
157
171
  {/* Takes a press on its own blank parts (the gap, an open menu's padding) while a menu is open, so
158
172
  it never reaches StatsPressAway. */}
159
173
  <View style={[styles.filters, pickerHost.openId !== null && styles.filtersOpen]} onStartShouldSetResponder={() => pickerHost.openId !== null}>
160
- <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => (value === MANAGE ? router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value))} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} alignOverride={playerAlign} triggerStyle={triggerStyle} />
161
- {showGamePicker && <OptionPicker id={GAME_PICKER_ID} host={pickerHost} options={gameOptions} value={gameId} onChange={setGameId} color={colors.primary} dark={dark} icon='view-grid-outline' alignOverride={gameAlign} triggerStyle={triggerStyle} />}
174
+ <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => (value === MANAGE ? router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value))} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} caption='Player' alignOverride={playerAlign} triggerStyle={triggerStyle} />
175
+ {showGamePicker && <OptionPicker id={GAME_PICKER_ID} host={pickerHost} options={gameOptions} value={gameId} onChange={setGameId} color={colors.primary} dark={dark} icon='view-grid-outline' caption='Game' alignOverride={gameAlign} triggerStyle={triggerStyle} />}
162
176
  </View>
163
177
 
164
178
  {/* The pack's own section across its games (a calendar of play), first on the Stats tab: it
165
179
  follows both filters, so narrowed to one game it shows that game's part. */}
166
- {tab === STATS && pack.StatsSections && <pack.StatsSections profileId={profileId} gameId={gameId === ALL_GAMES ? null : gameId} />}
180
+ {tab === STATS && pack.StatsSections && <pack.StatsSections profileId={profileId} gameId={oneGameId} gameIds={gameIds} />}
167
181
 
168
- {PackTabContent && <PackTabContent profileId={profileId} gameId={gameId === ALL_GAMES ? null : gameId} />}
182
+ {PackTabContent && <PackTabContent profileId={profileId} gameId={oneGameId} gameIds={gameIds} />}
169
183
 
170
184
  {tab === ACHIEVEMENTS && pack.AchievementList ? <pack.AchievementList profileId={profileId} /> : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => <GameStats key={game.id} game={game} tab={tab} profileId={profileId} showTitle={games.length > 1 && pack.statsGameTitles !== false} titleColor={fg} />)}
171
185
  </BaseStatsScreen>
package/src/types.ts CHANGED
@@ -237,7 +237,10 @@ export interface HeroTitleProps {
237
237
  // the player (null is Everyone) and the game (null is All Games).
238
238
  export interface PackStatsSectionsProps {
239
239
  profileId: string | null
240
+ // The one game the game picker is on, or null for several
240
241
  gameId: string | null
242
+ // The games it's on: null for All Games, one of the pack's Home tabs' games (its Solitaire, its Two Player), or [gameId]
243
+ gameIds: readonly string[] | null
241
244
  }
242
245
 
243
246
  // A tab on Home (PackDefinition.homeTabs): its label, and which of the pack's games it shows, in the