@commonpub/layer 0.37.0 → 0.38.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.
@@ -10,12 +10,19 @@ const { data: contests } = await useFetch('/api/contests', {
10
10
  query: computed(() => ({ limit: limit.value, status: 'active' })),
11
11
  lazy: true,
12
12
  });
13
+
14
+ // Dedupe against the hero: if the hero is already showing an active contest as a
15
+ // full callout, don't repeat it here. Other active contests still list.
16
+ const heroContestId = useState<string | null>('cpub:hero-contest-id', () => null);
17
+ const visibleContests = computed(() =>
18
+ (contests.value?.items ?? []).filter((c: { id: string }) => c.id !== heroContestId.value),
19
+ );
13
20
  </script>
14
21
 
15
22
  <template>
16
- <div v-if="contests?.items?.length" class="cpub-sb-card">
23
+ <div v-if="visibleContests.length" class="cpub-sb-card">
17
24
  <div class="cpub-sb-head">Active Contests <NuxtLink to="/contests">View all</NuxtLink></div>
18
- <div v-for="c in contests.items" :key="c.id" class="cpub-contest-item">
25
+ <div v-for="c in visibleContests" :key="c.id" class="cpub-contest-item">
19
26
  <NuxtLink :to="`/contests/${c.slug}`" class="cpub-contest-name">{{ c.title }}</NuxtLink>
20
27
  <div class="cpub-contest-row">
21
28
  <span class="cpub-contest-entries">{{ c.entryCount ?? 0 }} entries</span>
@@ -85,6 +85,15 @@ const heroDismissed = useState('cpub:hero-dismissed', () => false);
85
85
  function dismissHero(): void {
86
86
  heroDismissed.value = true;
87
87
  }
88
+
89
+ // Publish the contest the hero is currently showing so the sidebar "Active
90
+ // Contests" widget can DEDUPE it (no point showing the same contest twice — the
91
+ // hero is already a full callout). Null when the hero isn't showing one.
92
+ const heroContestId = useState<string | null>('cpub:hero-contest-id', () => null);
93
+ watchEffect(() => {
94
+ const shown = contestsEnabled.value && !!activeContest.value && !heroDismissed.value;
95
+ heroContestId.value = shown ? ((activeContest.value as { id?: string }).id ?? null) : null;
96
+ });
88
97
  </script>
89
98
 
90
99
  <template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonpub/layer",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "files": [
@@ -53,16 +53,16 @@
53
53
  "vue": "^3.4.0",
54
54
  "vue-router": "^4.3.0",
55
55
  "zod": "^4.3.6",
56
- "@commonpub/auth": "0.7.0",
57
- "@commonpub/explainer": "0.7.15",
56
+ "@commonpub/config": "0.16.0",
58
57
  "@commonpub/docs": "0.6.3",
58
+ "@commonpub/auth": "0.7.0",
59
59
  "@commonpub/editor": "0.7.11",
60
- "@commonpub/config": "0.16.0",
61
- "@commonpub/schema": "0.24.0",
60
+ "@commonpub/explainer": "0.7.15",
62
61
  "@commonpub/learning": "0.5.2",
63
- "@commonpub/ui": "0.9.1",
62
+ "@commonpub/protocol": "0.12.0",
64
63
  "@commonpub/server": "2.67.0",
65
- "@commonpub/protocol": "0.12.0"
64
+ "@commonpub/ui": "0.9.1",
65
+ "@commonpub/schema": "0.24.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@testing-library/jest-dom": "^6.9.1",