ShiftSync/src/pages/Settings/Settings.jsx

98 lines
2 KiB
React
Raw Normal View History

2025-05-26 01:40:36 +00:00
import React, { useEffect, useState } from 'react';
import styled from '@emotion/styled';
2025-05-20 16:28:48 +00:00
import { Link } from 'react-router-dom';
2025-05-26 01:40:36 +00:00
import { Stack } from '@mui/material';
import { ToggleTabs, useLocalStore } from '@components';
2025-05-26 01:40:36 +00:00
const OuterContainer = styled(Stack)`
display: flex;
align-items: center;
flex-direction: row;
justify-content: center;
2025-05-26 01:40:36 +00:00
padding: 10px 10px 0px 0px;
`;
2025-05-20 16:28:48 +00:00
const fields = {
departmentInformation: {
title: 'Information',
tab: 'department',
fields: []
},
departmentPermissions: {
title: 'Permissions',
tab: 'department',
fields: []
},
departmentManagers: {
title: 'Managers',
tab: 'department',
fields: []
},
departmentSubscriptions: {
title: 'Subscriptions',
tab: 'department',
fields: []
},
myInformation: {
title: 'Information',
tab: 'personal',
fields: []
},
myNotifications: {
title: 'Notifications',
tab: 'personal',
fields: []
},
departmentNotifications: {
title: 'Notifications',
tab: 'department',
fields: []
},
}
export const Settings = () => {
const { user } = useLocalStore();
2025-05-26 01:40:36 +00:00
const tabs = [
{
label: 'Personal',
value: 'personal'
},
{
label: 'Department',
value: 'department'
2025-05-26 01:40:36 +00:00
}
];
const [tabValue, setTabValue] = useState(tabs[0]);
2025-05-20 16:28:48 +00:00
useEffect(() => {
document.title = 'ShiftSync | Settings';
2025-05-20 16:28:48 +00:00
}, []);
return (
<div>
{user?.administrator ? (
<OuterContainer>
<ToggleTabs
2025-05-26 01:40:36 +00:00
tabs={tabs}
tabValue={tabValue}
setTabValue={setTabValue}
tabColor='#4D79FF'
/>
</OuterContainer>
) : null }
{tabValue?.value === 'personal' ? (
<div>
<h1>{`Settings Page${user?.administrator ? ` - ${tabValue?.label}` : ''}`}</h1>
<Link to="/">Go to Home</Link>
</div>
) : (
<div>
<h1>Settings Page - Organization</h1>
<Link to="/">Go to Home</Link>
</div>
)}
2025-05-20 16:28:48 +00:00
</div>
);
};