From 05c14e38e77f8b943a9bf7e175e19b098a88c013 Mon Sep 17 00:00:00 2001 From: Burhanuddin Khatri <144617735+BurhanCantCode@users.noreply.github.com> Date: Sat, 3 Aug 2024 17:42:11 +0000 Subject: [PATCH] ui changes --- components/AddProductForm.tsx | 10 +++++++++- pages/login.tsx | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/AddProductForm.tsx b/components/AddProductForm.tsx index 96519b5..329ab4d 100644 --- a/components/AddProductForm.tsx +++ b/components/AddProductForm.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { TextField, Button, Box, Typography, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material'; +import { TextField, Button, Box, Typography, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Snackbar, Alert } from '@mui/material'; import { useProducts } from '../hooks/useProducts'; import ImageCapture from './ImageCapture'; import { scanProduct } from '../utils/visionUtils'; @@ -12,6 +12,7 @@ const AddProductForm = () => { const [showConfirmation, setShowConfirmation] = useState(false); const [error, setError] = useState(null); const [potentialLabels, setPotentialLabels] = useState([]); + const [success, setSuccess] = useState(false); const { addProduct } = useProducts(); const handleImageCapture = async (imageData: string) => { @@ -53,6 +54,7 @@ const AddProductForm = () => { setName(''); setQuantity(''); setPrediction(null); + setSuccess(true); }; return ( @@ -114,6 +116,12 @@ const AddProductForm = () => { + + setSuccess(false)}> + setSuccess(false)} severity="success" sx={{ width: '100%' }}> + Product added successfully! + + ); }; diff --git a/pages/login.tsx b/pages/login.tsx index 038325a..b7a1c77 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -1,10 +1,14 @@ import { NextPage } from 'next'; -import { Typography, Button, Box, Paper } from '@mui/material'; +import { Typography, Button, Box, Paper, Container, TextField, CircularProgress, Dialog, DialogTitle, DialogContent, DialogActions, Snackbar, Alert } from '@mui/material'; import AuthModal from '../components/AuthModal'; import { FaLock } from 'react-icons/fa'; import { useAuth } from '../hooks/useAuth'; import { useEffect } from 'react'; import { useRouter } from 'next/router'; +import { useState } from 'react'; +import { useProducts } from '../hooks/useProducts'; +import ImageCapture from './ImageCapture'; +import { scanProduct } from '../utils/visionUtils'; const Login: NextPage = () => { const { user, redirectAfterAuth } = useAuth();