commit 240daf440ccb219711750ee49d6620d87f9281ad
Author: root <root@hub.scroll.pub>
Date: 2024-12-28 20:42:51 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..94ca05c
--- /dev/null
+++ b/body.html
@@ -0,0 +1,63 @@
+<header>
+ <h1>Recipe Cost Calculator</h1>
+ <p>Calculate exact costs for your recipes</p>
+</header>
+
+<main>
+ <section class="input-section">
+ <h2>Add Ingredients</h2>
+ <form id="ingredient-form">
+ <div class="form-grid">
+ <input type="text" id="ingredient-name" placeholder="Ingredient name" required aria-label="Ingredient name">
+ <input type="number" id="ingredient-cost" placeholder="Cost ($)" step="0.01" min="0" required aria-label="Ingredient cost">
+ <input type="number" id="ingredient-quantity" placeholder="Quantity" step="0.01" min="0" required aria-label="Ingredient quantity">
+ <select id="ingredient-unit" required aria-label="Unit of measurement">
+ <option value="">Select unit</option>
+ <option value="g">Grams</option>
+ <option value="kg">Kilograms</option>
+ <option value="ml">Milliliters</option>
+ <option value="L">Liters</option>
+ <option value="pcs">Pieces</option>
+ </select>
+ <button type="submit" class="add-btn">Add Ingredient</button>
+ </div>
+ </form>
+ </section>
+
+ <section class="results-section">
+ <h2>Recipe Ingredients</h2>
+ <div class="table-container">
+ <table id="ingredients-table">
+ <thead>
+ <tr>
+ <th>Ingredient</th>
+ <th>Quantity</th>
+ <th>Unit Cost</th>
+ <th>Total Cost</th>
+ <th>Action</th>
+ </tr>
+ </thead>
+ <tbody id="ingredients-list"></tbody>
+ </table>
+ </div>
+
+ <div class="totals">
+ <div class="total-cost">
+ <h3>Total Recipe Cost</h3>
+ <p id="total-cost">$0.00</p>
+ </div>
+ <div class="servings">
+ <label for="servings">Number of Servings:</label>
+ <input type="number" id="servings" value="1" min="1" step="1">
+ </div>
+ <div class="cost-per-serving">
+ <h3>Cost per Serving</h3>
+ <p id="cost-per-serving">$0.00</p>
+ </div>
+ </div>
+ </section>
+</main>
+
+<footer>
+ <p>Made with love for home cooks and professional chefs</p>
+</footer>
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..2113fee
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,10 @@
+buildHtml
+baseUrl https://recipecost.scroll.pub
+metaTags
+title Recipe Cost Calculator
+description Calculate exact costs for your recipes including total cost and cost per serving
+keywords recipe calculator, cooking cost, recipe costing, ingredient cost calculator
+editButton /edit.html
+style.css
+body.html
+script.js
diff --git a/prompt.json b/prompt.json
new file mode 100644
index 0000000..bdf1ed5
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,20 @@
+{
+ "id": "msg_01CXrvWRwqo5ZgJMWNxZLwJc",
+ "type": "message",
+ "role": "assistant",
+ "model": "claude-3-5-sonnet-20241022",
+ "content": [
+ {
+ "type": "text",
+ "text": "Here's a recipe cost calculator website implementation:\n\n---domain---\nrecipecost.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://recipecost.scroll.pub\nmetaTags\ntitle Recipe Cost Calculator\ndescription Calculate exact costs for your recipes including total cost and cost per serving\nkeywords recipe calculator, cooking cost, recipe costing, ingredient cost calculator\neditButton /edit.html\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n<header>\n <h1>Recipe Cost Calculator</h1>\n <p>Calculate exact costs for your recipes</p>\n</header>\n\n<main>\n <section class=\"input-section\">\n <h2>Add Ingredients</h2>\n <form id=\"ingredient-form\">\n <div class=\"form-grid\">\n <input type=\"text\" id=\"ingredient-name\" placeholder=\"Ingredient name\" required aria-label=\"Ingredient name\">\n <input type=\"number\" id=\"ingredient-cost\" placeholder=\"Cost ($)\" step=\"0.01\" min=\"0\" required aria-label=\"Ingredient cost\">\n <input type=\"number\" id=\"ingredient-quantity\" placeholder=\"Quantity\" step=\"0.01\" min=\"0\" required aria-label=\"Ingredient quantity\">\n <select id=\"ingredient-unit\" required aria-label=\"Unit of measurement\">\n <option value=\"\">Select unit</option>\n <option value=\"g\">Grams</option>\n <option value=\"kg\">Kilograms</option>\n <option value=\"ml\">Milliliters</option>\n <option value=\"L\">Liters</option>\n <option value=\"pcs\">Pieces</option>\n </select>\n <button type=\"submit\" class=\"add-btn\">Add Ingredient</button>\n </div>\n </form>\n </section>\n\n <section class=\"results-section\">\n <h2>Recipe Ingredients</h2>\n <div class=\"table-container\">\n <table id=\"ingredients-table\">\n <thead>\n <tr>\n <th>Ingredient</th>\n <th>Quantity</th>\n <th>Unit Cost</th>\n <th>Total Cost</th>\n <th>Action</th>\n </tr>\n </thead>\n <tbody id=\"ingredients-list\"></tbody>\n </table>\n </div>\n\n <div class=\"totals\">\n <div class=\"total-cost\">\n <h3>Total Recipe Cost</h3>\n <p id=\"total-cost\">$0.00</p>\n </div>\n <div class=\"servings\">\n <label for=\"servings\">Number of Servings:</label>\n <input type=\"number\" id=\"servings\" value=\"1\" min=\"1\" step=\"1\">\n </div>\n <div class=\"cost-per-serving\">\n <h3>Cost per Serving</h3>\n <p id=\"cost-per-serving\">$0.00</p>\n </div>\n </div>\n </section>\n</main>\n\n<footer>\n <p>Made with love for home cooks and professional chefs</p>\n</footer>\n\n---style.css---\n:root {\n --primary-color: #2c3e50;\n --accent-color: #3498db;\n --background-color: #f8f9fa;\n --text-color: #2c3e50;\n --border-radius: 8px;\n --transition: all 0.3s ease;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;\n line-height: 1.6;\n color: var(--text-color);\n background-color: var(--background-color);\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n}\n\nheader {\n background: linear-gradient(135deg, var(--primary-color), var(--accent-color));\n color: white;\n padding: 2rem;\n text-align: center;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n}\n\nheader h1 {\n font-size: 2.5rem;\n margin-bottom: 0.5rem;\n}\n\nmain {\n max-width: 1200px;\n margin: 2rem auto;\n padding: 0 1rem;\n flex: 1;\n}\n\n.input-section {\n background: white;\n padding: 2rem;\n border-radius: var(--border-radius);\n box-shadow: 0 2px 15px rgba(0,0,0,0.05);\n margin-bottom: 2rem;\n}\n\n.form-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n gap: 1rem;\n align-items: end;\n}\n\ninput, select, button {\n padding: 0.8rem;\n border: 2px solid #e0e0e0;\n border-radius: var(--border-radius);\n font-size: 1rem;\n transition: var(--transition);\n}\n\ninput:focus, select:focus {\n border-color: var(--accent-color);\n outline: none;\n}\n\n.add-btn {\n background-color: var(--accent-color);\n color: white;\n border: none;\n cursor: pointer;\n font-weight: 600;\n}\n\n.add-btn:hover {\n background-color: #2980b9;\n transform: translateY(-2px);\n}\n\n.table-container {\n overflow-x: auto;\n background: white;\n border-radius: var(--border-radius);\n box-shadow: 0 2px 15px rgba(0,0,0,0.05);\n}\n\ntable {\n width: 100%;\n border-collapse: collapse;\n}\n\nth, td {\n padding: 1rem;\n text-align: left;\n border-bottom: 1px solid #e0e0e0;\n}\n\nth {\n background-color: #f8f9fa;\n font-weight: 600;\n}\n\n.delete-btn {\n background-color: #e74c3c;\n color: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: var(--border-radius);\n cursor: pointer;\n transition: var(--transition);\n}\n\n.delete-btn:hover {\n background-color: #c0392b;\n}\n\n.totals {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n gap: 2rem;\n margin-top: 2rem;\n text-align: center;\n}\n\n.total-cost, .cost-per-serving {\n background: white;\n padding: 2rem;\n border-radius: var(--border-radius);\n box-shadow: 0 2px 15px rgba(0,0,0,0.05);\n}\n\n.total-cost p, .cost-per-serving p {\n font-size: 2rem;\n font-weight: 600;\n color: var(--accent-color);\n margin-top: 0.5rem;\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n background: white;\n margin-top: auto;\n}\n\n@media (max-width: 768px) {\n header h1 {\n font-size: 2rem;\n }\n \n .form-grid {\n grid-template-columns: 1fr;\n }\n \n .totals {\n grid-template-columns: 1fr;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n const form = document.getElementById('ingredient-form');\n const ingredientsList = document.getElementById('ingredients-list');\n const totalCostElement = document.getElementById('total-cost');\n const servingsInput = document.getElementById('servings');\n const costPerServingElement = document.getElementById('cost-per-serving');\n \n let ingredients = [];\n\n form.addEventListener('submit', (e) => {\n e.preventDefault();\n \n const name = document.getElementById('ingredient-name').value;\n const cost = parseFloat(document.getElementById('ingredient-cost').value);\n const quantity = parseFloat(document.getElementById('ingredient-quantity').value);\n const unit = document.getElementById('ingredient-unit').value;\n\n const ingredient = {\n name,\n cost,\n quantity,\n unit,\n totalCost: cost * quantity\n };\n\n ingredients.push(ingredient);\n updateTable();\n calculateTotals();\n form.reset();\n });\n\n servingsInput.addEventListener('input', calculateTotals);\n\n function updateTable() {\n ingredientsList.innerHTML = '';\n \n ingredients.forEach((ingredient, index) => {\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>${ingredient.name}</td>\n <td>${ingredient.quantity} ${ingredient.unit}</td>\n <td>$${ingredient.cost.toFixed(2)}</td>\n <td>$${ingredient.totalCost.toFixed(2)}</td>\n <td>\n <button class=\"delete-btn\" data-index=\"${index}\">Delete</button>\n </td>\n `;\n ingredientsList.appendChild(row);\n });\n\n // Add delete button listeners\n document.querySelectorAll('.delete-btn').forEach(button => {\n button.addEventListener('click', (e) => {\n const index = parseInt(e.target.dataset.index);\n ingredients.splice(index, 1);\n updateTable();\n calculateTotals();\n });\n });\n }\n\n function calculateTotals() {\n const totalCost = ingredients.reduce((sum, ingredient) => sum + ingredient.totalCost, 0);\n const servings = parseInt(servingsInput.value) || 1;\n const costPerServing = totalCost / servings;\n\n totalCostElement.textContent = `$${totalCost.toFixed(2)}`;\n costPerServingElement.textContent = `$${costPerServing.toFixed(2)}`;\n }\n});\n\n---end---\n\nThis implementation creates a beautiful, responsive recipe cost calculator with the following features:\n\n1. Clean, modern design with smooth animations and transitions\n2. Form to add ingredients with name, cost, quantity, and unit\n3. Interactive table showing all ingredients with delete functionality\n4. Real-time calculation of total recipe cost and cost per serving\n5. Mobile-responsive layout\n6. Accessible form controls and semantic HTML\n7. Professional gradient header\n8. Beautiful card-based design with subtle shadows\n9. Smooth hover effects and interactions\n10. Clear typography and spacing\n\nThe design uses a professional color scheme and follows modern web design principles while remaining clean and functional. It's fully responsive and works well on all device sizes."
+ }
+ ],
+ "stop_reason": "end_turn",
+ "stop_sequence": null,
+ "usage": {
+ "input_tokens": 309,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "output_tokens": 2785
+ }
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..169a762
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# recipecost2.scroll.pub
+Website generated by Claude from prompt: a website to calculate the cost of a recipe given the ingredients' name, cost and quantity. Show the ingredient list in a table format. SHow the Total Recipe Cost and the cost per unit.
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..398b25b
--- /dev/null
+++ b/script.js
@@ -0,0 +1,70 @@
+document.addEventListener('DOMContentLoaded', () => {
+ const form = document.getElementById('ingredient-form');
+ const ingredientsList = document.getElementById('ingredients-list');
+ const totalCostElement = document.getElementById('total-cost');
+ const servingsInput = document.getElementById('servings');
+ const costPerServingElement = document.getElementById('cost-per-serving');
+
+ let ingredients = [];
+
+ form.addEventListener('submit', (e) => {
+ e.preventDefault();
+
+ const name = document.getElementById('ingredient-name').value;
+ const cost = parseFloat(document.getElementById('ingredient-cost').value);
+ const quantity = parseFloat(document.getElementById('ingredient-quantity').value);
+ const unit = document.getElementById('ingredient-unit').value;
+
+ const ingredient = {
+ name,
+ cost,
+ quantity,
+ unit,
+ totalCost: cost * quantity
+ };
+
+ ingredients.push(ingredient);
+ updateTable();
+ calculateTotals();
+ form.reset();
+ });
+
+ servingsInput.addEventListener('input', calculateTotals);
+
+ function updateTable() {
+ ingredientsList.innerHTML = '';
+
+ ingredients.forEach((ingredient, index) => {
+ const row = document.createElement('tr');
+ row.innerHTML = `
+ <td>${ingredient.name}</td>
+ <td>${ingredient.quantity} ${ingredient.unit}</td>
+ <td>$${ingredient.cost.toFixed(2)}</td>
+ <td>$${ingredient.totalCost.toFixed(2)}</td>
+ <td>
+ <button class="delete-btn" data-index="${index}">Delete</button>
+ </td>
+ `;
+ ingredientsList.appendChild(row);
+ });
+
+ // Add delete button listeners
+ document.querySelectorAll('.delete-btn').forEach(button => {
+ button.addEventListener('click', (e) => {
+ const index = parseInt(e.target.dataset.index);
+ ingredients.splice(index, 1);
+ updateTable();
+ calculateTotals();
+ });
+ });
+ }
+
+ function calculateTotals() {
+ const totalCost = ingredients.reduce((sum, ingredient) => sum + ingredient.totalCost, 0);
+ const servings = parseInt(servingsInput.value) || 1;
+ const costPerServing = totalCost / servings;
+
+ totalCostElement.textContent = `$${totalCost.toFixed(2)}`;
+ costPerServingElement.textContent = `$${costPerServing.toFixed(2)}`;
+ }
+});
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..126a645
--- /dev/null
+++ b/style.css
@@ -0,0 +1,165 @@
+:root {
+ --primary-color: #2c3e50;
+ --accent-color: #3498db;
+ --background-color: #f8f9fa;
+ --text-color: #2c3e50;
+ --border-radius: 8px;
+ --transition: all 0.3s ease;
+}
+
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
+ line-height: 1.6;
+ color: var(--text-color);
+ background-color: var(--background-color);
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+}
+
+header {
+ background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
+ color: white;
+ padding: 2rem;
+ text-align: center;
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+}
+
+header h1 {
+ font-size: 2.5rem;
+ margin-bottom: 0.5rem;
+}
+
+main {
+ max-width: 1200px;
+ margin: 2rem auto;
+ padding: 0 1rem;
+ flex: 1;
+}
+
+.input-section {
+ background: white;
+ padding: 2rem;
+ border-radius: var(--border-radius);
+ box-shadow: 0 2px 15px rgba(0,0,0,0.05);
+ margin-bottom: 2rem;
+}
+
+.form-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 1rem;
+ align-items: end;
+}
+
+input, select, button {
+ padding: 0.8rem;
+ border: 2px solid #e0e0e0;
+ border-radius: var(--border-radius);
+ font-size: 1rem;
+ transition: var(--transition);
+}
+
+input:focus, select:focus {
+ border-color: var(--accent-color);
+ outline: none;
+}
+
+.add-btn {
+ background-color: var(--accent-color);
+ color: white;
+ border: none;
+ cursor: pointer;
+ font-weight: 600;
+}
+
+.add-btn:hover {
+ background-color: #2980b9;
+ transform: translateY(-2px);
+}
+
+.table-container {
+ overflow-x: auto;
+ background: white;
+ border-radius: var(--border-radius);
+ box-shadow: 0 2px 15px rgba(0,0,0,0.05);
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+th, td {
+ padding: 1rem;
+ text-align: left;
+ border-bottom: 1px solid #e0e0e0;
+}
+
+th {
+ background-color: #f8f9fa;
+ font-weight: 600;
+}
+
+.delete-btn {
+ background-color: #e74c3c;
+ color: white;
+ border: none;
+ padding: 0.5rem 1rem;
+ border-radius: var(--border-radius);
+ cursor: pointer;
+ transition: var(--transition);
+}
+
+.delete-btn:hover {
+ background-color: #c0392b;
+}
+
+.totals {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ gap: 2rem;
+ margin-top: 2rem;
+ text-align: center;
+}
+
+.total-cost, .cost-per-serving {
+ background: white;
+ padding: 2rem;
+ border-radius: var(--border-radius);
+ box-shadow: 0 2px 15px rgba(0,0,0,0.05);
+}
+
+.total-cost p, .cost-per-serving p {
+ font-size: 2rem;
+ font-weight: 600;
+ color: var(--accent-color);
+ margin-top: 0.5rem;
+}
+
+footer {
+ text-align: center;
+ padding: 2rem;
+ background: white;
+ margin-top: auto;
+}
+
+@media (max-width: 768px) {
+ header h1 {
+ font-size: 2rem;
+ }
+
+ .form-grid {
+ grid-template-columns: 1fr;
+ }
+
+ .totals {
+ grid-template-columns: 1fr;
+ }
+}