diff --git a/src/pages/Settings/EditUser/index.tsx b/src/pages/Settings/EditUser/index.tsx
index 3b729c2..22398a6 100644
--- a/src/pages/Settings/EditUser/index.tsx
+++ b/src/pages/Settings/EditUser/index.tsx
@@ -21,7 +21,7 @@ const EditUser = () => {
General
- Update your photo and your information.
+ Update your information.
diff --git a/src/pages/Settings/Users/Form/index.tsx b/src/pages/Settings/Users/Form/index.tsx
index 3e2a6e5..68527c4 100644
--- a/src/pages/Settings/Users/Form/index.tsx
+++ b/src/pages/Settings/Users/Form/index.tsx
@@ -10,7 +10,6 @@ import {
DrawerFooter,
DrawerHeader,
DrawerOverlay,
- FormControl,
FormErrorMessage,
FormLabel,
Input,
@@ -41,21 +40,33 @@ const UserForm: React.FC = ({ defaultValues, handleSubmitForm, handleClos
{defaultValues && 'id' in defaultValues ? 'Update user' : 'New user'}
-
- Name
- (
-
- )}
- />
+ Name
+ (
+
+ )}
+ />
-
- {errors.name && errors.name.type === 'required' && 'Name is required'}
-
-
+ {errors.name && errors.name.type === 'required' && 'Name is required'}
+
+
+ Email
+
+ (
+
+ )}
+ />
+
+
+ {errors.email && errors.email.type === 'required' && 'Email is required'}
+
diff --git a/src/pages/Settings/index.tsx b/src/pages/Settings/index.tsx
index 13f0032..c5f1b6d 100644
--- a/src/pages/Settings/index.tsx
+++ b/src/pages/Settings/index.tsx
@@ -1,5 +1,5 @@
import { Box, HStack, Text, VStack } from '@chakra-ui/react';
-import { useState } from 'react';
+import { useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import EditUser from './EditUser';
import ChangePassword from './ChangePassword';
@@ -7,9 +7,11 @@ import Users from './Users';
import Icon from '@/components/Base/Icon';
import HeaderPage from '@/components/HeaderPage';
import Logs from './Logs';
+import { UserContext } from '@/contexts/UserContext';
const SettingsPage: React.FC = () => {
const { t } = useTranslation();
+ const { user } = useContext(UserContext);
const [currentOption, setCurrentOption] = useState(0);
const options = [
{
@@ -22,16 +24,25 @@ const SettingsPage: React.FC = () => {
icon: 'lock',
component: ,
},
- {
- label: t('settings.tabs.users.title'),
- icon: 'user',
- component: ,
- },
- {
- label: t('settings.tabs.logs.title'),
- icon: 'receipt-alt',
- component: ,
- },
+ ...(user?.role === 'admin'
+ ? [
+ {
+ label: t('settings.tabs.users.title'),
+ icon: 'user',
+ component: ,
+ },
+ ]
+ : []),
+
+ ...(user?.role === 'admin'
+ ? [
+ {
+ label: t('settings.tabs.logs.title'),
+ icon: 'receipt-alt',
+ component: ,
+ },
+ ]
+ : []),
];
return (
diff --git a/src/types/index.ts b/src/types/index.ts
index 3543f7c..7c1ea47 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -25,6 +25,7 @@ export interface IUser {
id: string;
email: string;
name: string;
+ role: 'analist' | 'admin';
password: string;
}