From 324b8e01ddabef788a3169b2f565ceaf05f7208a Mon Sep 17 00:00:00 2001 From: chloe Date: Thu, 5 Mar 2026 20:49:00 +0000 Subject: [PATCH] UI update --- .../app/assets/css/app-theme.css | 15 ++++ Seasoned.Frontend/app/pages/index.vue | 70 +++++++++++++++---- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/Seasoned.Frontend/app/assets/css/app-theme.css b/Seasoned.Frontend/app/assets/css/app-theme.css index 5e72add..34d8d37 100644 --- a/Seasoned.Frontend/app/assets/css/app-theme.css +++ b/Seasoned.Frontend/app/assets/css/app-theme.css @@ -207,4 +207,19 @@ color: #ffffff !important; height: 56px !important; border-radius: 8px !important; +} + +.clear-btn-solid { + background-color: #dccca7 !important; + color: #4a3a2a !important; + min-width: 56px !important; + height: 56px !important; + border-radius: 8px !important; + display: flex !important; + align-items: center !important; + justify-content: center !important; +} + +.d-flex .analyze-btn { + margin-bottom: 0 !important; } \ No newline at end of file diff --git a/Seasoned.Frontend/app/pages/index.vue b/Seasoned.Frontend/app/pages/index.vue index 0898310..827640c 100644 --- a/Seasoned.Frontend/app/pages/index.vue +++ b/Seasoned.Frontend/app/pages/index.vue @@ -36,21 +36,33 @@ > - - - Analyze Recipe - +
+ + + Analyze Recipe + + + + + +
@@ -92,8 +104,9 @@ import { ref } from 'vue' import '@/assets/css/app-theme.css' + const config = useRuntimeConfig() const files = ref([]) const loading = ref(false) const recipe = ref(null) const isDragging = ref(false) const saving = ref(false) +const hasSaved = ref(false) const handleDrop = (e) => { isDragging.value = false @@ -132,6 +147,9 @@ const uploadImage = async () => { if (!fileToUpload) return; loading.value = true; + recipe.value = null; + hasSaved.value = false; + const formData = new FormData(); formData.append('image', fileToUpload); @@ -146,7 +164,31 @@ const uploadImage = async () => { } finally { loading.value = false; } +} - +const saveToCollection = async () => { + if (!recipe.value || hasSaved.value) return; + + saving.value = true; + + try { + await $fetch(`${config.public.apiBase}api/recipe/save`, { + method: 'POST', + body: recipe.value + }); + hasSaved.value = true; + } catch (error) { + console.error("Save failed:", error); + } finally { + saving.value = false; + } +} + +const clearAll = () => { + files.value = [] + recipe.value = null + hasSaved.value = false + loading.value = false + saving.value = false } \ No newline at end of file