summaryrefslogtreecommitdiff
path: root/admin/src
diff options
context:
space:
mode:
authorBlaster4385 <venkateshchaturvedi12@gmail.com>2022-08-25 11:44:08 +0530
committerBlaster4385 <venkateshchaturvedi12@gmail.com>2022-08-25 11:44:08 +0530
commitfcc4c3374d85b33755f852bcc559db0a8eb5115a (patch)
tree266005279ac7996b479e2cb3b5d48ccebd041290 /admin/src
parent3450e5ad9c59403b9ad75aa24e71a1b925f7bbcf (diff)
Misc changes and add more translation
Diffstat (limited to 'admin/src')
-rw-r--r--admin/src/components/Error/Error.jsx29
-rw-r--r--admin/src/components/Error/Error.module.css19
-rw-r--r--admin/src/components/Spinner/Spinner.jsx16
-rw-r--r--admin/src/components/Spinner/Spinner.module.css6
-rw-r--r--admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx14
5 files changed, 82 insertions, 2 deletions
diff --git a/admin/src/components/Error/Error.jsx b/admin/src/components/Error/Error.jsx
new file mode 100644
index 0000000..110999b
--- /dev/null
+++ b/admin/src/components/Error/Error.jsx
@@ -0,0 +1,29 @@
+import React, { useEffect } from 'react'
+import { useNavigate } from 'react-router-dom'
+import { initialUserData } from '../../constants/userData'
+import { userContext } from '../../context/User'
+
+import styles from './Error.module.css'
+
+const Error = ({ message }) => {
+ const navigate = useNavigate()
+ useEffect(() => {
+ setTimeout(() => {
+ navigate('/')
+ }, 3000)
+ }, [])
+
+ return (
+ <>
+ <div className={styles.error}>
+ <img
+ src={`${process.env.PUBLIC_URL}/assets/images/error.svg`}
+ className={styles.error__image}
+ />
+ <h1 className={styles.error__title}>{message}</h1>
+ </div>
+ </>
+ )
+}
+
+export default Error
diff --git a/admin/src/components/Error/Error.module.css b/admin/src/components/Error/Error.module.css
new file mode 100644
index 0000000..d58d354
--- /dev/null
+++ b/admin/src/components/Error/Error.module.css
@@ -0,0 +1,19 @@
+.error {
+ display: flex;
+ height: 100vh;
+ width: 100vw;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.error__title {
+ font-family: 'Barlow', sans-serif;
+ font-weight: 400;
+ font-size: var(--font-large);
+ text-align: center;
+}
+
+.error__image {
+ margin-left: 40px;
+}
diff --git a/admin/src/components/Spinner/Spinner.jsx b/admin/src/components/Spinner/Spinner.jsx
new file mode 100644
index 0000000..da16d0f
--- /dev/null
+++ b/admin/src/components/Spinner/Spinner.jsx
@@ -0,0 +1,16 @@
+import React from 'react'
+import CircularProgress from '@mui/material/CircularProgress'
+import Header from '../Header/Header'
+import styles from './Spinner.module.css'
+
+const Spinner = ({ heading }) => {
+ console.log(heading)
+ return (
+ <div className={styles.spinner}>
+ <Header subheading={heading} />
+ <CircularProgress />
+ </div>
+ )
+}
+
+export default Spinner
diff --git a/admin/src/components/Spinner/Spinner.module.css b/admin/src/components/Spinner/Spinner.module.css
new file mode 100644
index 0000000..04197de
--- /dev/null
+++ b/admin/src/components/Spinner/Spinner.module.css
@@ -0,0 +1,6 @@
+.spinner {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+} \ No newline at end of file
diff --git a/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx b/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx
index 67de506..0c3a57d 100644
--- a/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx
+++ b/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx
@@ -10,13 +10,23 @@ import {
import {useQuery, useMutation} from 'react-query';
import styles from './UnverifiedUsers.module.css';
+import Spinner from '../../components/Spinner/Spinner';
const UnverifiedUsers = () => {
- const {data} = useQuery('unverified', getUnverifiedUsers);
+ const {data, isLoading, isError} = useQuery('unverified', getUnverifiedUsers);
const deleteUse = useMutation((id) => deleteUser(id));
const updateUse = useMutation((id) => updateUser(id, {verified: true}));
-
+
useEffect(() => {}, [data]);
+
+ if (isLoading) {
+ return <Spinner heading='Admin' />
+ }
+
+ if (isError) {
+ return <div>Error</div>
+ }
+
return (
<div className={styles.unverified_users}>