@tastic/shell 0.17.1 → 0.19.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 +7 -6
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +71 -29
- package/dist/index.mjs +71 -29
- package/package.json +1 -1
- package/src/components/SettingsDialog.tsx +2 -2
- package/src/routes.ts +12 -2
- package/src/screens/EditProfileRoute.tsx +25 -3
- package/src/screens/GameRoute.tsx +8 -2
- package/src/screens/HomeScreen.tsx +2 -2
- package/src/screens/LoadoutScreen.tsx +40 -6
- package/src/screens/ProfilesRoute.tsx +11 -7
- package/src/types.ts +12 -0
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native
|
|
|
27
27
|
- **Screens** for the routes: `HomeScreen` (the pack's hero, seat 1's button, a row per game, or a
|
|
28
28
|
grid of preview tiles on a wide screen, split into tabs where the pack has them), `LoadoutRoute` and `PlayRoute` (`loadout/[game]`,
|
|
29
29
|
`play/[game]`), `ProfilesRoute`, `EditProfileRoute` (`profile/[id]`, one profile's Edit Profile
|
|
30
|
-
screen, which Profiles pushes with the profile's id or `new
|
|
30
|
+
screen, which Profiles pushes with the profile's id or `new`; a profile made there is picked for the seat whose Manage opened Profiles) and `StatsScreen`.
|
|
31
31
|
- **The store**: `createPackStore(pack, { keyPrefix, migrate, blacklist, serializableIgnoredPaths,
|
|
32
32
|
middleware })` builds one persisted store from the shell's keys (theme, haptics, sound, Keep Awake,
|
|
33
33
|
profiles, seat selection, seat colors, app settings, seat 2, the never-saved `liveplay`, and
|
|
@@ -108,9 +108,9 @@ the front of an in-app link, so a route starting with a game id equal to the bas
|
|
|
108
108
|
| `appearance?` | The theme's appearance on a fresh install (`'system'` when unset). |
|
|
109
109
|
| `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). |
|
|
110
110
|
| `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
|
|
111
|
-
| `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
|
|
112
|
-
| `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,
|
|
113
|
-
| `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
|
|
111
|
+
| `fontFamily?` | The typeface on every Paper text variant, and on every toast (`@rific/toaster` 0.14.0+ takes the theme's font). Unset is Paper's own. |
|
|
112
|
+
| `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, each loadout's header, the stats screen's title and game headings, every hud dialog's title (the shell mounts hud's `DialogHeaderStyleProvider` in the standard tone, so the big icon and accent color stay), each How to Play card's title (`@tastic/hud` 0.38.0+) and the Profiles and Edit Profile titles (`@tastic/profile` 0.27.0+). Needs `@tastic/hud` with `titleStyle` in the standard tone and on `BaseStatsScreen`. |
|
|
113
|
+
| `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 Achievements tab's too, `@tastic/hud` 0.38.0+), the Settings sheet's sections, every `@tastic/profile` picker pill, a loadout's READY? (`@tastic/hud` 0.38.0+) and Edit Profile's headings (`@tastic/profile` 0.28.0+). The shell mounts hud's `LetteringProvider` with it and `titleStyle`. Needs `@tastic/hud` with `LetteringProvider` and `@tastic/profile` reading it. |
|
|
114
114
|
| `otaVersion` | The version label in Settings. |
|
|
115
115
|
| `useSettingsRules?` | A hook returning what goes first in every Settings dialog, above the shell's rows: the rules of the game it's opened in. Null where there's nothing (Home). |
|
|
116
116
|
| `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
|
|
@@ -182,8 +182,9 @@ settings for the round `mode` seat 2 makes:
|
|
|
182
182
|
| Field | |
|
|
183
183
|
| --- | --- |
|
|
184
184
|
| `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`. |
|
|
185
|
-
| `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. |
|
|
186
|
-
| `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:
|
|
185
|
+
| `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. `titleShown` says whether the loadout's header already names the game (beside Back, as the stats screen's title): everywhere but 2 Player face to face, whose back and settings fold into the band between the players, so a game that names itself among its options does so only when it's false. |
|
|
186
|
+
| `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: first, above its Daily Deal and rules). 2 Player's seats stay in each person's half. |
|
|
187
|
+
| `drawsReady?` | With one person Ready sits under `options` (and the seat buttons). `true` draws no Ready and passes `options` an `onReady` that starts the round, for a game that starts it from a control of its own (CardTastic's solitaire games: a New Deal or Continue row in a card, as their Daily Deal's). 2 Player's Ready buttons stay in each person's half. |
|
|
187
188
|
| `optionIds` | The popover ids the options row opens, so the loadout lifts the row while one is open. |
|
|
188
189
|
| `randomize`, `reset` | The loadout's randomize and reset buttons. |
|
|
189
190
|
| `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
|
@@ -141,6 +141,8 @@ interface LoadoutOptionsProps {
|
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
143
|
seats?: ReactNode;
|
|
144
|
+
onReady?: () => void;
|
|
145
|
+
titleShown: boolean;
|
|
144
146
|
}
|
|
145
147
|
interface SeatControlLook {
|
|
146
148
|
accentColor: string;
|
|
@@ -152,6 +154,7 @@ interface GameLoadout {
|
|
|
152
154
|
roundSettings: object;
|
|
153
155
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
156
|
placesSeats?: boolean;
|
|
157
|
+
drawsReady?: boolean;
|
|
155
158
|
optionIds: readonly string[];
|
|
156
159
|
randomize: () => void;
|
|
157
160
|
reset: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,8 @@ interface LoadoutOptionsProps {
|
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
143
|
seats?: ReactNode;
|
|
144
|
+
onReady?: () => void;
|
|
145
|
+
titleShown: boolean;
|
|
144
146
|
}
|
|
145
147
|
interface SeatControlLook {
|
|
146
148
|
accentColor: string;
|
|
@@ -152,6 +154,7 @@ interface GameLoadout {
|
|
|
152
154
|
roundSettings: object;
|
|
153
155
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
156
|
placesSeats?: boolean;
|
|
157
|
+
drawsReady?: boolean;
|
|
155
158
|
optionIds: readonly string[];
|
|
156
159
|
randomize: () => void;
|
|
157
160
|
reset: () => void;
|
package/dist/index.js
CHANGED
|
@@ -586,34 +586,54 @@ var import_core6 = require("@rific/core");
|
|
|
586
586
|
var import_expo_router2 = require("expo-router");
|
|
587
587
|
(0, import_core6.configureNavigation)({ router: import_expo_router2.router });
|
|
588
588
|
|
|
589
|
-
// src/screens/ProfilesRoute.tsx
|
|
590
|
-
var import_chrome3 = require("@tastic/hud/chrome");
|
|
591
|
-
var import_profile4 = require("@tastic/profile");
|
|
592
|
-
var import_expo_router3 = require("expo-router");
|
|
593
|
-
|
|
594
589
|
// src/routes.ts
|
|
595
590
|
var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
|
|
596
591
|
var loadoutHref = (game) => ({ pathname: "/loadout/[game]", params: { game } });
|
|
597
592
|
var STATS_HREF = "/stats";
|
|
598
593
|
var PROFILES_HREF = "/profiles";
|
|
599
|
-
var
|
|
594
|
+
var profilesHref = (seat) => ({ pathname: "/profiles", params: { seat: String(seat) } });
|
|
595
|
+
var profileHref = (id, seat) => ({ pathname: "/profile/[id]", params: seat ? { id, seat: String(seat) } : { id } });
|
|
596
|
+
var seatParam = (value) => value === "1" ? 1 : value === "2" ? 2 : null;
|
|
600
597
|
|
|
601
598
|
// src/screens/ProfilesRoute.tsx
|
|
599
|
+
var import_chrome3 = require("@tastic/hud/chrome");
|
|
600
|
+
var import_profile4 = require("@tastic/profile");
|
|
601
|
+
var import_expo_router3 = require("expo-router");
|
|
602
602
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
603
603
|
var ROSTER_MAX_WIDTH = 640;
|
|
604
604
|
function ProfilesRoute() {
|
|
605
|
+
const { seat } = (0, import_expo_router3.useLocalSearchParams)();
|
|
606
|
+
const opener = seatParam(seat);
|
|
605
607
|
const { profiles } = useProfiles();
|
|
606
608
|
const { Backdrop, foreground } = usePack();
|
|
607
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome3.ScreenFrame, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile4.ProfilesScreen, { profiles, onEdit: (id) => import_expo_router3.router.push(profileHref(id)), onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome3.ScreenFrame, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile4.ProfilesScreen, { profiles, onEdit: (id) => import_expo_router3.router.push(profileHref(id, id === import_profile4.NEW_PROFILE_ID ? opener : null)), onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
608
610
|
}
|
|
609
611
|
|
|
610
612
|
// src/screens/EditProfileRoute.tsx
|
|
611
613
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
612
614
|
function EditProfileRoute() {
|
|
613
|
-
const { id } = (0, import_expo_router4.useLocalSearchParams)();
|
|
614
|
-
const
|
|
615
|
+
const { id, seat } = (0, import_expo_router4.useLocalSearchParams)();
|
|
616
|
+
const opener = seatParam(seat);
|
|
617
|
+
const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles();
|
|
615
618
|
const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
|
|
616
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
620
|
+
import_profile5.EditProfileScreen,
|
|
621
|
+
{
|
|
622
|
+
profileId: id,
|
|
623
|
+
profiles,
|
|
624
|
+
defaultColor: newProfileColor ?? import_auto_paper3.defaultColors[0].value,
|
|
625
|
+
onCreate: (patch) => {
|
|
626
|
+
const profile = createProfile(patch);
|
|
627
|
+
if (opener) selectProfile(opener, profile.id);
|
|
628
|
+
},
|
|
629
|
+
onSave: (profileId, patch) => updateProfile(profileId, patch),
|
|
630
|
+
onDelete: deleteProfile,
|
|
631
|
+
onBack: import_core6.safeBack,
|
|
632
|
+
fg: foreground,
|
|
633
|
+
bg: Backdrop ? "transparent" : void 0,
|
|
634
|
+
sections: ProfileSections ? (profile) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ProfileSections, { profile }) : void 0
|
|
635
|
+
}
|
|
636
|
+
) });
|
|
617
637
|
}
|
|
618
638
|
|
|
619
639
|
// src/screens/GameRoute.tsx
|
|
@@ -630,6 +650,7 @@ var import_split_screen = require("@tastic/split-screen");
|
|
|
630
650
|
var import_expo_router7 = require("expo-router");
|
|
631
651
|
var import_react13 = require("react");
|
|
632
652
|
var import_react_native6 = require("react-native");
|
|
653
|
+
var import_react_native_paper = require("react-native-paper");
|
|
633
654
|
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
|
|
634
655
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
635
656
|
var import_react_redux9 = require("react-redux");
|
|
@@ -700,7 +721,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
|
|
|
700
721
|
const rules = useSettingsRules();
|
|
701
722
|
const { profiles, lastSelected } = useProfiles();
|
|
702
723
|
const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
|
|
703
|
-
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => import_expo_router5.router.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => import_expo_router5.router.push(
|
|
724
|
+
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => import_expo_router5.router.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => import_expo_router5.router.push(profilesHref(1)) } : {};
|
|
704
725
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
705
726
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
|
|
706
727
|
children,
|
|
@@ -868,6 +889,10 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
|
868
889
|
var PANEL_SWAP_FADE_MS = 180;
|
|
869
890
|
var P1_CONTROL_ID = "p1-control";
|
|
870
891
|
var P2_CONTROL_ID = "p2-control";
|
|
892
|
+
var HEADER_TOP = 8;
|
|
893
|
+
var HEADER_ROW_HEIGHT = 52;
|
|
894
|
+
var HEADER_TITLE_LEFT = 64;
|
|
895
|
+
var HEADER_TITLE_RIGHT = 60;
|
|
871
896
|
function LoadoutScreen({ game }) {
|
|
872
897
|
const pack = usePack();
|
|
873
898
|
const { seatTwo: savedSeatTwo, setSeatTwo } = useOpponent();
|
|
@@ -887,6 +912,7 @@ function LoadoutScreen({ game }) {
|
|
|
887
912
|
const playersRowFade = panelFadeStyle;
|
|
888
913
|
const [settingsOpen, setSettingsOpen] = (0, import_react13.useState)(false);
|
|
889
914
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
915
|
+
const { title: lettering } = (0, import_chrome6.useLettering)();
|
|
890
916
|
const { colors: themeColors, dark } = (0, import_auto_paper5.useAutoPaperTheme)();
|
|
891
917
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
892
918
|
const dispatch = (0, import_react_redux9.useDispatch)();
|
|
@@ -934,9 +960,10 @@ function LoadoutScreen({ game }) {
|
|
|
934
960
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
935
961
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
936
962
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
937
|
-
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.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_router7.router.push(
|
|
963
|
+
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.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_router7.router.push(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
938
964
|
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
939
965
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
966
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
|
|
940
967
|
const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
941
968
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
942
969
|
p1Panel,
|
|
@@ -947,7 +974,7 @@ function LoadoutScreen({ game }) {
|
|
|
947
974
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
948
975
|
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
949
976
|
!seatsInOptions && seatButtons,
|
|
950
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
977
|
+
!readyInOptions && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
951
978
|
] });
|
|
952
979
|
const optionsRow = loadout.options({
|
|
953
980
|
host: controlsHost,
|
|
@@ -956,6 +983,8 @@ function LoadoutScreen({ game }) {
|
|
|
956
983
|
onAccentColor: themeColors.onTertiary,
|
|
957
984
|
dark,
|
|
958
985
|
seats: seatsInOptions ? seatButtons : void 0,
|
|
986
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : void 0,
|
|
987
|
+
titleShown: !showMetaInSharedBand,
|
|
959
988
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
960
989
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
961
990
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
@@ -965,10 +994,11 @@ function LoadoutScreen({ game }) {
|
|
|
965
994
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
966
995
|
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.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");
|
|
967
996
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
968
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: styles3.frame, children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
|
|
969
998
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
970
999
|
p2ZoneStyle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
971
1000
|
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.CornerActionButtons, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
1001
|
+
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native6.View, { style: [styles3.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }], pointerEvents: "none", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "headlineSmall", numberOfLines: 1, accessibilityRole: "header", style: [styles3.title, { color: fg }, lettering], children: game.title }) }),
|
|
972
1002
|
p2IsHuman ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
973
1003
|
import_split_screen.DualZoneLayout,
|
|
974
1004
|
{
|
|
@@ -983,7 +1013,7 @@ function LoadoutScreen({ game }) {
|
|
|
983
1013
|
}
|
|
984
1014
|
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
985
1015
|
seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
986
|
-
seatOne
|
|
1016
|
+
!(seatsInOptions && readyInOptions) && seatOne
|
|
987
1017
|
] })
|
|
988
1018
|
] }),
|
|
989
1019
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
@@ -1011,6 +1041,11 @@ var styles3 = import_react_native6.StyleSheet.create({
|
|
|
1011
1041
|
justifyContent: "center",
|
|
1012
1042
|
paddingHorizontal: 16
|
|
1013
1043
|
},
|
|
1044
|
+
headerTitle: {
|
|
1045
|
+
height: HEADER_ROW_HEIGHT,
|
|
1046
|
+
justifyContent: "center",
|
|
1047
|
+
position: "absolute"
|
|
1048
|
+
},
|
|
1014
1049
|
p2ZoneRight: {
|
|
1015
1050
|
bottom: 0,
|
|
1016
1051
|
position: "absolute",
|
|
@@ -1063,6 +1098,10 @@ var styles3 = import_react_native6.StyleSheet.create({
|
|
|
1063
1098
|
stackedZone: {
|
|
1064
1099
|
alignItems: "center",
|
|
1065
1100
|
gap: 28
|
|
1101
|
+
},
|
|
1102
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
1103
|
+
title: {
|
|
1104
|
+
fontWeight: "bold"
|
|
1066
1105
|
}
|
|
1067
1106
|
});
|
|
1068
1107
|
|
|
@@ -1086,13 +1125,16 @@ function PlayRoute() {
|
|
|
1086
1125
|
const { PlayScreen } = game;
|
|
1087
1126
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlayScreen, {}, game.id);
|
|
1088
1127
|
}
|
|
1128
|
+
var playScreensUp = 0;
|
|
1089
1129
|
function useResumePoint(gameId) {
|
|
1090
1130
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
1091
1131
|
(0, import_react14.useEffect)(() => {
|
|
1092
1132
|
if (!gameId) return;
|
|
1133
|
+
playScreensUp += 1;
|
|
1093
1134
|
setLastActiveGame(gameId);
|
|
1094
1135
|
return () => {
|
|
1095
|
-
|
|
1136
|
+
playScreensUp -= 1;
|
|
1137
|
+
if (playScreensUp === 0 && import_react_native7.AppState.currentState === "active") clearLastActiveGame();
|
|
1096
1138
|
};
|
|
1097
1139
|
}, [gameId, setLastActiveGame, clearLastActiveGame]);
|
|
1098
1140
|
}
|
|
@@ -1105,7 +1147,7 @@ var import_profile9 = require("@tastic/profile");
|
|
|
1105
1147
|
var import_expo_router9 = require("expo-router");
|
|
1106
1148
|
var import_react16 = require("react");
|
|
1107
1149
|
var import_react_native9 = require("react-native");
|
|
1108
|
-
var
|
|
1150
|
+
var import_react_native_paper2 = require("react-native-paper");
|
|
1109
1151
|
|
|
1110
1152
|
// src/components/segmentTheme.ts
|
|
1111
1153
|
var SEGMENT_THEME = { roundness: 3.8 };
|
|
@@ -1264,7 +1306,7 @@ function HomeMenu() {
|
|
|
1264
1306
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1265
1307
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1266
1308
|
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1267
|
-
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1309
|
+
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1268
1310
|
const columnClamp = useClampOnShrink();
|
|
1269
1311
|
const gridClamp = useClampOnShrink();
|
|
1270
1312
|
const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router9.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1273,7 +1315,7 @@ function HomeMenu() {
|
|
|
1273
1315
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1274
1316
|
const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
|
|
1275
1317
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1276
|
-
const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router9.router.push(
|
|
1318
|
+
const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router9.router.push(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1277
1319
|
const pressAway = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1278
1320
|
const RulesSheet = rulesGame?.Rules;
|
|
1279
1321
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
@@ -1336,7 +1378,7 @@ function hasRules(game) {
|
|
|
1336
1378
|
return !!(game.Rules || game.guide);
|
|
1337
1379
|
}
|
|
1338
1380
|
function RulesHost({ enabled, children }) {
|
|
1339
|
-
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1381
|
+
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Portal.Host, { children }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children });
|
|
1340
1382
|
}
|
|
1341
1383
|
var ROW_BLURB_LINES = 3;
|
|
1342
1384
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1350,11 +1392,11 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1350
1392
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1351
1393
|
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1352
1394
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1353
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1354
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1355
1397
|
] })
|
|
1356
1398
|
] }),
|
|
1357
|
-
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1399
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1358
1400
|
] })
|
|
1359
1401
|
);
|
|
1360
1402
|
}
|
|
@@ -1364,10 +1406,10 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1364
1406
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1365
1407
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1366
1408
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1367
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1368
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1369
1411
|
] }),
|
|
1370
|
-
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1412
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1371
1413
|
] });
|
|
1372
1414
|
}
|
|
1373
1415
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
@@ -1530,7 +1572,7 @@ var import_profile10 = require("@tastic/profile");
|
|
|
1530
1572
|
var import_expo_router10 = require("expo-router");
|
|
1531
1573
|
var import_react17 = require("react");
|
|
1532
1574
|
var import_react_native10 = require("react-native");
|
|
1533
|
-
var
|
|
1575
|
+
var import_react_native_paper3 = require("react-native-paper");
|
|
1534
1576
|
var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
|
|
1535
1577
|
var import_react_redux10 = require("react-redux");
|
|
1536
1578
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -1607,7 +1649,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1607
1649
|
const PackTabContent = packTab?.Content;
|
|
1608
1650
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_chrome8.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core6.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1609
1651
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1610
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1611
1653
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1612
1654
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
|
|
1613
1655
|
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
|
|
@@ -1631,7 +1673,7 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1631
1673
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1632
1674
|
if (!Sections) return null;
|
|
1633
1675
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1634
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1676
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1635
1677
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Sections, { profileId })
|
|
1636
1678
|
] });
|
|
1637
1679
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -500,57 +500,78 @@ var styles = StyleSheet.create({
|
|
|
500
500
|
import { defaultColors } from "@rific/auto-paper";
|
|
501
501
|
import { ScreenFrame as ScreenFrame3 } from "@tastic/hud/chrome";
|
|
502
502
|
import { EditProfileScreen } from "@tastic/profile";
|
|
503
|
-
import { useLocalSearchParams } from "expo-router";
|
|
503
|
+
import { useLocalSearchParams as useLocalSearchParams2 } from "expo-router";
|
|
504
504
|
|
|
505
505
|
// src/navigation.ts
|
|
506
506
|
import { configureNavigation, safeBack } from "@rific/core";
|
|
507
507
|
import { router } from "expo-router";
|
|
508
508
|
configureNavigation({ router });
|
|
509
509
|
|
|
510
|
-
// src/screens/ProfilesRoute.tsx
|
|
511
|
-
import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
|
|
512
|
-
import { ProfilesScreen } from "@tastic/profile";
|
|
513
|
-
import { router as router2 } from "expo-router";
|
|
514
|
-
|
|
515
510
|
// src/routes.ts
|
|
516
511
|
var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
|
|
517
512
|
var loadoutHref = (game) => ({ pathname: "/loadout/[game]", params: { game } });
|
|
518
513
|
var STATS_HREF = "/stats";
|
|
519
514
|
var PROFILES_HREF = "/profiles";
|
|
520
|
-
var
|
|
515
|
+
var profilesHref = (seat) => ({ pathname: "/profiles", params: { seat: String(seat) } });
|
|
516
|
+
var profileHref = (id, seat) => ({ pathname: "/profile/[id]", params: seat ? { id, seat: String(seat) } : { id } });
|
|
517
|
+
var seatParam = (value) => value === "1" ? 1 : value === "2" ? 2 : null;
|
|
521
518
|
|
|
522
519
|
// src/screens/ProfilesRoute.tsx
|
|
520
|
+
import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
|
|
521
|
+
import { NEW_PROFILE_ID, ProfilesScreen } from "@tastic/profile";
|
|
522
|
+
import { router as router2, useLocalSearchParams } from "expo-router";
|
|
523
523
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
524
524
|
var ROSTER_MAX_WIDTH = 640;
|
|
525
525
|
function ProfilesRoute() {
|
|
526
|
+
const { seat } = useLocalSearchParams();
|
|
527
|
+
const opener = seatParam(seat);
|
|
526
528
|
const { profiles } = useProfiles();
|
|
527
529
|
const { Backdrop, foreground } = usePack();
|
|
528
|
-
return /* @__PURE__ */ jsx11(ScreenFrame2, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx11(ProfilesScreen, { profiles, onEdit: (id) => router2.push(profileHref(id)), onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
530
|
+
return /* @__PURE__ */ jsx11(ScreenFrame2, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx11(ProfilesScreen, { profiles, onEdit: (id) => router2.push(profileHref(id, id === NEW_PROFILE_ID ? opener : null)), onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
529
531
|
}
|
|
530
532
|
|
|
531
533
|
// src/screens/EditProfileRoute.tsx
|
|
532
534
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
533
535
|
function EditProfileRoute() {
|
|
534
|
-
const { id } =
|
|
535
|
-
const
|
|
536
|
+
const { id, seat } = useLocalSearchParams2();
|
|
537
|
+
const opener = seatParam(seat);
|
|
538
|
+
const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles();
|
|
536
539
|
const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
|
|
537
|
-
return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(
|
|
540
|
+
return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(
|
|
541
|
+
EditProfileScreen,
|
|
542
|
+
{
|
|
543
|
+
profileId: id,
|
|
544
|
+
profiles,
|
|
545
|
+
defaultColor: newProfileColor ?? defaultColors[0].value,
|
|
546
|
+
onCreate: (patch) => {
|
|
547
|
+
const profile = createProfile(patch);
|
|
548
|
+
if (opener) selectProfile(opener, profile.id);
|
|
549
|
+
},
|
|
550
|
+
onSave: (profileId, patch) => updateProfile(profileId, patch),
|
|
551
|
+
onDelete: deleteProfile,
|
|
552
|
+
onBack: safeBack,
|
|
553
|
+
fg: foreground,
|
|
554
|
+
bg: Backdrop ? "transparent" : void 0,
|
|
555
|
+
sections: ProfileSections ? (profile) => /* @__PURE__ */ jsx12(ProfileSections, { profile }) : void 0
|
|
556
|
+
}
|
|
557
|
+
) });
|
|
538
558
|
}
|
|
539
559
|
|
|
540
560
|
// src/screens/GameRoute.tsx
|
|
541
|
-
import { Redirect, useLocalSearchParams as
|
|
561
|
+
import { Redirect, useLocalSearchParams as useLocalSearchParams3 } from "expo-router";
|
|
542
562
|
import { useEffect as useEffect5 } from "react";
|
|
543
563
|
import { AppState } from "react-native";
|
|
544
564
|
|
|
545
565
|
// src/screens/LoadoutScreen.tsx
|
|
546
566
|
import { defaultColors as defaultColors2, getRgb, useAutoPaperTheme as useAutoPaperTheme3 } from "@rific/auto-paper";
|
|
547
567
|
import { useOrientationState } from "@tastic/core";
|
|
548
|
-
import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from "@tastic/hud/chrome";
|
|
568
|
+
import { CornerActionButtons, PressAwayOverlay, useLettering, usePopoverHost } from "@tastic/hud/chrome";
|
|
549
569
|
import { PlayerSetupPanel, ReadyButton, SharedActionBand } from "@tastic/hud/lobby";
|
|
550
570
|
import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from "@tastic/split-screen";
|
|
551
571
|
import { router as router4, useFocusEffect as useFocusEffect2 } from "expo-router";
|
|
552
572
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
553
573
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
574
|
+
import { Text } from "react-native-paper";
|
|
554
575
|
import Animated from "react-native-reanimated";
|
|
555
576
|
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
556
577
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
@@ -621,7 +642,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
|
|
|
621
642
|
const rules = useSettingsRules();
|
|
622
643
|
const { profiles, lastSelected } = useProfiles();
|
|
623
644
|
const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
|
|
624
|
-
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(
|
|
645
|
+
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(profilesHref(1)) } : {};
|
|
625
646
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
626
647
|
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
|
|
627
648
|
children,
|
|
@@ -789,6 +810,10 @@ import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
789
810
|
var PANEL_SWAP_FADE_MS = 180;
|
|
790
811
|
var P1_CONTROL_ID = "p1-control";
|
|
791
812
|
var P2_CONTROL_ID = "p2-control";
|
|
813
|
+
var HEADER_TOP = 8;
|
|
814
|
+
var HEADER_ROW_HEIGHT = 52;
|
|
815
|
+
var HEADER_TITLE_LEFT = 64;
|
|
816
|
+
var HEADER_TITLE_RIGHT = 60;
|
|
792
817
|
function LoadoutScreen({ game }) {
|
|
793
818
|
const pack = usePack();
|
|
794
819
|
const { seatTwo: savedSeatTwo, setSeatTwo } = useOpponent();
|
|
@@ -808,6 +833,7 @@ function LoadoutScreen({ game }) {
|
|
|
808
833
|
const playersRowFade = panelFadeStyle;
|
|
809
834
|
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
810
835
|
const insets = useSafeAreaInsets2();
|
|
836
|
+
const { title: lettering } = useLettering();
|
|
811
837
|
const { colors: themeColors, dark } = useAutoPaperTheme3();
|
|
812
838
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
813
839
|
const dispatch = useDispatch9();
|
|
@@ -855,9 +881,10 @@ function LoadoutScreen({ game }) {
|
|
|
855
881
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
856
882
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
857
883
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
858
|
-
const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors2, 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: () => router4.push(
|
|
884
|
+
const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors2, 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: () => router4.push(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
859
885
|
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx15(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
860
886
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
887
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
|
|
861
888
|
const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
862
889
|
/* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
863
890
|
p1Panel,
|
|
@@ -868,7 +895,7 @@ function LoadoutScreen({ game }) {
|
|
|
868
895
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
869
896
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
870
897
|
!seatsInOptions && seatButtons,
|
|
871
|
-
/* @__PURE__ */ jsx15(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
898
|
+
!readyInOptions && /* @__PURE__ */ jsx15(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
872
899
|
] });
|
|
873
900
|
const optionsRow = loadout.options({
|
|
874
901
|
host: controlsHost,
|
|
@@ -877,6 +904,8 @@ function LoadoutScreen({ game }) {
|
|
|
877
904
|
onAccentColor: themeColors.onTertiary,
|
|
878
905
|
dark,
|
|
879
906
|
seats: seatsInOptions ? seatButtons : void 0,
|
|
907
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : void 0,
|
|
908
|
+
titleShown: !showMetaInSharedBand,
|
|
880
909
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
881
910
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
882
911
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
@@ -886,10 +915,11 @@ function LoadoutScreen({ game }) {
|
|
|
886
915
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
887
916
|
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, 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");
|
|
888
917
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
889
|
-
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
918
|
+
/* @__PURE__ */ jsxs4(View3, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
|
|
890
919
|
/* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
891
920
|
p2ZoneStyle && /* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
892
921
|
!showMetaInSharedBand && /* @__PURE__ */ jsx15(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
922
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx15(View3, { style: [styles3.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }], pointerEvents: "none", children: /* @__PURE__ */ jsx15(Text, { variant: "headlineSmall", numberOfLines: 1, accessibilityRole: "header", style: [styles3.title, { color: fg }, lettering], children: game.title }) }),
|
|
893
923
|
p2IsHuman ? /* @__PURE__ */ jsx15(
|
|
894
924
|
DualZoneLayout,
|
|
895
925
|
{
|
|
@@ -904,7 +934,7 @@ function LoadoutScreen({ game }) {
|
|
|
904
934
|
}
|
|
905
935
|
) : /* @__PURE__ */ jsxs4(View3, { style: styles3.stackedZone, children: [
|
|
906
936
|
seatsInOptions ? /* @__PURE__ */ jsx15(View3, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
907
|
-
seatOne
|
|
937
|
+
!(seatsInOptions && readyInOptions) && seatOne
|
|
908
938
|
] })
|
|
909
939
|
] }),
|
|
910
940
|
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
@@ -932,6 +962,11 @@ var styles3 = StyleSheet3.create({
|
|
|
932
962
|
justifyContent: "center",
|
|
933
963
|
paddingHorizontal: 16
|
|
934
964
|
},
|
|
965
|
+
headerTitle: {
|
|
966
|
+
height: HEADER_ROW_HEIGHT,
|
|
967
|
+
justifyContent: "center",
|
|
968
|
+
position: "absolute"
|
|
969
|
+
},
|
|
935
970
|
p2ZoneRight: {
|
|
936
971
|
bottom: 0,
|
|
937
972
|
position: "absolute",
|
|
@@ -984,13 +1019,17 @@ var styles3 = StyleSheet3.create({
|
|
|
984
1019
|
stackedZone: {
|
|
985
1020
|
alignItems: "center",
|
|
986
1021
|
gap: 28
|
|
1022
|
+
},
|
|
1023
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
1024
|
+
title: {
|
|
1025
|
+
fontWeight: "bold"
|
|
987
1026
|
}
|
|
988
1027
|
});
|
|
989
1028
|
|
|
990
1029
|
// src/screens/GameRoute.tsx
|
|
991
1030
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
992
1031
|
function LoadoutRoute() {
|
|
993
|
-
const { game: id } =
|
|
1032
|
+
const { game: id } = useLocalSearchParams3();
|
|
994
1033
|
const game = usePackGame(id);
|
|
995
1034
|
if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
|
|
996
1035
|
if (!hasLoadout(game)) return /* @__PURE__ */ jsx16(Redirect, { href: playHref(game.id) });
|
|
@@ -1000,20 +1039,23 @@ function hasLoadout(game) {
|
|
|
1000
1039
|
return !!game.useLoadout;
|
|
1001
1040
|
}
|
|
1002
1041
|
function PlayRoute() {
|
|
1003
|
-
const { game: id } =
|
|
1042
|
+
const { game: id } = useLocalSearchParams3();
|
|
1004
1043
|
const game = usePackGame(id);
|
|
1005
1044
|
useResumePoint(game?.resumable ? game.id : null);
|
|
1006
1045
|
if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
|
|
1007
1046
|
const { PlayScreen } = game;
|
|
1008
1047
|
return /* @__PURE__ */ jsx16(PlayScreen, {}, game.id);
|
|
1009
1048
|
}
|
|
1049
|
+
var playScreensUp = 0;
|
|
1010
1050
|
function useResumePoint(gameId) {
|
|
1011
1051
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
1012
1052
|
useEffect5(() => {
|
|
1013
1053
|
if (!gameId) return;
|
|
1054
|
+
playScreensUp += 1;
|
|
1014
1055
|
setLastActiveGame(gameId);
|
|
1015
1056
|
return () => {
|
|
1016
|
-
|
|
1057
|
+
playScreensUp -= 1;
|
|
1058
|
+
if (playScreensUp === 0 && AppState.currentState === "active") clearLastActiveGame();
|
|
1017
1059
|
};
|
|
1018
1060
|
}, [gameId, setLastActiveGame, clearLastActiveGame]);
|
|
1019
1061
|
}
|
|
@@ -1026,7 +1068,7 @@ import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
|
|
|
1026
1068
|
import { router as router5, useFocusEffect as useFocusEffect3, useIsFocused } from "expo-router";
|
|
1027
1069
|
import { useCallback as useCallback10, useDeferredValue, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
1028
1070
|
import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
|
|
1029
|
-
import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
|
|
1071
|
+
import { Icon, Portal, SegmentedButtons, Text as Text2 } from "react-native-paper";
|
|
1030
1072
|
|
|
1031
1073
|
// src/components/segmentTheme.ts
|
|
1032
1074
|
var SEGMENT_THEME = { roundness: 3.8 };
|
|
@@ -1194,7 +1236,7 @@ function HomeMenu() {
|
|
|
1194
1236
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1195
1237
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
|
|
1196
1238
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1197
|
-
const picker = /* @__PURE__ */ jsx17(ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => router5.push(
|
|
1239
|
+
const picker = /* @__PURE__ */ jsx17(ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => router5.push(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1198
1240
|
const pressAway = /* @__PURE__ */ jsx17(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1199
1241
|
const RulesSheet = rulesGame?.Rules;
|
|
1200
1242
|
return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
@@ -1271,8 +1313,8 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1271
1313
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1272
1314
|
game.Preview ? /* @__PURE__ */ jsx17(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx17(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx17(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1273
1315
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1274
|
-
/* @__PURE__ */ jsx17(
|
|
1275
|
-
/* @__PURE__ */ jsx17(
|
|
1316
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1317
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1276
1318
|
] })
|
|
1277
1319
|
] }),
|
|
1278
1320
|
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
@@ -1285,8 +1327,8 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1285
1327
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1286
1328
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1287
1329
|
/* @__PURE__ */ jsx17(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1288
|
-
/* @__PURE__ */ jsx17(
|
|
1289
|
-
/* @__PURE__ */ jsx17(
|
|
1330
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1331
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1290
1332
|
] }),
|
|
1291
1333
|
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1292
1334
|
] });
|
|
@@ -1451,7 +1493,7 @@ import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker
|
|
|
1451
1493
|
import { router as router6 } from "expo-router";
|
|
1452
1494
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1453
1495
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1454
|
-
import { SegmentedButtons as SegmentedButtons2, Text as
|
|
1496
|
+
import { SegmentedButtons as SegmentedButtons2, Text as Text3 } from "react-native-paper";
|
|
1455
1497
|
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1456
1498
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1457
1499
|
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -1552,7 +1594,7 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1552
1594
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1553
1595
|
if (!Sections) return null;
|
|
1554
1596
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1555
|
-
showTitle && /* @__PURE__ */ jsx18(
|
|
1597
|
+
showTitle && /* @__PURE__ */ jsx18(Text3, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1556
1598
|
/* @__PURE__ */ jsx18(Sections, { profileId })
|
|
1557
1599
|
] });
|
|
1558
1600
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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",
|
|
@@ -6,7 +6,7 @@ import type { ReactNode } from 'react'
|
|
|
6
6
|
import { useAppSettings } from '../hooks/useAppSettings'
|
|
7
7
|
import { useProfiles } from '../hooks/useProfiles'
|
|
8
8
|
import { usePack } from '../PackContext'
|
|
9
|
-
import { profileHref,
|
|
9
|
+
import { profileHref, profilesHref } from '../routes'
|
|
10
10
|
|
|
11
11
|
export interface SettingsDialogProps {
|
|
12
12
|
visible: boolean
|
|
@@ -42,7 +42,7 @@ export function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfil
|
|
|
42
42
|
const rules = useSettingsRules()
|
|
43
43
|
const { profiles, lastSelected } = useProfiles()
|
|
44
44
|
const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null
|
|
45
|
-
const profileRow = showProfile ? (seatOne ? { onShowProfiles: () => router.push(profileHref(seatOne.id)), profilesRow: { label: 'Profile', caption: seatOne.name, icon: 'account-outline' } } : { onShowProfiles: () => router.push(
|
|
45
|
+
const profileRow = showProfile ? (seatOne ? { onShowProfiles: () => router.push(profileHref(seatOne.id)), profilesRow: { label: 'Profile', caption: seatOne.name, icon: 'account-outline' } } : { onShowProfiles: () => router.push(profilesHref(1)) }) : {}
|
|
46
46
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value: boolean) => setSettings({ deferBottomEdgeGestures: value }) } : {}
|
|
47
47
|
|
|
48
48
|
return (
|
package/src/routes.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Href } from 'expo-router'
|
|
2
2
|
|
|
3
|
+
import type { Seat } from './types'
|
|
4
|
+
|
|
3
5
|
// The shell's own routes, the ones every pack's src/app/ has (play/[game], loadout/[game], stats,
|
|
4
6
|
// profiles, profile/[id]). An app with expo-router's typed routes type-checks this source against its own route tree
|
|
5
7
|
// (its tsc reads the package's src/), and an app moving onto the shell (Solitaire) has these routes only
|
|
@@ -7,6 +9,14 @@ import type { Href } from 'expo-router'
|
|
|
7
9
|
export const playHref = (game: string) => ({ pathname: '/play/[game]', params: { game } }) as unknown as Href
|
|
8
10
|
export const loadoutHref = (game: string) => ({ pathname: '/loadout/[game]', params: { game } }) as unknown as Href
|
|
9
11
|
export const STATS_HREF = '/stats' as unknown as Href
|
|
12
|
+
// The roster, opened by no seat (the stats screen's Manage).
|
|
10
13
|
export const PROFILES_HREF = '/profiles' as unknown as Href
|
|
11
|
-
//
|
|
12
|
-
|
|
14
|
+
// The roster, opened by a seat: its picker's Manage, or Settings' Profiles row for seat 1's guest. The seat rides along to New
|
|
15
|
+
// Profile, and the profile made there is picked for it (Jay, 2026-11-16 in HexFleet: a new profile is selected in the seat that
|
|
16
|
+
// went to make it).
|
|
17
|
+
export const profilesHref = (seat: Seat) => ({ pathname: '/profiles', params: { seat: String(seat) } }) as unknown as Href
|
|
18
|
+
// One profile's Edit Profile screen: a profile's id, or @tastic/profile's NEW_PROFILE_ID ('new') for New Profile, with the seat
|
|
19
|
+
// that opened the roster for a new one.
|
|
20
|
+
export const profileHref = (id: string, seat?: Seat | null) => ({ pathname: '/profile/[id]', params: seat ? { id, seat: String(seat) } : { id } }) as unknown as Href
|
|
21
|
+
// The seat a profiles route was opened for (its `seat` param), or null: none, or anything but 1 or 2.
|
|
22
|
+
export const seatParam = (value: string | string[] | undefined): Seat | null => (value === '1' ? 1 : value === '2' ? 2 : null)
|
|
@@ -6,6 +6,7 @@ import { useLocalSearchParams } from 'expo-router'
|
|
|
6
6
|
import { useProfiles } from '../hooks/useProfiles'
|
|
7
7
|
import { safeBack } from '../navigation'
|
|
8
8
|
import { usePack } from '../PackContext'
|
|
9
|
+
import { seatParam } from '../routes'
|
|
9
10
|
import { ROSTER_MAX_WIDTH } from './ProfilesRoute'
|
|
10
11
|
|
|
11
12
|
// One profile's Edit Profile screen (@tastic/profile's EditProfileScreen), the pack's profile/[id]
|
|
@@ -18,14 +19,35 @@ import { ROSTER_MAX_WIDTH } from './ProfilesRoute'
|
|
|
18
19
|
// pack's newProfileColor, or auto-paper's first swatch. Over a pack's Backdrop the screen is
|
|
19
20
|
// transparent, drawn in the pack's foreground. A saved profile's screen also draws the pack's own
|
|
20
21
|
// ProfileSections (its online play's, say) under Color.
|
|
22
|
+
//
|
|
23
|
+
// A new profile is picked for the seat that went to make it (the `seat` param, which Profiles passes on
|
|
24
|
+
// when a seat opened it): seat 1's Manage on Home or in a loadout, or Settings' Profiles row for seat
|
|
25
|
+
// 1's guest, so the player comes back to their new profile in their seat (Jay, 2026-11-16 in HexFleet;
|
|
26
|
+
// every pack since @tastic/shell 0.19.0). The newest made wins. Opened by no seat (the stats screen's
|
|
27
|
+
// Manage), or left without making one, it picks nothing.
|
|
21
28
|
export function EditProfileRoute() {
|
|
22
|
-
const { id } = useLocalSearchParams<{ id: string }>()
|
|
23
|
-
const
|
|
29
|
+
const { id, seat } = useLocalSearchParams<{ id: string; seat?: string }>()
|
|
30
|
+
const opener = seatParam(seat)
|
|
31
|
+
const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles()
|
|
24
32
|
const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack()
|
|
25
33
|
|
|
26
34
|
return (
|
|
27
35
|
<ScreenFrame portalHost maxContentWidth={ROSTER_MAX_WIDTH}>
|
|
28
|
-
<EditProfileScreen
|
|
36
|
+
<EditProfileScreen
|
|
37
|
+
profileId={id}
|
|
38
|
+
profiles={profiles}
|
|
39
|
+
defaultColor={newProfileColor ?? defaultColors[0].value}
|
|
40
|
+
onCreate={(patch) => {
|
|
41
|
+
const profile = createProfile(patch)
|
|
42
|
+
if (opener) selectProfile(opener, profile.id)
|
|
43
|
+
}}
|
|
44
|
+
onSave={(profileId, patch) => updateProfile(profileId, patch)}
|
|
45
|
+
onDelete={deleteProfile}
|
|
46
|
+
onBack={safeBack}
|
|
47
|
+
fg={foreground}
|
|
48
|
+
bg={Backdrop ? 'transparent' : undefined}
|
|
49
|
+
sections={ProfileSections ? (profile) => <ProfileSections profile={profile} /> : undefined}
|
|
50
|
+
/>
|
|
29
51
|
</ScreenFrame>
|
|
30
52
|
)
|
|
31
53
|
}
|
|
@@ -43,14 +43,20 @@ export function PlayRoute() {
|
|
|
43
43
|
// terminates an app it hasn't suspended yet (swiped away from the app switcher soon after leaving
|
|
44
44
|
// it), React Native's renderer stops every surface (RCTSurfacePresenter's will-terminate handler),
|
|
45
45
|
// which unmounts the whole tree, and clearing then sent every such relaunch to Home. Runs once per
|
|
46
|
-
// play screen: the context's functions never change.
|
|
46
|
+
// play screen: the context's functions never change. A play screen that goes while another is up
|
|
47
|
+
// (a pack replacing one play screen with another, CardTastic's regular game with its Daily Deal: the
|
|
48
|
+
// stack keeps the old one drawn until its transition ends, so it unmounts after the new one mounted)
|
|
49
|
+
// leaves the resume point to the one still up.
|
|
50
|
+
let playScreensUp = 0
|
|
47
51
|
function useResumePoint(gameId: string | null) {
|
|
48
52
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame()
|
|
49
53
|
useEffect(() => {
|
|
50
54
|
if (!gameId) return
|
|
55
|
+
playScreensUp += 1
|
|
51
56
|
setLastActiveGame(gameId)
|
|
52
57
|
return () => {
|
|
53
|
-
|
|
58
|
+
playScreensUp -= 1
|
|
59
|
+
if (playScreensUp === 0 && AppState.currentState === 'active') clearLastActiveGame()
|
|
54
60
|
}
|
|
55
61
|
}, [gameId, setLastActiveGame, clearLastActiveGame])
|
|
56
62
|
}
|
|
@@ -16,7 +16,7 @@ import { useOpponent } from '../hooks/useOpponent'
|
|
|
16
16
|
import { useProfiles } from '../hooks/useProfiles'
|
|
17
17
|
import { useSeatColors } from '../hooks/useSeatColors'
|
|
18
18
|
import { usePack } from '../PackContext'
|
|
19
|
-
import { loadoutHref, playHref,
|
|
19
|
+
import { loadoutHref, playHref, profilesHref, STATS_HREF } from '../routes'
|
|
20
20
|
import type { HomeTab, PackGameDefinition } from '../types'
|
|
21
21
|
import { HOME_GRID_GAP, HOME_LEFT_PANE_PICKER_GAP, HOME_TILE_PADDING, HOME_TOP_BAND, HOME_WIDE_PANE_GAP, PREVIEW_ASPECT, ROW_PREVIEW_WIDTH, useHomeLayout } from './homeLayout'
|
|
22
22
|
|
|
@@ -171,7 +171,7 @@ function HomeMenu() {
|
|
|
171
171
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height)
|
|
172
172
|
|
|
173
173
|
// A pack can leave seat 1's button off Home (PackDefinition.homePlayerPicker)
|
|
174
|
-
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(
|
|
174
|
+
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(profilesHref(1))} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
|
|
175
175
|
|
|
176
176
|
// Closes seat 1's menu on a press anywhere but the menu and its button. Where it's mounted matters on
|
|
177
177
|
// a phone, where zIndex only orders the children of one parent: the menu lives inside the scroller in
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { defaultColors, getRgb, useAutoPaperTheme } from '@rific/auto-paper'
|
|
2
2
|
import { useOrientationState } from '@tastic/core'
|
|
3
|
-
import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from '@tastic/hud/chrome'
|
|
3
|
+
import { CornerActionButtons, PressAwayOverlay, useLettering, usePopoverHost } from '@tastic/hud/chrome'
|
|
4
4
|
import { PlayerSetupPanel, ReadyButton, SharedActionBand } from '@tastic/hud/lobby'
|
|
5
5
|
import type { Profile } from '@tastic/profile'
|
|
6
6
|
import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from '@tastic/split-screen'
|
|
7
7
|
import { router, useFocusEffect } from 'expo-router'
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
9
9
|
import { type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
10
|
+
import { Text } from 'react-native-paper'
|
|
10
11
|
import Animated from 'react-native-reanimated'
|
|
11
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
12
13
|
import { useDispatch } from 'react-redux'
|
|
@@ -22,7 +23,7 @@ import { useSeatColors } from '../hooks/useSeatColors'
|
|
|
22
23
|
import { safeBack } from '../navigation'
|
|
23
24
|
import { usePack } from '../PackContext'
|
|
24
25
|
import { liveplayActions } from '../redux/liveplaySlice'
|
|
25
|
-
import { playHref,
|
|
26
|
+
import { playHref, profilesHref } from '../routes'
|
|
26
27
|
import { humanSeatsFor, type PackGameDefinition, roundModeFor, type Seat, type SeatTwo, seatTwoFor } from '../types'
|
|
27
28
|
|
|
28
29
|
// The player-panel area: whenever the window changes shape (a tablet turning, a browser window
|
|
@@ -36,6 +37,14 @@ const PANEL_SWAP_FADE_MS = 180
|
|
|
36
37
|
const P1_CONTROL_ID = 'p1-control'
|
|
37
38
|
const P2_CONTROL_ID = 'p2-control'
|
|
38
39
|
|
|
40
|
+
// The header's title, placed as the stats screen's (hud's BaseStatsScreen): beside the corner Back
|
|
41
|
+
// button (8pt from the edge, Paper's 6pt IconButton margin, its 40pt box, 6pt margin, 4pt gap), clear
|
|
42
|
+
// of the Settings button on the right, and centered on the buttons' 52pt row.
|
|
43
|
+
const HEADER_TOP = 8
|
|
44
|
+
const HEADER_ROW_HEIGHT = 52
|
|
45
|
+
const HEADER_TITLE_LEFT = 64
|
|
46
|
+
const HEADER_TITLE_RIGHT = 60
|
|
47
|
+
|
|
39
48
|
// A game that has a loadout (GameDefinition.useLoadout): the loadout route sends any other straight
|
|
40
49
|
// to its play screen.
|
|
41
50
|
export type LoadoutGame = PackGameDefinition & Required<Pick<PackGameDefinition, 'useLoadout'>>
|
|
@@ -81,6 +90,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
81
90
|
|
|
82
91
|
const [settingsOpen, setSettingsOpen] = useState(false)
|
|
83
92
|
const insets = useSafeAreaInsets()
|
|
93
|
+
const { title: lettering } = useLettering()
|
|
84
94
|
const { colors: themeColors, dark } = useAutoPaperTheme()
|
|
85
95
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman)
|
|
86
96
|
const dispatch = useDispatch<Dispatch<Action>>()
|
|
@@ -173,11 +183,13 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
173
183
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
|
|
174
184
|
// Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
|
|
175
185
|
// 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(
|
|
186
|
+
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(profilesHref(1))} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
|
|
177
187
|
// Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
|
|
178
188
|
// seat 1's button stands alone.
|
|
179
189
|
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
190
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
|
|
191
|
+
// With one person a game can draw its own start among its options (GameLoadout.drawsReady)
|
|
192
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady
|
|
181
193
|
const seatButtons = (
|
|
182
194
|
<View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
|
|
183
195
|
<Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
|
|
@@ -192,7 +204,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
192
204
|
const seatOne = (
|
|
193
205
|
<View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && !seatsInOptions && styles.raised]}>
|
|
194
206
|
{!seatsInOptions && seatButtons}
|
|
195
|
-
<ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
|
|
207
|
+
{!readyInOptions && <ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />}
|
|
196
208
|
</View>
|
|
197
209
|
)
|
|
198
210
|
|
|
@@ -203,6 +215,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
203
215
|
onAccentColor: themeColors.onTertiary,
|
|
204
216
|
dark,
|
|
205
217
|
seats: seatsInOptions ? seatButtons : undefined,
|
|
218
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : undefined,
|
|
219
|
+
titleShown: !showMetaInSharedBand,
|
|
206
220
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
207
221
|
onRandomize: showMetaInSharedBand ? undefined : loadout.randomize,
|
|
208
222
|
onReset: showMetaInSharedBand ? undefined : loadout.reset
|
|
@@ -225,7 +239,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
225
239
|
return (
|
|
226
240
|
<View style={[styles.container, { backgroundColor: bg }]}>
|
|
227
241
|
{/* The Settings dialog stays outside this frame: it renders through a Portal. */}
|
|
228
|
-
<View style={styles.frame}>
|
|
242
|
+
<View style={[styles.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }]}>
|
|
229
243
|
{/* Press-away overlays for the loadout's own menus. P1's covers the whole screen (their
|
|
230
244
|
panel plus the match options read as theirs), while P2's covers only their half and, as a
|
|
231
245
|
later sibling, takes priority there. P2's mounts whenever either host has a menu open, so it
|
|
@@ -234,6 +248,16 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
234
248
|
{p2ZoneStyle && <PressAwayOverlay active={controlsHost.openId !== null || p2Host.openId !== null} onPress={p2Host.close} style={p2ZoneStyle} />}
|
|
235
249
|
|
|
236
250
|
{!showMetaInSharedBand && <CornerActionButtons onBack={safeBack} onSettings={() => setSettingsOpen(true)} fg={fg} insets={insets} />}
|
|
251
|
+
{/* The game's name in the header, as a screen's title beside Back (Jay, 2026-11-21: over the
|
|
252
|
+
seat buttons it read as part of the options). 2 Player face to face has no header: its back
|
|
253
|
+
and settings sit in the band between the players, where a game names itself. */}
|
|
254
|
+
{!showMetaInSharedBand && (
|
|
255
|
+
<View style={[styles.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }]} pointerEvents='none'>
|
|
256
|
+
<Text variant='headlineSmall' numberOfLines={1} accessibilityRole='header' style={[styles.title, { color: fg }, lettering]}>
|
|
257
|
+
{game.title}
|
|
258
|
+
</Text>
|
|
259
|
+
</View>
|
|
260
|
+
)}
|
|
237
261
|
|
|
238
262
|
{p2IsHuman ? (
|
|
239
263
|
<DualZoneLayout
|
|
@@ -252,7 +276,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
252
276
|
<View style={styles.stackedZone}>
|
|
253
277
|
{/* A menu opening from seat buttons placed in the options has to clear Ready, the next sibling */}
|
|
254
278
|
{seatsInOptions ? <View style={p1PickerOpen && styles.raised}>{sharedControls}</View> : sharedControls}
|
|
255
|
-
{
|
|
279
|
+
{/* Nothing left of seat 1's column once a game places its buttons and draws its own start (no empty gap) */}
|
|
280
|
+
{!(seatsInOptions && readyInOptions) && seatOne}
|
|
256
281
|
</View>
|
|
257
282
|
)}
|
|
258
283
|
</View>
|
|
@@ -287,6 +312,11 @@ const styles = StyleSheet.create({
|
|
|
287
312
|
justifyContent: 'center',
|
|
288
313
|
paddingHorizontal: 16
|
|
289
314
|
},
|
|
315
|
+
headerTitle: {
|
|
316
|
+
height: HEADER_ROW_HEIGHT,
|
|
317
|
+
justifyContent: 'center',
|
|
318
|
+
position: 'absolute'
|
|
319
|
+
},
|
|
290
320
|
p2ZoneRight: {
|
|
291
321
|
bottom: 0,
|
|
292
322
|
position: 'absolute',
|
|
@@ -339,5 +369,9 @@ const styles = StyleSheet.create({
|
|
|
339
369
|
stackedZone: {
|
|
340
370
|
alignItems: 'center',
|
|
341
371
|
gap: 28
|
|
372
|
+
},
|
|
373
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
374
|
+
title: {
|
|
375
|
+
fontWeight: 'bold'
|
|
342
376
|
}
|
|
343
377
|
})
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import { ScreenFrame } from '@tastic/hud/chrome'
|
|
2
|
-
import { ProfilesScreen } from '@tastic/profile'
|
|
3
|
-
import { router } from 'expo-router'
|
|
2
|
+
import { NEW_PROFILE_ID, ProfilesScreen } from '@tastic/profile'
|
|
3
|
+
import { router, useLocalSearchParams } from 'expo-router'
|
|
4
4
|
|
|
5
5
|
import { useProfiles } from '../hooks/useProfiles'
|
|
6
6
|
import { safeBack } from '../navigation'
|
|
7
7
|
import { usePack } from '../PackContext'
|
|
8
|
-
import { profileHref } from '../routes'
|
|
8
|
+
import { profileHref, seatParam } from '../routes'
|
|
9
9
|
|
|
10
10
|
// Widest the roster and a profile's screen get in the wide layout (a landscape phone, a desktop
|
|
11
11
|
// window). Upright they're never capped.
|
|
12
12
|
export const ROSTER_MAX_WIDTH = 640
|
|
13
13
|
|
|
14
|
-
// The Profiles screen (Manage, from either seat 1 button
|
|
15
|
-
// its own Edit Profile screen, the pack's
|
|
16
|
-
// made, saved and deleted.
|
|
14
|
+
// The Profiles screen (Manage, from either seat 1 button, Settings' Profiles row for a guest and the
|
|
15
|
+
// stats screen): @tastic/profile's roster. A profile opens its own Edit Profile screen, the pack's
|
|
16
|
+
// profile/[id] route (EditProfileRoute), where profiles are made, saved and deleted. Opened by a seat
|
|
17
|
+
// (the `seat` param, routes.ts' profilesHref), New Profile carries the seat along, so the profile made
|
|
18
|
+
// there is picked for it.
|
|
17
19
|
//
|
|
18
20
|
// In hud's ScreenFrame: ProfilesManager reads the safe-area insets itself (the header's padding), and
|
|
19
21
|
// the roster's column is capped in the wide layout. Over a pack's Backdrop the screen is transparent,
|
|
20
22
|
// drawn in the pack's foreground.
|
|
21
23
|
export function ProfilesRoute() {
|
|
24
|
+
const { seat } = useLocalSearchParams<{ seat?: string }>()
|
|
25
|
+
const opener = seatParam(seat)
|
|
22
26
|
const { profiles } = useProfiles()
|
|
23
27
|
const { Backdrop, foreground } = usePack()
|
|
24
28
|
|
|
25
29
|
return (
|
|
26
30
|
<ScreenFrame maxContentWidth={ROSTER_MAX_WIDTH}>
|
|
27
|
-
<ProfilesScreen profiles={profiles} onEdit={(id) => router.push(profileHref(id))} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} />
|
|
31
|
+
<ProfilesScreen profiles={profiles} onEdit={(id) => router.push(profileHref(id, id === NEW_PROFILE_ID ? opener : null))} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} />
|
|
28
32
|
</ScreenFrame>
|
|
29
33
|
)
|
|
30
34
|
}
|
package/src/types.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface LoadoutOptionsProps {
|
|
|
56
56
|
// With one person, player 1's row of buttons (their seat's, the opponent's and their controls), for a
|
|
57
57
|
// game whose loadout sets placesSeats to put where it likes. Undefined otherwise.
|
|
58
58
|
seats?: ReactNode
|
|
59
|
+
// With one person, what starts the round (player 1 readying up), for a game whose loadout sets
|
|
60
|
+
// drawsReady to draw its own start among its options. Undefined otherwise.
|
|
61
|
+
onReady?: () => void
|
|
62
|
+
// Whether the loadout's header already shows the game's name (beside Back, as the stats screen's
|
|
63
|
+
// title does): everywhere but 2 Player face to face, whose back and settings fold into the band
|
|
64
|
+
// between the players. A game that names itself among its options does so only when this is false.
|
|
65
|
+
titleShown: boolean
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
// The colors a seat's controls picker draws with: the loadout's tertiary accent, or the seat's own.
|
|
@@ -78,6 +85,11 @@ export interface GameLoadout {
|
|
|
78
85
|
// instead (LoadoutOptionsProps.seats), for a game that wants them among its own (over its rules, under
|
|
79
86
|
// its name). 2 Player's seats stay in each person's half.
|
|
80
87
|
placesSeats?: boolean
|
|
88
|
+
// With one person Ready sits under the options row (and the seat buttons). True draws no Ready and
|
|
89
|
+
// hands `options` an onReady to call instead, for a game that starts the round from a control of its
|
|
90
|
+
// own (CardTastic's solitaire games: a New Deal or Continue row in a card, like their Daily Deal's, since
|
|
91
|
+
// READY? means nothing to one person). 2 Player's Ready buttons stay in each person's half.
|
|
92
|
+
drawsReady?: boolean
|
|
81
93
|
// The popover ids the options row opens, so the loadout can elevate the row while one is open.
|
|
82
94
|
optionIds: readonly string[]
|
|
83
95
|
randomize: () => void
|