Fix workspace logo (#9129)
Follow up on: https://github.com/twentyhq/twenty/issues/9042#issuecomment-2550886611
This commit is contained in:
@ -8,13 +8,10 @@ import {
|
||||
NavigationDrawerProps,
|
||||
} from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
|
||||
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
|
||||
import { getImageAbsoluteURI } from 'twenty-shared';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
|
||||
import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
|
||||
|
||||
import { MainNavigationDrawerItems } from '@/navigation/components/MainNavigationDrawerItems';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { AdvancedSettingsToggle } from 'twenty-ui';
|
||||
|
||||
export type AppNavigationDrawerProps = {
|
||||
@ -41,15 +38,11 @@ export const AppNavigationDrawer = ({
|
||||
setIsAdvancedModeEnabled={setIsAdvancedModeEnabled}
|
||||
/>
|
||||
),
|
||||
logo: '',
|
||||
}
|
||||
: {
|
||||
logo: isNonEmptyString(currentWorkspace?.logo)
|
||||
? getImageAbsoluteURI({
|
||||
imageUrl: currentWorkspace.logo,
|
||||
baseUrl: REACT_APP_SERVER_BASE_URL,
|
||||
})
|
||||
: undefined,
|
||||
title: currentWorkspace?.displayName ?? undefined,
|
||||
logo: currentWorkspace?.logo ?? '',
|
||||
title: currentWorkspace?.displayName ?? '',
|
||||
children: <MainNavigationDrawerItems />,
|
||||
footer: <SupportDropdown />,
|
||||
};
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
import { SupportDropdown } from '@/support/components/SupportDropdown';
|
||||
import {
|
||||
NavigationDrawer,
|
||||
NavigationDrawerProps,
|
||||
} from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
|
||||
import { NavigationDrawer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
|
||||
|
||||
import { NavigationDrawerSectionForObjectMetadataItems } from '@/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems';
|
||||
import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
|
||||
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
|
||||
import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';
|
||||
import { DEFAULT_WORKSPACE_NAME } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceName';
|
||||
import styled from '@emotion/styled';
|
||||
import { IconSearch, IconSettings, useIsMobile } from 'twenty-ui';
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
|
||||
@ -62,14 +61,14 @@ export const SignInAppNavigationDrawerMock = ({
|
||||
|
||||
const footer = <SupportDropdown />;
|
||||
|
||||
const drawerProps: NavigationDrawerProps = {
|
||||
children,
|
||||
footer,
|
||||
};
|
||||
|
||||
return (
|
||||
<NavigationDrawer className={className} footer={drawerProps.footer}>
|
||||
{drawerProps.children}
|
||||
<NavigationDrawer
|
||||
className={className}
|
||||
footer={footer}
|
||||
logo={DEFAULT_WORKSPACE_LOGO}
|
||||
title={DEFAULT_WORKSPACE_NAME}
|
||||
>
|
||||
{children}
|
||||
</NavigationDrawer>
|
||||
);
|
||||
};
|
||||
|
||||
@ -19,7 +19,7 @@ export type NavigationDrawerProps = {
|
||||
className?: string;
|
||||
footer?: ReactNode;
|
||||
logo?: string;
|
||||
title?: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
const StyledAnimatedContainer = styled(motion.div)<{ isSettings?: boolean }>`
|
||||
@ -111,15 +111,15 @@ export const NavigationDrawer = ({
|
||||
onMouseEnter={handleHover}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
{isSettingsDrawer && title ? (
|
||||
!isMobile && <NavigationDrawerBackButton title={title} />
|
||||
) : (
|
||||
<NavigationDrawerHeader
|
||||
name={title}
|
||||
logo={logo}
|
||||
showCollapseButton={isHovered}
|
||||
/>
|
||||
)}
|
||||
{isSettingsDrawer && title
|
||||
? !isMobile && <NavigationDrawerBackButton title={title} />
|
||||
: logo && (
|
||||
<NavigationDrawerHeader
|
||||
name={title}
|
||||
logo={logo}
|
||||
showCollapseButton={isHovered}
|
||||
/>
|
||||
)}
|
||||
<StyledItemsContainer isSettings={isSettingsDrawer}>
|
||||
{children}
|
||||
</StyledItemsContainer>
|
||||
|
||||
@ -3,8 +3,6 @@ import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { workspacesState } from '@/auth/states/workspaces';
|
||||
import { MultiWorkspaceDropdownButton } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdownButton';
|
||||
import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';
|
||||
import { DEFAULT_WORKSPACE_NAME } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceName';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
|
||||
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
|
||||
@ -41,14 +39,14 @@ const StyledNavigationDrawerCollapseButton = styled(
|
||||
`;
|
||||
|
||||
type NavigationDrawerHeaderProps = {
|
||||
name?: string;
|
||||
logo?: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
showCollapseButton: boolean;
|
||||
};
|
||||
|
||||
export const NavigationDrawerHeader = ({
|
||||
name = DEFAULT_WORKSPACE_NAME,
|
||||
logo = DEFAULT_WORKSPACE_LOGO,
|
||||
name,
|
||||
logo,
|
||||
showCollapseButton,
|
||||
}: NavigationDrawerHeaderProps) => {
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
Reference in New Issue
Block a user