-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
240 lines (205 loc) · 12.5 KB
/
index.html
File metadata and controls
240 lines (205 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SocialProof — Collect & Display Testimonials</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --bg: #fafafa; --surface: #ffffff; --text: #18181b; --text2: #71717a; --accent: #2563eb; --green: #16a34a; --border: #e4e4e7; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }
.container { max-width: 800px; margin: 0 auto; padding: 32px 20px; }
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 8px; }
.hero p { color: var(--text2); font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; }
.form-group textarea { height: 100px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.stars { display: flex; gap: 4px; margin-bottom: 16px; }
.star { font-size: 28px; cursor: pointer; color: #d4d4d8; transition: color 0.15s; }
.star.active, .star:hover { color: #facc15; }
.btn { padding: 12px 24px; border-radius: 10px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.9; }
.testimonial-wall { margin-top: 32px; }
.testimonial-wall h2 { font-size: 24px; margin-bottom: 20px; text-align: center; }
.testimonial-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.testimonial-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 18px; }
.testimonial-name { font-weight: 600; }
.testimonial-role { font-size: 13px; color: var(--text2); }
.testimonial-stars { color: #facc15; margin-bottom: 8px; }
.testimonial-text { font-size: 15px; line-height: 1.6; color: #3f3f46; }
.testimonial-date { font-size: 12px; color: var(--text2); margin-top: 8px; }
.widget-preview { background: #f4f4f5; border-radius: 12px; padding: 20px; margin-top: 24px; }
.widget-preview h3 { margin-bottom: 12px; }
.embed-code { background: #18181b; color: #a1a1aa; padding: 12px; border-radius: 8px; font-family: monospace; font-size: 12px; overflow-x: auto; white-space: pre; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { text-align: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text2); }
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tab { flex: 1; padding: 10px; text-align: center; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.15s; }
.tab.active { background: var(--accent); color: white; }
.tab:hover:not(.active) { background: #f4f4f5; }
.success-msg { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 16px; border-radius: 10px; text-align: center; margin-bottom: 20px; display: none; }
</style>
</head>
<body>
<div class="container">
<div class="hero">
<h1>⭐ SocialProof</h1>
<p>Collect testimonials from your clients. Display them beautifully. Build trust instantly.</p>
</div>
<div class="tab-bar">
<div class="tab active" onclick="showTab('collect')">✍️ Collect</div>
<div class="tab" onclick="showTab('display')">🖼️ Display</div>
<div class="tab" onclick="showTab('widget')">📋 Embed</div>
</div>
<!-- Collect Tab -->
<div id="tab-collect">
<div class="success-msg" id="success-msg">✅ Testimonial submitted successfully! It will appear on your wall.</div>
<div class="card">
<h3 style="margin-bottom:16px;">Leave a Testimonial</h3>
<div class="form-group">
<label>Your Name</label>
<input type="text" id="t-name" placeholder="Jane Smith">
</div>
<div class="form-group">
<label>Your Role / Company</label>
<input type="text" id="t-role" placeholder="CEO at Acme Corp">
</div>
<div class="form-group">
<label>Rating</label>
<div class="stars" id="star-rating">
<span class="star" data-value="1">★</span>
<span class="star" data-value="2">★</span>
<span class="star" data-value="3">★</span>
<span class="star" data-value="4">★</span>
<span class="star" data-value="5">★</span>
</div>
</div>
<div class="form-group">
<label>Your Testimonial</label>
<textarea id="t-text" placeholder="Share your experience... What problem did this solve? What results did you get?"></textarea>
</div>
<button class="btn btn-primary" onclick="submitTestimonial()">Submit Testimonial</button>
</div>
<div class="card">
<h3 style="margin-bottom:12px;">📤 Share This Link</h3>
<p style="color:var(--text2);font-size:14px;margin-bottom:12px;">Send this page to your clients to collect testimonials:</p>
<input type="text" readonly value="https://yourdomain.com/testimonial" style="width:100%;padding:10px;border:1px solid var(--border);border-radius:8px;font-size:13px;background:#f4f4f5;">
</div>
</div>
<!-- Display Tab -->
<div id="tab-display" style="display:none;">
<div class="stats">
<div class="stat"><div class="stat-value" id="stat-count">0</div><div class="stat-label">Testimonials</div></div>
<div class="stat"><div class="stat-value" id="stat-avg">0</div><div class="stat-label">Avg Rating</div></div>
<div class="stat"><div class="stat-value" id="stat-5star">0</div><div class="stat-label">5-Star Reviews</div></div>
</div>
<div class="testimonial-wall" id="testimonial-wall">
<h2>What Our Clients Say</h2>
<div id="testimonials-list"></div>
</div>
</div>
<!-- Widget Tab -->
<div id="tab-widget" style="display:none;">
<div class="card">
<h3 style="margin-bottom:12px;">📋 Embed Widget</h3>
<p style="color:var(--text2);font-size:14px;margin-bottom:16px;">Copy this code and paste it into your website:</p>
<div class="embed-code" id="embed-code"><!-- SocialProof Widget -->
<div id="socialproof-wall">
<script src="https://yourdomain.com/widget.js"></script>
</div></div>
<button class="btn btn-primary" style="margin-top:12px;" onclick="copyEmbed()">📋 Copy Embed Code</button>
</div>
<div class="widget-preview">
<h3>Preview</h3>
<div id="widget-preview-content"></div>
</div>
</div>
</div>
<script>
let testimonials = JSON.parse(localStorage.getItem('socialproof_testimonials') || '[]');
let selectedRating = 0;
// Star rating
document.querySelectorAll('.star').forEach(star => {
star.addEventListener('click', () => {
selectedRating = parseInt(star.dataset.value);
document.querySelectorAll('.star').forEach(s => {
s.classList.toggle('active', parseInt(s.dataset.value) <= selectedRating);
});
});
});
function submitTestimonial() {
const name = document.getElementById('t-name').value.trim();
const role = document.getElementById('t-role').value.trim();
const text = document.getElementById('t-text').value.trim();
if (!name || !text || !selectedRating) {
alert('Please fill in your name, rating, and testimonial.');
return;
}
testimonials.unshift({
id: Date.now(),
name,
role,
rating: selectedRating,
text,
date: new Date().toISOString().split('T')[0]
});
localStorage.setItem('socialproof_testimonials', JSON.stringify(testimonials));
document.getElementById('t-name').value = '';
document.getElementById('t-role').value = '';
document.getElementById('t-text').value = '';
selectedRating = 0;
document.querySelectorAll('.star').forEach(s => s.classList.remove('active'));
document.getElementById('success-msg').style.display = 'block';
setTimeout(() => document.getElementById('success-msg').style.display = 'none', 3000);
renderTestimonials();
updateStats();
}
function renderTestimonials() {
const list = document.getElementById('testimonials-list');
list.innerHTML = testimonials.map(t => `
<div class="testimonial-card">
<div class="testimonial-header">
<div class="avatar">${t.name.charAt(0)}</div>
<div>
<div class="testimonial-name">${t.name}</div>
<div class="testimonial-role">${t.role || ''}</div>
</div>
</div>
<div class="testimonial-stars">${'★'.repeat(t.rating)}${'☆'.repeat(5-t.rating)}</div>
<div class="testimonial-text">"${t.text}"</div>
<div class="testimonial-date">${t.date}</div>
</div>
`).join('');
// Widget preview
document.getElementById('widget-preview-content').innerHTML = list.innerHTML;
}
function updateStats() {
document.getElementById('stat-count').textContent = testimonials.length;
document.getElementById('stat-avg').textContent = testimonials.length ? (testimonials.reduce((s,t)=>s+t.rating,0)/testimonials.length).toFixed(1) : '0';
document.getElementById('stat-5star').textContent = testimonials.filter(t=>t.rating===5).length;
}
function showTab(tab) {
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
event.target.classList.add('active');
document.getElementById('tab-collect').style.display = tab === 'collect' ? '' : 'none';
document.getElementById('tab-display').style.display = tab === 'display' ? '' : 'none';
document.getElementById('tab-widget').style.display = tab === 'widget' ? '' : 'none';
}
function copyEmbed() {
navigator.clipboard.writeText(document.getElementById('embed-code').textContent);
alert('Embed code copied!');
}
// Init
renderTestimonials();
updateStats();
</script>
</body>
</html>