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

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

hub: artist self-management — owner manages their own subsite (posts/appearance/comments)

A site owner (member) now gets a "My PrutFolio" dashboard and can manage their
OWN site; cross-site access is restricted.

  • auth.js: requireSiteManager (owner of res.locals.site or god) + requireSiteManagerBySlug (owner of :slug or god).
  • admin.js: /admin role-aware -> god=hub management, owner=my-site dashboard, member without site=403.
  • admin-sites.js: /:slug/edit + /save owner-or-god (was god-only); upload-photo requireAuth. list/new/create/delete remain god-only.
  • admin-comments.js: requireSiteManager + redirects/form actions via siteUrlBase so the artist context (/user/<slug>/admin/comments) is correct.
  • render.js: userOwnsSite flag; topnav + overview show "Admin" for owners; topnav "New post" uses siteUrlBase.
  • pages/my-site.ejs: artist dashboard.

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

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