small fixes

This commit is contained in:
JCEEE
2026-09-07 19:02:43 +01:00
parent 7ced424a36
commit f2d6f8368c
3 changed files with 26 additions and 14 deletions
+4 -3
View File
@@ -96,9 +96,10 @@
display: flex;
align-items: center;
gap: 0.5rem;
padding: 1rem 0.75rem;
padding: 0 0.75rem;
border-bottom: 1px solid #3730a3;
min-height: 52px;
height: 52px;
box-sizing: border-box;
}
.app-icon {
font-size: 1.3rem;
@@ -155,7 +156,7 @@
}
.sidebar-header {
justify-content: center;
padding: 1rem 0;
padding: 0;
}
.app-name {
display: none;
+8 -7
View File
@@ -64,12 +64,10 @@ async function createRecord(collection: string, data: any): Promise<void> {
}
}
// Seed a default season (Holidays) per family so the family-admin season
// picker always has at least one option. "Term time" is intentionally NOT
// auto-seeded — it's a UK-school-specific term that not every family wants,
// and force-seeding it meant a deleted "Term time" kept coming back on every
// boot. Families that want it can add it themselves.
// Only seeds when a family has zero seasons, so user deletions stick.
// Seed two default seasons (Term + Holidays) per family so the family-admin
// season picker always has options from day one and they can tick either on/off.
// Only seeds when a family has zero seasons, so user deletions stick (a deleted
// default never comes back on boot as long as at least one season remains).
async function ensureDefaultSeasons(): Promise<void> {
const famsCol = await getCollection('fams');
if (!famsCol) return;
@@ -78,7 +76,10 @@ async function ensureDefaultSeasons(): Promise<void> {
headers: { Authorization: `Bearer ${t}` }
});
const fams = (await famsRes.json()).items || [];
const defaults = [{ name: 'Holidays', color: '#f59e0b', active: true }];
const defaults = [
{ name: 'Term', color: '#6366f1', active: true },
{ name: 'Holidays', color: '#f59e0b', active: true }
];
for (const fam of fams) {
const sRes = await fetch(
`${PB_ENDPOINT}/api/collections/seasons/records?filter=(famId='${fam.id}')&fields=name&perPage=200`,
@@ -269,6 +269,10 @@
let doneConfigs = $derived(
configs.filter((c: BonusConfig) => c.status === 'completed') as BonusConfig[]
);
let isPocketMoney = $derived(
!!editingConfig?.isPocketMoney || !!creatingFromTemplate?.isPocketMoney
);
</script>
<ViewHeader title="Rewards" hero />
@@ -598,11 +602,13 @@
<span class="field-label">{@html stepIcon(1)} Name</span>
<input name="name" bind:value={editVals.name} required />
</label>
{#if !isPocketMoney}
<label>
<span class="field-label">{@html stepIcon(1)} Description</span>
<input name="description" bind:value={editVals.description} />
</label>
<label>
{/if}
<label>
<span class="field-label"><UsersRound size={14} /> Target (who)</span>
<select name="target" bind:value={editVals.target}>
<option value="individual">Individual</option>
@@ -625,6 +631,7 @@
<!-- STEP 2 — How (rules + progress) -->
<div class="step-body" hidden={step !== 2}>
{#if !isPocketMoney}
<label>
<span class="field-label"><Settings2 size={14} /> Type</span>
<select name="type" bind:value={editVals.type}>
@@ -633,7 +640,8 @@
<option value="manual">Manual</option>
</select>
</label>
{#if editVals.type === 'threshold'}
{/if}
{#if editVals.type === 'threshold' && !isPocketMoney}
<label>
<span class="field-label"><Target size={14} /> Threshold by</span>
<select name="thresholdType" bind:value={editVals.thresholdType}>
@@ -691,6 +699,7 @@
>
</label>
{/if}
{#if !isPocketMoney}
<label>
<span class="field-label"><Settings2 size={14} /> Occurrence</span>
<select name="occurrence" bind:value={editVals.occurrence}>
@@ -698,7 +707,8 @@
<option value="once">Once</option>
</select>
</label>
{#if showPeriod}
{/if}
{#if showPeriod && !isPocketMoney}
<label>
<span class="field-label"><CalendarDays size={14} /> Period</span>
<select name="period" bind:value={editVals.period}>
@@ -847,7 +857,7 @@
<button type="button" class="nav-btn" onclick={() => (step = 2)}>
<ArrowLeft size={14} /> Back
</button>
{#if editingConfig}
{#if editingConfig && !isPocketMoney}
<button
type="button"
class="toggle-btn"