-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidepanel.html
More file actions
446 lines (413 loc) · 23.6 KB
/
Copy pathsidepanel.html
File metadata and controls
446 lines (413 loc) · 23.6 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="sidepanel.css" />
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="sidepanel-body">
<!-- Header -->
<header class="sidepanel-header">
<div class="header-content">
<div class="logo-section">
<img src="logo.png" alt="Readify Logo" class="sidepanel-logo" />
<h1 class="sidepanel-title">Readify</h1>
</div>
</div>
</header>
<!-- Auth Section (collapsible, shown when not logged in) -->
<section class="control-section auth-control-section" id="authSection" style="display: none;">
<div class="section-header">
<h2 class="section-title">👤 Account</h2>
</div>
<!-- Google Sign-In Button -->
<button class="google-signin-btn" id="googleSigninBtn">
<svg class="google-icon" viewBox="0 0 24 24" width="18" height="18">
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
</svg>
<span>Continue with Google</span>
</button>
<div class="auth-divider">
<span>or</span>
</div>
<div class="auth-buttons">
<button class="auth-toggle-btn" id="showSigninBtn">Sign In</button>
<button class="auth-toggle-btn secondary" id="showSignupBtn">Sign Up</button>
</div>
<!-- Collapsible Forms Container -->
<div class="auth-forms-container" id="authFormsContainer" style="display: none;">
<!-- Sign In Form -->
<div class="auth-form" id="signinForm">
<div class="form-group">
<label for="signinEmail">Email</label>
<input type="email" id="signinEmail" placeholder="you@example.com" />
</div>
<div class="form-group">
<label for="signinPassword">Password</label>
<input type="password" id="signinPassword" placeholder="••••••••" />
</div>
<button class="auth-submit-btn" id="signinBtn">Sign In</button>
<div class="auth-message" id="signinMessage"></div>
<button class="forgot-password-btn" id="forgotPasswordBtn">Forgot Password?</button>
</div>
<!-- Sign Up Form -->
<div class="auth-form" id="signupForm" style="display: none;">
<div class="form-group">
<label for="signupEmail">Email</label>
<input type="email" id="signupEmail" placeholder="you@example.com" />
</div>
<div class="form-group">
<label for="signupPassword">Password</label>
<input type="password" id="signupPassword" placeholder="••••••••" />
</div>
<div class="form-group">
<label for="signupConfirmPassword">Confirm Password</label>
<input type="password" id="signupConfirmPassword" placeholder="••••••••" />
</div>
<button class="auth-submit-btn" id="signupBtn">Create Account</button>
<div class="auth-message" id="signupMessage"></div>
</div>
</div>
</section>
<!-- Premium Banner (shown for free users) -->
<section class="premium-banner" id="premiumBanner" style="display: none;">
<div class="premium-content">
<span class="premium-icon">✨</span>
<div class="premium-text">
<strong>Upgrade to Premium</strong>
<small>Unlimited sites, AI features, cloud sync</small>
</div>
<button class="premium-cta" id="premiumCta">$4.99/mo</button>
</div>
</section>
<!-- Main Content -->
<main class="sidepanel-main">
<!-- Line Height Controls -->
<section class="control-section">
<div class="section-header">
<h2 class="section-title">📏 Line Height</h2>
</div>
<div class="button-group">
<button id="decrease" class="control-button secondary">
<span class="button-icon">Aa-</span>
<span class="button-label">Decrease</span>
</button>
<button id="increase" class="control-button primary">
<span class="button-icon">Aa+</span>
<span class="button-label">Increase</span>
</button>
</div>
</section>
<!-- Study Mode Toggle -->
<section class="control-section">
<div class="section-header">
<h2 class="section-title">🎯 Study Mode</h2>
</div>
<div class="toggle-container">
<label class="modern-toggle study-toggle" for="enableCheckbox">
<input type="checkbox" id="enableCheckbox" />
<span class="toggle-slider"></span>
<span class="toggle-text">Enable Study Mode</span>
</label>
</div>
</section>
<!-- AI Chat Button -->
<section class="control-section">
<div class="section-header">
<h2 class="section-title">🤖 AI Chat</h2>
</div>
<button id="openChatBtn" class="control-button primary chat-button">
<span class="button-icon">💬</span>
<span class="button-label">Chat about this page</span>
</button>
<p class="chat-description">Have a conversation about this webpage</p>
</section>
<!-- My Sites -->
<section class="control-section">
<div class="section-header">
<h2 class="section-title">🌐 My Sites <span class="limit-counter" id="limitCounter">(0/5)</span></h2>
</div>
<div class="sites-container">
<div class="sites-list" id="sitesList">
<div class="empty-sites">
<p>No saved sites yet</p>
<small>Your highlighted and noted websites will appear here</small>
</div>
</div>
</div>
</section>
<!-- Delete Changes (shown only when there are sites) -->
<section class="control-section" id="deleteChangesSection" style="display: none;">
<div class="danger-zone">
<button id="deleteChangesButton" class="control-button danger">
<span class="button-icon">🗑️</span>
<span class="button-label">Clear This Page's Data</span>
</button>
</div>
</section>
<!-- User Profile Section (always visible when logged in) -->
<section class="user-profile-section" id="userProfileSection" style="display: none;">
<div class="user-info">
<div class="user-avatar">👤</div>
<div class="user-details">
<div class="user-email" id="userEmail">user@example.com</div>
<div class="user-plan" id="userPlan">
<span class="plan-badge free">Free Plan</span>
</div>
</div>
</div>
<!-- Token Usage Stats (Per-Feature) -->
<div class="usage-stats-section" id="usageStatsSection">
<div class="usage-stats-header">
<span class="usage-stats-title">AI Usage</span>
<span class="usage-stats-reset" id="usageResetDate">Resets Jan 1</span>
</div>
<!-- Chat Usage -->
<div class="usage-feature-row" id="usageChatRow">
<div class="usage-feature-label">
<span class="feature-icon">💬</span>
<span class="feature-name">Chat</span>
</div>
<div class="usage-feature-bar-wrap">
<div class="usage-feature-bar">
<div class="usage-feature-fill" id="usageChatFill"></div>
</div>
<span class="usage-feature-text" id="usageChatText">0 / 50k</span>
</div>
</div>
<!-- TTS Usage -->
<div class="usage-feature-row" id="usageTTSRow">
<div class="usage-feature-label">
<span class="feature-icon">🔊</span>
<span class="feature-name">TTS</span>
</div>
<div class="usage-feature-bar-wrap">
<div class="usage-feature-bar">
<div class="usage-feature-fill" id="usageTTSFill"></div>
</div>
<span class="usage-feature-text" id="usageTTSText">0 / 10k</span>
</div>
</div>
<!-- Realtime Voice Usage -->
<div class="usage-feature-row" id="usageRealtimeRow">
<div class="usage-feature-label">
<span class="feature-icon">🎙️</span>
<span class="feature-name">Voice</span>
</div>
<div class="usage-feature-bar-wrap">
<div class="usage-feature-bar">
<div class="usage-feature-fill" id="usageRealtimeFill"></div>
</div>
<span class="usage-feature-text" id="usageRealtimeText">0 / 3k</span>
</div>
</div>
<div class="usage-stats-tier" id="usageStatsTier">
<span class="tier-label">Free tier</span>
<span class="tier-upgrade" id="usageTierUpgrade">Upgrade for more</span>
</div>
</div>
<div class="user-actions">
<button class="upgrade-btn" id="upgradeBtn" style="display: none;">
✨ Upgrade to Premium
</button>
<button class="cancel-sub-btn" id="cancelSubBtn" style="display: none;">
Cancel Subscription
</button>
<button class="sub-ending-btn" id="subEndingBtn" style="display: none;" disabled>
Ends on ...
</button>
<button class="signout-btn" id="signoutBtn">Sign Out</button>
</div>
</section>
<!-- Voice Settings Section (shown when logged in) -->
<section class="voice-settings-section" id="voiceSettingsSection" style="display: none;">
<div class="voice-settings-header">
<span class="voice-settings-icon">🔊</span>
<span class="voice-settings-title">TTS Voice</span>
</div>
<div class="voice-selector-container">
<select id="voiceSelector" class="voice-selector">
<option value="nova">Nova - Warm & Natural</option>
<option value="alloy">Alloy - Neutral & Balanced</option>
<option value="echo">Echo - Warm Male</option>
<option value="fable">Fable - British Accent</option>
<option value="onyx">Onyx - Deep & Authoritative</option>
<option value="shimmer">Shimmer - Clear & Optimistic</option>
</select>
</div>
</section>
</main>
<!-- Footer -->
<footer class="sidepanel-footer">
<div class="footer-links">
<a href="https://www.readify.ca/faq-s" target="_blank" rel="noopener noreferrer" class="footer-link">FAQ</a>
<a href="https://www.readify.ca/" target="_blank" rel="noopener noreferrer" class="footer-link">Report Issue</a>
<a href="https://www.readify.ca/" target="_blank" rel="noopener noreferrer" class="footer-link">Website</a>
</div>
<div class="footer-image">
<img src="thanks.png" alt="Thanks" class="thanks-image" />
</div>
</footer>
<!-- Confirmation Modal -->
<div class="modal-overlay" id="confirmationModal" style="display: none;">
<div class="modern-modal">
<div class="modal-header">
<h3 class="modal-title">⚠️ Important Notice</h3>
</div>
<div class="modal-body">
<p class="modal-text">This action will delete all your saved notes, highlights, and underlines from the current webpage.</p>
<p><strong>Note:</strong> This action cannot be undone.</p>
</div>
<div class="modal-footer">
<button type="button" class="control-button secondary" id="cancelBtn">Cancel</button>
<button type="button" class="control-button primary" id="confirmBtn">Delete</button>
</div>
</div>
</div>
<!-- Payment Success Modal -->
<div class="modal-overlay" id="paymentSuccessModal" style="display: none;">
<div class="modern-modal success-modal">
<div class="modal-header">
<h3>🎉 Welcome to Premium!</h3>
</div>
<div class="modal-body">
<p>Your subscription is now active. Enjoy unlimited sites, AI features, and cloud sync!</p>
</div>
<div class="modal-footer">
<button type="button" class="control-button primary" id="successOkBtn">Get Started</button>
</div>
</div>
</div>
<!-- Token Limit / Sign In Required Modal -->
<div class="modal-overlay" id="premiumRequiredModal" style="display: none;">
<div class="modern-modal">
<div class="modal-header">
<h3 class="modal-title" id="premiumRequiredTitle">⚡ Token Limit Reached</h3>
</div>
<div class="modal-body">
<p class="modal-text" id="premiumRequiredText">You've used all your free tokens this month. Upgrade to Premium for 500,000 tokens/month!</p>
</div>
<div class="modal-footer" id="premiumRequiredFooter">
<button type="button" class="control-button secondary" id="premiumRequiredCancelBtn">Maybe Later</button>
<button type="button" class="control-button primary" id="premiumRequiredUpgradeBtn">Upgrade Now</button>
</div>
<div class="modal-footer" id="premiumRequiredCloseFooter" style="display: none;">
<button type="button" class="control-button secondary" id="premiumRequiredCloseBtn">Close</button>
</div>
</div>
</div>
<!-- Cancel Subscription Modal -->
<div class="modal-overlay" id="cancelSubModal" style="display: none;">
<div class="modern-modal">
<!-- Confirmation State -->
<div id="cancelSubConfirmState">
<div class="modal-header">
<h3 class="modal-title">⚠️ Cancel Subscription</h3>
</div>
<div class="modal-body">
<p class="modal-text">You'll keep Premium access until your billing period ends.</p>
</div>
<div class="modal-footer">
<button type="button" class="control-button secondary" id="cancelSubCancelBtn">Keep Premium</button>
<button type="button" class="control-button danger" id="cancelSubConfirmBtn">Cancel</button>
</div>
</div>
<!-- Success State -->
<div id="cancelSubSuccessState" style="display: none;">
<div class="modal-header">
<h3 class="modal-title">✓ Subscription Cancelled</h3>
</div>
<div class="modal-body">
<p class="modal-text" id="cancelSuccessMessage">Your Premium access will end on your billing date.</p>
</div>
<div class="modal-footer">
<button type="button" class="control-button primary" id="cancelSubDoneBtn">Done</button>
</div>
</div>
</div>
</div>
<!-- AI Chat Panel (slides in from right) -->
<div id="chatPanel" class="chat-panel">
<div class="chat-panel-header">
<button id="chatBackBtn" class="chat-back-btn">
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M11.17,10.23a33.37,33.37,0,0,0-3.05,3.13c-.51.62-1.28,1.3-1.21,2.17s.81,1.24,1.35,1.76a16.3,16.3,0,0,1,2.57,3.17c.86,1.36,3,.11,2.16-1.26a21.06,21.06,0,0,0-1.82-2.48A16.16,16.16,0,0,0,10,15.52c-.22-.21-.86-1.14-.68-.49l-.13,1a17.85,17.85,0,0,1,3.72-4c1.19-1.08-.58-2.85-1.77-1.76Z"/><path d="M9.4,17a109.13,109.13,0,0,0,12.53-.1c1.59-.11,1.61-2.61,0-2.5a109.13,109.13,0,0,1-12.53.1c-1.61-.07-1.6,2.43,0,2.5Z"/></svg>
</button>
<div class="chat-header-title" id="chatHeaderTitle">
<span class="chat-header-page-title"></span>
</div>
</div>
<!-- Voice Overlay -->
<div id="voiceOverlay" class="voice-overlay">
<div class="voice-circle">
<div class="voice-pulse voice-pulse-1"></div>
<div class="voice-pulse voice-pulse-2"></div>
<div class="voice-ball">
<div class="voice-waveform-inner" id="voiceWaveform">
<span></span><span></span><span></span><span></span><span></span>
</div>
</div>
</div>
<div class="voice-text" id="voiceText">Listening...</div>
<div class="voice-subtext">Speak naturally. Tap to stop.</div>
<!-- Voice Usage Meter -->
<div class="voice-usage-meter" id="voiceUsageMeter">
<div class="voice-usage-bar">
<div class="voice-usage-fill" id="voiceUsageFill"></div>
</div>
<span class="voice-usage-text" id="voiceUsageText">0 / 3k voice tokens</span>
</div>
<button id="voiceStopBtn" class="voice-stop-btn">✕</button>
</div>
<div id="chatMessages" class="chat-messages">
<div class="chat-welcome" id="chatWelcome">
<div class="chat-welcome-icon">💬</div>
<div class="chat-welcome-title">Chat about this page</div>
<div class="chat-welcome-text" id="chatWelcomeText">
Ask me anything about the current page!
</div>
<div class="chat-suggestions">
<button class="chat-suggestion" data-prompt="Summarize this page">📝 Summarize</button>
<button class="chat-suggestion" data-prompt="What are the key points?">🎯 Key points</button>
<button class="chat-suggestion" data-prompt="Explain this in simple terms">💡 Simplify</button>
</div>
</div>
</div>
<div class="chat-input-wrapper">
<div class="chat-input-container" id="chatInputContainer">
<textarea id="chatInput" class="chat-input" placeholder="Ask anything" rows="1" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off"></textarea>
<div class="chat-input-actions">
<button id="chatVoiceBtn" class="chat-composer-btn" title="Voice Chat">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>
</button>
<button id="chatSendBtn" class="chat-submit-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
</button>
</div>
</div>
</div>
</div>
<!-- Load scripts -->
<script src="lib/supabase.min.js"></script>
<script src="config.js"></script>
<script src="services/supabase-client.js"></script>
<script src="services/auth-service.js"></script>
<script src="services/subscription-service.js"></script>
<script src="services/stripe-service.js"></script>
<script src="services/chat-service.js"></script>
<script src="services/voice-service.js"></script>
<script src="services/usage-service.js"></script>
<!-- Sidepanel modules -->
<script src="sidepanel-modules/auth-ui.js"></script>
<script src="sidepanel-modules/auth-handlers.js"></script>
<script src="sidepanel-modules/subscription-ui.js"></script>
<script src="sidepanel-modules/sites-manager.js"></script>
<script src="sidepanel-modules/limits.js"></script>
<script src="sidepanel-modules/study-mode.js"></script>
<script src="sidepanel-modules/chat-ui.js"></script>
<script src="sidepanel-modules/main.js"></script>
</body>
</html>