2024-02-18 01:44:48 -05:00
|
|
|
// ** Icon imports
|
|
|
|
import Login from 'mdi-material-ui/Login'
|
|
|
|
import Table from 'mdi-material-ui/Table'
|
|
|
|
import CubeOutline from 'mdi-material-ui/CubeOutline'
|
|
|
|
import HomeOutline from 'mdi-material-ui/HomeOutline'
|
2024-02-18 06:59:55 -05:00
|
|
|
import SettingsApplicationsIcon from '@mui/icons-material/SettingsApplications';
|
2024-03-02 00:51:43 -05:00
|
|
|
import ListIcon from '@mui/icons-material/List';
|
2024-02-18 01:44:48 -05:00
|
|
|
// ** Type import
|
|
|
|
import { VerticalNavItemsType } from '../../core/layouts/types'
|
2024-02-27 21:37:43 -05:00
|
|
|
import { BankTransfer, Cart, Clipboard, PageFirst, StarOutline } from 'mdi-material-ui'
|
2024-03-03 16:03:22 -05:00
|
|
|
import { DocumentScanner, FileOpen, LockPerson, OpenInBrowser, People, PeopleOutline, Settings, WebAsset } from '@mui/icons-material'
|
2024-02-18 01:44:48 -05:00
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
|
|
|
|
const navigation = (): VerticalNavItemsType => {
|
|
|
|
const [isStripeOnboarded, setIsStripeOnboarded] = useState(false);
|
2024-02-25 18:34:51 -05:00
|
|
|
const [profileData, setProfileData] = useState(null);
|
|
|
|
const [userData, setUserData] = useState(null);
|
2024-03-03 16:23:40 -05:00
|
|
|
const [isAdmin, setIsAdmin] = useState(false);
|
2024-02-18 01:44:48 -05:00
|
|
|
|
|
|
|
const getData = async () => {
|
2024-02-25 18:34:51 -05:00
|
|
|
|
2024-03-03 16:23:40 -05:00
|
|
|
const adminCheck = await fetch('/api/admin/check', { method: "GET" });
|
|
|
|
if (adminCheck.status === 200) {
|
|
|
|
setIsAdmin(true);
|
|
|
|
}
|
|
|
|
|
2024-02-18 01:44:48 -05:00
|
|
|
const onboardCheckRequest = await fetch('/api/artist/onboarded', { method: "GET" });
|
|
|
|
const onboardCheckResponse = await onboardCheckRequest.json();
|
|
|
|
setIsStripeOnboarded(onboardCheckResponse["onboarded"]);
|
2024-02-25 18:34:51 -05:00
|
|
|
|
|
|
|
const artistProfileRequest = await fetch('/api/artist/profile', { method: "GET" });
|
|
|
|
const artistProfileResponse = await artistProfileRequest.json();
|
|
|
|
setProfileData(artistProfileResponse);
|
|
|
|
|
|
|
|
const userRequest = await fetch('/api/me', { method: "GET" });
|
|
|
|
const userResponse = await userRequest.json();
|
|
|
|
setUserData(userResponse);
|
|
|
|
////console.log(roleResponse)
|
2024-02-18 01:44:48 -05:00
|
|
|
}
|
2024-02-25 18:34:51 -05:00
|
|
|
|
2024-02-18 01:44:48 -05:00
|
|
|
useEffect(() => {
|
|
|
|
getData();
|
|
|
|
}, []);
|
|
|
|
|
2024-02-25 18:34:51 -05:00
|
|
|
var result = [
|
2024-03-02 00:51:43 -05:00
|
|
|
{
|
|
|
|
title: 'Dashboard',
|
|
|
|
icon: HomeOutline,
|
|
|
|
path: '/dashboard'
|
|
|
|
},
|
2024-02-25 18:34:51 -05:00
|
|
|
{
|
|
|
|
sectionTitle: 'General'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Account Settings',
|
|
|
|
icon: Settings,
|
|
|
|
path: '/dashboard/settings'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Your Requests',
|
2024-03-02 00:51:43 -05:00
|
|
|
icon: ListIcon,
|
2024-02-25 18:34:51 -05:00
|
|
|
path: '/dashboard/requests'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2024-03-03 16:23:40 -05:00
|
|
|
if (isAdmin) {
|
|
|
|
result.push(
|
|
|
|
{
|
|
|
|
sectionTitle: 'Admin'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Manage Artist Access',
|
|
|
|
icon: LockPerson,
|
|
|
|
path: '/dashboard/admin/requests'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Manage Users',
|
|
|
|
icon: People,
|
|
|
|
path: '/dashboard/admin/users'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Manage Artists',
|
|
|
|
icon: PeopleOutline,
|
|
|
|
path: '/dashboard/admin/artists'
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-02-25 18:34:51 -05:00
|
|
|
if (isStripeOnboarded) {
|
|
|
|
result.push(
|
2024-02-18 01:44:48 -05:00
|
|
|
{
|
2024-02-25 18:34:51 -05:00
|
|
|
sectionTitle: 'Artist'
|
2024-02-18 01:44:48 -05:00
|
|
|
},
|
2024-02-27 21:37:43 -05:00
|
|
|
{
|
|
|
|
title: 'Request Reviews',
|
|
|
|
icon: StarOutline,
|
|
|
|
path: '/dashboard/artist/reviews'
|
|
|
|
},
|
2024-02-18 01:44:48 -05:00
|
|
|
{
|
2024-02-25 18:34:51 -05:00
|
|
|
title: 'Incoming Requests',
|
2024-03-02 00:51:43 -05:00
|
|
|
icon: ListIcon,
|
2024-02-25 18:34:51 -05:00
|
|
|
path: '/dashboard/artist/requests'
|
2024-02-18 01:44:48 -05:00
|
|
|
},
|
|
|
|
{
|
2024-02-25 18:34:51 -05:00
|
|
|
title: 'Payments/Payouts',
|
|
|
|
icon: BankTransfer,
|
2024-02-27 21:37:43 -05:00
|
|
|
path: '/dashboard/artist/payout'
|
2024-02-18 01:44:48 -05:00
|
|
|
},
|
2024-02-18 06:59:55 -05:00
|
|
|
{
|
2024-02-27 21:37:43 -05:00
|
|
|
title: 'Artist Settings',
|
|
|
|
icon: Settings,
|
2024-02-18 06:59:55 -05:00
|
|
|
path: '/dashboard/artist/artistsettings'
|
|
|
|
},
|
2024-02-18 01:44:48 -05:00
|
|
|
{
|
|
|
|
title: 'Page Settings',
|
2024-02-27 21:37:43 -05:00
|
|
|
icon: WebAsset,
|
2024-02-18 01:44:48 -05:00
|
|
|
path: '/dashboard/artist/pagesettings'
|
|
|
|
},
|
|
|
|
{
|
2024-02-25 18:34:51 -05:00
|
|
|
title: 'Your Page',
|
2024-02-27 21:37:43 -05:00
|
|
|
icon: OpenInBrowser,
|
2024-02-25 18:34:51 -05:00
|
|
|
path: '/box/' + (userData ? userData["displayName"] : "")
|
2024-02-18 01:44:48 -05:00
|
|
|
}
|
2024-02-25 18:34:51 -05:00
|
|
|
);
|
2024-02-18 01:44:48 -05:00
|
|
|
}
|
|
|
|
|
2024-02-25 18:34:51 -05:00
|
|
|
return result;
|
2024-02-18 01:44:48 -05:00
|
|
|
}
|
|
|
|
|
2024-02-25 18:34:51 -05:00
|
|
|
export default navigation;
|
|
|
|
|