Initial Commit

This commit is contained in:
2026-01-27 13:24:03 -05:00
commit c85b877dc0
42 changed files with 5689 additions and 0 deletions

271
src/views/public/index.ejs Normal file
View File

@@ -0,0 +1,271 @@
<div class="hero">
<h1>Privacy Policy Analyzer</h1>
<p class="tagline">We read the fine print so you don't have to. Get clear A-E privacy grades for your favorite services.</p>
</div>
<div class="search-section">
<form action="/search" method="GET" class="search-form">
<input
type="search"
name="q"
placeholder="Search services..."
aria-label="Search services"
>
<button type="submit">Search</button>
</form>
</div>
<div class="grade-filters">
<p>Filter by grade:</p>
<div class="filter-buttons">
<a href="/?grade=A" class="filter-btn grade-a">A</a>
<a href="/?grade=B" class="filter-btn grade-b">B</a>
<a href="/?grade=C" class="filter-btn grade-c">C</a>
<a href="/?grade=D" class="filter-btn grade-d">D</a>
<a href="/?grade=E" class="filter-btn grade-e">E</a>
<a href="/" class="filter-btn all">All</a>
</div>
</div>
<% if (services && services.length > 0) { %>
<div class="services-grid">
<% services.forEach(function(service) { %>
<article class="service-card">
<a href="/service/<%= service.id %>" class="service-link" aria-describedby="service-<%= service.id %>-grade">
<% if (service.logo_url) { %>
<img src="<%= service.logo_url %>" alt="<%= service.name %> logo" class="service-logo">
<% } %>
<h2><%= service.name %></h2>
<% if (service.grade) { %>
<div class="grade-display">
<span class="grade grade-<%= service.grade.toLowerCase() %>" id="service-<%= service.id %>-grade">
Grade <%= service.grade %>
</span>
<span class="visually-hidden">Privacy Grade <%= service.grade %></span>
</div>
<% if (service.last_analyzed) { %>
<p class="last-analyzed">
Last analyzed: <%= new Date(service.last_analyzed).toLocaleDateString() %>
</p>
<% } %>
<% if (service.findings && service.findings.negative && service.findings.negative.length > 0) { %>
<ul class="key-findings" aria-label="Key privacy concerns">
<% service.findings.negative.slice(0, 3).forEach(function(finding) { %>
<li><%= finding.title %></li>
<% }); %>
<% if (service.findings.negative.length > 3) { %>
<li class="more">...and <%= service.findings.negative.length - 3 %> more</li>
<% } %>
</ul>
<% } %>
<% } else { %>
<p class="no-grade">Not analyzed yet</p>
<% } %>
</a>
</article>
<% }); %>
</div>
<% if (pagination && pagination.totalPages > 1) { %>
<nav class="pagination" aria-label="Pagination">
<% if (pagination.hasPrev) { %>
<a href="/?page=<%= pagination.currentPage - 1 %>" class="btn">Previous</a>
<% } %>
<span>Page <%= pagination.currentPage %> of <%= pagination.totalPages %></span>
<% if (pagination.hasNext) { %>
<a href="/?page=<%= pagination.currentPage + 1 %>" class="btn">Next</a>
<% } %>
</nav>
<% } %>
<% } else { %>
<div class="empty-state">
<p>No services found. Check back soon!</p>
</div>
<% } %>
<style>
.hero {
text-align: center;
padding: 3rem 0;
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
color: #2c3e50;
}
.tagline {
font-size: 1.25rem;
color: #666;
max-width: 600px;
margin: 0 auto;
}
.search-section {
max-width: 600px;
margin: 0 auto 2rem;
}
.search-form {
display: flex;
gap: 0.5rem;
}
.search-form input {
flex: 1;
padding: 1rem;
border: 2px solid #ddd;
border-radius: 8px;
font-size: 1rem;
}
.search-form button {
padding: 1rem 2rem;
min-height: 44px;
}
.grade-filters {
text-align: center;
margin-bottom: 2rem;
}
.grade-filters p {
margin-bottom: 0.5rem;
color: #666;
}
.filter-buttons {
display: flex;
justify-content: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.filter-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
border-radius: 50%;
text-decoration: none;
font-weight: 700;
color: #fff;
min-width: 44px;
min-height: 44px;
}
.filter-btn.all {
background: #95a5a6;
width: auto;
padding: 0 1rem;
border-radius: 22px;
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1.5rem;
}
.service-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
transition: transform 0.2s, box-shadow 0.2s;
}
.service-card:hover {
transform: translateY(-4px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.service-link {
display: block;
padding: 1.5rem;
text-decoration: none;
color: inherit;
}
.service-logo {
width: 48px;
height: 48px;
object-fit: contain;
margin-bottom: 1rem;
}
.service-card h2 {
font-size: 1.25rem;
margin-bottom: 0.5rem;
color: #2c3e50;
}
.grade-display {
margin: 1rem 0;
}
.last-analyzed {
font-size: 0.875rem;
color: #999;
margin-top: 0.5rem;
}
.no-grade {
color: #999;
font-style: italic;
}
.key-findings {
list-style: none;
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid #eee;
}
.key-findings li {
padding: 0.25rem 0;
color: #666;
font-size: 0.875rem;
}
.key-findings li::before {
content: "⚠️ ";
}
.key-findings li.more {
color: #999;
font-style: italic;
}
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
margin-top: 2rem;
}
.empty-state {
text-align: center;
padding: 4rem 2rem;
color: #666;
}
@media (max-width: 768px) {
.hero h1 {
font-size: 2rem;
}
.search-form {
flex-direction: column;
}
}
</style>

View File

@@ -0,0 +1,331 @@
<!-- Breadcrumb -->
<nav aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li><a href="/">Home</a></li>
<li aria-current="page"><%= service.name %></li>
</ol>
</nav>
<article class="service-detail">
<header class="service-header">
<div class="service-title">
<% if (service.logo_url) { %>
<img src="<%= service.logo_url %>" alt="<%= service.name %> logo" class="service-logo-large">
<% } %>
<div>
<h1><%= service.name %></h1>
<a href="<%= service.url %>" target="_blank" rel="noopener noreferrer" class="service-external-link">
Visit website ↗
</a>
</div>
</div>
<% if (analysis) { %>
<div class="grade-section">
<div class="grade-large grade-<%= analysis.overall_score.toLowerCase() %>">
Grade <%= analysis.overall_score %>
</div>
<p class="last-analyzed">
<strong>Last analyzed:</strong>
<%= new Date(analysis.created_at).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
}) %>
</p>
<% if (analysis.summary) { %>
<p class="summary"><%= analysis.summary %></p>
<% } %>
</div>
<% } else { %>
<div class="no-analysis">
<p>This service hasn't been analyzed yet.</p>
</div>
<% } %>
</header>
<% if (analysis && analysis.findings) { %>
<section class="findings-section" aria-labelledby="negative-findings">
<h2 id="negative-findings">Privacy Concerns</h2>
<% if (analysis.findings.negative && analysis.findings.negative.length > 0) { %>
<ul class="findings-list">
<% analysis.findings.negative.forEach(function(finding) { %>
<li class="finding finding-negative">
<h3><%= finding.title %></h3>
<p><%= finding.description %></p>
</li>
<% }); %>
</ul>
<% } else { %>
<p class="no-findings">No major privacy concerns found. ✓</p>
<% } %>
</section>
<section class="findings-section" aria-labelledby="positive-findings">
<h2 id="positive-findings">Positive Aspects</h2>
<% if (analysis.findings.positive && analysis.findings.positive.length > 0) { %>
<ul class="findings-list">
<% analysis.findings.positive.forEach(function(finding) { %>
<li class="finding finding-positive">
<h3><%= finding.title %></h3>
<p><%= finding.description %></p>
</li>
<% }); %>
</ul>
<% } else { %>
<p class="no-findings">No positive aspects highlighted.</p>
<% } %>
</section>
<% if (analysis.data_types_collected && analysis.data_types_collected.length > 0) { %>
<section class="data-section" aria-labelledby="data-collected">
<h2 id="data-collected">Data Collected</h2>
<ul class="data-list">
<% analysis.data_types_collected.forEach(function(dataType) { %>
<li><%= dataType %></li>
<% }); %>
</ul>
</section>
<% } %>
<% if (analysis.third_parties && analysis.third_parties.length > 0) { %>
<section class="data-section" aria-labelledby="third-parties">
<h2 id="third-parties">Third Parties</h2>
<ul class="third-party-list">
<% analysis.third_parties.forEach(function(party) { %>
<li>
<strong><%= party.name %></strong>
<% if (party.purpose) { %>
<span class="purpose"> - <%= party.purpose %></span>
<% } %>
</li>
<% }); %>
</ul>
</section>
<% } %>
<section class="policy-source">
<h2>Privacy Policy Source</h2>
<p>
<a href="<%= service.policy_url %>" target="_blank" rel="noopener noreferrer">
View original privacy policy ↗
</a>
</p>
</section>
<% } %>
</article>
<style>
.breadcrumb {
margin-bottom: 1rem;
}
.breadcrumb ol {
list-style: none;
display: flex;
gap: 0.5rem;
font-size: 0.875rem;
color: #666;
}
.breadcrumb li:not(:last-child)::after {
content: "/";
margin-left: 0.5rem;
}
.breadcrumb a {
color: #3498db;
text-decoration: none;
}
.breadcrumb a:hover {
text-decoration: underline;
}
.service-detail {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 2rem;
}
.service-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 2rem;
padding-bottom: 2rem;
border-bottom: 2px solid #eee;
}
.service-title {
display: flex;
align-items: center;
gap: 1rem;
}
.service-logo-large {
width: 64px;
height: 64px;
object-fit: contain;
}
.service-title h1 {
margin-bottom: 0.5rem;
color: #2c3e50;
}
.service-external-link {
color: #3498db;
text-decoration: none;
font-size: 0.875rem;
}
.service-external-link:hover {
text-decoration: underline;
}
.grade-section {
text-align: center;
}
.grade-large {
display: inline-flex;
align-items: center;
justify-content: center;
width: 120px;
height: 120px;
border-radius: 50%;
font-size: 2.5rem;
font-weight: 700;
color: #fff;
margin-bottom: 1rem;
}
.last-analyzed {
color: #666;
font-size: 0.875rem;
}
.summary {
margin-top: 1rem;
color: #666;
max-width: 400px;
}
.no-analysis {
text-align: center;
color: #999;
padding: 2rem;
}
.findings-section {
margin-bottom: 2rem;
}
.findings-section h2 {
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid #eee;
}
.findings-list {
list-style: none;
}
.finding {
padding: 1rem;
margin-bottom: 1rem;
border-radius: 4px;
border-left: 4px solid;
}
.finding-negative {
background: #fef5f5;
border-color: #e74c3c;
}
.finding-positive {
background: #f5fef5;
border-color: #27ae60;
}
.finding h3 {
font-size: 1.1rem;
margin-bottom: 0.5rem;
}
.finding p {
color: #666;
font-size: 0.875rem;
}
.no-findings {
color: #999;
font-style: italic;
padding: 1rem;
}
.data-section {
margin-bottom: 2rem;
}
.data-section h2 {
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid #eee;
}
.data-list,
.third-party-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
list-style: none;
}
.data-list li {
background: #f0f0f0;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.875rem;
}
.third-party-list li {
background: #fff;
padding: 0.75rem 1rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 0.875rem;
}
.purpose {
color: #666;
}
.policy-source {
margin-top: 2rem;
padding-top: 2rem;
border-top: 2px solid #eee;
}
@media (max-width: 768px) {
.service-header {
flex-direction: column;
gap: 1rem;
}
.grade-large {
width: 80px;
height: 80px;
font-size: 1.5rem;
}
}
</style>