@wix/himalaya-cli 0.1855.0 → 0.1856.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/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{fb500748f6c4768468f2e7f985aa67c38633077c7a98caaa6b500c7b00eea8e9.bin → c1f008be31a41521c6de7c1afad419a1f4dad53cbc2701a14738d5b22f291463.bin} +1 -1
- package/dist/browser-plane/sw.js +10 -10
- package/dist/cli.mjs +596 -309
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +2 -2
- package/guides/one-app-to-himi-app.md +1 -1
- package/package.json +2 -2
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +5 -2
- package/templates/branded-lite/l10n/ar.json +15 -10
- package/templates/branded-lite/l10n/cs.json +15 -10
- package/templates/branded-lite/l10n/da.json +15 -10
- package/templates/branded-lite/l10n/de.json +15 -10
- package/templates/branded-lite/l10n/el.json +15 -10
- package/templates/branded-lite/l10n/es.json +15 -10
- package/templates/branded-lite/l10n/fi.json +15 -10
- package/templates/branded-lite/l10n/fr.json +15 -10
- package/templates/branded-lite/l10n/he.json +12 -8
- package/templates/branded-lite/l10n/hu.json +15 -10
- package/templates/branded-lite/l10n/id.json +15 -10
- package/templates/branded-lite/l10n/it.json +15 -10
- package/templates/branded-lite/l10n/ja.json +15 -10
- package/templates/branded-lite/l10n/ko.json +15 -10
- package/templates/branded-lite/l10n/lt.json +15 -10
- package/templates/branded-lite/l10n/nl.json +15 -10
- package/templates/branded-lite/l10n/no.json +15 -10
- package/templates/branded-lite/l10n/pl.json +15 -10
- package/templates/branded-lite/l10n/pt.json +15 -10
- package/templates/branded-lite/l10n/ru.json +15 -10
- package/templates/branded-lite/l10n/sv.json +15 -10
- package/templates/branded-lite/l10n/th.json +15 -10
- package/templates/branded-lite/l10n/tr.json +15 -10
- package/templates/branded-lite/l10n/uk.json +15 -10
- package/templates/branded-lite/l10n/vi.json +15 -10
- package/templates/branded-lite/l10n/zh.json +15 -10
- package/templates/branded-lite/recipes/performance-tracker.json +464 -75
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-goal.ts +57 -0
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-section.ts +124 -49
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-weeks.ts +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// The member's own weekly session goal on a performance tracker, as pure rules over a key-value store (no @himalaya import, so a test
|
|
2
|
+
// can load this file alone). The source keeps the goal in a private fitness service that signs its calls with the site's instance, a
|
|
3
|
+
// credential a member's session cannot stand in for, so the goal is kept on this device: under the member's own key, never read for
|
|
4
|
+
// another member, and never shown to a visitor.
|
|
5
|
+
import type { MemberAccess } from "./member-access.js";
|
|
6
|
+
|
|
7
|
+
/** The source's picker offers 1 to 14 sessions a week. */
|
|
8
|
+
export const MIN_MEMBER_GOAL = 1;
|
|
9
|
+
export const MAX_MEMBER_GOAL = 14;
|
|
10
|
+
export const GOAL_CHOICES: readonly number[] = Array.from({ length: MAX_MEMBER_GOAL }, (_, i) => MIN_MEMBER_GOAL + i);
|
|
11
|
+
|
|
12
|
+
/** What the picker lists: 1 to 14, plus the goal in force when the site's default is above that (a default of 20 must show as chosen). */
|
|
13
|
+
export function goalChoices(current: number): number[] {
|
|
14
|
+
return GOAL_CHOICES.includes(current) ? [...GOAL_CHOICES] : [...GOAL_CHOICES, current];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GoalStore { getItem(key: string): string | null; setItem(key: string, value: string): void }
|
|
18
|
+
|
|
19
|
+
const KEY = "himi-performance-tracker:weekly-goal:v1";
|
|
20
|
+
|
|
21
|
+
/** A goal the picker offers (a whole number in [1, 14], or its text), else 0. */
|
|
22
|
+
export function pickableGoal(raw: unknown): number {
|
|
23
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
24
|
+
return Number.isInteger(n) && n >= MIN_MEMBER_GOAL && n <= MAX_MEMBER_GOAL ? n : 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Whose goal this is: the member's partition (account + business + email), else their email on a host that has no partition. "" = nobody. */
|
|
28
|
+
export function goalOwner(member: Pick<MemberAccess, "email" | "scope"> | undefined): string {
|
|
29
|
+
return member?.email ? member.scope || member.email : "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const keyOf = (owner: string): string => `${KEY}.${encodeURIComponent(owner)}`;
|
|
33
|
+
|
|
34
|
+
/** The goal this member set, or 0 when they have not (or the store cannot be read). */
|
|
35
|
+
export function readMemberGoal(store: GoalStore | undefined, owner: string): number {
|
|
36
|
+
if (!store || !owner) return 0;
|
|
37
|
+
try { return pickableGoal(store.getItem(keyOf(owner))); } catch { return 0; }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Whether this device can keep a goal for this member: a probe key is written and read back. A member is offered the picker only when it can. */
|
|
41
|
+
export function canKeepGoal(store: GoalStore | undefined, owner: string): boolean {
|
|
42
|
+
if (!store || !owner) return false;
|
|
43
|
+
try {
|
|
44
|
+
const key = `${keyOf(owner)}:probe`;
|
|
45
|
+
store.setItem(key, "1");
|
|
46
|
+
return store.getItem(key) === "1";
|
|
47
|
+
} catch { return false; }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Keep `goal` for this member. True only when it reads back: a host may swallow a failed write, and a save must never claim success. */
|
|
51
|
+
export function saveMemberGoal(store: GoalStore | undefined, owner: string, goal: number): boolean {
|
|
52
|
+
if (!store || !owner || !pickableGoal(goal)) return false;
|
|
53
|
+
try {
|
|
54
|
+
store.setItem(keyOf(owner), String(goal));
|
|
55
|
+
return readMemberGoal(store, owner) === goal;
|
|
56
|
+
} catch { return false; }
|
|
57
|
+
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
// A page's performance-tracker section as a registrable service: the signed-in member's progress against a weekly session goal
|
|
2
|
-
// (this week's range, "N of G sessions this week", a progress ring), their
|
|
2
|
+
// (this week's range, "N of G sessions this week", a progress ring), their weeks of meeting the goal and their sessions in total. The source
|
|
3
3
|
// reads a private fitness service; this reads the same member-scoped bookings as My Bookings (himi_bookings) and counts with the
|
|
4
4
|
// same rule as its "This week" card (`weekly-goal.ts`: a CONFIRMED booking that already took place; Wix attendance is owner-scoped,
|
|
5
5
|
// so a no-show still counts), so a guest or a refused member gets the sign-in state instead of a read.
|
|
6
|
-
// goal -> the weekly goal (the source's `defaultWeeklyGoal
|
|
6
|
+
// goal -> the default weekly goal (the source's `defaultWeeklyGoal`). A member picks their own from 1 to 14 in a sheet with a number wheel, as in
|
|
7
|
+
// the source; it is kept on this device under the member's key (`performance-tracker-goal.ts`), because the source's goal lives in a
|
|
8
|
+
// private service a member's session cannot call. A visitor keeps the default and is asked to sign in to change it,
|
|
7
9
|
// showTotal -> the all-time row (the source's `totalNumberOfSessions.show`).
|
|
8
10
|
// A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipe performance-tracker.json).
|
|
9
11
|
import { defineService } from "@himalaya/state";
|
|
10
12
|
import { hostSessionFromGlobal } from "@himalaya/iap";
|
|
11
|
-
import {
|
|
13
|
+
import { copyPlural, stashCopy } from "./himi-copy.js";
|
|
12
14
|
import { formatNumber } from "./engine-intl.js";
|
|
13
15
|
import { fetchMemberBookings } from "./member-bookings.js";
|
|
14
16
|
import { memberAccess, memberAccessDenied, memberChanged } from "./member-access.js";
|
|
15
17
|
import { parseWeeklyGoal, weeklyGoalProgress } from "./weekly-goal.js";
|
|
18
|
+
import { canKeepGoal, goalChoices, goalOwner, pickableGoal, readMemberGoal, saveMemberGoal, type GoalStore } from "./performance-tracker-goal.js";
|
|
16
19
|
import { DEFAULT_WEEKLY_GOAL, MAX_ALL_TIME_SESSIONS, MAX_PAGES, allTimeSessions, sessionsInWeek, streakMayBeLonger, weekRange, weeklyStreak } from "./performance-tracker-weeks.js";
|
|
20
|
+
import type { MemberBookingRow } from "./member-bookings.js";
|
|
17
21
|
|
|
18
22
|
export interface PerformanceTrackerOptions {
|
|
19
23
|
/** The weekly session goal. Not a goal in [1, 21]: the source's default of 2. */
|
|
@@ -22,11 +26,13 @@ export interface PerformanceTrackerOptions {
|
|
|
22
26
|
showTotal?: boolean;
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
export interface GoalOption { id: string; label: string }
|
|
30
|
+
|
|
25
31
|
export interface PerformanceTrackerState {
|
|
26
32
|
status: "loading" | "ready" | "error";
|
|
27
33
|
/** A guest, or a member Wix refused: the section asks to sign in instead of reading. */
|
|
28
34
|
signedOut: boolean;
|
|
29
|
-
/** "Nov 16
|
|
35
|
+
/** "Nov 16 - Nov 22". */
|
|
30
36
|
weekRange: string;
|
|
31
37
|
/** "1 of 2 sessions this week". */
|
|
32
38
|
goalLabel: string;
|
|
@@ -36,8 +42,15 @@ export interface PerformanceTrackerState {
|
|
|
36
42
|
progress: number;
|
|
37
43
|
/** "1/2", inside the ring. */
|
|
38
44
|
ringText: string;
|
|
45
|
+
/** The goal wheel: 1 to 14 (the numbers the wheel shows), the id of the wheel's choice, the id in force, and its label ("2 Sessions"; a visitor reads it as text). */
|
|
46
|
+
goalOptions: GoalOption[]; goalDraft: string; goalValue: string; goalSessions: string;
|
|
47
|
+
/** The goal sheet is open. */
|
|
48
|
+
goalOpen: boolean;
|
|
49
|
+
/** The device cannot keep a goal (or just failed to): the goal row is plain text, with no sheet to open. */
|
|
50
|
+
goalLocked: boolean; goalUnlocked: boolean;
|
|
51
|
+
/** "Weeks of meeting my goal": the count, then its label ("Week of..." for one). */
|
|
39
52
|
streak: string; streakLabel: string;
|
|
40
|
-
/** "500+" past the source's cap. */
|
|
53
|
+
/** "500+" past the source's cap, then "Sessions attended in total". */
|
|
41
54
|
total: string; totalLabel: string;
|
|
42
55
|
notLoading: boolean; notErrored: boolean; notSignedOut: boolean;
|
|
43
56
|
/** Nothing to show yet: loading, failed or signed out. */
|
|
@@ -47,70 +60,132 @@ export interface PerformanceTrackerState {
|
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
export function registerPerformanceTrackerSection(serviceName: string, options: PerformanceTrackerOptions = {}) {
|
|
50
|
-
const
|
|
63
|
+
const defaultGoal = parseWeeklyGoal(options.goal) || DEFAULT_WEEKLY_GOAL;
|
|
51
64
|
const showTotal = options.showTotal !== false;
|
|
52
|
-
const
|
|
65
|
+
const sessionsLabel = (n: number): string => copyPlural("performanceTracker.goalSessions", "{n, plural, one {# Session} other {# Sessions}}", n);
|
|
66
|
+
const weeksLabel = (n: number): string => copyPlural("performanceTracker.weeksMeetingGoal", "{n, plural, one {Week of meeting my goal} other {Weeks of meeting my goal}}", n);
|
|
67
|
+
const attendedLabel = (n: number): string => copyPlural("performanceTracker.sessionsAttended", "{n, plural, one {Session attended in total} other {Sessions attended in total}}", n);
|
|
68
|
+
const blank = {
|
|
69
|
+
goalLabel: "", remainingLabel: "", progress: 0, ringText: "", streak: "", total: "",
|
|
70
|
+
goalOptions: [] as GoalOption[], goalDraft: "", goalValue: "", goalSessions: "", goalOpen: false, goalLocked: false, goalUnlocked: true,
|
|
71
|
+
streakLabel: "", totalLabel: "",
|
|
72
|
+
};
|
|
53
73
|
const view = (status: PerformanceTrackerState["status"], signedOut: boolean, fields: Partial<typeof blank> = {}, now?: number): PerformanceTrackerState => {
|
|
54
74
|
const noContent = !(status === "ready" && !signedOut);
|
|
55
75
|
return {
|
|
56
76
|
// No clock read at registration (a worker boots deterministically): the range is set by the load.
|
|
57
77
|
status, signedOut, weekRange: now === undefined ? "" : weekRange(now), ...blank, ...fields,
|
|
58
|
-
streakLabel: copyParam("performanceTracker.weekStreak", "Week streak"),
|
|
59
|
-
totalLabel: copyParam("performanceTracker.allTimeSessions", "All-time sessions"),
|
|
60
78
|
notLoading: status !== "loading", notErrored: status !== "error", notSignedOut: !signedOut,
|
|
61
79
|
noContent, noTotal: noContent || !showTotal,
|
|
62
80
|
};
|
|
63
81
|
};
|
|
64
82
|
const session = hostSessionFromGlobal();
|
|
83
|
+
const goalStore = (): GoalStore | undefined => {
|
|
84
|
+
const host = globalThis as { himalaya?: { storage?: GoalStore }; localStorage?: GoalStore };
|
|
85
|
+
try { return host.himalaya?.storage ?? host.localStorage; } catch { return undefined; }
|
|
86
|
+
};
|
|
87
|
+
// What the last read found, so choosing a goal repaints this week's numbers without reading the bookings again.
|
|
88
|
+
let found: { rows: MemberBookingRow[]; now: number; unreadRemain: boolean; owner: string; locked: boolean } | undefined;
|
|
89
|
+
const ready = (read: NonNullable<typeof found>, goal: number): PerformanceTrackerState => {
|
|
90
|
+
const { rows, now, unreadRemain } = read;
|
|
91
|
+
const progress = weeklyGoalProgress(sessionsInWeek(rows, now, 0), goal);
|
|
92
|
+
const total = allTimeSessions(rows, now);
|
|
93
|
+
const streak = weeklyStreak(rows, now, goal);
|
|
94
|
+
return view("ready", false, {
|
|
95
|
+
goalLabel: progress.label, remainingLabel: progress.remainingLabel, progress: progress.fraction,
|
|
96
|
+
ringText: `${formatNumber(progress.done)}/${formatNumber(progress.goal)}`,
|
|
97
|
+
goalOptions: goalChoices(progress.goal).map((n) => ({ id: String(n), label: formatNumber(n) })),
|
|
98
|
+
goalDraft: String(progress.goal), goalValue: String(progress.goal), goalSessions: sessionsLabel(progress.goal),
|
|
99
|
+
goalLocked: read.locked, goalUnlocked: !read.locked,
|
|
100
|
+
streak: `${formatNumber(streak)}${streakMayBeLonger(rows, now, goal, streak, unreadRemain) ? "+" : ""}`, streakLabel: weeksLabel(streak),
|
|
101
|
+
total: total > MAX_ALL_TIME_SESSIONS ? `${formatNumber(MAX_ALL_TIME_SESSIONS)}+` : `${formatNumber(total)}${unreadRemain ? "+" : ""}`,
|
|
102
|
+
totalLabel: attendedLabel(Math.min(total, MAX_ALL_TIME_SESSIONS)),
|
|
103
|
+
}, now);
|
|
104
|
+
};
|
|
105
|
+
// A guest, or a member Wix refused, keeps the default goal and is asked to sign in to change it.
|
|
106
|
+
const signedOut = () => view("ready", true, { goalSessions: sessionsLabel(defaultGoal) });
|
|
65
107
|
// Only the newest load may answer: a guest read that finishes after the member signed in must not overwrite the member's progress.
|
|
66
108
|
let sequence = 0;
|
|
67
109
|
const initial = view("loading", false);
|
|
68
110
|
// The member changed: the progress already published is the previous member's, so it goes at once.
|
|
69
111
|
const restart = () => { void service.clear(); void service.load(); };
|
|
70
|
-
|
|
112
|
+
type State = PerformanceTrackerState;
|
|
113
|
+
const load = async (_state: State, arg?: unknown): Promise<State | undefined> => {
|
|
114
|
+
stashCopy(arg);
|
|
115
|
+
const seq = ++sequence;
|
|
116
|
+
let member: Awaited<ReturnType<typeof memberAccess>> | undefined;
|
|
117
|
+
try {
|
|
118
|
+
member = await memberAccess();
|
|
119
|
+
if (seq !== sequence) return undefined;
|
|
120
|
+
if (!member.email) return signedOut();
|
|
121
|
+
const now = Date.now();
|
|
122
|
+
const nowIso = new Date(now).toISOString();
|
|
123
|
+
const read = (cursor: string) => fetchMemberBookings({ query: "", filter: "value:Past", sort: "za", savedIds: [] }, cursor, nowIso, member);
|
|
124
|
+
let page = await read("");
|
|
125
|
+
const rows = [...page.items];
|
|
126
|
+
for (let pages = 1; pages < MAX_PAGES && page.nextCursor; pages++) { page = await read(page.nextCursor); rows.push(...page.items); }
|
|
127
|
+
// Older bookings the page cap left unread: the streak and the all-time total are then "at least", never a silent shortfall.
|
|
128
|
+
const unreadRemain = Boolean(page.nextCursor);
|
|
129
|
+
if (seq !== sequence) return undefined;
|
|
130
|
+
const owner = goalOwner(member);
|
|
131
|
+
found = { rows, now, unreadRemain, owner, locked: !canKeepGoal(goalStore(), owner) };
|
|
132
|
+
return ready(found, readMemberGoal(goalStore(), owner) || defaultGoal);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (seq !== sequence) return undefined;
|
|
135
|
+
// The member signed out (or changed) while the read was out: read again for whoever is signed in now.
|
|
136
|
+
const changed = await memberChanged(member, error);
|
|
137
|
+
// A newer load may have answered while that check was out: restarting then would blank its card and read the bookings again.
|
|
138
|
+
if (seq !== sequence) return undefined;
|
|
139
|
+
if (changed) { restart(); return undefined; }
|
|
140
|
+
// Wix refusing the member is a sign-in state, as on My Bookings; anything else is a failed read.
|
|
141
|
+
if (memberAccessDenied(error)) return signedOut();
|
|
142
|
+
console.warn("performance_tracker_section: the bookings could not be read", error);
|
|
143
|
+
return view("error", false);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const service = defineService<State, {
|
|
147
|
+
load: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
148
|
+
refresh: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
149
|
+
openGoal: (state: State) => State;
|
|
150
|
+
closeGoal: (state: State) => State;
|
|
151
|
+
draftGoal: (state: State, arg?: unknown) => State;
|
|
152
|
+
chooseGoal: (state: State) => Promise<State>;
|
|
153
|
+
clear: () => Promise<State>;
|
|
154
|
+
}>(serviceName, {
|
|
71
155
|
state: initial,
|
|
72
156
|
// The progress is one member's: never written to disk and restored for the next person on the device.
|
|
73
|
-
notHydrated: Object.keys(initial) as Array<keyof
|
|
157
|
+
notHydrated: Object.keys(initial) as Array<keyof State>,
|
|
74
158
|
actions: {
|
|
75
|
-
clear: async () => initial,
|
|
76
|
-
load
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (seq !== sequence) return undefined;
|
|
104
|
-
// The member signed out (or changed) while the read was out: read again for whoever is signed in now.
|
|
105
|
-
const changed = await memberChanged(member, error);
|
|
106
|
-
// A newer load may have answered while that check was out: restarting then would blank its card and read the bookings again.
|
|
107
|
-
if (seq !== sequence) return undefined;
|
|
108
|
-
if (changed) { restart(); return undefined; }
|
|
109
|
-
// Wix refusing the member is a sign-in state, as on My Bookings; anything else is a failed read.
|
|
110
|
-
if (memberAccessDenied(error)) return view("ready", true);
|
|
111
|
-
console.warn("performance_tracker_section: the bookings could not be read", error);
|
|
112
|
-
return view("error", false);
|
|
159
|
+
clear: async () => { found = undefined; return initial; },
|
|
160
|
+
load,
|
|
161
|
+
// The "..." menu's Refresh: the same read, for the member who is here now.
|
|
162
|
+
refresh: load,
|
|
163
|
+
// The goal row opens the sheet on the goal in force.
|
|
164
|
+
openGoal: (state) => (state.status === "ready" && !state.signedOut && !state.goalLocked ? { ...state, goalOpen: true, goalDraft: state.goalValue } : state),
|
|
165
|
+
closeGoal: (state) => (state.goalOpen ? { ...state, goalOpen: false } : state),
|
|
166
|
+
// The wheel turned: only a goal the wheel offers is taken.
|
|
167
|
+
draftGoal: (state, arg) => {
|
|
168
|
+
const pick = pickableGoal((arg as { selectedId?: unknown } | undefined)?.selectedId);
|
|
169
|
+
return pick && state.goalOpen ? { ...state, goalDraft: String(pick) } : state;
|
|
170
|
+
},
|
|
171
|
+
// "Select": keep the wheel's choice for this member, then repaint and close. A choice that cannot be kept leaves the goal as it was.
|
|
172
|
+
chooseGoal: async (state) => {
|
|
173
|
+
const choice = pickableGoal(state.goalDraft);
|
|
174
|
+
const read = found;
|
|
175
|
+
if (!choice || !read || read.locked || state.status !== "ready" || state.signedOut) return { ...state, goalOpen: false };
|
|
176
|
+
if (String(choice) === state.goalValue) return { ...state, goalOpen: false };
|
|
177
|
+
const seq = sequence;
|
|
178
|
+
let owner = "";
|
|
179
|
+
try { owner = goalOwner(await memberAccess()); } catch { return { ...state, goalOpen: false }; }
|
|
180
|
+
// The member changed, or a newer load took over, while the identity was read: the choice was not this member's to keep.
|
|
181
|
+
if (seq !== sequence || owner !== read.owner) return { ...state, goalOpen: false };
|
|
182
|
+
if (!saveMemberGoal(goalStore(), owner, choice)) {
|
|
183
|
+
// The goal row turns into plain text: nothing is offered that cannot be kept, and the goal in force is the one shown.
|
|
184
|
+
console.warn("performance_tracker_section: the weekly goal could not be kept on this device");
|
|
185
|
+
read.locked = true;
|
|
186
|
+
return ready(read, readMemberGoal(goalStore(), owner) || defaultGoal);
|
|
113
187
|
}
|
|
188
|
+
return ready(read, choice);
|
|
114
189
|
},
|
|
115
190
|
},
|
|
116
191
|
});
|
|
@@ -62,10 +62,10 @@ export function allTimeSessions(rows: readonly MemberBookingRow[], now: number):
|
|
|
62
62
|
return new Set(rows.filter((row) => isHeldSession(row, now)).map((row) => row.id || `${row.start}|${row.title}`)).size;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** "Nov 16
|
|
65
|
+
/** "Nov 16 - Nov 22" (the source's `{startDate} - {endDate}`): Monday to Sunday of the week `now` is in. */
|
|
66
66
|
export function weekRange(now: number): string {
|
|
67
67
|
const start = new Date(weekStartMs(now));
|
|
68
68
|
const end = new Date(start);
|
|
69
69
|
end.setDate(end.getDate() + 6);
|
|
70
|
-
return `${formatMonthDay(start)}
|
|
70
|
+
return `${formatMonthDay(start)} - ${formatMonthDay(end)}`;
|
|
71
71
|
}
|