Skip to content

Commit

Permalink
Fix workspace logo (#9129)
Browse files Browse the repository at this point in the history
Follow up on:
#9042 (comment)
  • Loading branch information
charlesBochet authored Dec 18, 2024
1 parent 5586270 commit 71254bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 />,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type NavigationDrawerProps = {
className?: string;
footer?: ReactNode;
logo?: string;
title?: string;
title: string;
};

const StyledAnimatedContainer = styled(motion.div)<{ isSettings?: boolean }>`
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 71254bf

Please sign in to comment.