source: Klonkt/src/views/pages/hub-home.ejs@ 8afbdd6

main
Last change on this file since 8afbdd6 was 8afbdd6, checked in by roboburr <roboburr@…>, 3 months ago

feat: viewer role + artists directory + Klonkt Hub Beta rebrand

Viewer role (replaces the separate view-mode/readonly toggle):

  • 'kijker' is now a real role (VALID_ROLES) selectable in Admin. May view EVERYTHING including Admin, but cannot modify anything.
  • isViewer(user) (= role kijker or legacy readonly flag) is the source; requireGod/requireSiteManager(BySlug) let a viewer through (viewing), the global guard 403s every write. Existing readonly accounts are migrated on each role change (readonly=0).
  • Write leaks via GET patched: /prutter/new (INSERT) blocks for viewers, /prutter/:id skips markAsRead (UPDATE); WS upgrade rejects viewers (the HTTP guard doesn't cover WebSockets).
  • Clean "Viewer mode" page (viewer-blocked) instead of raw 403 text; styled sticky banner; account page shows read-only UI instead of an upload button that silently 403s. canMutate hides write buttons.

Scalability (>50 artists):

  • Hub home shows max 24 (most active first) + "All N artists ->".
  • New searchable, paginated /artiesten directory (hub only).
  • 'user' + 'artiesten' reserved as slugs.

Rebrand PrutFolio v1 -> Klonkt Hub Beta (footer, PWA manifest, account/
admin texts, default page title, startup, README; internal package +
PWA id 'prutfolio' remain for stability).

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 9.9 KB
Line 
1<div class="hub<%= hub.heroImage ? ' hub--img' : '' %>">
2
3 <%# ── Minimale nav (alleen auth) — over de hero, geen brand/switcher ── %>
4 <nav class="hub-nav">
5 <div class="hub-nav-inner container">
6 <% if (user) { %>
7 <% if (user.role === 'god' || user.role === 'admin' || (typeof userOwnsSite !== 'undefined' && userOwnsSite)) { %>
8 <a class="hub-nav-link" href="/admin">Beheer</a>
9 <% } %>
10 <a class="hub-nav-link" href="/account"><%= user.username %></a>
11 <a class="hub-nav-link" href="/auth/logout">Uitloggen</a>
12 <% } else { %>
13 <a class="hub-nav-link" href="/auth/login">Inloggen</a>
14 <% } %>
15 </div>
16 </nav>
17
18 <%# ── HERO (label) — de pagina begint hier, geen header erboven ────── %>
19 <header class="hub-hero<%= hub.heroImage ? ' has-img' : '' %>"<% if (hub.heroImage) { %> style="--hero-img:url('<%= hub.heroImage %>')"<% } %>>
20 <div class="hub-hero-inner container">
21 <h1 class="hub-hero-title"><%= hub.title %></h1>
22 <% if (hub.tagline) { %>
23 <p class="hub-hero-tag"><%= hub.tagline %></p>
24 <% } %>
25 <% if (hub.intro) { %>
26 <p class="hub-hero-desc"><%= hub.intro %></p>
27 <% } %>
28 </div>
29 </header>
30
31 <div class="container hub-body">
32
33 <%# ── ARTIESTEN-ROSTER ─────────────────────────────────────────── %>
34 <% if (artists && artists.length) { %>
35 <% var _total = (typeof totalArtists !== 'undefined') ? totalArtists : artists.length; %>
36 <% var _hasMore = _total > artists.length; %>
37 <section class="hub-sec">
38 <h2 class="hub-sec-title">
39 Artiesten
40 <% if (_hasMore) { %><span class="hub-sec-count"><%= _total %></span><% } %>
41 </h2>
42 <div class="roster">
43 <% artists.forEach(function(a){ %>
44 <a class="roster-card" href="/user/<%= a.slug %>">
45 <% var _ava = a.profile_photo || a.owner_avatar; %>
46 <span class="roster-avatar"<% if (_ava) { %> style="background-image:url('<%= _ava %>')"<% } else { %> style="background:<%= a.accent || 'var(--accent)' %>;color:#fff"<% } %>>
47 <% if (!_ava) { %><%= (a.title || a.slug).charAt(0).toUpperCase() %><% } %>
48 </span>
49 <span class="roster-name"><%= a.title %></span>
50 <% if (a.tagline) { %><span class="roster-tag"><%= a.tagline %></span><% } %>
51 <span class="roster-count"><%= a.post_count %> post<%= a.post_count === 1 ? '' : 's' %></span>
52 </a>
53 <% }); %>
54 </div>
55 <% if (_hasMore) { %>
56 <div class="hub-more">
57 <a class="hub-more-link" href="/artiesten">Alle <%= _total %> artiesten <span aria-hidden="true">→</span></a>
58 </div>
59 <% } %>
60 </section>
61 <% } %>
62
63 <%# ── LAATSTE POSTS ────────────────────────────────────────────── %>
64 <% if (posts && posts.length) { %>
65 <section class="hub-sec">
66 <h2 class="hub-sec-title">Laatste posts van users</h2>
67 <div class="hub-feed">
68 <% posts.forEach(function(p){ %>
69 <a class="feed-item" href="/user/<%= p.site_slug %>/<%= p.slug %>">
70 <% if (p.cover_image_url) { %>
71 <span class="feed-cover" style="background-image:url('<%= p.cover_image_url %>')"></span>
72 <% } %>
73 <span class="feed-body">
74 <span class="feed-meta"><%= p.site_title %> · <%= formatDate(p.published_at || p.created_at) %></span>
75 <span class="feed-title"><%= p.title %></span>
76 <% if (p.excerpt) { %><span class="feed-excerpt"><%= p.excerpt %></span><% } %>
77 </span>
78 <span class="feed-arrow" aria-hidden="true">→</span>
79 </a>
80 <% }); %>
81 </div>
82 </section>
83 <% } %>
84
85 </div>
86</div>
87
88<style>
89.hub { width: 100%; position: relative; }
90
91/* ── Minimale auth-nav (over de hero) ─────────────────────────────── */
92.hub-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: 1rem 0; }
93.hub-nav-inner { display: flex; justify-content: flex-end; align-items: center; gap: 1.4rem; }
94.hub-nav-link {
95 color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; opacity: 0.85;
96}
97.hub-nav-link:hover { opacity: 1; color: var(--accent); }
98.hub--img .hub-nav-link { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
99.hub--img .hub-nav-link:hover { color: #fff; opacity: 1; }
100
101/* ── Hero ─────────────────────────────────────────────────────────── */
102.hub-hero {
103 display: flex; align-items: center; justify-content: center;
104 min-height: clamp(340px, 58vh, 560px);
105 text-align: center;
106 background:
107 radial-gradient(130% 130% at 50% -10%, color-mix(in srgb, var(--accent) 26%, var(--paper)) 0%, var(--paper) 62%);
108 border-bottom: 1px solid var(--rule);
109}
110.hub-hero.has-img {
111 background:
112 linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,.55) 100%),
113 var(--hero-img) center / cover no-repeat;
114 border-bottom: 0;
115 color: #fff;
116}
117.hub-hero-inner { padding: 3.5rem 1rem; }
118.hub-hero-title {
119 font-family: var(--font-display, serif);
120 font-size: clamp(2.6rem, 7vw, 4.4rem);
121 line-height: 1.02; margin: 0; letter-spacing: -0.015em;
122}
123.hub-hero-tag {
124 margin: 0.7rem 0 0; font-size: 1.05rem; font-weight: 600;
125 text-transform: uppercase; letter-spacing: 0.1em;
126 color: var(--accent);
127}
128.hub-hero.has-img .hub-hero-tag { color: #fff; opacity: 0.92; }
129.hub-hero-desc {
130 margin: 1.1rem auto 0; max-width: 48ch;
131 font-size: 1.1rem; line-height: 1.55; color: var(--ink-muted);
132}
133.hub-hero.has-img .hub-hero-desc { color: rgba(255,255,255,.9); }
134
135.hub-body { padding-bottom: 4.5rem; }
136.hub-sec { margin-top: 3rem; }
137.hub-sec-title {
138 font-family: var(--font-display, serif);
139 font-size: 1.5rem; margin: 0 0 1.2rem;
140 display: flex; align-items: center; gap: 0.75rem;
141}
142.hub-sec-title::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
143.hub-sec-count {
144 font-family: var(--font-ui, system-ui); font-size: 0.8rem; font-weight: 700;
145 color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
146 padding: 0.1rem 0.55rem; border-radius: 99px; order: 1;
147}
148.hub-more { margin-top: 1.25rem; text-align: center; }
149.hub-more-link {
150 display: inline-flex; align-items: center; gap: 0.4rem;
151 padding: 0.6rem 1.3rem; border: 1px solid var(--rule); border-radius: 99px;
152 background: var(--paper-2); color: var(--ink); text-decoration: none;
153 font-weight: 600; font-size: 0.92rem; transition: border-color 140ms, background 140ms;
154}
155.hub-more-link:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper-2)); }
156
157/* ── Roster (artiesten) ───────────────────────────────────────────── */
158.roster {
159 display: grid;
160 grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
161 gap: 1rem;
162}
163.roster-card {
164 display: flex; flex-direction: column; align-items: center; text-align: center;
165 gap: 0.4rem; padding: 1.6rem 1rem 1.3rem;
166 border: 1px solid var(--rule); border-radius: 16px;
167 background: var(--paper-2); color: var(--ink); text-decoration: none;
168 transition: border-color 140ms, transform 140ms, box-shadow 140ms;
169}
170.roster-card:hover {
171 border-color: var(--accent); transform: translateY(-3px);
172 box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--accent) 55%, transparent);
173}
174.roster-avatar {
175 width: 88px; height: 88px; border-radius: 50%; margin-bottom: 0.45rem;
176 background-size: cover; background-position: center;
177 display: inline-flex; align-items: center; justify-content: center;
178 font-family: var(--font-display, serif); font-size: 2.1rem; font-weight: 700; color: #fff;
179 box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
180}
181.roster-name { font-weight: 700; font-size: 1.1rem; }
182.roster-tag { color: var(--ink-muted); font-size: 0.82rem; }
183.roster-count {
184 margin-top: 0.35rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
185 color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
186 padding: 0.15rem 0.6rem; border-radius: 99px;
187}
188
189/* ── Feed (laatste posts) ─────────────────────────────────────────── */
190.hub-feed { display: flex; flex-direction: column; gap: 0.6rem; }
191.feed-item {
192 display: flex; align-items: center; gap: 1rem;
193 padding: 0.9rem 1rem; border: 1px solid var(--rule); border-radius: 12px;
194 background: var(--paper-2); color: var(--ink); text-decoration: none;
195 transition: border-color 140ms, background 140ms;
196}
197.feed-item:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--paper-2)); }
198.feed-cover {
199 width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0;
200 background-size: cover; background-position: center; background-color: var(--paper);
201}
202.feed-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1; }
203.feed-meta { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
204.feed-title { font-weight: 600; font-size: 1.05rem; line-height: 1.25; }
205.feed-excerpt {
206 color: var(--ink-muted); font-size: 0.88rem; line-height: 1.4;
207 display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
208}
209.feed-arrow { color: var(--ink-muted); font-size: 1.2rem; flex-shrink: 0; transition: transform 140ms, color 140ms; }
210.feed-item:hover .feed-arrow { color: var(--accent); transform: translateX(3px); }
211
212@media (max-width: 560px) {
213 .hub-hero-inner { padding: 2.5rem 1rem; }
214 .feed-cover { width: 52px; height: 52px; }
215 .feed-arrow { display: none; }
216}
217</style>
Note: See TracBrowser for help on using the repository browser.