@tastic/shell 0.11.0 → 0.13.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 +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +52 -33
- package/dist/index.mjs +53 -34
- package/package.json +3 -3
- package/src/RootLayout.tsx +43 -23
- package/src/screens/HomeScreen.tsx +11 -7
- package/src/screens/LoadoutScreen.tsx +30 -22
- package/src/screens/StatsScreen.tsx +17 -7
- package/src/screens/homeLayout.ts +5 -5
- package/src/types.ts +28 -1
package/README.md
CHANGED
|
@@ -105,6 +105,8 @@ the front of an in-app link, so a route starting with a game id equal to the bas
|
|
|
105
105
|
| `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
106
|
| `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
|
|
107
107
|
| `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
|
|
108
|
+
| `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`. |
|
|
109
|
+
| `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
110
|
| `otaVersion` | The version label in Settings. |
|
|
109
111
|
| `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
112
|
| `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
|
|
@@ -128,12 +130,15 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
128
130
|
| `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
131
|
| `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
132
|
| `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. |
|
|
133
|
+
| `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
134
|
| `AchievementList?` | One achievement list across the pack's games, on the Achievements tab, with the game picker hidden there. |
|
|
132
135
|
| `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
136
|
| `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. |
|
|
134
137
|
| `statsGameTitles?` | `false` leaves each game's name off its sections on All Games, where the sections name it. |
|
|
135
138
|
| `newProfileColor?` | A new profile's starting color on Profiles. Unset is auto-paper's first swatch. |
|
|
136
139
|
| `usePickerAlign?` | `(open, contentWidth, contentHeight, options?) => 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), the stats screen's two pickers and a profile's color swatch 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. Profiles passes `{ maxContentWidth: 640 }`, its roster's column. Unset is hud's placement. |
|
|
140
|
+
| `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. |
|
|
141
|
+
| `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
|
|
137
142
|
| `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. |
|
|
138
143
|
|
|
139
144
|
### `GameDefinition`
|
|
@@ -173,6 +178,7 @@ settings for the round `mode` seat 2 makes:
|
|
|
173
178
|
| --- | --- |
|
|
174
179
|
| `roundSettings` | The settings the round plays with, committed (liveplay's `activeRound.settings`) once every human seat is Ready. The play screen reads them back with `useActiveRound`. |
|
|
175
180
|
| `options` | `(props: LoadoutOptionsProps) => ReactNode`: the match-options row (board, rules, puck), drawn under the loadout's popover `host` in its colors (`accentColor`, `mutedColor`, `onAccentColor`, `dark`). `onRandomize` and `onReset` are undefined while the loadout folds them into its shared action band. |
|
|
181
|
+
| `placesSeats?` | With one person the seat buttons sit under `options`, over Ready. `true` passes them to `options` as `seats` instead, so a game can put them where it likes (CardTastic: under the game's name, above its rules). 2 Player's seats stay in each person's half. |
|
|
176
182
|
| `optionIds` | The popover ids the options row opens, so the loadout lifts the row while one is open. |
|
|
177
183
|
| `randomize`, `reset` | The loadout's randomize and reset buttons. |
|
|
178
184
|
| `seatControl` | `(seat, host, look) => ReactNode \| undefined`: a human seat's controls picker (shot style, keys) in `look`'s colors (`SeatControlLook`: `accentColor`, `seatColor`, `mutedColor`, `dark`), or undefined where the game has none. |
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,8 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
|
|
|
6
6
|
import { GuideStep } from '@tastic/hud/guide';
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
|
-
import { Stack } from 'expo-router';
|
|
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
|
|
|
@@ -140,6 +140,7 @@ interface LoadoutOptionsProps {
|
|
|
140
140
|
dark: boolean;
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
|
+
seats?: ReactNode;
|
|
143
144
|
}
|
|
144
145
|
interface SeatControlLook {
|
|
145
146
|
accentColor: string;
|
|
@@ -150,6 +151,7 @@ interface SeatControlLook {
|
|
|
150
151
|
interface GameLoadout {
|
|
151
152
|
roundSettings: object;
|
|
152
153
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
|
+
placesSeats?: boolean;
|
|
153
155
|
optionIds: readonly string[];
|
|
154
156
|
randomize: () => void;
|
|
155
157
|
reset: () => void;
|
|
@@ -270,11 +272,15 @@ interface PackDefinition {
|
|
|
270
272
|
colorCaption: string;
|
|
271
273
|
games: readonly PackGameDefinition[];
|
|
272
274
|
homeTabs?: readonly HomeTab[];
|
|
275
|
+
homePlayerPicker?: boolean;
|
|
276
|
+
resumeHref?: (gameId: string) => Href | null;
|
|
273
277
|
seatColors: Record<Seat, string>;
|
|
274
278
|
appearance?: ThemeAppearance;
|
|
275
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
276
280
|
fonts?: Record<string, FontSource>;
|
|
277
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
278
284
|
otaVersion: number;
|
|
279
285
|
SettingsSections?: ComponentType;
|
|
280
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -295,6 +301,7 @@ interface PackDefinition {
|
|
|
295
301
|
guestLabel?: string;
|
|
296
302
|
nullLabel?: string;
|
|
297
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
298
305
|
AchievementList?: ComponentType<{
|
|
299
306
|
profileId: string | null;
|
|
300
307
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
|
|
|
6
6
|
import { GuideStep } from '@tastic/hud/guide';
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
|
-
import { Stack } from 'expo-router';
|
|
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
|
|
|
@@ -140,6 +140,7 @@ interface LoadoutOptionsProps {
|
|
|
140
140
|
dark: boolean;
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
|
+
seats?: ReactNode;
|
|
143
144
|
}
|
|
144
145
|
interface SeatControlLook {
|
|
145
146
|
accentColor: string;
|
|
@@ -150,6 +151,7 @@ interface SeatControlLook {
|
|
|
150
151
|
interface GameLoadout {
|
|
151
152
|
roundSettings: object;
|
|
152
153
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
|
+
placesSeats?: boolean;
|
|
153
155
|
optionIds: readonly string[];
|
|
154
156
|
randomize: () => void;
|
|
155
157
|
reset: () => void;
|
|
@@ -270,11 +272,15 @@ interface PackDefinition {
|
|
|
270
272
|
colorCaption: string;
|
|
271
273
|
games: readonly PackGameDefinition[];
|
|
272
274
|
homeTabs?: readonly HomeTab[];
|
|
275
|
+
homePlayerPicker?: boolean;
|
|
276
|
+
resumeHref?: (gameId: string) => Href | null;
|
|
273
277
|
seatColors: Record<Seat, string>;
|
|
274
278
|
appearance?: ThemeAppearance;
|
|
275
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
276
280
|
fonts?: Record<string, FontSource>;
|
|
277
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
278
284
|
otaVersion: number;
|
|
279
285
|
SettingsSections?: ComponentType;
|
|
280
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -295,6 +301,7 @@ interface PackDefinition {
|
|
|
295
301
|
guestLabel?: string;
|
|
296
302
|
nullLabel?: string;
|
|
297
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
298
305
|
AchievementList?: ComponentType<{
|
|
299
306
|
profileId: string | null;
|
|
300
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 }
|
|
@@ -889,33 +895,36 @@ function LoadoutScreen({ game }) {
|
|
|
889
895
|
const p2Host = (0, import_chrome4.usePopoverHost)();
|
|
890
896
|
const p1PickerOpen = controlsHost.openId?.startsWith("p1-") ?? false;
|
|
891
897
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
898
|
+
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
899
|
+
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
900
|
+
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
901
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
902
|
+
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
903
|
+
const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
905
|
+
p1Panel,
|
|
906
|
+
opponentPicker
|
|
907
|
+
] }),
|
|
908
|
+
p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
909
|
+
] });
|
|
910
|
+
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
911
|
+
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
912
|
+
!seatsInOptions && seatButtons,
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
914
|
+
] });
|
|
892
915
|
const optionsRow = loadout.options({
|
|
893
916
|
host: controlsHost,
|
|
894
917
|
accentColor: themeColors.tertiary,
|
|
895
918
|
mutedColor: fgMuted,
|
|
896
919
|
onAccentColor: themeColors.onTertiary,
|
|
897
920
|
dark,
|
|
921
|
+
seats: seatsInOptions ? seatButtons : void 0,
|
|
898
922
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
899
923
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
900
924
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
901
925
|
});
|
|
902
926
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
903
927
|
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.SharedActionBand, { onBack: import_core8.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
904
|
-
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
905
|
-
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
906
|
-
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
907
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
908
|
-
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
909
|
-
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
910
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
911
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
912
|
-
p1Panel,
|
|
913
|
-
opponentPicker
|
|
914
|
-
] }),
|
|
915
|
-
p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
916
|
-
] }),
|
|
917
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
918
|
-
] });
|
|
919
928
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
920
929
|
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
921
930
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
@@ -936,7 +945,7 @@ function LoadoutScreen({ game }) {
|
|
|
936
945
|
sharedElevated: optionsPopoverOpen
|
|
937
946
|
}
|
|
938
947
|
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
939
|
-
sharedControls,
|
|
948
|
+
seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
940
949
|
seatOne
|
|
941
950
|
] })
|
|
942
951
|
] }),
|
|
@@ -1103,7 +1112,7 @@ var HOME_LEFT_PANE_PICKER_HEIGHT = 44;
|
|
|
1103
1112
|
var HOME_LEFT_PANE_PICKER_GAP = 12;
|
|
1104
1113
|
var HOME_LEFT_PANE_BOTTOM_PADDING = 16;
|
|
1105
1114
|
var HOME_HERO_SIDE_ROOM = 16;
|
|
1106
|
-
function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
1115
|
+
function computeHomeLayout(windowWidth, windowHeight, insets, withPicker = true) {
|
|
1107
1116
|
const isWide = windowWidth > windowHeight;
|
|
1108
1117
|
if (!isWide) {
|
|
1109
1118
|
return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: void 0 };
|
|
@@ -1119,7 +1128,7 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1119
1128
|
const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING);
|
|
1120
1129
|
const heroFit = {
|
|
1121
1130
|
width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
|
|
1122
|
-
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - HOME_LEFT_PANE_PICKER_GAP
|
|
1131
|
+
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - (withPicker ? HOME_LEFT_PANE_PICKER_GAP + HOME_LEFT_PANE_PICKER_HEIGHT : 0) - HOME_LEFT_PANE_BOTTOM_PADDING)
|
|
1123
1132
|
};
|
|
1124
1133
|
return {
|
|
1125
1134
|
isWide,
|
|
@@ -1136,10 +1145,10 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1136
1145
|
heroFit
|
|
1137
1146
|
};
|
|
1138
1147
|
}
|
|
1139
|
-
function useHomeLayout() {
|
|
1148
|
+
function useHomeLayout(withPicker = true) {
|
|
1140
1149
|
const { width, height } = (0, import_react_native8.useWindowDimensions)();
|
|
1141
1150
|
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
1142
|
-
return computeHomeLayout(width, height, insets);
|
|
1151
|
+
return computeHomeLayout(width, height, insets, withPicker);
|
|
1143
1152
|
}
|
|
1144
1153
|
|
|
1145
1154
|
// src/screens/HomeScreen.tsx
|
|
@@ -1155,12 +1164,13 @@ function HomeScreen() {
|
|
|
1155
1164
|
(0, import_react16.useEffect)(() => {
|
|
1156
1165
|
if (!resumeGame) autoShowPack();
|
|
1157
1166
|
}, [resumeGame, autoShowPack]);
|
|
1158
|
-
if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: playHref(resumeGame.id) });
|
|
1167
|
+
if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
|
|
1159
1168
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HomeMenu, {});
|
|
1160
1169
|
}
|
|
1161
1170
|
function HomeMenu() {
|
|
1162
1171
|
const pack = usePack();
|
|
1163
|
-
const
|
|
1172
|
+
const showPicker = pack.homePlayerPicker !== false;
|
|
1173
|
+
const layout = useHomeLayout(showPicker);
|
|
1164
1174
|
const { insets } = layout;
|
|
1165
1175
|
const { dark, colors } = (0, import_auto_paper5.useAutoPaperTheme)();
|
|
1166
1176
|
const { openFirstTime, openFor, openPack } = useGameGuide();
|
|
@@ -1198,7 +1208,7 @@ function HomeMenu() {
|
|
|
1198
1208
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1199
1209
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1200
1210
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1201
|
-
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]);
|
|
1202
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 }] });
|
|
1203
1213
|
const columnClamp = useClampOnShrink();
|
|
1204
1214
|
const gridClamp = useClampOnShrink();
|
|
@@ -1221,12 +1231,12 @@ function HomeMenu() {
|
|
|
1221
1231
|
] }),
|
|
1222
1232
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
|
|
1223
1233
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1224
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1234
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1225
1235
|
] })
|
|
1226
1236
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_auto_paper5.FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
|
|
1227
1237
|
pressAway,
|
|
1228
1238
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1229
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1239
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1230
1240
|
tabBar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
|
|
1231
1241
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1232
1242
|
] }),
|
|
@@ -1275,6 +1285,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1275
1285
|
}
|
|
1276
1286
|
var ROW_BLURB_LINES = 3;
|
|
1277
1287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1288
|
+
const { titleStyle } = usePack();
|
|
1278
1289
|
const well = (0, import_chrome5.useWellColors)();
|
|
1279
1290
|
const GameIcon = game.icon;
|
|
1280
1291
|
return (
|
|
@@ -1284,7 +1295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1284
1295
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1285
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 }) }),
|
|
1286
1297
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1287
|
-
/* @__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 }),
|
|
1288
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 })
|
|
1289
1300
|
] })
|
|
1290
1301
|
] }),
|
|
@@ -1293,11 +1304,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1293
1304
|
);
|
|
1294
1305
|
}
|
|
1295
1306
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1307
|
+
const { titleStyle } = usePack();
|
|
1296
1308
|
const well = (0, import_chrome5.useWellColors)();
|
|
1297
1309
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1298
1310
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1299
1311
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1300
|
-
/* @__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 }),
|
|
1301
1313
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1302
1314
|
] }),
|
|
1303
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" }) })
|
|
@@ -1504,6 +1516,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1504
1516
|
}
|
|
1505
1517
|
var useNoPackReset = () => null;
|
|
1506
1518
|
var noPickerAlign2 = () => void 0;
|
|
1519
|
+
var useNoStatsPlayer = () => null;
|
|
1507
1520
|
function StatsContent({ pickerHost }) {
|
|
1508
1521
|
const pack = usePack();
|
|
1509
1522
|
const { dark, colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
@@ -1513,7 +1526,9 @@ function StatsContent({ pickerHost }) {
|
|
|
1513
1526
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1514
1527
|
const [tab, setTab] = (0, import_react17.useState)(STATS);
|
|
1515
1528
|
const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES);
|
|
1516
|
-
const
|
|
1529
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1530
|
+
const statsPlayer = useStatsPlayer();
|
|
1531
|
+
const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1517
1532
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1518
1533
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1519
1534
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
@@ -1521,7 +1536,10 @@ function StatsContent({ pickerHost }) {
|
|
|
1521
1536
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1522
1537
|
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]);
|
|
1523
1538
|
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]);
|
|
1524
|
-
const tabButtons = (0, import_react17.useMemo)(() =>
|
|
1539
|
+
const tabButtons = (0, import_react17.useMemo)(() => {
|
|
1540
|
+
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;
|
|
1541
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1542
|
+
}, [packTabs, pack.labelStyle]);
|
|
1525
1543
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1526
1544
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1527
1545
|
const packReset = usePackReset();
|
|
@@ -1534,7 +1552,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1534
1552
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1535
1553
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1536
1554
|
const PackTabContent = packTab?.Content;
|
|
1537
|
-
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: [
|
|
1555
|
+
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: [
|
|
1538
1556
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1539
1557
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1540
1558
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
@@ -1555,11 +1573,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1555
1573
|
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.` };
|
|
1556
1574
|
}
|
|
1557
1575
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1576
|
+
const { titleStyle } = usePack();
|
|
1558
1577
|
const { StatsSections, AchievementList } = game;
|
|
1559
1578
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1560
1579
|
if (!Sections) return null;
|
|
1561
1580
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1562
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1581
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1563
1582
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sections, { profileId })
|
|
1564
1583
|
] });
|
|
1565
1584
|
}
|
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 }
|
|
@@ -811,33 +817,36 @@ function LoadoutScreen({ game }) {
|
|
|
811
817
|
const p2Host = usePopoverHost();
|
|
812
818
|
const p1PickerOpen = controlsHost.openId?.startsWith("p1-") ?? false;
|
|
813
819
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
820
|
+
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
821
|
+
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
822
|
+
const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
823
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
824
|
+
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
825
|
+
const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
826
|
+
/* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
827
|
+
p1Panel,
|
|
828
|
+
opponentPicker
|
|
829
|
+
] }),
|
|
830
|
+
p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
831
|
+
] });
|
|
832
|
+
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
833
|
+
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
834
|
+
!seatsInOptions && seatButtons,
|
|
835
|
+
/* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
836
|
+
] });
|
|
814
837
|
const optionsRow = loadout.options({
|
|
815
838
|
host: controlsHost,
|
|
816
839
|
accentColor: themeColors.tertiary,
|
|
817
840
|
mutedColor: fgMuted,
|
|
818
841
|
onAccentColor: themeColors.onTertiary,
|
|
819
842
|
dark,
|
|
843
|
+
seats: seatsInOptions ? seatButtons : void 0,
|
|
820
844
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
821
845
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
822
846
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
823
847
|
});
|
|
824
848
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
825
849
|
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx13(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
826
|
-
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
827
|
-
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
828
|
-
const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
829
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
830
|
-
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
831
|
-
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
832
|
-
/* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
833
|
-
/* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
834
|
-
p1Panel,
|
|
835
|
-
opponentPicker
|
|
836
|
-
] }),
|
|
837
|
-
p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
838
|
-
] }),
|
|
839
|
-
/* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
840
|
-
] });
|
|
841
850
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
842
851
|
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
843
852
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
@@ -858,7 +867,7 @@ function LoadoutScreen({ game }) {
|
|
|
858
867
|
sharedElevated: optionsPopoverOpen
|
|
859
868
|
}
|
|
860
869
|
) : /* @__PURE__ */ jsxs4(View3, { style: styles3.stackedZone, children: [
|
|
861
|
-
sharedControls,
|
|
870
|
+
seatsInOptions ? /* @__PURE__ */ jsx13(View3, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
862
871
|
seatOne
|
|
863
872
|
] })
|
|
864
873
|
] }),
|
|
@@ -1025,7 +1034,7 @@ var HOME_LEFT_PANE_PICKER_HEIGHT = 44;
|
|
|
1025
1034
|
var HOME_LEFT_PANE_PICKER_GAP = 12;
|
|
1026
1035
|
var HOME_LEFT_PANE_BOTTOM_PADDING = 16;
|
|
1027
1036
|
var HOME_HERO_SIDE_ROOM = 16;
|
|
1028
|
-
function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
1037
|
+
function computeHomeLayout(windowWidth, windowHeight, insets, withPicker = true) {
|
|
1029
1038
|
const isWide = windowWidth > windowHeight;
|
|
1030
1039
|
if (!isWide) {
|
|
1031
1040
|
return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: void 0 };
|
|
@@ -1041,7 +1050,7 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1041
1050
|
const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING);
|
|
1042
1051
|
const heroFit = {
|
|
1043
1052
|
width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
|
|
1044
|
-
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - HOME_LEFT_PANE_PICKER_GAP
|
|
1053
|
+
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - (withPicker ? HOME_LEFT_PANE_PICKER_GAP + HOME_LEFT_PANE_PICKER_HEIGHT : 0) - HOME_LEFT_PANE_BOTTOM_PADDING)
|
|
1045
1054
|
};
|
|
1046
1055
|
return {
|
|
1047
1056
|
isWide,
|
|
@@ -1058,10 +1067,10 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1058
1067
|
heroFit
|
|
1059
1068
|
};
|
|
1060
1069
|
}
|
|
1061
|
-
function useHomeLayout() {
|
|
1070
|
+
function useHomeLayout(withPicker = true) {
|
|
1062
1071
|
const { width, height } = useWindowDimensions();
|
|
1063
1072
|
const insets = useSafeAreaInsets3();
|
|
1064
|
-
return computeHomeLayout(width, height, insets);
|
|
1073
|
+
return computeHomeLayout(width, height, insets, withPicker);
|
|
1065
1074
|
}
|
|
1066
1075
|
|
|
1067
1076
|
// src/screens/HomeScreen.tsx
|
|
@@ -1077,12 +1086,13 @@ function HomeScreen() {
|
|
|
1077
1086
|
useEffect6(() => {
|
|
1078
1087
|
if (!resumeGame) autoShowPack();
|
|
1079
1088
|
}, [resumeGame, autoShowPack]);
|
|
1080
|
-
if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: playHref(resumeGame.id) });
|
|
1089
|
+
if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
|
|
1081
1090
|
return /* @__PURE__ */ jsx15(HomeMenu, {});
|
|
1082
1091
|
}
|
|
1083
1092
|
function HomeMenu() {
|
|
1084
1093
|
const pack = usePack();
|
|
1085
|
-
const
|
|
1094
|
+
const showPicker = pack.homePlayerPicker !== false;
|
|
1095
|
+
const layout = useHomeLayout(showPicker);
|
|
1086
1096
|
const { insets } = layout;
|
|
1087
1097
|
const { dark, colors } = useAutoPaperTheme4();
|
|
1088
1098
|
const { openFirstTime, openFor, openPack } = useGameGuide();
|
|
@@ -1120,7 +1130,7 @@ function HomeMenu() {
|
|
|
1120
1130
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1121
1131
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1122
1132
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1123
|
-
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]);
|
|
1124
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 }] });
|
|
1125
1135
|
const columnClamp = useClampOnShrink();
|
|
1126
1136
|
const gridClamp = useClampOnShrink();
|
|
@@ -1143,12 +1153,12 @@ function HomeMenu() {
|
|
|
1143
1153
|
] }),
|
|
1144
1154
|
/* @__PURE__ */ jsxs5(View4, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
|
|
1145
1155
|
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1146
|
-
/* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
|
|
1156
|
+
showPicker && /* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
|
|
1147
1157
|
] })
|
|
1148
1158
|
] }) : /* @__PURE__ */ jsxs5(FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
|
|
1149
1159
|
pressAway,
|
|
1150
1160
|
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1151
|
-
/* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1161
|
+
showPicker && /* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1152
1162
|
tabBar && /* @__PURE__ */ jsx15(View4, { style: styles4.listWidth, children: tabBar }),
|
|
1153
1163
|
/* @__PURE__ */ jsx15(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx15(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1154
1164
|
] }),
|
|
@@ -1197,6 +1207,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1197
1207
|
}
|
|
1198
1208
|
var ROW_BLURB_LINES = 3;
|
|
1199
1209
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1210
|
+
const { titleStyle } = usePack();
|
|
1200
1211
|
const well = useWellColors();
|
|
1201
1212
|
const GameIcon = game.icon;
|
|
1202
1213
|
return (
|
|
@@ -1206,7 +1217,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1206
1217
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1207
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 }) }),
|
|
1208
1219
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1209
|
-
/* @__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 }),
|
|
1210
1221
|
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1211
1222
|
] })
|
|
1212
1223
|
] }),
|
|
@@ -1215,11 +1226,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1215
1226
|
);
|
|
1216
1227
|
}
|
|
1217
1228
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1229
|
+
const { titleStyle } = usePack();
|
|
1218
1230
|
const well = useWellColors();
|
|
1219
1231
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1220
1232
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1221
1233
|
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1222
|
-
/* @__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 }),
|
|
1223
1235
|
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1224
1236
|
] }),
|
|
1225
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" }) })
|
|
@@ -1426,6 +1438,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1426
1438
|
}
|
|
1427
1439
|
var useNoPackReset = () => null;
|
|
1428
1440
|
var noPickerAlign2 = () => void 0;
|
|
1441
|
+
var useNoStatsPlayer = () => null;
|
|
1429
1442
|
function StatsContent({ pickerHost }) {
|
|
1430
1443
|
const pack = usePack();
|
|
1431
1444
|
const { dark, colors } = useAutoPaperTheme5();
|
|
@@ -1435,7 +1448,9 @@ function StatsContent({ pickerHost }) {
|
|
|
1435
1448
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1436
1449
|
const [tab, setTab] = useState7(STATS);
|
|
1437
1450
|
const [gameId, setGameId] = useState7(ALL_GAMES);
|
|
1438
|
-
const
|
|
1451
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1452
|
+
const statsPlayer = useStatsPlayer();
|
|
1453
|
+
const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1439
1454
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1440
1455
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1441
1456
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
@@ -1443,7 +1458,10 @@ function StatsContent({ pickerHost }) {
|
|
|
1443
1458
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1444
1459
|
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]);
|
|
1445
1460
|
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]);
|
|
1446
|
-
const tabButtons = useMemo7(() =>
|
|
1461
|
+
const tabButtons = useMemo7(() => {
|
|
1462
|
+
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;
|
|
1463
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1464
|
+
}, [packTabs, pack.labelStyle]);
|
|
1447
1465
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1448
1466
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1449
1467
|
const packReset = usePackReset();
|
|
@@ -1456,7 +1474,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1456
1474
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1457
1475
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1458
1476
|
const PackTabContent = packTab?.Content;
|
|
1459
|
-
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: [
|
|
1477
|
+
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: [
|
|
1460
1478
|
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1461
1479
|
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1462
1480
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
@@ -1477,11 +1495,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1477
1495
|
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.` };
|
|
1478
1496
|
}
|
|
1479
1497
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1498
|
+
const { titleStyle } = usePack();
|
|
1480
1499
|
const { StatsSections, AchievementList } = game;
|
|
1481
1500
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1482
1501
|
if (!Sections) return null;
|
|
1483
1502
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1484
|
-
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1503
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1485
1504
|
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1486
1505
|
] });
|
|
1487
1506
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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>
|
|
@@ -47,13 +47,14 @@ export function HomeScreen() {
|
|
|
47
47
|
useEffect(() => {
|
|
48
48
|
if (!resumeGame) autoShowPack()
|
|
49
49
|
}, [resumeGame, autoShowPack])
|
|
50
|
-
if (resumeGame) return <Redirect href={playHref(resumeGame.id)} />
|
|
50
|
+
if (resumeGame) return <Redirect href={pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id)} />
|
|
51
51
|
return <HomeMenu />
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function HomeMenu() {
|
|
55
55
|
const pack = usePack()
|
|
56
|
-
const
|
|
56
|
+
const showPicker = pack.homePlayerPicker !== false
|
|
57
|
+
const layout = useHomeLayout(showPicker)
|
|
57
58
|
const { insets } = layout
|
|
58
59
|
const { dark, colors } = useAutoPaperTheme()
|
|
59
60
|
const { openFirstTime, openFor, openPack } = useGameGuide()
|
|
@@ -118,7 +119,7 @@ function HomeMenu() {
|
|
|
118
119
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null
|
|
119
120
|
const [tabLabel, setTabLabel] = useState(() => tabs?.[0].label ?? null)
|
|
120
121
|
const tab = tabs ? (tabs.find((t) => t.label === tabLabel) ?? tabs[0]) : null
|
|
121
|
-
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])
|
|
122
123
|
const tabBar = tab && <SegmentedButtons value={tab.label} onValueChange={setTabLabel} buttons={tabButtons} theme={SEGMENT_THEME} style={[styles.tabs, pack.Backdrop && { backgroundColor: colors.surface }]} />
|
|
123
124
|
const columnClamp = useClampOnShrink()
|
|
124
125
|
const gridClamp = useClampOnShrink()
|
|
@@ -136,6 +137,7 @@ function HomeMenu() {
|
|
|
136
137
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection)
|
|
137
138
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height)
|
|
138
139
|
|
|
140
|
+
// A pack can leave seat 1's button off Home (PackDefinition.homePlayerPicker)
|
|
139
141
|
const picker = <ProfilePicker idPrefix={SEAT_ONE_PICKER} host={pickerHost} profiles={profiles} selectedId={lastSelected[1]} color={p1Drawn} dark={dark} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onSelect={(profile: Profile | null) => selectProfile(1, profile?.id ?? null)} onManage={() => router.push(PROFILES_HREF)} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
|
|
140
142
|
|
|
141
143
|
// Closes seat 1's menu on a press anywhere but the menu and its button. Where it's mounted matters on
|
|
@@ -173,7 +175,7 @@ function HomeMenu() {
|
|
|
173
175
|
paints over the tiles. box-none: only its controls claim taps. */}
|
|
174
176
|
<View style={[styles.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles.pickerOpen]}>
|
|
175
177
|
<pack.HeroTitle words={pack.wordmark} color={fg} p1Color={p1Color} p2Color={p2Color} active={heroActive} fit={layout.heroFit} />
|
|
176
|
-
<View style={styles.widePicker}>{picker}</View>
|
|
178
|
+
{showPicker && <View style={styles.widePicker}>{picker}</View>}
|
|
177
179
|
</View>
|
|
178
180
|
</>
|
|
179
181
|
) : (
|
|
@@ -183,7 +185,7 @@ function HomeMenu() {
|
|
|
183
185
|
|
|
184
186
|
{/* Who's playing: seat 1's button, the same one each loadout starts with. Lifted above the
|
|
185
187
|
tiles while its menu is open, so the menu paints over them. */}
|
|
186
|
-
<View style={[styles.picker, pickerHost.openId !== null && styles.pickerOpen]}>{picker}</View>
|
|
188
|
+
{showPicker && <View style={[styles.picker, pickerHost.openId !== null && styles.pickerOpen]}>{picker}</View>}
|
|
187
189
|
|
|
188
190
|
{tabBar && <View style={styles.listWidth}>{tabBar}</View>}
|
|
189
191
|
|
|
@@ -283,6 +285,7 @@ interface GameRowProps {
|
|
|
283
285
|
export const ROW_BLURB_LINES = 3
|
|
284
286
|
|
|
285
287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameRowProps) {
|
|
288
|
+
const { titleStyle } = usePack()
|
|
286
289
|
const well = useWellColors()
|
|
287
290
|
const GameIcon = game.icon
|
|
288
291
|
return (
|
|
@@ -292,7 +295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
292
295
|
<Pressable onPress={onPress} style={[styles.row, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
293
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>}
|
|
294
297
|
<View style={styles.rowText}>
|
|
295
|
-
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
298
|
+
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
296
299
|
{game.title}
|
|
297
300
|
</Text>
|
|
298
301
|
{/* Three lines, as a tile allows: a narrow phone (an iPhone SE, a 411dp Android phone) wraps a
|
|
@@ -320,12 +323,13 @@ interface GameTileProps extends GameRowProps {
|
|
|
320
323
|
// name and blurb under it, since a row needs ~290pt, more than a grid column beside the hero has. The
|
|
321
324
|
// rules button floats over the preview's corner, beside the tile's button rather than inside it.
|
|
322
325
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameTileProps) {
|
|
326
|
+
const { titleStyle } = usePack()
|
|
323
327
|
const well = useWellColors()
|
|
324
328
|
return (
|
|
325
329
|
<View style={[{ width }, hidden && styles.hidden]}>
|
|
326
330
|
<Pressable onPress={onPress} style={[styles.tile, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
327
331
|
<PreviewBox game={game} width={previewWidth} revealed={previewRevealed} dark={dark} p1Color={p1Color} p2Color={p2Color} />
|
|
328
|
-
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
332
|
+
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
329
333
|
{game.title}
|
|
330
334
|
</Text>
|
|
331
335
|
<Text variant='bodySmall' style={{ color: well.fgMuted }} numberOfLines={3}>
|
|
@@ -169,12 +169,40 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
169
169
|
const p1PickerOpen = controlsHost.openId?.startsWith('p1-') ?? false
|
|
170
170
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID
|
|
171
171
|
|
|
172
|
+
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark }
|
|
173
|
+
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
|
|
174
|
+
// Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
|
|
175
|
+
// opponent button, centered under both.
|
|
176
|
+
const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
|
|
177
|
+
// Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
|
|
178
|
+
// seat 1's button stands alone.
|
|
179
|
+
const opponentPicker = game.seatTwo && <OpponentPicker key={`opponent-${layoutKey}`} idPrefix='p1' host={controlsHost} choices={game.seatTwo} seatTwo={seatTwo} onSeatTwoChange={changeSeatTwo} cpuDifficulty={loadout.cpuDifficulty} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} allowSwapTaken={mode === 'vsCpu'} dark={dark} previewValue={seatPreview} triggerStyle={triggerStyle} usePickerAlign={seatPickerAlign} />
|
|
180
|
+
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
|
|
181
|
+
const seatButtons = (
|
|
182
|
+
<View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
|
|
183
|
+
<Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
|
|
184
|
+
{p1Panel}
|
|
185
|
+
{opponentPicker}
|
|
186
|
+
</Animated.View>
|
|
187
|
+
{p1Control && <View style={[styles.controlRow, p1ControlOpen && styles.raised]}>{p1Control}</View>}
|
|
188
|
+
</View>
|
|
189
|
+
)
|
|
190
|
+
// With one person a game can place the seat buttons among its own options (GameLoadout.placesSeats).
|
|
191
|
+
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats
|
|
192
|
+
const seatOne = (
|
|
193
|
+
<View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && !seatsInOptions && styles.raised]}>
|
|
194
|
+
{!seatsInOptions && seatButtons}
|
|
195
|
+
<ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
|
|
196
|
+
</View>
|
|
197
|
+
)
|
|
198
|
+
|
|
172
199
|
const optionsRow = loadout.options({
|
|
173
200
|
host: controlsHost,
|
|
174
201
|
accentColor: themeColors.tertiary,
|
|
175
202
|
mutedColor: fgMuted,
|
|
176
203
|
onAccentColor: themeColors.onTertiary,
|
|
177
204
|
dark,
|
|
205
|
+
seats: seatsInOptions ? seatButtons : undefined,
|
|
178
206
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
179
207
|
onRandomize: showMetaInSharedBand ? undefined : loadout.randomize,
|
|
180
208
|
onReset: showMetaInSharedBand ? undefined : loadout.reset
|
|
@@ -189,27 +217,6 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
189
217
|
optionsRow
|
|
190
218
|
)
|
|
191
219
|
|
|
192
|
-
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark }
|
|
193
|
-
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
|
|
194
|
-
// Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
|
|
195
|
-
// opponent button, centered under both.
|
|
196
|
-
const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
|
|
197
|
-
// Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
|
|
198
|
-
// seat 1's button stands alone.
|
|
199
|
-
const opponentPicker = game.seatTwo && <OpponentPicker key={`opponent-${layoutKey}`} idPrefix='p1' host={controlsHost} choices={game.seatTwo} seatTwo={seatTwo} onSeatTwoChange={changeSeatTwo} cpuDifficulty={loadout.cpuDifficulty} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} allowSwapTaken={mode === 'vsCpu'} dark={dark} previewValue={seatPreview} triggerStyle={triggerStyle} usePickerAlign={seatPickerAlign} />
|
|
200
|
-
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
|
|
201
|
-
const seatOne = (
|
|
202
|
-
<View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && styles.raised]}>
|
|
203
|
-
<View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
|
|
204
|
-
<Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
|
|
205
|
-
{p1Panel}
|
|
206
|
-
{opponentPicker}
|
|
207
|
-
</Animated.View>
|
|
208
|
-
{p1Control && <View style={[styles.controlRow, p1ControlOpen && styles.raised]}>{p1Control}</View>}
|
|
209
|
-
</View>
|
|
210
|
-
<ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
|
|
211
|
-
</View>
|
|
212
|
-
)
|
|
213
220
|
// A person in seat 2: their own seat button (Player 2 or a profile, never the CPU), controls and
|
|
214
221
|
// Ready, in their half.
|
|
215
222
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : undefined
|
|
@@ -243,7 +250,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
243
250
|
/>
|
|
244
251
|
) : (
|
|
245
252
|
<View style={styles.stackedZone}>
|
|
246
|
-
{
|
|
253
|
+
{/* A menu opening from seat buttons placed in the options has to clear Ready, the next sibling */}
|
|
254
|
+
{seatsInOptions ? <View style={p1PickerOpen && styles.raised}>{sharedControls}</View> : sharedControls}
|
|
247
255
|
{seatOne}
|
|
248
256
|
</View>
|
|
249
257
|
)}
|
|
@@ -81,6 +81,8 @@ const useNoPackReset = () => null
|
|
|
81
81
|
|
|
82
82
|
// No placement of the pack's own: hud places the pickers' menus itself.
|
|
83
83
|
const noPickerAlign = () => undefined
|
|
84
|
+
// No player of the pack's own to open on.
|
|
85
|
+
const useNoStatsPlayer = (): string | null => null
|
|
84
86
|
|
|
85
87
|
function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
86
88
|
const pack = usePack()
|
|
@@ -92,10 +94,13 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
92
94
|
|
|
93
95
|
const [tab, setTab] = useState<string>(STATS)
|
|
94
96
|
const [gameId, setGameId] = useState<string>(ALL_GAMES)
|
|
95
|
-
// Opens on
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
97
|
+
// Opens on the pack's own player where it says who is playing (PackDefinition.useStatsPlayer), on
|
|
98
|
+
// whoever is in seat 1 (Guest for a guest) where the pack keeps a guest's stats, else on Everyone.
|
|
99
|
+
// Self-heals to Everyone if the selected profile is deleted while this screen is mounted, and from
|
|
100
|
+
// Guest once there is no profile (Everyone is then just the guest).
|
|
101
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer
|
|
102
|
+
const statsPlayer = useStatsPlayer()
|
|
103
|
+
const [selectedProfileId, setSelectedProfileId] = useState<string | null>(() => (pack.useStatsPlayer ? statsPlayer : pack.guestStats ? (lastSelected[1] ?? GUEST_PLAYER_ID) : null))
|
|
99
104
|
const profileId = selectedProfileId && profiles.length > 0 && ((pack.guestStats && selectedProfileId === GUEST_PLAYER_ID) || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null
|
|
100
105
|
|
|
101
106
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId)
|
|
@@ -106,7 +111,11 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
106
111
|
|
|
107
112
|
const playerOptions = useMemo<OptionPickerOption<string>[]>(() => [{ 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])
|
|
108
113
|
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
|
-
|
|
114
|
+
// The pack's label lettering (PackDefinition.labelStyle) on each tab.
|
|
115
|
+
const tabButtons = useMemo(() => {
|
|
116
|
+
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
|
|
117
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons
|
|
118
|
+
}, [packTabs, pack.labelStyle])
|
|
110
119
|
const title = tab === STATS ? 'Stats' : tab === ACHIEVEMENTS ? 'Achievements' : (packTab?.label ?? '')
|
|
111
120
|
|
|
112
121
|
// Reset: the pack's own (PackDefinition.resetStats) follows the player picker, one player's or
|
|
@@ -129,7 +138,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
129
138
|
const PackTabContent = packTab?.Content
|
|
130
139
|
|
|
131
140
|
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}>
|
|
141
|
+
<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
142
|
{/* Inside the page, not before it: BaseStatsScreen paints an opaque full-screen container that
|
|
134
143
|
would hide a tap catcher placed underneath it. Over the stat sections and under the open
|
|
135
144
|
filters (pressAway's zIndex sits below filtersOpen's), so a tap anywhere on the page but a
|
|
@@ -169,13 +178,14 @@ function resetFor(pack: PackDefinition, packReset: ((profileId: string | null) =
|
|
|
169
178
|
// One game's part of the page: its own sections, under its name when more than one game is shown. A
|
|
170
179
|
// game with no achievement list of its own shows nothing on Achievements.
|
|
171
180
|
function GameStats({ game, tab, profileId, showTitle, titleColor }: { game: PackGameDefinition; tab: string; profileId: string | null; showTitle: boolean; titleColor: string }) {
|
|
181
|
+
const { titleStyle } = usePack()
|
|
172
182
|
const { StatsSections, AchievementList } = game
|
|
173
183
|
const Sections = tab === STATS ? StatsSections : AchievementList
|
|
174
184
|
if (!Sections) return null
|
|
175
185
|
return (
|
|
176
186
|
<View style={styles.game}>
|
|
177
187
|
{showTitle && (
|
|
178
|
-
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }]}>
|
|
188
|
+
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }, titleStyle]}>
|
|
179
189
|
{game.title}
|
|
180
190
|
</Text>
|
|
181
191
|
)}
|
|
@@ -74,7 +74,7 @@ export interface HomeLayout {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// Pure form of useHomeLayout, for tests.
|
|
77
|
-
export function computeHomeLayout(windowWidth: number, windowHeight: number, insets: EdgeInsets): HomeLayout {
|
|
77
|
+
export function computeHomeLayout(windowWidth: number, windowHeight: number, insets: EdgeInsets, withPicker = true): HomeLayout {
|
|
78
78
|
const isWide = windowWidth > windowHeight
|
|
79
79
|
if (!isWide) {
|
|
80
80
|
return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: undefined }
|
|
@@ -95,10 +95,10 @@ export function computeHomeLayout(windowWidth: number, windowHeight: number, ins
|
|
|
95
95
|
const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING)
|
|
96
96
|
|
|
97
97
|
// The hero gets the pane's width and whatever height the pane has left once the corner buttons'
|
|
98
|
-
// band, seat 1's button and the bottom padding are taken: how it shrinks to fit is the pack's own.
|
|
98
|
+
// band, seat 1's button (where Home has one) and the bottom padding are taken: how it shrinks to fit is the pack's own.
|
|
99
99
|
const heroFit = {
|
|
100
100
|
width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
|
|
101
|
-
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - HOME_LEFT_PANE_PICKER_GAP
|
|
101
|
+
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - (withPicker ? HOME_LEFT_PANE_PICKER_GAP + HOME_LEFT_PANE_PICKER_HEIGHT : 0) - HOME_LEFT_PANE_BOTTOM_PADDING)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
return {
|
|
@@ -118,8 +118,8 @@ export function computeHomeLayout(windowWidth: number, windowHeight: number, ins
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// The live layout for the current window.
|
|
121
|
-
export function useHomeLayout(): HomeLayout {
|
|
121
|
+
export function useHomeLayout(withPicker = true): HomeLayout {
|
|
122
122
|
const { width, height } = useWindowDimensions()
|
|
123
123
|
const insets = useSafeAreaInsets()
|
|
124
|
-
return computeHomeLayout(width, height, insets)
|
|
124
|
+
return computeHomeLayout(width, height, insets, withPicker)
|
|
125
125
|
}
|
package/src/types.ts
CHANGED
|
@@ -3,8 +3,9 @@ import type { AlignResult, PopoverHost } from '@tastic/hud/chrome'
|
|
|
3
3
|
import type { GuideStep } from '@tastic/hud/guide'
|
|
4
4
|
import type { MenuOption } from '@tastic/hud/lobby'
|
|
5
5
|
import type { FontSource } from 'expo-font'
|
|
6
|
-
import type { Stack } from 'expo-router'
|
|
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'
|
|
@@ -51,6 +52,9 @@ export interface LoadoutOptionsProps {
|
|
|
51
52
|
// Undefined while the loadout folds randomize/reset into its shared action band instead.
|
|
52
53
|
onRandomize?: () => void
|
|
53
54
|
onReset?: () => void
|
|
55
|
+
// With one person, player 1's row of buttons (their seat's, the opponent's and their controls), for a
|
|
56
|
+
// game whose loadout sets placesSeats to put where it likes. Undefined otherwise.
|
|
57
|
+
seats?: ReactNode
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
// The colors a seat's controls picker draws with: the loadout's tertiary accent, or the seat's own.
|
|
@@ -69,6 +73,10 @@ export interface GameLoadout {
|
|
|
69
73
|
// The match-options row (board, rules, puck): the game's own controls, drawn under the shared
|
|
70
74
|
// popover host so its menus open, elevate and close like every other loadout menu.
|
|
71
75
|
options: (props: LoadoutOptionsProps) => ReactNode
|
|
76
|
+
// With one person the seat buttons sit under the options row, over Ready. True hands them to `options`
|
|
77
|
+
// instead (LoadoutOptionsProps.seats), for a game that wants them among its own (over its rules, under
|
|
78
|
+
// its name). 2 Player's seats stay in each person's half.
|
|
79
|
+
placesSeats?: boolean
|
|
72
80
|
// The popover ids the options row opens, so the loadout can elevate the row while one is open.
|
|
73
81
|
optionIds: readonly string[]
|
|
74
82
|
randomize: () => void
|
|
@@ -277,6 +285,12 @@ export interface PackDefinition {
|
|
|
277
285
|
// screen) showing one tab's games at a time. It opens on the first, and keeps the tab picked while Home
|
|
278
286
|
// is covered. Unset, or a single tab, shows every game with no switch.
|
|
279
287
|
homeTabs?: readonly HomeTab[]
|
|
288
|
+
// False leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the
|
|
289
|
+
// player is picked anyway (CardTastic). Home's hero then takes its room.
|
|
290
|
+
homePlayerPicker?: boolean
|
|
291
|
+
// Where a cold launch goes back into a resumable game, for a pack with more than one way to be playing
|
|
292
|
+
// it (CardTastic's Daily Deals). Null, or unset, is the game's play screen.
|
|
293
|
+
resumeHref?: (gameId: string) => Href | null
|
|
280
294
|
// Player 1's and player 2's own default colors. They seed the theme's primary and secondary (the
|
|
281
295
|
// tertiary is derived from them, see shellState.ts) and the guest and CPU colors a fresh install
|
|
282
296
|
// starts with (seatColorsSlice.ts), so a fresh install's live theme and its remembered colors agree.
|
|
@@ -291,6 +305,14 @@ export interface PackDefinition {
|
|
|
291
305
|
fonts?: Record<string, FontSource>
|
|
292
306
|
// The typeface every Paper text variant is set in (auto-paper's Provider). Unset is Paper's own.
|
|
293
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
|
|
294
316
|
// The version label in Settings: src/constants/release.ts's otaVersion, which the OTA tooling bumps.
|
|
295
317
|
otaVersion: number
|
|
296
318
|
// The pack's own Settings sections (how cards look, how play is helped along), in every Settings
|
|
@@ -349,6 +371,11 @@ export interface PackDefinition {
|
|
|
349
371
|
// The stats screen keeps a guest's stats under GUEST_PLAYER_ID: a Guest entry in the player picker
|
|
350
372
|
// once a profile exists, and the screen opens on whoever is in seat 1.
|
|
351
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
|
|
352
379
|
// One achievement list across the pack's games, on the Achievements tab (the game picker hidden there).
|
|
353
380
|
AchievementList?: ComponentType<{ profileId: string | null }>
|
|
354
381
|
// Tabs of the pack's own between Stats and Achievements.
|