Skip to content

Commit

Permalink
ui changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BurhanCantCode committed Aug 3, 2024
1 parent 352c115 commit 05c14e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion components/AddProductForm.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -12,6 +12,7 @@ const AddProductForm = () => {
const [showConfirmation, setShowConfirmation] = useState(false);
const [error, setError] = useState<string | null>(null);
const [potentialLabels, setPotentialLabels] = useState<string[]>([]);
const [success, setSuccess] = useState(false);
const { addProduct } = useProducts();

const handleImageCapture = async (imageData: string) => {
Expand Down Expand Up @@ -53,6 +54,7 @@ const AddProductForm = () => {
setName('');
setQuantity('');
setPrediction(null);
setSuccess(true);
};

return (
Expand Down Expand Up @@ -114,6 +116,12 @@ const AddProductForm = () => {
</Button>
</DialogActions>
</Dialog>

<Snackbar open={success} autoHideDuration={6000} onClose={() => setSuccess(false)}>
<Alert onClose={() => setSuccess(false)} severity="success" sx={{ width: '100%' }}>
Product added successfully!
</Alert>
</Snackbar>
</Box>
);
};
Expand Down
6 changes: 5 additions & 1 deletion pages/login.tsx
Original file line number Diff line number Diff line change
@@ -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();
Expand Down

0 comments on commit 05c14e3

Please sign in to comment.