← back to NationalPaperHangers
views/partials/social-videos.ejs
58 lines
<%
// Watch-the-work partial — included by every installer template (legacy
// installer.ejs + 6 installer-tpl-*.ejs). Renders nothing when there's
// no embed-able URL and no IG/YT/TikTok handle.
var _hasEmbed = (typeof featuredVideos !== 'undefined' && Array.isArray(featuredVideos) && featuredVideos.length > 0);
// typeof guard: every installer template currently passes installer, but a
// future error/fallback render path could omit it. Match the featuredVideos
// pattern. (claude-codex r3 finding HIGH#5)
// Gate on social_verified — a self-claimed handle that NPH ops hasn't
// confirmed must NOT render publicly. Anyone could put any handle on their
// profile; surfacing it as if it's "the studio's work" is brand-fraud risk.
// Steve's standing rule: handles render only after ops verifies the account
// belongs to the studio (mirror of the credential review queue).
var _socialVerified = (typeof installer !== 'undefined') && installer && installer.social_verified === true;
var _hasHandle = _socialVerified && (installer.youtube_handle || installer.instagram_handle || installer.tiktok_handle);
%>
<% if (_hasEmbed || _hasHandle) { %>
<section class="profile-videos" aria-labelledby="videos-heading">
<h2 class="section-title" id="videos-heading">Watch the work</h2>
<p class="muted" style="margin:-12px 0 18px;font-size:13px">Reels and videos from the studio's own channels — actual installations, not stock footage.</p>
<% if (_hasEmbed) { %>
<div class="video-embed-grid">
<% featuredVideos.forEach(function(v){ %>
<div class="video-embed-card video-<%= v.platform %>">
<%- v.html %>
<div class="video-platform-pill"><%= v.platform.toUpperCase() %></div>
</div>
<% }); %>
</div>
<% } %>
<% if (_hasHandle) { %>
<div class="social-handles" style="margin-top:24px;display:flex;gap:12px;flex-wrap:wrap">
<% if (installer.instagram_handle) { %>
<a href="https://instagram.com/<%= encodeURIComponent(installer.instagram_handle.replace(/^@/, '')) %>" target="_blank" rel="noopener" class="social-handle-card ig">
<span class="social-handle-icon" aria-hidden="true">▶</span>
<span class="social-handle-platform">Instagram reels</span>
<span class="social-handle-name">@<%= installer.instagram_handle.replace(/^@/, '') %></span>
</a>
<% } %>
<% if (installer.youtube_handle) { %>
<a href="https://www.youtube.com/<%= installer.youtube_handle.startsWith('@') ? installer.youtube_handle : '@' + installer.youtube_handle %>" target="_blank" rel="noopener" class="social-handle-card yt">
<span class="social-handle-icon" aria-hidden="true">▶</span>
<span class="social-handle-platform">YouTube installations</span>
<span class="social-handle-name"><%= installer.youtube_handle.startsWith('@') ? installer.youtube_handle : '@' + installer.youtube_handle %></span>
</a>
<% } %>
<% if (installer.tiktok_handle) { %>
<a href="https://www.tiktok.com/@<%= encodeURIComponent(installer.tiktok_handle.replace(/^@/, '')) %>" target="_blank" rel="noopener" class="social-handle-card tt">
<span class="social-handle-icon" aria-hidden="true">▶</span>
<span class="social-handle-platform">TikTok</span>
<span class="social-handle-name">@<%= installer.tiktok_handle.replace(/^@/, '') %></span>
</a>
<% } %>
</div>
<% } %>
</section>
<% } %>