@tastic/shell 0.8.2 → 0.8.3
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 +1 -1
- package/dist/index.js +159 -149
- package/dist/index.mjs +119 -109
- package/package.json +2 -2
- package/src/RootLayout.tsx +38 -35
- package/src/components/WindowControlsInsets.tsx +19 -0
package/dist/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import { ProfileColorProvider } from "@tastic/profile";
|
|
|
31
31
|
import * as Haptics from "expo-haptics";
|
|
32
32
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from "expo-router";
|
|
33
33
|
import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
34
|
-
import { Platform as
|
|
34
|
+
import { Platform as Platform3, StyleSheet, View } from "react-native";
|
|
35
35
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
36
36
|
import * as RNPaper2 from "react-native-paper";
|
|
37
37
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
@@ -232,6 +232,16 @@ function UpdateDialog() {
|
|
|
232
232
|
return /* @__PURE__ */ jsx6(SharedUpdateDialog, { onError });
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
// src/components/WindowControlsInsets.tsx
|
|
236
|
+
import { Platform as Platform2 } from "react-native";
|
|
237
|
+
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
238
|
+
import { Fragment as Fragment3, jsx as jsx7 } from "react/jsx-runtime";
|
|
239
|
+
function WindowControlsInsets({ children }) {
|
|
240
|
+
const vertical = useSafeAreaInsets({ cornerAdaptation: "vertical" });
|
|
241
|
+
if (Platform2.OS !== "ios" || !Platform2.isPad) return /* @__PURE__ */ jsx7(Fragment3, { children });
|
|
242
|
+
return /* @__PURE__ */ jsx7(SafeAreaInsetsContext.Provider, { value: vertical, children });
|
|
243
|
+
}
|
|
244
|
+
|
|
235
245
|
// src/hooks/useLastActiveGame.tsx
|
|
236
246
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
237
247
|
import { useDispatch as useDispatch4, useStore as useStore2 } from "react-redux";
|
|
@@ -243,7 +253,7 @@ var lastActiveGameActions = actions;
|
|
|
243
253
|
var lastActiveGameSlice_default = reducer;
|
|
244
254
|
|
|
245
255
|
// src/hooks/useLastActiveGame.tsx
|
|
246
|
-
import { jsx as
|
|
256
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
247
257
|
var LastActiveGameContext = createContext3(null);
|
|
248
258
|
function LastActiveGameProvider({ children }) {
|
|
249
259
|
const store = useStore2();
|
|
@@ -276,7 +286,7 @@ function LastActiveGameProvider({ children }) {
|
|
|
276
286
|
}),
|
|
277
287
|
[dispatch]
|
|
278
288
|
);
|
|
279
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ jsx8(LastActiveGameContext.Provider, { value, children });
|
|
280
290
|
}
|
|
281
291
|
function useLastActiveGame() {
|
|
282
292
|
const ctx = useContext3(LastActiveGameContext);
|
|
@@ -297,7 +307,7 @@ var profileSelectionActions = actions2;
|
|
|
297
307
|
var profileSelectionSlice_default = reducer2;
|
|
298
308
|
|
|
299
309
|
// src/hooks/useProfiles.tsx
|
|
300
|
-
import { jsx as
|
|
310
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
301
311
|
var SHARED_GROUP_ID = "group.com.infinitetoken.tastic";
|
|
302
312
|
var ProfilesContext = createContext4(null);
|
|
303
313
|
function ProfilesProvider({ children }) {
|
|
@@ -357,7 +367,7 @@ function ProfilesProvider({ children }) {
|
|
|
357
367
|
},
|
|
358
368
|
[dispatch]
|
|
359
369
|
);
|
|
360
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ jsx9(ProfilesContext.Provider, { value: { profiles, lastSelected, loaded, createProfile, updateProfile, deleteProfile, selectProfile }, children });
|
|
361
371
|
}
|
|
362
372
|
function useProfiles() {
|
|
363
373
|
const ctx = useContext4(ProfilesContext);
|
|
@@ -366,7 +376,7 @@ function useProfiles() {
|
|
|
366
376
|
}
|
|
367
377
|
|
|
368
378
|
// src/RootLayout.tsx
|
|
369
|
-
import { Fragment as
|
|
379
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
370
380
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
371
381
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
372
382
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
@@ -379,7 +389,7 @@ function AppStack() {
|
|
|
379
389
|
const rootBackground = useThemedRootBackground(darkRoot, false);
|
|
380
390
|
const statusBarStyle = darkRoot ? "light" : "dark";
|
|
381
391
|
const packOptions = (pack.useScreenOptions ?? noScreenOptions)();
|
|
382
|
-
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation:
|
|
392
|
+
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation: Platform3.select({ android: "fade" }) } : void 0;
|
|
383
393
|
const playOptions = useCallback5(
|
|
384
394
|
({ route }) => {
|
|
385
395
|
const id = route.params?.game;
|
|
@@ -392,54 +402,54 @@ function AppStack() {
|
|
|
392
402
|
const base = darkRoot ? DarkTheme : DefaultTheme;
|
|
393
403
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
394
404
|
}, [darkRoot, navigationBackground]);
|
|
395
|
-
const stack = /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
405
|
+
const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
|
|
406
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "index" }),
|
|
407
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
398
408
|
] }) });
|
|
399
409
|
if (!Backdrop) return stack;
|
|
400
410
|
return /* @__PURE__ */ jsxs2(View, { style: styles.root, children: [
|
|
401
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ jsx10(Backdrop, {}),
|
|
402
412
|
stack
|
|
403
413
|
] });
|
|
404
414
|
}
|
|
405
415
|
function GatedApp({ children }) {
|
|
406
416
|
const { loaded } = useProfiles();
|
|
407
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsx10(SplashGate, { gate: "profiles", ready: loaded, children });
|
|
408
418
|
}
|
|
409
419
|
function HapticGatedToastProvider({ children }) {
|
|
410
420
|
const { settings } = useHapticSettings();
|
|
411
421
|
const { Toaster: PackToasterComponent } = usePack();
|
|
412
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsx10(ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
413
423
|
}
|
|
414
424
|
function RotatingToaster() {
|
|
415
425
|
const renderFrame = useCallback5(
|
|
416
|
-
(toasts) => /* @__PURE__ */
|
|
426
|
+
(toasts) => /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: toasts }),
|
|
417
427
|
[]
|
|
418
428
|
);
|
|
419
|
-
return /* @__PURE__ */
|
|
429
|
+
return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
|
|
420
430
|
}
|
|
421
431
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
422
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx10(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: /* @__PURE__ */ jsx10(PackToasterComponent, {}) }) });
|
|
423
433
|
}
|
|
424
434
|
function GameProviders({ games, children }) {
|
|
425
|
-
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */
|
|
435
|
+
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ jsx10(game.Provider, { children: inner }, game.id) : inner, children);
|
|
426
436
|
}
|
|
427
437
|
function PreviewColors({ previewColor, children }) {
|
|
428
438
|
const { dark } = useAutoPaperTheme();
|
|
429
439
|
const preview = useCallback5((hex) => previewColor(hex, dark), [previewColor, dark]);
|
|
430
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ jsx10(ProfileColorProvider, { preview, children });
|
|
431
441
|
}
|
|
432
442
|
function PackRoot({ pack, children }) {
|
|
433
443
|
const { Provider, previewColor } = pack;
|
|
434
|
-
const inner = Provider ? /* @__PURE__ */
|
|
435
|
-
return previewColor ? /* @__PURE__ */
|
|
444
|
+
const inner = Provider ? /* @__PURE__ */ jsx10(Provider, { children }) : children;
|
|
445
|
+
return previewColor ? /* @__PURE__ */ jsx10(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ jsx10(Fragment4, { children: inner });
|
|
436
446
|
}
|
|
437
447
|
function RootLayout({ pack, store, persistor }) {
|
|
438
|
-
return /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
pack.Toaster ? /* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
] }) }) }) }) }) }) }) }) }) }) }) });
|
|
448
|
+
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
449
|
+
/* @__PURE__ */ jsx10(GuideHost, { children: /* @__PURE__ */ jsx10(AppStack, {}) }),
|
|
450
|
+
pack.Toaster ? /* @__PURE__ */ jsx10(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ jsx10(RotatingToaster, {}),
|
|
451
|
+
/* @__PURE__ */ jsx10(UpdateDialog, {})
|
|
452
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
443
453
|
}
|
|
444
454
|
var styles = StyleSheet.create({
|
|
445
455
|
root: { flex: 1 }
|
|
@@ -466,7 +476,7 @@ import { router as router2, useFocusEffect as useFocusEffect2 } from "expo-route
|
|
|
466
476
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
467
477
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
468
478
|
import Animated from "react-native-reanimated";
|
|
469
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
479
|
+
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
470
480
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
471
481
|
|
|
472
482
|
// src/components/OpponentPicker.tsx
|
|
@@ -474,7 +484,7 @@ import { useZoneClampedAlign } from "@tastic/hud/lobby";
|
|
|
474
484
|
import { getOptionPickerContentSize, OptionPicker } from "@tastic/profile";
|
|
475
485
|
import { useMemo as useMemo4 } from "react";
|
|
476
486
|
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
477
|
-
import { jsx as
|
|
487
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
478
488
|
var CPU_PREFIX = "cpu:";
|
|
479
489
|
var NOBODY = "nobody";
|
|
480
490
|
var PERSON = "person";
|
|
@@ -509,7 +519,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
509
519
|
const size = getOptionPickerContentSize(options, colorSection);
|
|
510
520
|
const useAlign = usePickerAlign ?? useZoneClampedAlign;
|
|
511
521
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
512
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsx11(View2, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ jsx11(OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
|
|
513
523
|
}
|
|
514
524
|
var styles2 = StyleSheet2.create({
|
|
515
525
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
@@ -557,7 +567,7 @@ function useAppSettings() {
|
|
|
557
567
|
}
|
|
558
568
|
|
|
559
569
|
// src/components/SettingsDialog.tsx
|
|
560
|
-
import { jsx as
|
|
570
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
561
571
|
var noSettingsRules = () => null;
|
|
562
572
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
563
573
|
const onUpdateError = useUpdateErrorToast2();
|
|
@@ -567,16 +577,16 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
|
567
577
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
568
578
|
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
569
579
|
children,
|
|
570
|
-
SettingsSections && /* @__PURE__ */
|
|
580
|
+
SettingsSections && /* @__PURE__ */ jsx12(SettingsSections, {})
|
|
571
581
|
] });
|
|
572
582
|
}
|
|
573
583
|
|
|
574
584
|
// src/hooks/useAtComputer.ts
|
|
575
585
|
import { useIsTouchPrimaryDevice as useIsTouchPrimaryDevice2 } from "@tastic/core";
|
|
576
|
-
import { Platform as
|
|
586
|
+
import { Platform as Platform4 } from "react-native";
|
|
577
587
|
function useAtComputer() {
|
|
578
588
|
const touchPrimary = useIsTouchPrimaryDevice2();
|
|
579
|
-
return
|
|
589
|
+
return Platform4.OS === "web" && !touchPrimary;
|
|
580
590
|
}
|
|
581
591
|
|
|
582
592
|
// src/hooks/useOpponent.ts
|
|
@@ -732,7 +742,7 @@ var liveplayActions = actions5;
|
|
|
732
742
|
var liveplaySlice_default = reducer5;
|
|
733
743
|
|
|
734
744
|
// src/screens/LoadoutScreen.tsx
|
|
735
|
-
import { jsx as
|
|
745
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
736
746
|
var PANEL_SWAP_FADE_MS = 180;
|
|
737
747
|
var P1_CONTROL_ID = "p1-control";
|
|
738
748
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -754,7 +764,7 @@ function LoadoutScreen({ game }) {
|
|
|
754
764
|
const { panelLayout, panelFadeStyle } = useDualZoneLayout(panelMode, false, true, false, PANEL_SWAP_FADE_MS);
|
|
755
765
|
const playersRowFade = panelFadeStyle;
|
|
756
766
|
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
757
|
-
const insets =
|
|
767
|
+
const insets = useSafeAreaInsets2();
|
|
758
768
|
const { colors: themeColors, dark } = useAutoPaperTheme3();
|
|
759
769
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
760
770
|
const dispatch = useDispatch9();
|
|
@@ -811,11 +821,11 @@ function LoadoutScreen({ game }) {
|
|
|
811
821
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
812
822
|
});
|
|
813
823
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
814
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */
|
|
824
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx13(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
815
825
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
816
826
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
817
|
-
const p1Panel = /* @__PURE__ */
|
|
818
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */
|
|
827
|
+
const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
828
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
819
829
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
820
830
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
821
831
|
/* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
@@ -823,18 +833,18 @@ function LoadoutScreen({ game }) {
|
|
|
823
833
|
p1Panel,
|
|
824
834
|
opponentPicker
|
|
825
835
|
] }),
|
|
826
|
-
p1Control && /* @__PURE__ */
|
|
836
|
+
p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
827
837
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
829
839
|
] });
|
|
830
840
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
831
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */
|
|
841
|
+
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
832
842
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
833
843
|
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
p2ZoneStyle && /* @__PURE__ */
|
|
836
|
-
!showMetaInSharedBand && /* @__PURE__ */
|
|
837
|
-
p2IsHuman ? /* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
845
|
+
p2ZoneStyle && /* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
846
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx13(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
847
|
+
p2IsHuman ? /* @__PURE__ */ jsx13(
|
|
838
848
|
DualZoneLayout,
|
|
839
849
|
{
|
|
840
850
|
panelLayout,
|
|
@@ -851,7 +861,7 @@ function LoadoutScreen({ game }) {
|
|
|
851
861
|
seatOne
|
|
852
862
|
] })
|
|
853
863
|
] }),
|
|
854
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx13(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
|
|
855
865
|
] });
|
|
856
866
|
}
|
|
857
867
|
function halfOf(color) {
|
|
@@ -932,13 +942,13 @@ var styles3 = StyleSheet3.create({
|
|
|
932
942
|
});
|
|
933
943
|
|
|
934
944
|
// src/screens/GameRoute.tsx
|
|
935
|
-
import { jsx as
|
|
945
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
936
946
|
function LoadoutRoute() {
|
|
937
947
|
const { game: id } = useLocalSearchParams();
|
|
938
948
|
const game = usePackGame(id);
|
|
939
|
-
if (!game) return /* @__PURE__ */
|
|
940
|
-
if (!hasLoadout(game)) return /* @__PURE__ */
|
|
941
|
-
return /* @__PURE__ */
|
|
949
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
950
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ jsx14(Redirect, { href: playHref(game.id) });
|
|
951
|
+
return /* @__PURE__ */ jsx14(LoadoutScreen, { game }, game.id);
|
|
942
952
|
}
|
|
943
953
|
function hasLoadout(game) {
|
|
944
954
|
return !!game.useLoadout;
|
|
@@ -947,9 +957,9 @@ function PlayRoute() {
|
|
|
947
957
|
const { game: id } = useLocalSearchParams();
|
|
948
958
|
const game = usePackGame(id);
|
|
949
959
|
useResumePoint(game?.resumable ? game.id : null);
|
|
950
|
-
if (!game) return /* @__PURE__ */
|
|
960
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
951
961
|
const { PlayScreen } = game;
|
|
952
|
-
return /* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ jsx14(PlayScreen, {}, game.id);
|
|
953
963
|
}
|
|
954
964
|
function useResumePoint(gameId) {
|
|
955
965
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
@@ -995,7 +1005,7 @@ function useFrozenWhileHidden(value, hidden) {
|
|
|
995
1005
|
// src/screens/homeLayout.ts
|
|
996
1006
|
import { clamp } from "@tastic/core";
|
|
997
1007
|
import { useWindowDimensions } from "react-native";
|
|
998
|
-
import { useSafeAreaInsets as
|
|
1008
|
+
import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
|
|
999
1009
|
var PREVIEW_ASPECT = 360 / 200;
|
|
1000
1010
|
var ROW_PREVIEW_WIDTH = 92;
|
|
1001
1011
|
var HOME_WIDE_EDGE_PADDING = 16;
|
|
@@ -1049,12 +1059,12 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1049
1059
|
}
|
|
1050
1060
|
function useHomeLayout() {
|
|
1051
1061
|
const { width, height } = useWindowDimensions();
|
|
1052
|
-
const insets =
|
|
1062
|
+
const insets = useSafeAreaInsets3();
|
|
1053
1063
|
return computeHomeLayout(width, height, insets);
|
|
1054
1064
|
}
|
|
1055
1065
|
|
|
1056
1066
|
// src/screens/HomeScreen.tsx
|
|
1057
|
-
import { Fragment as
|
|
1067
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1058
1068
|
function HomeScreen() {
|
|
1059
1069
|
const pack = usePack();
|
|
1060
1070
|
const { consumeResumeGame } = useLastActiveGame();
|
|
@@ -1066,8 +1076,8 @@ function HomeScreen() {
|
|
|
1066
1076
|
useEffect6(() => {
|
|
1067
1077
|
if (!resumeGame) autoShowPack();
|
|
1068
1078
|
}, [resumeGame, autoShowPack]);
|
|
1069
|
-
if (resumeGame) return /* @__PURE__ */
|
|
1070
|
-
return /* @__PURE__ */
|
|
1079
|
+
if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: playHref(resumeGame.id) });
|
|
1080
|
+
return /* @__PURE__ */ jsx15(HomeMenu, {});
|
|
1071
1081
|
}
|
|
1072
1082
|
function HomeMenu() {
|
|
1073
1083
|
const pack = usePack();
|
|
@@ -1110,7 +1120,7 @@ function HomeMenu() {
|
|
|
1110
1120
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1111
1121
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1112
1122
|
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1113
|
-
const tabBar = tab && /* @__PURE__ */
|
|
1123
|
+
const tabBar = tab && /* @__PURE__ */ jsx15(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1114
1124
|
const columnClamp = useClampOnShrink();
|
|
1115
1125
|
const gridClamp = useClampOnShrink();
|
|
1116
1126
|
const openGame = useCallback10((game) => openFirstTime(game.id, () => router3.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1119,33 +1129,33 @@ function HomeMenu() {
|
|
|
1119
1129
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1120
1130
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
|
|
1121
1131
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1122
|
-
const picker = /* @__PURE__ */
|
|
1123
|
-
const pressAway = /* @__PURE__ */
|
|
1132
|
+
const picker = /* @__PURE__ */ jsx15(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: () => router3.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1133
|
+
const pressAway = /* @__PURE__ */ jsx15(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1124
1134
|
const RulesSheet = rulesGame?.Rules;
|
|
1125
1135
|
return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
isWide ? /* @__PURE__ */ jsxs5(
|
|
1136
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.frame, children: /* @__PURE__ */ jsxs5(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1137
|
+
isWide ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1128
1138
|
pressAway,
|
|
1129
1139
|
/* @__PURE__ */ jsxs5(FadingScrollView, { ...tab && gridClamp, style: [styles4.wideRightPane, { left: layout.paddingLeft + layout.leftPaneWidth + HOME_WIDE_PANE_GAP }], contentContainerStyle: { paddingTop: 16 + insets.top, paddingBottom: 16 + insets.bottom, paddingRight: layout.paddingRight }, children: [
|
|
1130
|
-
tabBar && /* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1140
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1141
|
+
/* @__PURE__ */ jsx15(View4, { style: [styles4.grid, { width: layout.rightPaneWidth }], children: pack.games.map((game) => /* @__PURE__ */ jsx15(GameTile, { game, hidden: isHidden(tab, game), width: layout.tileWidth, previewWidth: layout.previewWidth, previewRevealed: previewsRevealed, dark, p1Color, p2Color, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1132
1142
|
] }),
|
|
1133
1143
|
/* @__PURE__ */ jsxs5(View4, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1145
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
|
|
1136
1146
|
] })
|
|
1137
1147
|
] }) : /* @__PURE__ */ jsxs5(FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
|
|
1138
1148
|
pressAway,
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
tabBar && /* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1150
|
+
/* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1151
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: styles4.listWidth, children: tabBar }),
|
|
1152
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx15(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1143
1153
|
] }),
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
RulesSheet && /* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ jsx15(IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => router3.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
|
|
1155
|
+
/* @__PURE__ */ jsx15(IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
|
|
1156
|
+
RulesSheet && /* @__PURE__ */ jsx15(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1147
1157
|
] }) }),
|
|
1148
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
|
|
1149
1159
|
] });
|
|
1150
1160
|
}
|
|
1151
1161
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1182,7 +1192,7 @@ function hasRules(game) {
|
|
|
1182
1192
|
return !!(game.Rules || game.guide);
|
|
1183
1193
|
}
|
|
1184
1194
|
function RulesHost({ enabled, children }) {
|
|
1185
|
-
return enabled ? /* @__PURE__ */
|
|
1195
|
+
return enabled ? /* @__PURE__ */ jsx15(Portal.Host, { children }) : /* @__PURE__ */ jsx15(Fragment5, { children });
|
|
1186
1196
|
}
|
|
1187
1197
|
var ROW_BLURB_LINES = 3;
|
|
1188
1198
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1193,13 +1203,13 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1193
1203
|
// inside a button is invalid on the web.
|
|
1194
1204
|
/* @__PURE__ */ jsxs5(View4, { style: hidden ? styles4.hidden : void 0, children: [
|
|
1195
1205
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1196
|
-
game.Preview ? /* @__PURE__ */
|
|
1206
|
+
game.Preview ? /* @__PURE__ */ jsx15(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx15(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx15(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1197
1207
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1209
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1200
1210
|
] })
|
|
1201
1211
|
] }),
|
|
1202
|
-
onRules && /* @__PURE__ */
|
|
1212
|
+
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1203
1213
|
] })
|
|
1204
1214
|
);
|
|
1205
1215
|
}
|
|
@@ -1207,18 +1217,18 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1207
1217
|
const well = useWellColors();
|
|
1208
1218
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1209
1219
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1210
|
-
/* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1221
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1222
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1213
1223
|
] }),
|
|
1214
|
-
onRules && /* @__PURE__ */
|
|
1224
|
+
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1215
1225
|
] });
|
|
1216
1226
|
}
|
|
1217
1227
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
1218
1228
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1219
1229
|
const { Preview, icon: GameIcon } = game;
|
|
1220
1230
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1221
|
-
return /* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ jsx15(View4, { style: [styles4.preview, { width, height, backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: Preview ? revealed && /* @__PURE__ */ jsx15(Preview, { width, height, p1Color, p2Color, dark }) : GameIcon && /* @__PURE__ */ jsx15(View4, { style: [styles4.previewIcon, { width: iconSize, height: iconSize, borderRadius: iconSize * 0.22 }], children: /* @__PURE__ */ jsx15(GameIcon, { size: iconSize, p1Color, p2Color, dark }) }) });
|
|
1222
1232
|
}
|
|
1223
1233
|
var ROW_ICON_SIZE = 56;
|
|
1224
1234
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
@@ -1371,7 +1381,7 @@ var styles4 = StyleSheet4.create({
|
|
|
1371
1381
|
import { defaultColors as defaultColors3 } from "@rific/auto-paper";
|
|
1372
1382
|
import { RotatedFrame as RotatedFrame2 } from "@tastic/hud/chrome";
|
|
1373
1383
|
import { ProfilesScreen } from "@tastic/profile";
|
|
1374
|
-
import { jsx as
|
|
1384
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1375
1385
|
var ROSTER_MAX_WIDTH = 640;
|
|
1376
1386
|
function useRosterAlign(open, contentWidth, contentHeight) {
|
|
1377
1387
|
const { usePickerAlign } = usePack();
|
|
@@ -1380,7 +1390,7 @@ function useRosterAlign(open, contentWidth, contentHeight) {
|
|
|
1380
1390
|
function ProfilesRoute() {
|
|
1381
1391
|
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1382
1392
|
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1383
|
-
return /* @__PURE__ */
|
|
1393
|
+
return /* @__PURE__ */ jsx16(RotatedFrame2, { rotatedSafeArea: true, portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx16(ProfilesScreen, { profiles, defaultColor: newProfileColor ?? defaultColors3[0].value, onCreate: (patch) => createProfile(patch), onSave: (id, patch) => updateProfile(id, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, useColorPickerAlign: usePickerAlign ? useRosterAlign : void 0 }) });
|
|
1384
1394
|
}
|
|
1385
1395
|
|
|
1386
1396
|
// src/screens/StatsScreen.tsx
|
|
@@ -1390,9 +1400,9 @@ import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker
|
|
|
1390
1400
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1391
1401
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1392
1402
|
import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
|
|
1393
|
-
import { useSafeAreaInsets as
|
|
1403
|
+
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1394
1404
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1395
|
-
import { jsx as
|
|
1405
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1396
1406
|
var STATS = "stats";
|
|
1397
1407
|
var ACHIEVEMENTS = "achievements";
|
|
1398
1408
|
var TABS = [
|
|
@@ -1408,17 +1418,17 @@ var GAME_PICKER_ID = "stats-game";
|
|
|
1408
1418
|
var STATS_MAX_WIDTH = 640;
|
|
1409
1419
|
function StatsScreen() {
|
|
1410
1420
|
const pickerHost = usePopoverHost3();
|
|
1411
|
-
return /* @__PURE__ */
|
|
1421
|
+
return /* @__PURE__ */ jsx17(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx17(RotatedFrame3, { rotatedSafeArea: true, portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx17(StatsContent, { pickerHost }) }) });
|
|
1412
1422
|
}
|
|
1413
1423
|
function StatsPressAway({ host, children }) {
|
|
1414
|
-
return /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsx17(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1415
1425
|
}
|
|
1416
1426
|
var useNoPackReset = () => null;
|
|
1417
1427
|
var noPickerAlign2 = () => void 0;
|
|
1418
1428
|
function StatsContent({ pickerHost }) {
|
|
1419
1429
|
const pack = usePack();
|
|
1420
1430
|
const { dark, colors } = useAutoPaperTheme5();
|
|
1421
|
-
const insets =
|
|
1431
|
+
const insets = useSafeAreaInsets4();
|
|
1422
1432
|
const { profiles, lastSelected } = useProfiles();
|
|
1423
1433
|
const dispatch = useDispatch10();
|
|
1424
1434
|
const fg = pack.foreground ?? colors.onBackground;
|
|
@@ -1446,15 +1456,15 @@ function StatsContent({ pickerHost }) {
|
|
|
1446
1456
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1447
1457
|
const PackTabContent = packTab?.Content;
|
|
1448
1458
|
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, rotation: 0, children: [
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1459
|
+
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1460
|
+
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1451
1461
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1452
|
-
profiles.length > 0 && /* @__PURE__ */
|
|
1453
|
-
showGamePicker && /* @__PURE__ */
|
|
1462
|
+
profiles.length > 0 && /* @__PURE__ */ jsx17(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1463
|
+
showGamePicker && /* @__PURE__ */ jsx17(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1454
1464
|
] }),
|
|
1455
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */
|
|
1456
|
-
PackTabContent && /* @__PURE__ */
|
|
1457
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */
|
|
1465
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx17(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1466
|
+
PackTabContent && /* @__PURE__ */ jsx17(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1467
|
+
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx17(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx17(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
|
|
1458
1468
|
] });
|
|
1459
1469
|
}
|
|
1460
1470
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1470,8 +1480,8 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1470
1480
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1471
1481
|
if (!Sections) return null;
|
|
1472
1482
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1473
|
-
showTitle && /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1483
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1484
|
+
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1475
1485
|
] });
|
|
1476
1486
|
}
|
|
1477
1487
|
var styles5 = StyleSheet5.create({
|
|
@@ -1509,10 +1519,10 @@ var styles5 = StyleSheet5.create({
|
|
|
1509
1519
|
|
|
1510
1520
|
// src/components/imageGameIcon.tsx
|
|
1511
1521
|
import { Image } from "react-native";
|
|
1512
|
-
import { jsx as
|
|
1522
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1513
1523
|
function imageGameIcon(images) {
|
|
1514
1524
|
return function ImageGameIcon({ size, dark }) {
|
|
1515
|
-
return /* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ jsx18(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1516
1526
|
};
|
|
1517
1527
|
}
|
|
1518
1528
|
|
|
@@ -1522,14 +1532,14 @@ import { IconButton as IconButton2 } from "@rific/feedback-press";
|
|
|
1522
1532
|
import { useEffect as useEffect7 } from "react";
|
|
1523
1533
|
import { StyleSheet as StyleSheet6, useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
1524
1534
|
import Animated2, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
1525
|
-
import { useSafeAreaInsets as
|
|
1526
|
-
import { Fragment as
|
|
1535
|
+
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
1536
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1527
1537
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1528
1538
|
var CHIP_SIZE = 48;
|
|
1529
1539
|
var EDGE_PAD = 8;
|
|
1530
1540
|
function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
1531
1541
|
const { height } = useWindowDimensions2();
|
|
1532
|
-
const insets =
|
|
1542
|
+
const insets = useSafeAreaInsets5();
|
|
1533
1543
|
const { dark } = useAutoPaperTheme6();
|
|
1534
1544
|
const atComputer = useAtComputer();
|
|
1535
1545
|
const visible = atComputer || !playing;
|
|
@@ -1545,9 +1555,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1545
1555
|
const backSlot = { top, left: EDGE_PAD + insets.left };
|
|
1546
1556
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1547
1557
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1548
|
-
return /* @__PURE__ */ jsxs7(
|
|
1549
|
-
/* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
1559
|
+
/* @__PURE__ */ jsx19(Animated2.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ jsx19(IconButton2, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
|
|
1560
|
+
/* @__PURE__ */ jsx19(Animated2.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ jsx19(IconButton2, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
|
|
1551
1561
|
] });
|
|
1552
1562
|
}
|
|
1553
1563
|
var styles6 = StyleSheet6.create({
|
|
@@ -1699,7 +1709,7 @@ function forgetProfileAchievements(dropStats) {
|
|
|
1699
1709
|
// src/gameStats.tsx
|
|
1700
1710
|
import { createAchievementsSlice, mapUnlocksBySeat, useAchievements } from "@tastic/achievements";
|
|
1701
1711
|
import { createContext as createContext5, useCallback as useCallback11, useContext as useContext5, useMemo as useMemo8 } from "react";
|
|
1702
|
-
import { jsx as
|
|
1712
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1703
1713
|
var SEATS = [1, 2];
|
|
1704
1714
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
1705
1715
|
const { actions: actions6, reducer: sliceReducer } = createAchievementsSlice({
|
|
@@ -1732,7 +1742,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1732
1742
|
[recordOutcome]
|
|
1733
1743
|
);
|
|
1734
1744
|
const value = useMemo8(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
1735
|
-
return /* @__PURE__ */
|
|
1745
|
+
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
1736
1746
|
}
|
|
1737
1747
|
function useStats() {
|
|
1738
1748
|
const ctx = useContext5(Context);
|