mirror of
https://github.com/twentyhq/twenty.git
synced 2025-01-03 17:53:58 +03:00
Fixes before 0-35 release
This commit is contained in:
parent
8f3fbeccb1
commit
65469bbf02
@ -9,6 +9,7 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/reco
|
|||||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||||
import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter';
|
import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter';
|
||||||
import { ShowPageLeftContainer } from '@/ui/layout/show-page/components/ShowPageLeftContainer';
|
import { ShowPageLeftContainer } from '@/ui/layout/show-page/components/ShowPageLeftContainer';
|
||||||
|
import { ShowPageTabListFromUrlOptionalEffect } from '@/ui/layout/show-page/components/ShowPageTabListFromUrlOptionalEffect';
|
||||||
import { SingleTabProps, TabList } from '@/ui/layout/tab/components/TabList';
|
import { SingleTabProps, TabList } from '@/ui/layout/tab/components/TabList';
|
||||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||||
@ -64,9 +65,9 @@ export const ShowPageSubContainer = ({
|
|||||||
isInRightDrawer = false,
|
isInRightDrawer = false,
|
||||||
isNewRightDrawerItemLoading = false,
|
isNewRightDrawerItemLoading = false,
|
||||||
}: ShowPageSubContainerProps) => {
|
}: ShowPageSubContainerProps) => {
|
||||||
const { activeTabId } = useTabList(
|
const tabListComponentId = `${TAB_LIST_COMPONENT_ID}-${isInRightDrawer}-${targetableObject.id}`;
|
||||||
`${TAB_LIST_COMPONENT_ID}-${isInRightDrawer}-${targetableObject.id}`,
|
|
||||||
);
|
const { activeTabId } = useTabList(tabListComponentId);
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
|
||||||
@ -125,10 +126,15 @@ export const ShowPageSubContainer = ({
|
|||||||
)}
|
)}
|
||||||
<StyledShowPageRightContainer isMobile={isMobile}>
|
<StyledShowPageRightContainer isMobile={isMobile}>
|
||||||
<StyledTabListContainer shouldDisplay={visibleTabs.length > 1}>
|
<StyledTabListContainer shouldDisplay={visibleTabs.length > 1}>
|
||||||
|
<ShowPageTabListFromUrlOptionalEffect
|
||||||
|
isInRightDrawer={isInRightDrawer}
|
||||||
|
componentInstanceId={tabListComponentId}
|
||||||
|
tabListIds={tabs.map((tab) => tab.id)}
|
||||||
|
/>
|
||||||
<TabList
|
<TabList
|
||||||
behaveAsLinks={!isInRightDrawer}
|
behaveAsLinks={!isInRightDrawer}
|
||||||
loading={loading || isNewViewableRecordLoading}
|
loading={loading || isNewViewableRecordLoading}
|
||||||
tabListInstanceId={`${TAB_LIST_COMPONENT_ID}-${isInRightDrawer}-${targetableObject.id}`}
|
tabListInstanceId={tabListComponentId}
|
||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
/>
|
/>
|
||||||
</StyledTabListContainer>
|
</StyledTabListContainer>
|
||||||
|
@ -2,21 +2,27 @@ import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
type TabListFromUrlOptionalEffectProps = {
|
type ShowPageTabListFromUrlOptionalEffectProps = {
|
||||||
componentInstanceId: string;
|
componentInstanceId: string;
|
||||||
tabListIds: string[];
|
tabListIds: string[];
|
||||||
|
isInRightDrawer: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TabListFromUrlOptionalEffect = ({
|
export const ShowPageTabListFromUrlOptionalEffect = ({
|
||||||
componentInstanceId,
|
componentInstanceId,
|
||||||
tabListIds,
|
tabListIds,
|
||||||
}: TabListFromUrlOptionalEffectProps) => {
|
isInRightDrawer,
|
||||||
|
}: ShowPageTabListFromUrlOptionalEffectProps) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { activeTabId, setActiveTabId } = useTabList(componentInstanceId);
|
const { activeTabId, setActiveTabId } = useTabList(componentInstanceId);
|
||||||
|
|
||||||
const hash = location.hash.replace('#', '');
|
const hash = location.hash.replace('#', '');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isInRightDrawer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hash === activeTabId) {
|
if (hash === activeTabId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
@ -1,4 +1,3 @@
|
|||||||
import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab/components/TabListFromUrlOptionalEffect';
|
|
||||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||||
import { TabListScope } from '@/ui/layout/tab/scopes/TabListScope';
|
import { TabListScope } from '@/ui/layout/tab/scopes/TabListScope';
|
||||||
import { LayoutCard } from '@/ui/layout/tab/types/LayoutCard';
|
import { LayoutCard } from '@/ui/layout/tab/types/LayoutCard';
|
||||||
@ -60,10 +59,6 @@ export const TabList = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TabListScope tabListScopeId={tabListInstanceId}>
|
<TabListScope tabListScopeId={tabListInstanceId}>
|
||||||
<TabListFromUrlOptionalEffect
|
|
||||||
componentInstanceId={tabListInstanceId}
|
|
||||||
tabListIds={tabs.map((tab) => tab.id)}
|
|
||||||
/>
|
|
||||||
<ScrollWrapper
|
<ScrollWrapper
|
||||||
defaultEnableYScroll={false}
|
defaultEnableYScroll={false}
|
||||||
contextProviderName="tabList"
|
contextProviderName="tabList"
|
||||||
|
Loading…
Reference in New Issue
Block a user