@tastic/shell 0.12.0 → 0.14.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 +6 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +32 -14
- package/dist/index.mjs +31 -13
- package/package.json +3 -3
- package/src/RootLayout.tsx +43 -23
- package/src/screens/HomeScreen.tsx +5 -3
- package/src/screens/StatsScreen.tsx +29 -11
- package/src/types.ts +14 -0
package/README.md
CHANGED
|
@@ -8,6 +8,9 @@ leave out its seat 2 and its loadout, come back on a cold launch, and show a pre
|
|
|
8
8
|
pack for one player at a time (CardTastic, Solitaire renamed) can lay its own table, theme, toaster,
|
|
9
9
|
How to Play and stats tabs into the same screens.
|
|
10
10
|
|
|
11
|
+
The stats screen's player picker is always there, with no profile yet too: Everyone, each profile
|
|
12
|
+
(and Guest, with `guestStats`, once one exists), then Manage, which opens the Profiles screen.
|
|
13
|
+
|
|
11
14
|
Built from the shell PuckTastic and DuelTastic each carried in `src/shell/` (made identical on
|
|
12
15
|
2026-10-28), so the packs and the next ones (CardTastic) share one copy. Part of the `@tastic`
|
|
13
16
|
package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native-hud),
|
|
@@ -105,6 +108,8 @@ the front of an in-app link, so a route starting with a game id equal to the bas
|
|
|
105
108
|
| `HeroTitle` | Home's wordmark, drawn by the pack (`HeroTitleProps`: `words`, `color`, `p1Color`, `p2Color`, `active`, false while Home is covered or the app is in the background, and `fit`, the box it has beside the preview grid on a wide screen, undefined at its own size). |
|
|
106
109
|
| `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
|
|
107
110
|
| `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
|
|
111
|
+
| `titleStyle?` | The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own type: Home's game cards, the stats screen's title and game headings, and every hud dialog's title (the shell mounts hud's `DialogHeaderStyleProvider` in the standard tone, so the big icon and accent color stay). Needs `@tastic/hud` with `titleStyle` in the standard tone and on `BaseStatsScreen`. |
|
|
112
|
+
| `labelStyle?` | The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's and Home's tabs, the stats screen's section headings, the Settings sheet's sections and every `@tastic/profile` picker pill. The shell mounts hud's `LetteringProvider` with it and `titleStyle`. Needs `@tastic/hud` with `LetteringProvider` and `@tastic/profile` reading it. |
|
|
108
113
|
| `otaVersion` | The version label in Settings. |
|
|
109
114
|
| `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). |
|
|
110
115
|
| `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
|
|
@@ -128,6 +133,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
128
133
|
| `guide?` | The pack's own How to Play (`PackGuide`: `version`, `selectVersionSeen`, `markSeen`, `getSteps({ touch })`), for cards that teach every game at once: shown on Home's first launch (never while a cold launch resumes a game), replayed from Home's Settings, never in a play screen. Its seen version is a key of the pack's own. |
|
|
129
134
|
| `guestLabel?`, `nullLabel?` | Seat 1's button on Home and in every loadout: the chip's label for a guest (default `'P1'`) and the guest row's in its menu. A 2 Player loadout's seat 2 button takes the same two (its guest default `'P2'`). |
|
|
130
135
|
| `guestStats?` | The stats screen keeps a guest's stats under `GUEST_PLAYER_ID` (`'guest'`): a Guest entry between Everyone and the profiles once a profile exists, and the screen opens on seat 1's player. Without it the screen opens on Everyone, where guests count. |
|
|
136
|
+
| `useStatsPlayer?` | A hook returning the profile id the stats screen opens on, for a pack that keeps its own idea of who is playing (AlphaTastic's active player). Null, or an id not on the roster, opens on Everyone. Takes precedence over `guestStats`' opening on seat 1. |
|
|
131
137
|
| `AchievementList?` | One achievement list across the pack's games, on the Achievements tab, with the game picker hidden there. |
|
|
132
138
|
| `statsTabs?` | Tabs of the pack's own between Stats and Achievements (`PackStatsTab`: `value`, `label`, `Content`, handed both filters). With them every tab is as wide as its label, with no icons, so three fit a phone. |
|
|
133
139
|
| `resetStats?` | The stats screen's Reset where the pack resets stats itself (`PackStatsReset`: a `useReset` hook returning `(profileId) => void`, and the `labels` for a player's name, Guest, or `null` for Everyone). It follows the player picker, not the game picker. |
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ import { GuideStep } from '@tastic/hud/guide';
|
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
9
|
import { Href, Stack } from 'expo-router';
|
|
10
|
+
import { TextStyle, ImageSourcePropType } from 'react-native';
|
|
10
11
|
import * as redux from 'redux';
|
|
11
12
|
import { Reducer, Action } from 'redux';
|
|
12
13
|
import * as _rific_core from '@rific/core';
|
|
@@ -20,7 +21,6 @@ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
|
20
21
|
import { Middleware } from '@reduxjs/toolkit';
|
|
21
22
|
import * as redux_thunk from 'redux-thunk';
|
|
22
23
|
import * as redux_persist_es_persistReducer from 'redux-persist/es/persistReducer';
|
|
23
|
-
import { ImageSourcePropType } from 'react-native';
|
|
24
24
|
import * as _tastic_achievements from '@tastic/achievements';
|
|
25
25
|
import { UnlockedAchievementsState, AchievementDefinition, AchievementsState } from '@tastic/achievements';
|
|
26
26
|
|
|
@@ -279,6 +279,8 @@ interface PackDefinition {
|
|
|
279
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
280
280
|
fonts?: Record<string, FontSource>;
|
|
281
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
282
284
|
otaVersion: number;
|
|
283
285
|
SettingsSections?: ComponentType;
|
|
284
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -299,6 +301,7 @@ interface PackDefinition {
|
|
|
299
301
|
guestLabel?: string;
|
|
300
302
|
nullLabel?: string;
|
|
301
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
302
305
|
AchievementList?: ComponentType<{
|
|
303
306
|
profileId: string | null;
|
|
304
307
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { GuideStep } from '@tastic/hud/guide';
|
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
9
|
import { Href, Stack } from 'expo-router';
|
|
10
|
+
import { TextStyle, ImageSourcePropType } from 'react-native';
|
|
10
11
|
import * as redux from 'redux';
|
|
11
12
|
import { Reducer, Action } from 'redux';
|
|
12
13
|
import * as _rific_core from '@rific/core';
|
|
@@ -20,7 +21,6 @@ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
|
20
21
|
import { Middleware } from '@reduxjs/toolkit';
|
|
21
22
|
import * as redux_thunk from 'redux-thunk';
|
|
22
23
|
import * as redux_persist_es_persistReducer from 'redux-persist/es/persistReducer';
|
|
23
|
-
import { ImageSourcePropType } from 'react-native';
|
|
24
24
|
import * as _tastic_achievements from '@tastic/achievements';
|
|
25
25
|
import { UnlockedAchievementsState, AchievementDefinition, AchievementsState } from '@tastic/achievements';
|
|
26
26
|
|
|
@@ -279,6 +279,8 @@ interface PackDefinition {
|
|
|
279
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
280
280
|
fonts?: Record<string, FontSource>;
|
|
281
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
282
284
|
otaVersion: number;
|
|
283
285
|
SettingsSections?: ComponentType;
|
|
284
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -299,6 +301,7 @@ interface PackDefinition {
|
|
|
299
301
|
guestLabel?: string;
|
|
300
302
|
nullLabel?: string;
|
|
301
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
302
305
|
AchievementList?: ComponentType<{
|
|
303
306
|
profileId: string | null;
|
|
304
307
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -555,12 +555,18 @@ function PackRoot({ pack, children }) {
|
|
|
555
555
|
const inner = Provider ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Provider, { children }) : children;
|
|
556
556
|
return previewColor ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: inner });
|
|
557
557
|
}
|
|
558
|
+
function DialogTitles({ children }) {
|
|
559
|
+
const { titleStyle, labelStyle } = usePack();
|
|
560
|
+
const lettered = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.LetteringProvider, { title: titleStyle, label: labelStyle, children });
|
|
561
|
+
if (!titleStyle) return lettered;
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.DialogHeaderStyleProvider, { tone: "standard", titleStyle, children: lettered });
|
|
563
|
+
}
|
|
558
564
|
function RootLayout({ pack, store, persistor }) {
|
|
559
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitles, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
560
566
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GuideHost, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AppStack, {}) }),
|
|
561
567
|
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FramedToaster, {}),
|
|
562
568
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateDialog, {})
|
|
563
|
-
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
569
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
564
570
|
}
|
|
565
571
|
var styles = import_react_native3.StyleSheet.create({
|
|
566
572
|
root: { flex: 1 }
|
|
@@ -1202,7 +1208,7 @@ function HomeMenu() {
|
|
|
1202
1208
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1203
1209
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1204
1210
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1205
|
-
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1211
|
+
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1206
1212
|
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1207
1213
|
const columnClamp = useClampOnShrink();
|
|
1208
1214
|
const gridClamp = useClampOnShrink();
|
|
@@ -1279,6 +1285,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1279
1285
|
}
|
|
1280
1286
|
var ROW_BLURB_LINES = 3;
|
|
1281
1287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1288
|
+
const { titleStyle } = usePack();
|
|
1282
1289
|
const well = (0, import_chrome5.useWellColors)();
|
|
1283
1290
|
const GameIcon = game.icon;
|
|
1284
1291
|
return (
|
|
@@ -1288,7 +1295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1288
1295
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1289
1296
|
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1290
1297
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1291
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1292
1299
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1293
1300
|
] })
|
|
1294
1301
|
] }),
|
|
@@ -1297,11 +1304,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1297
1304
|
);
|
|
1298
1305
|
}
|
|
1299
1306
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1307
|
+
const { titleStyle } = usePack();
|
|
1300
1308
|
const well = (0, import_chrome5.useWellColors)();
|
|
1301
1309
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1302
1310
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1303
1311
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1304
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1305
1313
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1306
1314
|
] }),
|
|
1307
1315
|
onRules && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
@@ -1480,6 +1488,7 @@ function ProfilesRoute() {
|
|
|
1480
1488
|
var import_auto_paper7 = require("@rific/auto-paper");
|
|
1481
1489
|
var import_chrome7 = require("@tastic/hud/chrome");
|
|
1482
1490
|
var import_profile9 = require("@tastic/profile");
|
|
1491
|
+
var import_expo_router7 = require("expo-router");
|
|
1483
1492
|
var import_react17 = require("react");
|
|
1484
1493
|
var import_react_native10 = require("react-native");
|
|
1485
1494
|
var import_react_native_paper2 = require("react-native-paper");
|
|
@@ -1498,6 +1507,8 @@ var EVERYONE = "__everyone__";
|
|
|
1498
1507
|
var ALL_GAMES = "__all__";
|
|
1499
1508
|
var PLAYER_PICKER_ID = "stats-player";
|
|
1500
1509
|
var GAME_PICKER_ID = "stats-game";
|
|
1510
|
+
var MANAGE = "__manage__";
|
|
1511
|
+
var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline", dividerBefore: true };
|
|
1501
1512
|
var STATS_MAX_WIDTH = 640;
|
|
1502
1513
|
function StatsScreen() {
|
|
1503
1514
|
const pickerHost = (0, import_chrome7.usePopoverHost)();
|
|
@@ -1508,6 +1519,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1508
1519
|
}
|
|
1509
1520
|
var useNoPackReset = () => null;
|
|
1510
1521
|
var noPickerAlign2 = () => void 0;
|
|
1522
|
+
var useNoStatsPlayer = () => null;
|
|
1511
1523
|
function StatsContent({ pickerHost }) {
|
|
1512
1524
|
const pack = usePack();
|
|
1513
1525
|
const { dark, colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
@@ -1517,32 +1529,37 @@ function StatsContent({ pickerHost }) {
|
|
|
1517
1529
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1518
1530
|
const [tab, setTab] = (0, import_react17.useState)(STATS);
|
|
1519
1531
|
const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES);
|
|
1520
|
-
const
|
|
1532
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1533
|
+
const statsPlayer = useStatsPlayer();
|
|
1534
|
+
const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1521
1535
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1522
1536
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1523
1537
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
1524
1538
|
const packTab = packTabs.find((t) => t.value === tab);
|
|
1525
1539
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1526
|
-
const playerOptions = (0, import_react17.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats ? [{ 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 }))], [profiles, pack, dark]);
|
|
1540
|
+
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]);
|
|
1527
1541
|
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]);
|
|
1528
|
-
const tabButtons = (0, import_react17.useMemo)(() =>
|
|
1542
|
+
const tabButtons = (0, import_react17.useMemo)(() => {
|
|
1543
|
+
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;
|
|
1544
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1545
|
+
}, [packTabs, pack.labelStyle]);
|
|
1529
1546
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1530
1547
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1531
1548
|
const packReset = usePackReset();
|
|
1532
1549
|
const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
|
|
1533
1550
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
|
|
1534
|
-
const playerSize = (0, import_profile9.getOptionPickerContentSize)(playerOptions
|
|
1551
|
+
const playerSize = (0, import_profile9.getOptionPickerContentSize)(playerOptions);
|
|
1535
1552
|
const gameSize = (0, import_profile9.getOptionPickerContentSize)(gameOptions.length);
|
|
1536
1553
|
const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
|
|
1537
1554
|
const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
|
|
1538
1555
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1539
1556
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1540
1557
|
const PackTabContent = packTab?.Content;
|
|
1541
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1542
1559
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1543
1560
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1544
1561
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1545
|
-
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router7.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1546
1563
|
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1547
1564
|
] }),
|
|
1548
1565
|
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
@@ -1559,11 +1576,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1559
1576
|
return { onReset: resetGames, label: games.length === 1 ? `Reset ${scope} Stats` : "Reset All Stats", title: "Reset Stats?", body: `Erases every player's stats and achievements in ${scope}. This cannot be undone.` };
|
|
1560
1577
|
}
|
|
1561
1578
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1579
|
+
const { titleStyle } = usePack();
|
|
1562
1580
|
const { StatsSections, AchievementList } = game;
|
|
1563
1581
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1564
1582
|
if (!Sections) return null;
|
|
1565
1583
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1566
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1584
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1567
1585
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sections, { profileId })
|
|
1568
1586
|
] });
|
|
1569
1587
|
}
|
|
@@ -1658,7 +1676,7 @@ function useActiveRound(game, defaults) {
|
|
|
1658
1676
|
}
|
|
1659
1677
|
|
|
1660
1678
|
// src/hooks/useBackBlock.ts
|
|
1661
|
-
var
|
|
1679
|
+
var import_expo_router8 = require("expo-router");
|
|
1662
1680
|
var import_react19 = require("react");
|
|
1663
1681
|
function useBackBlock(held, onHeld, leave = import_core8.safeBack) {
|
|
1664
1682
|
const leavingRef = (0, import_react19.useRef)(false);
|
|
@@ -1667,7 +1685,7 @@ function useBackBlock(held, onHeld, leave = import_core8.safeBack) {
|
|
|
1667
1685
|
(0, import_react19.useEffect)(() => {
|
|
1668
1686
|
leaveRef.current = leave;
|
|
1669
1687
|
});
|
|
1670
|
-
(0,
|
|
1688
|
+
(0, import_expo_router8.usePreventRemove)(held && !leaving, ({ repeat }) => {
|
|
1671
1689
|
if (leavingRef.current) {
|
|
1672
1690
|
setLeaving(true);
|
|
1673
1691
|
repeat();
|
package/dist/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { useHapticSettings } from "@rific/feedback-press";
|
|
|
27
27
|
import { Toaster, ToastProvider } from "@rific/toaster";
|
|
28
28
|
import { useThemedRootBackground } from "@tastic/core";
|
|
29
29
|
import { edgeGuardScreenOptions } from "@tastic/edge-guard";
|
|
30
|
-
import { ScreenFrame } from "@tastic/hud/chrome";
|
|
30
|
+
import { DialogHeaderStyleProvider, LetteringProvider, ScreenFrame } from "@tastic/hud/chrome";
|
|
31
31
|
import { ProfileColorProvider } from "@tastic/profile";
|
|
32
32
|
import * as Haptics from "expo-haptics";
|
|
33
33
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from "expo-router";
|
|
@@ -477,12 +477,18 @@ function PackRoot({ pack, children }) {
|
|
|
477
477
|
const inner = Provider ? /* @__PURE__ */ jsx10(Provider, { children }) : children;
|
|
478
478
|
return previewColor ? /* @__PURE__ */ jsx10(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ jsx10(Fragment4, { children: inner });
|
|
479
479
|
}
|
|
480
|
+
function DialogTitles({ children }) {
|
|
481
|
+
const { titleStyle, labelStyle } = usePack();
|
|
482
|
+
const lettered = /* @__PURE__ */ jsx10(LetteringProvider, { title: titleStyle, label: labelStyle, children });
|
|
483
|
+
if (!titleStyle) return lettered;
|
|
484
|
+
return /* @__PURE__ */ jsx10(DialogHeaderStyleProvider, { tone: "standard", titleStyle, children: lettered });
|
|
485
|
+
}
|
|
480
486
|
function RootLayout({ pack, store, persistor }) {
|
|
481
|
-
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
487
|
+
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(DialogTitles, { children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
482
488
|
/* @__PURE__ */ jsx10(GuideHost, { children: /* @__PURE__ */ jsx10(AppStack, {}) }),
|
|
483
489
|
pack.Toaster ? /* @__PURE__ */ jsx10(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ jsx10(FramedToaster, {}),
|
|
484
490
|
/* @__PURE__ */ jsx10(UpdateDialog, {})
|
|
485
|
-
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
491
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
486
492
|
}
|
|
487
493
|
var styles = StyleSheet.create({
|
|
488
494
|
root: { flex: 1 }
|
|
@@ -1124,7 +1130,7 @@ function HomeMenu() {
|
|
|
1124
1130
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1125
1131
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1126
1132
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1127
|
-
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1133
|
+
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1128
1134
|
const tabBar = tab && /* @__PURE__ */ jsx15(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1129
1135
|
const columnClamp = useClampOnShrink();
|
|
1130
1136
|
const gridClamp = useClampOnShrink();
|
|
@@ -1201,6 +1207,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1201
1207
|
}
|
|
1202
1208
|
var ROW_BLURB_LINES = 3;
|
|
1203
1209
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1210
|
+
const { titleStyle } = usePack();
|
|
1204
1211
|
const well = useWellColors();
|
|
1205
1212
|
const GameIcon = game.icon;
|
|
1206
1213
|
return (
|
|
@@ -1210,7 +1217,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1210
1217
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1211
1218
|
game.Preview ? /* @__PURE__ */ jsx15(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx15(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx15(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1212
1219
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1213
|
-
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1220
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1214
1221
|
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1215
1222
|
] })
|
|
1216
1223
|
] }),
|
|
@@ -1219,11 +1226,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1219
1226
|
);
|
|
1220
1227
|
}
|
|
1221
1228
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1229
|
+
const { titleStyle } = usePack();
|
|
1222
1230
|
const well = useWellColors();
|
|
1223
1231
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1224
1232
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1225
1233
|
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1226
|
-
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1234
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1227
1235
|
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1228
1236
|
] }),
|
|
1229
1237
|
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
@@ -1402,6 +1410,7 @@ function ProfilesRoute() {
|
|
|
1402
1410
|
import { useAutoPaperTheme as useAutoPaperTheme5 } from "@rific/auto-paper";
|
|
1403
1411
|
import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as ScreenFrame3, usePopoverHost as usePopoverHost3 } from "@tastic/hud/chrome";
|
|
1404
1412
|
import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker as OptionPicker2 } from "@tastic/profile";
|
|
1413
|
+
import { router as router4 } from "expo-router";
|
|
1405
1414
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1406
1415
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1407
1416
|
import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
|
|
@@ -1420,6 +1429,8 @@ var EVERYONE = "__everyone__";
|
|
|
1420
1429
|
var ALL_GAMES = "__all__";
|
|
1421
1430
|
var PLAYER_PICKER_ID = "stats-player";
|
|
1422
1431
|
var GAME_PICKER_ID = "stats-game";
|
|
1432
|
+
var MANAGE = "__manage__";
|
|
1433
|
+
var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline", dividerBefore: true };
|
|
1423
1434
|
var STATS_MAX_WIDTH = 640;
|
|
1424
1435
|
function StatsScreen() {
|
|
1425
1436
|
const pickerHost = usePopoverHost3();
|
|
@@ -1430,6 +1441,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1430
1441
|
}
|
|
1431
1442
|
var useNoPackReset = () => null;
|
|
1432
1443
|
var noPickerAlign2 = () => void 0;
|
|
1444
|
+
var useNoStatsPlayer = () => null;
|
|
1433
1445
|
function StatsContent({ pickerHost }) {
|
|
1434
1446
|
const pack = usePack();
|
|
1435
1447
|
const { dark, colors } = useAutoPaperTheme5();
|
|
@@ -1439,32 +1451,37 @@ function StatsContent({ pickerHost }) {
|
|
|
1439
1451
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1440
1452
|
const [tab, setTab] = useState7(STATS);
|
|
1441
1453
|
const [gameId, setGameId] = useState7(ALL_GAMES);
|
|
1442
|
-
const
|
|
1454
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1455
|
+
const statsPlayer = useStatsPlayer();
|
|
1456
|
+
const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1443
1457
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1444
1458
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1445
1459
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
1446
1460
|
const packTab = packTabs.find((t) => t.value === tab);
|
|
1447
1461
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1448
|
-
const playerOptions = useMemo7(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats ? [{ 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 }))], [profiles, pack, dark]);
|
|
1462
|
+
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]);
|
|
1449
1463
|
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]);
|
|
1450
|
-
const tabButtons = useMemo7(() =>
|
|
1464
|
+
const tabButtons = useMemo7(() => {
|
|
1465
|
+
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;
|
|
1466
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1467
|
+
}, [packTabs, pack.labelStyle]);
|
|
1451
1468
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1452
1469
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1453
1470
|
const packReset = usePackReset();
|
|
1454
1471
|
const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
|
|
1455
1472
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
|
|
1456
|
-
const playerSize = getOptionPickerContentSize2(playerOptions
|
|
1473
|
+
const playerSize = getOptionPickerContentSize2(playerOptions);
|
|
1457
1474
|
const gameSize = getOptionPickerContentSize2(gameOptions.length);
|
|
1458
1475
|
const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
|
|
1459
1476
|
const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
|
|
1460
1477
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1461
1478
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1462
1479
|
const PackTabContent = packTab?.Content;
|
|
1463
|
-
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1480
|
+
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1464
1481
|
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1465
1482
|
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1466
1483
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1467
|
-
|
|
1484
|
+
/* @__PURE__ */ jsx17(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router4.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1468
1485
|
showGamePicker && /* @__PURE__ */ jsx17(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1469
1486
|
] }),
|
|
1470
1487
|
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx17(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
@@ -1481,11 +1498,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1481
1498
|
return { onReset: resetGames, label: games.length === 1 ? `Reset ${scope} Stats` : "Reset All Stats", title: "Reset Stats?", body: `Erases every player's stats and achievements in ${scope}. This cannot be undone.` };
|
|
1482
1499
|
}
|
|
1483
1500
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1501
|
+
const { titleStyle } = usePack();
|
|
1484
1502
|
const { StatsSections, AchievementList } = game;
|
|
1485
1503
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1486
1504
|
if (!Sections) return null;
|
|
1487
1505
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1488
|
-
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1506
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1489
1507
|
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1490
1508
|
] });
|
|
1491
1509
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@tastic/achievements": "^0.6.1",
|
|
87
87
|
"@tastic/core": "^0.17.0",
|
|
88
88
|
"@tastic/edge-guard": "^0.2.1",
|
|
89
|
-
"@tastic/hud": "^0.
|
|
89
|
+
"@tastic/hud": "^0.35.0",
|
|
90
90
|
"@tastic/profile": "^0.19.0",
|
|
91
91
|
"@tastic/split-screen": "^0.6.0",
|
|
92
92
|
"@testing-library/react-native": "^14.1.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"@tastic/achievements": ">=0.6.0",
|
|
139
139
|
"@tastic/core": ">=0.16.0",
|
|
140
140
|
"@tastic/edge-guard": ">=0.2.0",
|
|
141
|
-
"@tastic/hud": ">=0.
|
|
141
|
+
"@tastic/hud": ">=0.35.0",
|
|
142
142
|
"@tastic/profile": ">=0.18.0",
|
|
143
143
|
"@tastic/split-screen": ">=0.5.5",
|
|
144
144
|
"expo-audio": ">=58.0.11",
|
package/src/RootLayout.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { useHapticSettings } from '@rific/feedback-press'
|
|
|
3
3
|
import { Toaster, ToastProvider } from '@rific/toaster'
|
|
4
4
|
import { useThemedRootBackground } from '@tastic/core'
|
|
5
5
|
import { edgeGuardScreenOptions } from '@tastic/edge-guard'
|
|
6
|
-
import { ScreenFrame } from '@tastic/hud/chrome'
|
|
6
|
+
import { DialogHeaderStyleProvider, LetteringProvider, ScreenFrame } from '@tastic/hud/chrome'
|
|
7
7
|
import { ProfileColorProvider } from '@tastic/profile'
|
|
8
8
|
import * as Haptics from 'expo-haptics'
|
|
9
9
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from 'expo-router'
|
|
@@ -198,6 +198,24 @@ interface RootLayoutProps {
|
|
|
198
198
|
persistor: Persistor
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// The pack's own lettering (PackDefinition.titleStyle and labelStyle): every hud dialog's title, the
|
|
202
|
+
// fleet's big header kept, and hud's and @tastic/profile's titles and labels (LetteringProvider). Above
|
|
203
|
+
// Theme, so it reaches the dialogs in auto-paper's portal host.
|
|
204
|
+
function DialogTitles({ children }: { children: ReactNode }) {
|
|
205
|
+
const { titleStyle, labelStyle } = usePack()
|
|
206
|
+
const lettered = (
|
|
207
|
+
<LetteringProvider title={titleStyle} label={labelStyle}>
|
|
208
|
+
{children}
|
|
209
|
+
</LetteringProvider>
|
|
210
|
+
)
|
|
211
|
+
if (!titleStyle) return lettered
|
|
212
|
+
return (
|
|
213
|
+
<DialogHeaderStyleProvider tone='standard' titleStyle={titleStyle}>
|
|
214
|
+
{lettered}
|
|
215
|
+
</DialogHeaderStyleProvider>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
201
219
|
export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
|
|
202
220
|
return (
|
|
203
221
|
<GestureHandlerRootView style={styles.root}>
|
|
@@ -206,35 +224,37 @@ export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
|
|
|
206
224
|
<PackProvider pack={pack}>
|
|
207
225
|
<Fonts>
|
|
208
226
|
<Providers store={store} persistor={persistor}>
|
|
209
|
-
<
|
|
210
|
-
<
|
|
211
|
-
|
|
227
|
+
<DialogTitles>
|
|
228
|
+
<Theme>
|
|
229
|
+
<ProfilesProvider>
|
|
230
|
+
{/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
|
|
212
231
|
it mounts) is the saved one. */}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
232
|
+
<LastActiveGameProvider>
|
|
233
|
+
<GameProviders games={pack.games}>
|
|
234
|
+
<PackRoot pack={pack}>
|
|
235
|
+
<GatedApp>
|
|
236
|
+
<HapticGatedToastProvider>
|
|
237
|
+
{/* Wraps the stack (rather than sitting beside it like UpdateDialog)
|
|
219
238
|
because Home's tiles and the loadout's How to Play row reach it through
|
|
220
239
|
context (see GuideHost). Inside the toast provider because the card renders
|
|
221
240
|
through a Portal, and inside the gate so it mounts together with Home rather
|
|
222
241
|
than before it. */}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
242
|
+
<GuideHost>
|
|
243
|
+
<AppStack />
|
|
244
|
+
</GuideHost>
|
|
245
|
+
{/* historyButton/clearButton off: there's no toast history to open, and a
|
|
227
246
|
control row for it above the toast stack would go nowhere. limit pins the
|
|
228
247
|
package's current default (3) so a future toaster release can't change it. */}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
{pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <FramedToaster />}
|
|
249
|
+
<UpdateDialog />
|
|
250
|
+
</HapticGatedToastProvider>
|
|
251
|
+
</GatedApp>
|
|
252
|
+
</PackRoot>
|
|
253
|
+
</GameProviders>
|
|
254
|
+
</LastActiveGameProvider>
|
|
255
|
+
</ProfilesProvider>
|
|
256
|
+
</Theme>
|
|
257
|
+
</DialogTitles>
|
|
238
258
|
</Providers>
|
|
239
259
|
</Fonts>
|
|
240
260
|
</PackProvider>
|
|
@@ -119,7 +119,7 @@ function HomeMenu() {
|
|
|
119
119
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null
|
|
120
120
|
const [tabLabel, setTabLabel] = useState(() => tabs?.[0].label ?? null)
|
|
121
121
|
const tab = tabs ? (tabs.find((t) => t.label === tabLabel) ?? tabs[0]) : null
|
|
122
|
-
const tabButtons = useMemo(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs])
|
|
122
|
+
const tabButtons = useMemo(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle])
|
|
123
123
|
const tabBar = tab && <SegmentedButtons value={tab.label} onValueChange={setTabLabel} buttons={tabButtons} theme={SEGMENT_THEME} style={[styles.tabs, pack.Backdrop && { backgroundColor: colors.surface }]} />
|
|
124
124
|
const columnClamp = useClampOnShrink()
|
|
125
125
|
const gridClamp = useClampOnShrink()
|
|
@@ -285,6 +285,7 @@ interface GameRowProps {
|
|
|
285
285
|
export const ROW_BLURB_LINES = 3
|
|
286
286
|
|
|
287
287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameRowProps) {
|
|
288
|
+
const { titleStyle } = usePack()
|
|
288
289
|
const well = useWellColors()
|
|
289
290
|
const GameIcon = game.icon
|
|
290
291
|
return (
|
|
@@ -294,7 +295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
294
295
|
<Pressable onPress={onPress} style={[styles.row, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
295
296
|
{game.Preview ? <PreviewBox game={game} width={ROW_PREVIEW_WIDTH} revealed={previewRevealed} dark={dark} p1Color={p1Color} p2Color={p2Color} /> : <View style={[styles.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }]}>{GameIcon && <GameIcon size={ROW_ICON_SIZE} p1Color={p1Color} p2Color={p2Color} dark={dark} />}</View>}
|
|
296
297
|
<View style={styles.rowText}>
|
|
297
|
-
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
298
|
+
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
298
299
|
{game.title}
|
|
299
300
|
</Text>
|
|
300
301
|
{/* Three lines, as a tile allows: a narrow phone (an iPhone SE, a 411dp Android phone) wraps a
|
|
@@ -322,12 +323,13 @@ interface GameTileProps extends GameRowProps {
|
|
|
322
323
|
// name and blurb under it, since a row needs ~290pt, more than a grid column beside the hero has. The
|
|
323
324
|
// rules button floats over the preview's corner, beside the tile's button rather than inside it.
|
|
324
325
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameTileProps) {
|
|
326
|
+
const { titleStyle } = usePack()
|
|
325
327
|
const well = useWellColors()
|
|
326
328
|
return (
|
|
327
329
|
<View style={[{ width }, hidden && styles.hidden]}>
|
|
328
330
|
<Pressable onPress={onPress} style={[styles.tile, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
329
331
|
<PreviewBox game={game} width={previewWidth} revealed={previewRevealed} dark={dark} p1Color={p1Color} p2Color={p2Color} />
|
|
330
|
-
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
332
|
+
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
331
333
|
{game.title}
|
|
332
334
|
</Text>
|
|
333
335
|
<Text variant='bodySmall' style={{ color: well.fgMuted }} numberOfLines={3}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAutoPaperTheme } from '@rific/auto-paper'
|
|
2
2
|
import { BaseStatsScreen, type PopoverHost, PressAwayOverlay, ScreenFrame, usePopoverHost } from '@tastic/hud/chrome'
|
|
3
3
|
import { getOptionPickerContentSize, OptionPicker, type OptionPickerOption } from '@tastic/profile'
|
|
4
|
+
import { router } from 'expo-router'
|
|
4
5
|
import { type ReactNode, useMemo, useState } from 'react'
|
|
5
6
|
import { StyleSheet, View } from 'react-native'
|
|
6
7
|
import { SegmentedButtons, Text } from 'react-native-paper'
|
|
@@ -11,6 +12,7 @@ import { SEGMENT_RADIUS, SEGMENT_THEME } from '../components/segmentTheme'
|
|
|
11
12
|
import { useProfiles } from '../hooks/useProfiles'
|
|
12
13
|
import { safeBack } from '../navigation'
|
|
13
14
|
import { usePack } from '../PackContext'
|
|
15
|
+
import { PROFILES_HREF } from '../routes'
|
|
14
16
|
import { GUEST_PLAYER_ID, type PackDefinition, type PackGameDefinition, type PackStatsTab } from '../types'
|
|
15
17
|
|
|
16
18
|
// Two tabs, as on Solitaire's stats screen: a page with every game's stats above the achievements
|
|
@@ -38,12 +40,16 @@ const ALL_GAMES = '__all__'
|
|
|
38
40
|
|
|
39
41
|
const PLAYER_PICKER_ID = 'stats-player'
|
|
40
42
|
const GAME_PICKER_ID = 'stats-game'
|
|
43
|
+
// The player picker's last row: not a player, the way to the Profiles screen.
|
|
44
|
+
const MANAGE = '__manage__'
|
|
45
|
+
const MANAGE_OPTION: OptionPickerOption<string> = { value: MANAGE, label: 'Manage', icon: 'account-cog-outline', dividerBefore: true }
|
|
41
46
|
|
|
42
47
|
// Widest the column gets in the wide layout (a landscape phone, a desktop window): a list of stat
|
|
43
48
|
// rows stretched across an 874pt-wide screen reads badly. Upright it's never capped.
|
|
44
49
|
const STATS_MAX_WIDTH = 640
|
|
45
50
|
|
|
46
|
-
// Every game's stats and achievements on one screen, filtered by player (Everyone, or one profile
|
|
51
|
+
// Every game's stats and achievements on one screen, filtered by player (Everyone, or one profile, the
|
|
52
|
+
// picker always there with Manage at its end)
|
|
47
53
|
// and by game (All Games, or one), like Solitaire's. Each game keeps its own stats and its own
|
|
48
54
|
// achievements; this screen only shows them side by side. With two seats there's no one player to
|
|
49
55
|
// open on, so it opens on Everyone, and guests count only toward Everyone: two guests in one match
|
|
@@ -81,6 +87,8 @@ const useNoPackReset = () => null
|
|
|
81
87
|
|
|
82
88
|
// No placement of the pack's own: hud places the pickers' menus itself.
|
|
83
89
|
const noPickerAlign = () => undefined
|
|
90
|
+
// No player of the pack's own to open on.
|
|
91
|
+
const useNoStatsPlayer = (): string | null => null
|
|
84
92
|
|
|
85
93
|
function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
86
94
|
const pack = usePack()
|
|
@@ -92,10 +100,13 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
92
100
|
|
|
93
101
|
const [tab, setTab] = useState<string>(STATS)
|
|
94
102
|
const [gameId, setGameId] = useState<string>(ALL_GAMES)
|
|
95
|
-
// Opens on
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
103
|
+
// Opens on the pack's own player where it says who is playing (PackDefinition.useStatsPlayer), on
|
|
104
|
+
// whoever is in seat 1 (Guest for a guest) where the pack keeps a guest's stats, else on Everyone.
|
|
105
|
+
// Self-heals to Everyone if the selected profile is deleted while this screen is mounted, and from
|
|
106
|
+
// Guest once there is no profile (Everyone is then just the guest).
|
|
107
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer
|
|
108
|
+
const statsPlayer = useStatsPlayer()
|
|
109
|
+
const [selectedProfileId, setSelectedProfileId] = useState<string | null>(() => (pack.useStatsPlayer ? statsPlayer : pack.guestStats ? (lastSelected[1] ?? GUEST_PLAYER_ID) : null))
|
|
99
110
|
const profileId = selectedProfileId && profiles.length > 0 && ((pack.guestStats && selectedProfileId === GUEST_PLAYER_ID) || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null
|
|
100
111
|
|
|
101
112
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId)
|
|
@@ -104,9 +115,15 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
104
115
|
// One achievement list across the pack's games doesn't narrow to a game, so the game picker goes.
|
|
105
116
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList)
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
// Always there (Jay, 2026-11-19), with no profile yet too: Everyone, then each profile, then Manage, which
|
|
119
|
+
// opens the Profiles screen to make one.
|
|
120
|
+
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])
|
|
108
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])
|
|
109
|
-
|
|
122
|
+
// The pack's label lettering (PackDefinition.labelStyle) on each tab.
|
|
123
|
+
const tabButtons = useMemo(() => {
|
|
124
|
+
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
|
|
125
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons
|
|
126
|
+
}, [packTabs, pack.labelStyle])
|
|
110
127
|
const title = tab === STATS ? 'Stats' : tab === ACHIEVEMENTS ? 'Achievements' : (packTab?.label ?? '')
|
|
111
128
|
|
|
112
129
|
// Reset: the pack's own (PackDefinition.resetStats) follows the player picker, one player's or
|
|
@@ -118,7 +135,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
118
135
|
|
|
119
136
|
// The pack's own placement for the pickers' menus (PackDefinition.usePickerAlign), sized from their rows.
|
|
120
137
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign
|
|
121
|
-
const playerSize = getOptionPickerContentSize(playerOptions
|
|
138
|
+
const playerSize = getOptionPickerContentSize(playerOptions)
|
|
122
139
|
const gameSize = getOptionPickerContentSize(gameOptions.length)
|
|
123
140
|
const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height)
|
|
124
141
|
const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height)
|
|
@@ -129,7 +146,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
129
146
|
const PackTabContent = packTab?.Content
|
|
130
147
|
|
|
131
148
|
return (
|
|
132
|
-
<BaseStatsScreen title={title} onBack={safeBack} insets={insets} onReset={reset.onReset} resetLabel={reset.label} resetConfirmTitle={reset.title} resetConfirmBody={reset.body} fg={pack.foreground} bg={pack.Backdrop ? 'transparent' : undefined}>
|
|
149
|
+
<BaseStatsScreen title={title} titleStyle={pack.titleStyle} onBack={safeBack} insets={insets} onReset={reset.onReset} resetLabel={reset.label} resetConfirmTitle={reset.title} resetConfirmBody={reset.body} fg={pack.foreground} bg={pack.Backdrop ? 'transparent' : undefined}>
|
|
133
150
|
{/* Inside the page, not before it: BaseStatsScreen paints an opaque full-screen container that
|
|
134
151
|
would hide a tap catcher placed underneath it. Over the stat sections and under the open
|
|
135
152
|
filters (pressAway's zIndex sits below filtersOpen's), so a tap anywhere on the page but a
|
|
@@ -140,7 +157,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
140
157
|
{/* Takes a press on its own blank parts (the gap, an open menu's padding) while a menu is open, so
|
|
141
158
|
it never reaches StatsPressAway. */}
|
|
142
159
|
<View style={[styles.filters, pickerHost.openId !== null && styles.filtersOpen]} onStartShouldSetResponder={() => pickerHost.openId !== null}>
|
|
143
|
-
|
|
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} />
|
|
144
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} />}
|
|
145
162
|
</View>
|
|
146
163
|
|
|
@@ -169,13 +186,14 @@ function resetFor(pack: PackDefinition, packReset: ((profileId: string | null) =
|
|
|
169
186
|
// One game's part of the page: its own sections, under its name when more than one game is shown. A
|
|
170
187
|
// game with no achievement list of its own shows nothing on Achievements.
|
|
171
188
|
function GameStats({ game, tab, profileId, showTitle, titleColor }: { game: PackGameDefinition; tab: string; profileId: string | null; showTitle: boolean; titleColor: string }) {
|
|
189
|
+
const { titleStyle } = usePack()
|
|
172
190
|
const { StatsSections, AchievementList } = game
|
|
173
191
|
const Sections = tab === STATS ? StatsSections : AchievementList
|
|
174
192
|
if (!Sections) return null
|
|
175
193
|
return (
|
|
176
194
|
<View style={styles.game}>
|
|
177
195
|
{showTitle && (
|
|
178
|
-
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }]}>
|
|
196
|
+
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }, titleStyle]}>
|
|
179
197
|
{game.title}
|
|
180
198
|
</Text>
|
|
181
199
|
)}
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { MenuOption } from '@tastic/hud/lobby'
|
|
|
5
5
|
import type { FontSource } from 'expo-font'
|
|
6
6
|
import type { Href, Stack } from 'expo-router'
|
|
7
7
|
import type { ComponentProps, ComponentType, ReactNode } from 'react'
|
|
8
|
+
import type { TextStyle } from 'react-native'
|
|
8
9
|
import type { Action, Reducer } from 'redux'
|
|
9
10
|
|
|
10
11
|
import type { ShellState } from './redux/shellState'
|
|
@@ -304,6 +305,14 @@ export interface PackDefinition {
|
|
|
304
305
|
fonts?: Record<string, FontSource>
|
|
305
306
|
// The typeface every Paper text variant is set in (auto-paper's Provider). Unset is Paper's own.
|
|
306
307
|
fontFamily?: string
|
|
308
|
+
// The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own
|
|
309
|
+
// type: Home's game cards, the stats screen's title and game headings, and every hud dialog's title
|
|
310
|
+
// (through hud's DialogHeaderStyleProvider, in the standard tone). Unset, titles keep their type.
|
|
311
|
+
titleStyle?: TextStyle
|
|
312
|
+
// The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's
|
|
313
|
+
// tabs and section headings, the Settings sheet's sections and every picker pill (through hud's
|
|
314
|
+
// LetteringProvider). Unset, labels keep their type.
|
|
315
|
+
labelStyle?: TextStyle
|
|
307
316
|
// The version label in Settings: src/constants/release.ts's otaVersion, which the OTA tooling bumps.
|
|
308
317
|
otaVersion: number
|
|
309
318
|
// The pack's own Settings sections (how cards look, how play is helped along), in every Settings
|
|
@@ -362,6 +371,11 @@ export interface PackDefinition {
|
|
|
362
371
|
// The stats screen keeps a guest's stats under GUEST_PLAYER_ID: a Guest entry in the player picker
|
|
363
372
|
// once a profile exists, and the screen opens on whoever is in seat 1.
|
|
364
373
|
guestStats?: boolean
|
|
374
|
+
// The profile the stats screen opens on, for a pack that keeps its own idea of who is playing (a
|
|
375
|
+
// hook, called on every render of the screen; only its value as the screen mounts is used): the
|
|
376
|
+
// player picker starts there, and on Everyone when it's null or not a profile. Without it, Everyone
|
|
377
|
+
// (or seat 1's player, with guestStats).
|
|
378
|
+
useStatsPlayer?: () => string | null
|
|
365
379
|
// One achievement list across the pack's games, on the Achievements tab (the game picker hidden there).
|
|
366
380
|
AchievementList?: ComponentType<{ profileId: string | null }>
|
|
367
381
|
// Tabs of the pack's own between Stats and Achievements.
|