Client: Profile: hide tab for visitor

This commit is contained in:
Viktor Fomin 2023-09-26 23:24:52 +03:00
parent b545e62061
commit f90f8c3df1

View File

@ -33,9 +33,11 @@ const Wrapper = styled.div`
`;
const SectionBodyContent = (props) => {
const { isProfileLoaded, t } = props;
const { isProfileLoaded, profile, t } = props;
const navigate = useNavigate();
console.log("profile", profile);
const data = [
{
id: "login",
@ -47,11 +49,6 @@ const SectionBodyContent = (props) => {
name: t("Notifications:Notifications"),
content: <Notifications />,
},
{
id: "file-management",
name: t("FileManagement"),
content: <h1>File management</h1>,
},
{
id: "interface-theme",
name: t("InterfaceTheme"),
@ -59,6 +56,13 @@ const SectionBodyContent = (props) => {
},
];
if (!profile?.isVisitor)
data.splice(2, 0, {
id: "file-management",
name: t("FileManagement"),
content: <h1>File management</h1>,
});
const getCurrentTab = () => {
const path = location.pathname;
const currentTab = data.findIndex((item) => path.includes(item.id));
@ -86,10 +90,13 @@ const SectionBodyContent = (props) => {
);
};
export default inject(({ clientLoadingStore }) => {
export default inject(({ peopleStore, clientLoadingStore }) => {
const { isProfileLoaded } = clientLoadingStore;
const { targetUser: profile } = peopleStore.targetUserStore;
return {
isProfileLoaded,
profile,
};
})(
observer(