From 3c996ceec61e2231905f4e2065d1c09d471bb1f4 Mon Sep 17 00:00:00 2001 From: AG Date: Wed, 15 Oct 2025 07:45:34 +0300 Subject: [PATCH] Inner Contradictions error display as snackbar --- backend/.env | 3 +-- frontend/src/components/DesireForm.tsx | 14 ++++++++++++-- frontend/src/components/PassphraseInput.tsx | 5 ++--- frontend/src/pages/LoginPage.tsx | 4 ++-- frontend/src/pages/SessionPage.tsx | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/backend/.env b/backend/.env index b7ddd15..5f146fe 100644 --- a/backend/.env +++ b/backend/.env @@ -1,3 +1,2 @@ GEMINI_API_KEY="AIzaSyDke9H2NhiG6rBwxT0qrdYgnNoNZm_0j58" -ENCRYPTION_KEY=a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2 -AUTH_PASSPHRASE="HonorableHumansPrivilegeIsToBeAllowedHere" \ No newline at end of file +ENCRYPTION_KEY=a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2 \ No newline at end of file diff --git a/frontend/src/components/DesireForm.tsx b/frontend/src/components/DesireForm.tsx index d9c19fd..a4aab17 100644 --- a/frontend/src/components/DesireForm.tsx +++ b/frontend/src/components/DesireForm.tsx @@ -1,11 +1,12 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { TextField, Button, Box, Typography, Snackbar, Alert } from '@mui/material'; interface DesireFormProps { onSubmit: (desires: { wants: string[], accepts: string[], noGoes: string[], afraidToAsk: string }) => void; + externalError?: string | null; } -const DesireForm: React.FC = ({ onSubmit }) => { +const DesireForm: React.FC = ({ onSubmit, externalError }) => { const [wants, setWants] = useState(''); const [accepts, setAccepts] = useState(''); const [noGoes, setNoGoes] = useState(''); @@ -14,6 +15,15 @@ const DesireForm: React.FC = ({ onSubmit }) => { const [alertMessage, setAlertMessage] = useState(''); const [alertSeverity, setAlertSeverity] = useState<'error' | 'warning' | 'info' | 'success'>('error'); + // Effect to handle external errors + useEffect(() => { + if (externalError) { + setAlertMessage(externalError); + setAlertSeverity('error'); + setAlertOpen(true); + } + }, [externalError]); + const handleCloseAlert = (event?: React.SyntheticEvent | Event, reason?: string) => { if (reason === 'clickaway') { return; diff --git a/frontend/src/components/PassphraseInput.tsx b/frontend/src/components/PassphraseInput.tsx index b796d65..ceaf9f2 100644 --- a/frontend/src/components/PassphraseInput.tsx +++ b/frontend/src/components/PassphraseInput.tsx @@ -17,7 +17,7 @@ const PassphraseInput: React.FC = ({ onSubmit, isLoading, }; return ( - + = ({ onSubmit, isLoading, />