Files
shopify-ai-backup/chat/public/templates.html

206 lines
5.9 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plugin Templates - Plugin Compass</title>
<link rel="icon" type="image/png" href="/assets/Plugin.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="/chat/styles.css">
<style>
:root {
--shopify-green: #008060;
--shopify-green-dark: #004c3f;
--shopify-green-light: #e3f5ef;
--accent: #5A31F4;
}
body {
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
font-family: 'Inter', sans-serif;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 40px 24px;
}
.header {
text-align: center;
margin-bottom: 60px;
}
.header h1 {
font-family: 'Space Grotesk', sans-serif;
font-size: 48px;
margin-bottom: 16px;
color: #1a1a1a;
}
.header p {
color: #6c757d;
font-size: 20px;
max-width: 600px;
margin: 0 auto;
}
.templates-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 32px;
}
.template-card {
background: white;
border-radius: 20px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
transition: transform 0.2s, box-shadow 0.2s;
border: 1px solid rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
}
.template-card:hover {
transform: translateY(-8px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
.card-image {
height: 200px;
background: #f1f3f5;
display: flex;
align-items: center;
justify-content: center;
color: #adb5bd;
font-size: 48px;
}
.card-body {
padding: 24px;
flex: 1;
display: flex;
flex-direction: column;
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 999px;
font-size: 12px;
font-weight: 600;
background: var(--shopify-green-light);
color: var(--shopify-green);
margin-bottom: 12px;
align-self: flex-start;
}
.card-title {
font-family: 'Space Grotesk', sans-serif;
font-size: 24px;
font-weight: 700;
margin: 0 0 12px 0;
color: #1a1a1a;
}
.card-desc {
color: #6c757d;
line-height: 1.6;
margin-bottom: 24px;
flex: 1;
}
.card-actions {
border-top: 1px solid #f1f3f5;
padding-top: 20px;
margin-top: auto;
}
.use-template-btn {
display: block;
width: 100%;
background: #1a1a1a;
color: white;
text-align: center;
padding: 14px;
border-radius: 12px;
text-decoration: none;
font-weight: 600;
transition: background 0.2s;
}
.use-template-btn:hover {
background: var(--shopify-green);
}
.loading {
text-align: center;
padding: 60px;
font-size: 18px;
color: #adb5bd;
}
</style>
<!-- PostHog Analytics -->
<script src="/posthog.js"></script>
</head>
<body>
<div class="container">
<div style="margin-bottom: 40px;">
<a href="/" style="text-decoration: none; color: #6c757d; font-weight: 500;">← Back to Home</a>
</div>
<div class="header">
<h1>Start with a Template</h1>
<p>Jumpstart your development with our professionally crafted plugin templates.</p>
</div>
<div class="templates-grid" id="templates-grid">
<div class="loading">Loading templates...</div>
</div>
</div>
<script>
async function loadTemplates() {
try {
const res = await fetch('/api/templates');
const data = await res.json();
const grid = document.getElementById('templates-grid');
if (!data.templates || !data.templates.length) {
grid.innerHTML = '<div style="grid-column: 1/-1; text-align: center;">No templates found.</div>';
return;
}
grid.innerHTML = data.templates.map(t => `
<div class="template-card">
<div class="card-image">
${t.image && !t.image.includes('placeholder') ? `<img src="${t.image}" style="width:100%; height:100%; object-fit:cover;">` : '🧩'}
</div>
<div class="card-body">
<div class="badge">${t.category || 'General'}</div>
<h3 class="card-title">${t.name}</h3>
<p class="card-desc">${t.description}</p>
<div class="card-actions">
<a href="/apps?template=${t.id}" class="use-template-btn">Use Template</a>
</div>
</div>
</div>
`).join('');
} catch (err) {
document.getElementById('templates-grid').innerHTML = '<div style="color:red; text-align:center;">Failed to load templates</div>';
}
}
loadTemplates();
</script>
</body>
</html>