106 lines
2.7 KiB
TypeScript
Raw Normal View History

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-02-18 01:44:48 -05:00
// ** Type import
import { VerticalNavItemsType } from '../../core/layouts/types'
import { BankTransfer, Cart, Clipboard, PageFirst } from 'mdi-material-ui'
2024-02-18 01:44:48 -05:00
import { DocumentScanner, FileOpen, Settings } from '@mui/icons-material'
import { useState, useEffect } from 'react'
const navigation = (): VerticalNavItemsType => {
const [isStripeOnboarded, setIsStripeOnboarded] = useState(false);
const [profileData, setProfileData] = useState(null);
const [userData, setUserData] = useState(null);
2024-02-18 01:44:48 -05:00
const getData = async () => {
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"]);
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-18 01:44:48 -05:00
useEffect(() => {
getData();
}, []);
var result = [
{
sectionTitle: 'Admin'
},
{
title: 'Artist Requests',
icon: Clipboard,
path: '/dashboard/admin/requests'
},
{
sectionTitle: 'General'
},
{
title: 'Dashboard',
icon: HomeOutline,
path: '/dashboard'
},
{
title: 'Account Settings',
icon: Settings,
path: '/dashboard/settings'
},
{
title: 'Your Requests',
icon: Cart,
path: '/dashboard/requests'
}
];
if (isStripeOnboarded) {
result.push(
2024-02-18 01:44:48 -05:00
{
sectionTitle: 'Artist'
2024-02-18 01:44:48 -05:00
},
{
title: 'Incoming Requests',
icon: CubeOutline,
path: '/dashboard/artist/requests'
2024-02-18 01:44:48 -05:00
},
{
title: 'Payments/Payouts',
icon: BankTransfer,
path: '/dashboard/payout'
2024-02-18 01:44:48 -05:00
},
2024-02-18 06:59:55 -05:00
{
title: 'Shop Settings',
icon: SettingsApplicationsIcon,
path: '/dashboard/artist/artistsettings'
},
2024-02-18 01:44:48 -05:00
{
title: 'Page Settings',
icon: DocumentScanner,
path: '/dashboard/artist/pagesettings'
},
{
title: 'Your Page',
2024-02-18 01:44:48 -05:00
icon: FileOpen,
path: '/box/' + (userData ? userData["displayName"] : "")
2024-02-18 01:44:48 -05:00
}
);
2024-02-18 01:44:48 -05:00
}
return result;
2024-02-18 01:44:48 -05:00
}
export default navigation;