@commonpub/layer 0.56.0 → 0.57.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.
@@ -63,6 +63,10 @@ function critWeightInput(i: number, ci: number, e: Event): void {
63
63
  const v = (e.target as HTMLInputElement).value;
64
64
  setCriterion(i, ci, { weight: v === '' ? undefined : Math.max(0, Math.min(100, Math.round(Number(v)))) });
65
65
  }
66
+ function advanceCountInput(i: number, e: Event): void {
67
+ const v = (e.target as HTMLInputElement).value;
68
+ setField(i, { advanceCount: v === '' ? undefined : Math.max(1, Math.round(Number(v))) });
69
+ }
66
70
 
67
71
  // Array operations live as pure functions in utils/contestStages.ts (unit-tested).
68
72
  function addStage(): void {
@@ -190,8 +194,12 @@ const missingSubmission = computed(() => stages.value.length > 0 && !stages.valu
190
194
  />
191
195
  </div>
192
196
 
193
- <!-- Per-round judging rubric (review stages) -->
197
+ <!-- Per-round config (review stages): how many advance + the rubric -->
194
198
  <div v-if="stage.kind === 'review'" class="cpub-stage-criteria">
199
+ <div class="cpub-form-field" style="margin-bottom: 10px;">
200
+ <label class="cpub-form-label">Advance the top N to the next stage</label>
201
+ <input :value="stage.advanceCount ?? ''" type="number" min="1" class="cpub-form-input cpub-stage-advn" placeholder="e.g. 50 — leave blank to decide at advance time" @input="advanceCountInput(i, $event)" />
202
+ </div>
195
203
  <div class="cpub-stage-criteria-head">
196
204
  <span class="cpub-form-label" style="margin: 0;">Judging criteria — this round</span>
197
205
  <button type="button" class="cpub-btn cpub-btn-sm" @click="addCriterion(i)"><i class="fa-solid fa-plus"></i> Add</button>
@@ -258,4 +266,5 @@ const missingSubmission = computed(() => stages.value.length > 0 && !stages.valu
258
266
  .cpub-stage-crit-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
259
267
  .cpub-stage-crit-row .cpub-form-input { margin: 0; }
260
268
  .cpub-stage-crit-pts { max-width: 70px; flex-shrink: 0; }
269
+ .cpub-stage-advn { max-width: 320px; }
261
270
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonpub/layer",
3
- "version": "0.56.0",
3
+ "version": "0.57.0",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "files": [
@@ -57,12 +57,12 @@
57
57
  "@commonpub/config": "0.18.0",
58
58
  "@commonpub/docs": "0.6.3",
59
59
  "@commonpub/editor": "0.7.11",
60
- "@commonpub/explainer": "0.7.15",
61
- "@commonpub/schema": "0.31.0",
62
- "@commonpub/server": "2.78.0",
63
60
  "@commonpub/protocol": "0.13.0",
61
+ "@commonpub/learning": "0.5.2",
62
+ "@commonpub/server": "2.79.0",
63
+ "@commonpub/schema": "0.32.0",
64
64
  "@commonpub/ui": "0.9.2",
65
- "@commonpub/learning": "0.5.2"
65
+ "@commonpub/explainer": "0.7.15"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@testing-library/jest-dom": "^6.9.1",
@@ -60,6 +60,9 @@ const criteria = ref<Criterion[]>([]);
60
60
  // Phase B1 — explicit stage timeline (empty ⇒ standard synthesized flow).
61
61
  const stages = ref<ContestStage[]>([]);
62
62
  const currentStageIdRef = ref<string | null>(null);
63
+ // Declared before the contest loader (below) since the loader pre-fills advanceN.
64
+ const advancing = ref<string | null>(null);
65
+ const advanceN = ref<Record<string, number>>({});
63
66
 
64
67
  // Load current data
65
68
  watch(contest, (c) => {
@@ -83,6 +86,10 @@ watch(contest, (c) => {
83
86
  showPrizes.value = c.showPrizes !== false;
84
87
  stages.value = Array.isArray(c.stages) ? [...c.stages] : [];
85
88
  currentStageIdRef.value = c.currentStageId ?? null;
89
+ // Pre-fill the Advancement control from each review stage's defined cut.
90
+ for (const s of stages.value) {
91
+ if (s.kind === 'review' && typeof s.advanceCount === 'number') advanceN.value[s.id] = s.advanceCount;
92
+ }
86
93
  prizesDescription.value = c.prizesDescription ?? '';
87
94
  prizes.value = (c.prizes ?? []).map((p: { place?: number; category?: string; title?: string; description?: string; value?: string }) => ({
88
95
  place: p.place ?? null,
@@ -218,8 +225,6 @@ const statusAction = contestStatusAction;
218
225
 
219
226
  // Phase B2 — advancement cuts. Operates on the PERSISTED stages (contest.value),
220
227
  // not the editable `stages` ref, since it acts on real entries.
221
- const advancing = ref<string | null>(null);
222
- const advanceN = ref<Record<string, number>>({});
223
228
  const reviewStages = computed(() => (contest.value?.stages ?? []).filter((s) => s.kind === 'review'));
224
229
  async function advanceStage(stageId: string): Promise<void> {
225
230
  const topN = advanceN.value[stageId];