-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.html
More file actions
499 lines (479 loc) · 18.9 KB
/
app.html
File metadata and controls
499 lines (479 loc) · 18.9 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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="PantryClean Recipe Normalizer - Transform messy recipe text into clean, structured ingredients."
/>
<title>Recipe Normalizer | PantryClean</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body class="app-page">
<!-- Navigation -->
<nav class="navbar" role="navigation" aria-label="Main navigation">
<div class="container nav-container">
<a href="index.html" class="logo" aria-label="PantryClean Home">
<!-- Leaf/Kitchen Icon SVG -->
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
aria-hidden="true"
>
<circle
cx="16"
cy="16"
r="14"
stroke="currentColor"
stroke-width="2"
/>
<path
d="M10 16c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
<path
d="M16 10v12M12 14l4-4 4 4"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<span>PantryClean</span>
</a>
<div class="nav-links">
<a href="index.html">Home</a>
</div>
<button
class="mobile-menu-btn"
aria-label="Toggle menu"
aria-expanded="false"
onclick="document.getElementById('mobileMenu').classList.toggle('active'); this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') === 'true' ? 'false' : 'true');"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
>
<path d="M3 12h18M3 6h18M3 18h18" stroke-linecap="round" />
</svg>
</button>
</div>
</nav>
<!-- Mobile Menu -->
<div
class="mobile-menu"
id="mobileMenu"
role="dialog"
aria-label="Mobile navigation"
>
<a href="index.html">Home</a>
</div>
<main id="main-content" class="app-main">
<!-- App Section -->
<section class="app-section-full">
<div class="container">
<div class="app-header">
<h1>Recipe Normalizer</h1>
<div class="app-controls">
<button class="btn btn-ghost btn-sm" id="manageCorrectionsBtn">Corrections</button>
<button class="btn btn-ghost btn-sm" id="settingsBtn">⚙️ Settings</button>
</div>
</div>
<div class="app-grid">
<!-- Input Panel (Top Left - Wide & Short) -->
<div class="input-panel">
<div class="panel-header">
<h3>Paste Ingredients</h3>
<select id="sampleSelect" class="sample-select">
<option value="">Load Sample...</option>
<option value="pancakes">Pancakes</option>
<option value="coriander-chutney">Coriander Chutney</option>
<option value="masala-egg-curry">Masala Egg Curry</option>
</select>
</div>
<textarea
id="recipeInput"
class="recipe-textarea"
placeholder="2 tbsp olive oil 1 small onion, chopped ½ cup milk 3 garlic cloves"
></textarea>
<div class="input-actions">
<button class="btn btn-primary" id="parseBtn">Parse Ingredients</button>
</div>
</div>
<!-- Alternatives Panel (Top Right) -->
<div class="alternatives-panel">
<h3>Healthier Alternatives</h3>
<div class="alt-list" id="alternativesList">
<div class="alt-empty">Parse ingredients to see healthier alternatives</div>
</div>
</div>
<!-- Notes Panel (Bottom Right) -->
<div class="notes-panel">
<h3>Notes</h3>
<textarea
id="recipeNotes"
class="notes-textarea"
placeholder="Add your notes here... These will be included in CSV/JSON exports."
></textarea>
</div>
<!-- Results Panel (Bottom Left) -->
<div class="results-panel">
<div class="panel-header">
<h3>Parsed Results</h3>
<div class="export-buttons">
<button class="btn btn-sm btn-ghost" id="exportJsonBtn" disabled>JSON</button>
<button class="btn btn-sm btn-ghost" id="exportCsvBtn" disabled>CSV</button>
<button class="btn btn-sm btn-ghost" id="copyClipboardBtn" disabled>Copy</button>
</div>
</div>
<div class="results-container" id="resultsContainer">
<div class="empty-state">
<svg width="48" height="48" viewBox="0 0 64 64" fill="none">
<rect x="8" y="8" width="48" height="48" rx="8" stroke="currentColor" stroke-width="2" stroke-dasharray="4 4"/>
<path d="M24 32h16M32 24v16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
<p>Parse ingredients to see results</p>
</div>
</div>
<div class="results-legend">
<span class="legend-item">⚠️ Needs Review</span>
<span class="legend-item">🔁 Auto-corrected</span>
</div>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="footer app-footer">
<div class="container">
<div class="footer-content">
<p class="privacy-note">
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
>
<rect
x="3"
y="7"
width="10"
height="7"
rx="1"
stroke="currentColor"
stroke-width="1.5"
/>
<path
d="M5 7V5a3 3 0 116 0v2"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
/>
</svg>
No data leaves your browser — everything stored locally.
</p>
</div>
</div>
</footer>
<!-- Editor Modal -->
<div
class="modal-overlay"
id="editorModal"
role="dialog"
aria-modal="true"
aria-labelledby="editorModalTitle"
hidden
>
<div class="modal">
<div class="modal-header">
<h3 id="editorModalTitle">Edit Ingredient</h3>
<button
class="modal-close"
aria-label="Close dialog"
id="closeEditorModal"
>
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
<path
d="M5 5l10 10M15 5L5 15"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
</div>
<div class="modal-body">
<div class="editor-original">
<label>Original Text</label>
<p id="editorOriginalText"></p>
</div>
<div class="editor-parsed">
<label>Current Parsing</label>
<div class="parsed-preview" id="editorParsedPreview"></div>
</div>
<div class="editor-reason">
<label>Ambiguity Reason</label>
<p id="editorAmbiguityReason"></p>
</div>
<div class="editor-suggestions" id="editorSuggestions">
<label>Suggested Corrections</label>
<div class="suggestion-list" id="suggestionList"></div>
</div>
<div class="editor-custom">
<label>Or Enter Custom Value</label>
<div class="custom-inputs">
<input
type="number"
id="customQuantity"
placeholder="Quantity"
step="any"
aria-label="Custom quantity"
/>
<select id="customUnit" aria-label="Custom unit">
<option value="">Select unit...</option>
<optgroup label="Weight">
<option value="g">grams (g)</option>
<option value="kg">kilograms (kg)</option>
<option value="oz">ounces (oz)</option>
<option value="lb">pounds (lb)</option>
</optgroup>
<optgroup label="Volume">
<option value="ml">milliliters (ml)</option>
<option value="liter">liters (L)</option>
<option value="cup">cup</option>
<option value="tablespoon">tablespoon</option>
<option value="teaspoon">teaspoon</option>
</optgroup>
<optgroup label="Count">
<option value="piece">piece</option>
<option value="clove">clove</option>
<option value="bunch">bunch</option>
<option value="pinch">pinch</option>
<option value="dash">dash</option>
<option value="slice">slice</option>
<option value="sprig">sprig</option>
</optgroup>
</select>
</div>
<input
type="text"
id="customNote"
placeholder="Note (optional)"
aria-label="Custom note"
/>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-ghost" id="dismissEditorBtn">Dismiss</button>
<button class="btn btn-primary" id="saveCorrectionBtn">
Save Correction
</button>
</div>
</div>
</div>
<!-- Manage Corrections Modal -->
<div
class="modal-overlay"
id="correctionsModal"
role="dialog"
aria-modal="true"
aria-labelledby="correctionsModalTitle"
hidden
>
<div class="modal modal-lg">
<div class="modal-header">
<h3 id="correctionsModalTitle">Manage Saved Corrections</h3>
<button
class="modal-close"
aria-label="Close dialog"
id="closeCorrectionsModal"
>
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
<path
d="M5 5l10 10M15 5L5 15"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
</div>
<div class="modal-body">
<p class="corrections-info">
These corrections are automatically applied when parsing new
recipes. Press <kbd>E</kbd> while focused in the app to open this
panel.
</p>
<div class="corrections-list" id="correctionsList">
<!-- Populated by JS -->
</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger" id="clearAllCorrectionsBtn">
Clear All
</button>
<button class="btn btn-ghost" id="closeCorrectionsModalBtn">
Close
</button>
</div>
</div>
</div>
<!-- Settings Modal -->
<div
class="modal-overlay"
id="settingsModal"
role="dialog"
aria-modal="true"
aria-labelledby="settingsModalTitle"
hidden
>
<div class="modal modal-lg">
<div class="modal-header">
<h3 id="settingsModalTitle">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true" style="vertical-align: middle; margin-right: 8px;">
<path d="M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z" stroke="currentColor" stroke-width="1.5"/>
<path d="M16.3 8.2l-1-.6c-.1-.3-.2-.7-.4-1l.3-1.1c.1-.3 0-.7-.2-.9l-1.1-1.1c-.2-.2-.6-.3-.9-.2l-1.1.3c-.3-.2-.7-.3-1-.4l-.6-1c-.1-.3-.4-.5-.8-.5H8c-.4 0-.7.2-.8.5l-.6 1c-.3.1-.7.2-1 .4l-1.1-.3c-.3-.1-.7 0-.9.2L2.5 5.6c-.2.2-.3.6-.2.9l.3 1.1c-.2.3-.3.7-.4 1l-1 .6c-.3.1-.5.4-.5.8v1.6c0 .4.2.7.5.8l1 .6c.1.3.2.7.4 1l-.3 1.1c-.1.3 0 .7.2.9l1.1 1.1c.2.2.6.3.9.2l1.1-.3c.3.2.7.3 1 .4l.6 1c.1.3.4.5.8.5h1.6c.4 0 .7-.2.8-.5l.6-1c.3-.1.7-.2 1-.4l1.1.3c.3.1.7 0 .9-.2l1.1-1.1c.2-.2.3-.6.2-.9l-.3-1.1c.2-.3.3-.7.4-1l1-.6c.3-.1.5-.4.5-.8V9c0-.4-.2-.7-.5-.8z" stroke="currentColor" stroke-width="1.5"/>
</svg>
Unit Settings
</h3>
<button
class="modal-close"
aria-label="Close dialog"
id="closeSettingsModal"
>
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
<path
d="M5 5l10 10M15 5L5 15"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
</div>
<div class="modal-body">
<p class="settings-info">
Configure your preferred units for parsing recipes. These settings will be applied to all future parsed ingredients.
</p>
<!-- Default Unit System -->
<div class="settings-section">
<h4 class="settings-section-title">Default Unit System</h4>
<p class="settings-section-desc">Choose your preferred measurement system</p>
<div class="settings-toggle-group">
<label class="settings-radio-card">
<input type="radio" name="defaultSystem" value="metric" checked>
<span class="radio-card-content">
<span class="radio-card-icon">📏</span>
<span class="radio-card-label">Metric</span>
<span class="radio-card-desc">grams, ml, liters</span>
</span>
</label>
<label class="settings-radio-card">
<input type="radio" name="defaultSystem" value="imperial">
<span class="radio-card-content">
<span class="radio-card-icon">🥄</span>
<span class="radio-card-label">Imperial</span>
<span class="radio-card-desc">cups, oz, tablespoons</span>
</span>
</label>
</div>
</div>
<!-- Volume Unit Preferences -->
<div class="settings-section">
<h4 class="settings-section-title">Preferred Volume Unit</h4>
<p class="settings-section-desc">Default unit for liquid measurements</p>
<div class="settings-select-row">
<select id="preferredVolumeUnit" class="settings-select">
<option value="ml">Milliliters (ml)</option>
<option value="liter">Liters (L)</option>
<option value="cup">Cups</option>
<option value="tablespoon">Tablespoons (tbsp)</option>
<option value="teaspoon">Teaspoons (tsp)</option>
<option value="fl oz">Fluid Ounces (fl oz)</option>
</select>
</div>
</div>
<!-- Weight Unit Preferences -->
<div class="settings-section">
<h4 class="settings-section-title">Preferred Weight Unit</h4>
<p class="settings-section-desc">Default unit for solid measurements</p>
<div class="settings-select-row">
<select id="preferredWeightUnit" class="settings-select">
<option value="g">Grams (g)</option>
<option value="kg">Kilograms (kg)</option>
<option value="oz">Ounces (oz)</option>
<option value="lb">Pounds (lb)</option>
</select>
</div>
</div>
<!-- Decimal Precision -->
<div class="settings-section">
<h4 class="settings-section-title">Decimal Precision</h4>
<p class="settings-section-desc">Number of decimal places for quantities</p>
<div class="settings-select-row">
<select id="decimalPrecision" class="settings-select">
<option value="0">Whole numbers (0)</option>
<option value="1">1 decimal place</option>
<option value="2" selected>2 decimal places</option>
<option value="3">3 decimal places</option>
</select>
</div>
</div>
<!-- Small Quantity Handling -->
<div class="settings-section">
<h4 class="settings-section-title">Small Quantity Display</h4>
<p class="settings-section-desc">How to display small volume amounts (less than 15ml)</p>
<div class="settings-select-row">
<select id="smallQuantityUnit" class="settings-select">
<option value="teaspoon">Teaspoons (tsp)</option>
<option value="tablespoon">Tablespoons (tbsp)</option>
<option value="ml">Keep as ml</option>
</select>
</div>
</div>
<!-- Reset to Defaults -->
<div class="settings-section settings-reset">
<button class="btn btn-ghost" id="resetSettingsBtn" type="button">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M2 8a6 6 0 1111.5 2.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
<path d="M2 4v4h4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Reset to Defaults
</button>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-ghost" id="cancelSettingsBtn">Cancel</button>
<button class="btn btn-primary" id="saveSettingsBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M3 8l3 3 7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Save Settings
</button>
</div>
</div>
</div>
<!-- Toast Notification -->
<div class="toast" id="toast" role="alert" aria-live="polite" hidden>
<span class="toast-icon" aria-hidden="true">✓</span>
<span class="toast-message" id="toastMessage"></span>
</div>
<!-- Theme Toggle Script -->
<script>
// Always use light theme for app page
document.documentElement.setAttribute('data-theme', 'light');
</script>
<script src="app.js"></script>
</body>
</html>