@commonpub/layer 0.1.2 → 0.1.4
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.
|
@@ -76,16 +76,6 @@ export function useMirrorContent(fedContent: Ref<Record<string, unknown> | null>
|
|
|
76
76
|
} satisfies ContentViewData;
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
const viewComponent = computed(() => {
|
|
80
|
-
switch (contentType.value) {
|
|
81
|
-
case 'article': return resolveComponent('ViewsArticleView');
|
|
82
|
-
case 'blog': return resolveComponent('ViewsBlogView');
|
|
83
|
-
case 'explainer': return resolveComponent('ViewsExplainerView');
|
|
84
|
-
case 'project': return resolveComponent('ViewsProjectView');
|
|
85
|
-
default: return null;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
79
|
const originDomain = computed(() => (fedContent.value?.originDomain as string) || 'unknown');
|
|
90
80
|
const originUrl = computed(() => (fedContent.value?.url as string) || null);
|
|
91
81
|
const authorHandle = computed(() => {
|
|
@@ -97,7 +87,6 @@ export function useMirrorContent(fedContent: Ref<Record<string, unknown> | null>
|
|
|
97
87
|
contentType,
|
|
98
88
|
actor,
|
|
99
89
|
transformedContent,
|
|
100
|
-
viewComponent,
|
|
101
90
|
originDomain,
|
|
102
91
|
originUrl,
|
|
103
92
|
authorHandle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"@commonpub/docs": "0.5.0",
|
|
50
50
|
"@commonpub/auth": "0.5.0",
|
|
51
51
|
"@commonpub/editor": "0.5.0",
|
|
52
|
-
"@commonpub/learning": "0.5.0",
|
|
53
52
|
"@commonpub/protocol": "0.9.3",
|
|
54
53
|
"@commonpub/server": "2.6.0",
|
|
55
54
|
"@commonpub/schema": "0.8.7",
|
|
56
|
-
"@commonpub/ui": "0.7.1"
|
|
55
|
+
"@commonpub/ui": "0.7.1",
|
|
56
|
+
"@commonpub/learning": "0.5.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {}
|
|
59
59
|
}
|
|
@@ -57,16 +57,7 @@ const enrichedContent = computed(() => {
|
|
|
57
57
|
return { ...content.value, readTime: readTime.value };
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
const viewComponent = computed(() => {
|
|
62
|
-
switch (contentType.value) {
|
|
63
|
-
case 'article': return resolveComponent('ViewsArticleView');
|
|
64
|
-
case 'blog': return resolveComponent('ViewsBlogView');
|
|
65
|
-
case 'explainer': return resolveComponent('ViewsExplainerView');
|
|
66
|
-
case 'project': return resolveComponent('ViewsProjectView');
|
|
67
|
-
default: return null;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
60
|
+
// Content type used for conditional view component rendering in template
|
|
70
61
|
|
|
71
62
|
// Related content
|
|
72
63
|
const { data: related } = await useFetch<PaginatedResponse<Serialized<ContentListItem>>>('/api/content', {
|
|
@@ -91,12 +82,11 @@ onMounted(() => {
|
|
|
91
82
|
</NuxtLink>
|
|
92
83
|
</div>
|
|
93
84
|
|
|
94
|
-
<!-- Specialized view -->
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/>
|
|
85
|
+
<!-- Specialized view by content type -->
|
|
86
|
+
<ViewsProjectView v-if="contentType === 'project'" :content="(enrichedContent as any)" />
|
|
87
|
+
<ViewsArticleView v-else-if="contentType === 'article'" :content="(enrichedContent as any)" />
|
|
88
|
+
<ViewsBlogView v-else-if="contentType === 'blog'" :content="(enrichedContent as any)" />
|
|
89
|
+
<ViewsExplainerView v-else-if="contentType === 'explainer'" :content="(enrichedContent as any)" />
|
|
100
90
|
|
|
101
91
|
<!-- Fallback: generic view for unknown types -->
|
|
102
92
|
<article v-else class="cpub-view">
|
package/pages/hubs/index.vue
CHANGED
|
@@ -24,7 +24,7 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
24
24
|
<div class="cpub-hubs-header">
|
|
25
25
|
<div>
|
|
26
26
|
<h1 class="cpub-hubs-title">Hubs</h1>
|
|
27
|
-
<p class="cpub-hubs-desc">Communities, products, and companies on
|
|
27
|
+
<p class="cpub-hubs-desc">Communities, products, and companies on {{ useSiteName() }}</p>
|
|
28
28
|
</div>
|
|
29
29
|
<NuxtLink v-if="isAuthenticated" to="/hubs/create" class="cpub-btn cpub-btn-primary">
|
|
30
30
|
<i class="fa-solid fa-plus"></i> Create Hub
|
|
@@ -91,8 +91,8 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
91
91
|
|
|
92
92
|
.cpub-hubs-grid {
|
|
93
93
|
display: grid;
|
|
94
|
-
grid-template-columns: repeat(auto-fill, minmax(
|
|
95
|
-
gap:
|
|
94
|
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
95
|
+
gap: 20px;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.cpub-hub-card {
|
|
@@ -101,18 +101,17 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
101
101
|
overflow: hidden;
|
|
102
102
|
text-decoration: none;
|
|
103
103
|
color: inherit;
|
|
104
|
-
transition: box-shadow 0.15s, border-color 0.15s;
|
|
105
|
-
box-shadow: var(--shadow-md);
|
|
104
|
+
transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
.cpub-hub-card:hover {
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
border-color: var(--accent);
|
|
109
|
+
transform: translateY(-2px);
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
.cpub-hub-card-banner {
|
|
114
|
-
height:
|
|
115
|
-
background: linear-gradient(135deg, var(--
|
|
113
|
+
height: 72px;
|
|
114
|
+
background: linear-gradient(135deg, var(--surface2) 0%, var(--accent-bg-strong) 100%);
|
|
116
115
|
background-size: cover;
|
|
117
116
|
background-position: center;
|
|
118
117
|
position: relative;
|
|
@@ -120,25 +119,29 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
120
119
|
|
|
121
120
|
.cpub-hub-card-icon {
|
|
122
121
|
position: absolute;
|
|
123
|
-
bottom: -
|
|
124
|
-
left:
|
|
125
|
-
width:
|
|
126
|
-
height:
|
|
122
|
+
bottom: -18px;
|
|
123
|
+
left: 16px;
|
|
124
|
+
width: 44px;
|
|
125
|
+
height: 44px;
|
|
127
126
|
display: flex;
|
|
128
127
|
align-items: center;
|
|
129
128
|
justify-content: center;
|
|
130
129
|
background: var(--surface);
|
|
131
|
-
border: var(--border-width-default) solid var(--
|
|
130
|
+
border: var(--border-width-default) solid var(--border);
|
|
132
131
|
color: var(--accent);
|
|
133
|
-
font-size:
|
|
132
|
+
font-size: 18px;
|
|
134
133
|
overflow: hidden;
|
|
135
|
-
box-shadow: var(--shadow-sm);
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
.cpub-hub-card-avatar { width: 100%; height: 100%; object-fit: cover; }
|
|
139
137
|
|
|
140
138
|
.cpub-hub-card-body {
|
|
141
|
-
padding:
|
|
139
|
+
padding: 24px 16px 16px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Reset borders on all card body children — prevent theme bleed */
|
|
143
|
+
.cpub-hub-card-body > * {
|
|
144
|
+
border: none;
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
.cpub-hub-card-name-row {
|
|
@@ -166,6 +169,8 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
166
169
|
display: flex;
|
|
167
170
|
align-items: center;
|
|
168
171
|
gap: 14px;
|
|
172
|
+
padding-top: 10px;
|
|
173
|
+
border-top: 1px solid var(--border2);
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
.cpub-hub-card-stat {
|
|
@@ -185,7 +190,7 @@ function hubLink(hub: Record<string, unknown>): string {
|
|
|
185
190
|
letter-spacing: 0.08em;
|
|
186
191
|
color: var(--accent);
|
|
187
192
|
background: var(--accent-bg);
|
|
188
|
-
border:
|
|
193
|
+
border: 1px solid var(--accent-border);
|
|
189
194
|
padding: 2px 6px;
|
|
190
195
|
}
|
|
191
196
|
|
package/pages/mirror/[id].vue
CHANGED
|
@@ -7,8 +7,8 @@ const id = route.params.id as string;
|
|
|
7
7
|
const { data: fedContent, error, pending } = await useFetch<Record<string, unknown>>(`/api/federation/content/${id}`);
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
|
+
contentType,
|
|
10
11
|
transformedContent,
|
|
11
|
-
viewComponent,
|
|
12
12
|
originDomain,
|
|
13
13
|
originUrl,
|
|
14
14
|
authorHandle,
|
|
@@ -51,15 +51,13 @@ useSeoMeta({
|
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
54
|
-
<!-- Reuse existing content view
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
:federated-id="id"
|
|
60
|
-
/>
|
|
54
|
+
<!-- Reuse existing content view components by type -->
|
|
55
|
+
<ViewsProjectView v-if="contentType === 'project'" :content="transformedContent" :federated-id="id" />
|
|
56
|
+
<ViewsArticleView v-else-if="contentType === 'article'" :content="transformedContent" :federated-id="id" />
|
|
57
|
+
<ViewsBlogView v-else-if="contentType === 'blog'" :content="transformedContent" :federated-id="id" />
|
|
58
|
+
<ViewsExplainerView v-else-if="contentType === 'explainer'" :content="transformedContent" :federated-id="id" />
|
|
61
59
|
|
|
62
|
-
<!-- Fallback for non-CommonPub content -->
|
|
60
|
+
<!-- Fallback for non-CommonPub content (Mastodon notes, Lemmy posts, etc.) -->
|
|
63
61
|
<article v-else class="cpub-mirror-fallback">
|
|
64
62
|
<div class="cpub-mirror-container">
|
|
65
63
|
<img v-if="transformedContent.coverImageUrl" :src="transformedContent.coverImageUrl" :alt="transformedContent.title" class="cpub-mirror-cover" />
|