From 011b316b5b8c11a57ffdefc96d6036151e58045d Mon Sep 17 00:00:00 2001 From: Mahdi Date: Wed, 23 Sep 2026 17:18:04 +0330 Subject: [PATCH] Creating a modal for the assistant --- .../components/dashboard/HomeAiAssistant.vue | 175 ++++++++++-------- apps/web/src/views/HomeView.vue | 7 + 2 files changed, 109 insertions(+), 73 deletions(-) diff --git a/apps/web/src/components/dashboard/HomeAiAssistant.vue b/apps/web/src/components/dashboard/HomeAiAssistant.vue index 41789af..6cb18fc 100644 --- a/apps/web/src/components/dashboard/HomeAiAssistant.vue +++ b/apps/web/src/components/dashboard/HomeAiAssistant.vue @@ -1,9 +1,10 @@ @@ -274,57 +312,48 @@ function cancelDraft() { gap: 0.5rem; } -.confirm { - background: #fffbeb; - border: 1px solid #fde68a; - border-radius: var(--radius); - padding: 0.7rem 0.8rem; - margin-bottom: 0.75rem; -} - -.confirm p, -.confirm li { - margin: 0; - color: #78350f; - font-size: 0.8rem; +.modal-lead { + margin: 0 0 0.85rem; + color: #334155; + font-size: 0.9rem; line-height: 1.7; } -.confirm ul { - margin: 0.35rem 0 0; - padding: 0 1rem 0 0; +.modal-fields { + margin: 0; + display: grid; + gap: 0.45rem; } -.confirm-actions { - display: flex; - gap: 0.4rem; - margin-top: 0.55rem; -} - -.confirm-actions button { - border: 0; +.modal-fields div { + display: grid; + grid-template-columns: 5.5rem 1fr; + gap: 0.6rem; + align-items: start; + padding: 0.55rem 0.7rem; + background: #f8fafc; + border: 1px solid #eef2f7; border-radius: var(--radius); - padding: 0.4rem 0.7rem; - font: inherit; - font-size: 0.75rem; - font-weight: 700; - cursor: pointer; } -.confirm-actions .ok { - background: #0f766e; - color: #fff; -} - -.confirm-actions .ok:disabled, -.confirm-actions .no:disabled { - opacity: 0.5; - cursor: not-allowed; -} - -.confirm-actions .no { - background: transparent; +.modal-fields dt { + margin: 0; color: #64748b; + font-size: 0.78rem; + font-weight: 700; +} + +.modal-fields dd { + margin: 0; + color: #0f172a; + font-size: 0.88rem; +} + +.warn { + display: inline-block; + margin-inline-start: 0.35rem; + color: #b45309; + font-size: 0.75rem; } h2 { diff --git a/apps/web/src/views/HomeView.vue b/apps/web/src/views/HomeView.vue index fd8cb2f..ae525ac 100644 --- a/apps/web/src/views/HomeView.vue +++ b/apps/web/src/views/HomeView.vue @@ -77,6 +77,12 @@ function formatTrendAmount(value: number) { return formatMoney(value, home.value?.currency ?? 'IRR'); } +function clearAsk() { + askAnswer.value = ''; + askError.value = ''; + askSources.value = []; +} + async function submitAsk(preset?: string) { const q = (preset || askQuery.value).trim(); if (!q || asking.value) return; @@ -181,6 +187,7 @@ onUnmounted(() => { :error="askError" :sources="askSources" @ask="submitAsk" + @clear="clearAsk" />