Fixes #8601 We had 3 implementations of getImageAbsoluteURI: in twenty-front, in twenty-ui and in twenty-emails. I was able to remove the one in twenty-front but I could not remove it from twenty-emails as this is a standalone for now. The vision is to introduce shared utils in a twenty-shared package
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { useRecoilState, useRecoilValue } from 'recoil';
|
|
|
|
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
|
import { SettingsNavigationDrawerItems } from '@/settings/components/SettingsNavigationDrawerItems';
|
|
import { SupportDropdown } from '@/support/components/SupportDropdown';
|
|
import {
|
|
NavigationDrawer,
|
|
NavigationDrawerProps,
|
|
} from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
|
|
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
|
|
|
|
import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
|
|
|
|
import { AdvancedSettingsToggle, getImageAbsoluteURI } from 'twenty-ui';
|
|
import { MainNavigationDrawerItems } from './MainNavigationDrawerItems';
|
|
|
|
export type AppNavigationDrawerProps = {
|
|
className?: string;
|
|
};
|
|
|
|
export const AppNavigationDrawer = ({
|
|
className,
|
|
}: AppNavigationDrawerProps) => {
|
|
const isSettingsDrawer = useIsSettingsDrawer();
|
|
|
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
|
const [isAdvancedModeEnabled, setIsAdvancedModeEnabled] = useRecoilState(
|
|
isAdvancedModeEnabledState,
|
|
);
|
|
|
|
const drawerProps: NavigationDrawerProps = isSettingsDrawer
|
|
? {
|
|
title: 'Exit Settings',
|
|
children: <SettingsNavigationDrawerItems />,
|
|
footer: (
|
|
<AdvancedSettingsToggle
|
|
isAdvancedModeEnabled={isAdvancedModeEnabled}
|
|
setIsAdvancedModeEnabled={setIsAdvancedModeEnabled}
|
|
/>
|
|
),
|
|
}
|
|
: {
|
|
logo:
|
|
(currentWorkspace?.logo &&
|
|
getImageAbsoluteURI(currentWorkspace.logo)) ??
|
|
undefined,
|
|
title: currentWorkspace?.displayName ?? undefined,
|
|
children: <MainNavigationDrawerItems />,
|
|
footer: <SupportDropdown />,
|
|
};
|
|
|
|
return (
|
|
<NavigationDrawer
|
|
className={className}
|
|
logo={drawerProps.logo}
|
|
title={drawerProps.title}
|
|
footer={drawerProps.footer}
|
|
>
|
|
{drawerProps.children}
|
|
</NavigationDrawer>
|
|
);
|
|
};
|