@tastic/shell 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,11 @@ How to Play and stats tabs into the same screens.
11
11
  The stats screen's player picker is always there, with no profile yet too: Everyone, each profile
12
12
  (and Guest, with `guestStats`, once one exists), then Manage, which opens the Profiles screen.
13
13
 
14
+ Every seat button names its seat in a small caption over it (0.20.0+, on `@tastic/profile` 0.29.0 and
15
+ `@tastic/hud` 0.40.0), as the stats screen's PLAYER and GAME pickers do: PLAYER over seat 1's button on
16
+ Home and in a loadout with one person, PLAYER 1 and PLAYER 2 in 2 Player's halves, and OPPONENT over
17
+ player 1's opponent button.
18
+
14
19
  Built from the shell PuckTastic and DuelTastic each carried in `src/shell/` (made identical on
15
20
  2026-10-28), so the packs and the next ones (CardTastic) share one copy. Part of the `@tastic`
16
21
  package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native-hud),
@@ -27,7 +32,7 @@ package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native
27
32
  - **Screens** for the routes: `HomeScreen` (the pack's hero, seat 1's button, a row per game, or a
28
33
  grid of preview tiles on a wide screen, split into tabs where the pack has them), `LoadoutRoute` and `PlayRoute` (`loadout/[game]`,
29
34
  `play/[game]`), `ProfilesRoute`, `EditProfileRoute` (`profile/[id]`, one profile's Edit Profile
30
- screen, which Profiles pushes with the profile's id or `new`) and `StatsScreen`.
35
+ 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
36
  - **The store**: `createPackStore(pack, { keyPrefix, migrate, blacklist, serializableIgnoredPaths,
32
37
  middleware })` builds one persisted store from the shell's keys (theme, haptics, sound, Keep Awake,
33
38
  profiles, seat selection, seat colors, app settings, seat 2, the never-saved `liveplay`, and
@@ -108,9 +113,9 @@ the front of an in-app link, so a route starting with a game id equal to the bas
108
113
  | `appearance?` | The theme's appearance on a fresh install (`'system'` when unset). |
109
114
  | `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
115
  | `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, 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`. |
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 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. |
116
+ | `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. |
117
+ | `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`. |
118
+ | `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
119
  | `otaVersion` | The version label in Settings. |
115
120
  | `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
121
  | `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
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 profileHref = (id) => ({ pathname: "/profile/[id]", params: { id } });
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 { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
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)(import_profile5.EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? import_auto_paper3.defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, sections: ProfileSections ? (profile) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ProfileSections, { profile }) : void 0 }) });
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
@@ -675,7 +695,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
675
695
  const size = (0, import_profile6.getOptionPickerContentSize)(options, colorSection);
676
696
  const useAlign = usePickerAlign ?? import_lobby.useZoneClampedAlign;
677
697
  const align = useAlign(host.openId === pickerId, size.width, size.height);
678
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_profile6.OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
698
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_profile6.OptionPicker, { id: pickerId, host, caption: "Opponent", options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
679
699
  }
680
700
  var styles2 = import_react_native4.StyleSheet.create({
681
701
  // Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
@@ -701,7 +721,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
701
721
  const rules = useSettingsRules();
702
722
  const { profiles, lastSelected } = useProfiles();
703
723
  const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
704
- 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(PROFILES_HREF) } : {};
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)) } : {};
705
725
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
706
726
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
707
727
  children,
@@ -940,7 +960,8 @@ function LoadoutScreen({ game }) {
940
960
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
941
961
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
942
962
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
943
- 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(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
963
+ const p1Caption = p2IsHuman ? "Player 1" : "Player";
964
+ const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", caption: p1Caption, 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}`);
944
965
  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}`);
945
966
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
946
967
  const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
@@ -972,7 +993,7 @@ function LoadoutScreen({ game }) {
972
993
  const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
973
994
  const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.SharedActionBand, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
974
995
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
975
- 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");
996
+ const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", caption: "Player 2", 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");
976
997
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
977
998
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
978
999
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
@@ -1295,7 +1316,7 @@ function HomeMenu() {
1295
1316
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1296
1317
  const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
1297
1318
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1298
- 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(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1319
+ const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, caption: "Player", 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 });
1299
1320
  const pressAway = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1300
1321
  const RulesSheet = rulesGame?.Rules;
1301
1322
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
package/dist/index.mjs CHANGED
@@ -500,45 +500,65 @@ 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 profileHref = (id) => ({ pathname: "/profile/[id]", params: { id } });
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 } = useLocalSearchParams();
535
- const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
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(EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, sections: ProfileSections ? (profile) => /* @__PURE__ */ jsx12(ProfileSections, { profile }) : void 0 }) });
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 useLocalSearchParams2 } from "expo-router";
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
 
@@ -596,7 +616,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
596
616
  const size = getOptionPickerContentSize(options, colorSection);
597
617
  const useAlign = usePickerAlign ?? useZoneClampedAlign;
598
618
  const align = useAlign(host.openId === pickerId, size.width, size.height);
599
- return /* @__PURE__ */ jsx13(View2, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ jsx13(OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
619
+ return /* @__PURE__ */ jsx13(View2, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ jsx13(OptionPicker, { id: pickerId, host, caption: "Opponent", options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
600
620
  }
601
621
  var styles2 = StyleSheet2.create({
602
622
  // Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
@@ -622,7 +642,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
622
642
  const rules = useSettingsRules();
623
643
  const { profiles, lastSelected } = useProfiles();
624
644
  const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
625
- const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(PROFILES_HREF) } : {};
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)) } : {};
626
646
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
627
647
  return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
628
648
  children,
@@ -861,7 +881,8 @@ function LoadoutScreen({ game }) {
861
881
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
862
882
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
863
883
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
864
- 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(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
884
+ const p1Caption = p2IsHuman ? "Player 1" : "Player";
885
+ const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", caption: p1Caption, 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}`);
865
886
  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}`);
866
887
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
867
888
  const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
@@ -893,7 +914,7 @@ function LoadoutScreen({ game }) {
893
914
  const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
894
915
  const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx15(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
895
916
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
896
- 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");
917
+ const p2Panel = p2IsHuman && /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p2", caption: "Player 2", 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");
897
918
  return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
898
919
  /* @__PURE__ */ jsxs4(View3, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
899
920
  /* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
@@ -1009,7 +1030,7 @@ var styles3 = StyleSheet3.create({
1009
1030
  // src/screens/GameRoute.tsx
1010
1031
  import { jsx as jsx16 } from "react/jsx-runtime";
1011
1032
  function LoadoutRoute() {
1012
- const { game: id } = useLocalSearchParams2();
1033
+ const { game: id } = useLocalSearchParams3();
1013
1034
  const game = usePackGame(id);
1014
1035
  if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
1015
1036
  if (!hasLoadout(game)) return /* @__PURE__ */ jsx16(Redirect, { href: playHref(game.id) });
@@ -1019,7 +1040,7 @@ function hasLoadout(game) {
1019
1040
  return !!game.useLoadout;
1020
1041
  }
1021
1042
  function PlayRoute() {
1022
- const { game: id } = useLocalSearchParams2();
1043
+ const { game: id } = useLocalSearchParams3();
1023
1044
  const game = usePackGame(id);
1024
1045
  useResumePoint(game?.resumable ? game.id : null);
1025
1046
  if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
@@ -1216,7 +1237,7 @@ function HomeMenu() {
1216
1237
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1217
1238
  const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
1218
1239
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1219
- 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(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1240
+ const picker = /* @__PURE__ */ jsx17(ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, caption: "Player", 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 });
1220
1241
  const pressAway = /* @__PURE__ */ jsx17(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1221
1242
  const RulesSheet = rulesGame?.Rules;
1222
1243
  return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.18.0",
3
+ "version": "0.20.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,8 +86,8 @@
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.37.0",
90
- "@tastic/profile": "^0.26.0",
89
+ "@tastic/hud": "^0.40.0",
90
+ "@tastic/profile": "^0.29.0",
91
91
  "@tastic/split-screen": "^0.6.0",
92
92
  "@testing-library/react-native": "^14.1.0",
93
93
  "@types/jest": "30.0.0",
@@ -138,8 +138,8 @@
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.37.0",
142
- "@tastic/profile": ">=0.26.0",
141
+ "@tastic/hud": ">=0.40.0",
142
+ "@tastic/profile": ">=0.29.0",
143
143
  "@tastic/split-screen": ">=0.5.5",
144
144
  "expo-audio": ">=58.0.11",
145
145
  "expo-blur": ">=58.0.4",
@@ -95,7 +95,7 @@ export function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChan
95
95
 
96
96
  return (
97
97
  <View style={[styles.button, host.openId === pickerId && styles.buttonOpen]}>
98
- <OptionPicker id={pickerId} host={host} options={options} value={value} onChange={handleChange} color={drawn} dark={dark} icon={icon} colorSection={colorSection} alignOverride={align} triggerStyle={triggerStyle} />
98
+ <OptionPicker id={pickerId} host={host} caption='Opponent' options={options} value={value} onChange={handleChange} color={drawn} dark={dark} icon={icon} colorSection={colorSection} alignOverride={align} triggerStyle={triggerStyle} />
99
99
  </View>
100
100
  )
101
101
  }
@@ -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, PROFILES_HREF } from '../routes'
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(PROFILES_HREF) }) : {}
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
- // One profile's Edit Profile screen: a profile's id, or @tastic/profile's NEW_PROFILE_ID ('new') for New Profile.
12
- export const profileHref = (id: string) => ({ pathname: '/profile/[id]', params: { id } }) as unknown as Href
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 { profiles, createProfile, updateProfile, deleteProfile } = useProfiles()
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 profileId={id} profiles={profiles} defaultColor={newProfileColor ?? defaultColors[0].value} onCreate={(patch) => createProfile(patch)} onSave={(profileId, patch) => updateProfile(profileId, patch)} onDelete={deleteProfile} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} sections={ProfileSections ? (profile) => <ProfileSections profile={profile} /> : undefined} />
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
  }
@@ -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, PROFILES_HREF, STATS_HREF } from '../routes'
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(PROFILES_HREF)} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
174
+ const picker = <ProfilePicker idPrefix={SEAT_ONE_PICKER} host={pickerHost} caption='Player' 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
@@ -23,7 +23,7 @@ import { useSeatColors } from '../hooks/useSeatColors'
23
23
  import { safeBack } from '../navigation'
24
24
  import { usePack } from '../PackContext'
25
25
  import { liveplayActions } from '../redux/liveplaySlice'
26
- import { playHref, PROFILES_HREF } from '../routes'
26
+ import { playHref, profilesHref } from '../routes'
27
27
  import { humanSeatsFor, type PackGameDefinition, roundModeFor, type Seat, type SeatTwo, seatTwoFor } from '../types'
28
28
 
29
29
  // The player-panel area: whenever the window changes shape (a tablet turning, a browser window
@@ -183,7 +183,10 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
183
183
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
184
184
  // Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
185
185
  // opponent button, centered under both.
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(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
186
+ // Each seat button names its seat (Jay, 2026-11-25, as the stats screen's PLAYER and GAME pills): PLAYER with
187
+ // one person, PLAYER 1 and PLAYER 2 in 2 Player's halves, and OPPONENT over player 1's opponent button.
188
+ const p1Caption = p2IsHuman ? 'Player 1' : 'Player'
189
+ const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' caption={p1Caption} 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} />
187
190
  // Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
188
191
  // seat 1's button stands alone.
189
192
  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} />
@@ -234,7 +237,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
234
237
  // A person in seat 2: their own seat button (Player 2 or a profile, never the CPU), controls and
235
238
  // Ready, in their half.
236
239
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : undefined
237
- const p2Panel = p2IsHuman && <PlayerSetupPanel key='p2-zones' idPrefix='p2' host={p2Host} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} colorCaption={pack.colorCaption} isHuman ready={ready[2]} onToggleReady={() => setReady((r) => ({ ...r, 2: !r[2] }))} dark={dark} secondPicker={p2Control} secondPickerId={p2Control ? P2_CONTROL_ID : undefined} profiles={profiles} selectedProfileId={lastSelected[2]} takenProfileId={lastSelected[1]} guestLabel={pack.guestLabel ?? 'P2'} nullLabel={pack.nullLabel} onProfileSelect={handleP2ProfileSelect} previewValue={seatPreview} triggerStyle={triggerStyle} readySurfaceColor={readySurface} />
240
+ const p2Panel = p2IsHuman && <PlayerSetupPanel key='p2-zones' idPrefix='p2' caption='Player 2' host={p2Host} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} colorCaption={pack.colorCaption} isHuman ready={ready[2]} onToggleReady={() => setReady((r) => ({ ...r, 2: !r[2] }))} dark={dark} secondPicker={p2Control} secondPickerId={p2Control ? P2_CONTROL_ID : undefined} profiles={profiles} selectedProfileId={lastSelected[2]} takenProfileId={lastSelected[1]} guestLabel={pack.guestLabel ?? 'P2'} nullLabel={pack.nullLabel} onProfileSelect={handleP2ProfileSelect} previewValue={seatPreview} triggerStyle={triggerStyle} readySurfaceColor={readySurface} />
238
241
 
239
242
  return (
240
243
  <View style={[styles.container, { backgroundColor: bg }]}>
@@ -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): @tastic/profile's roster. A profile opens
15
- // its own Edit Profile screen, the pack's profile/[id] route (EditProfileRoute), where profiles are
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
  }