fix: conditionally rendered Tablist only if there are multiple accounts. (#6274)
issue - 6267 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -12,7 +12,6 @@ const StyledDetailsContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: ${({ theme }) => theme.spacing(6)};
|
||||
padding-top: ${({ theme }) => theme.spacing(6)};
|
||||
`;
|
||||
|
||||
type SettingsAccountsCalendarChannelDetailsProps = {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { CalendarChannel } from '@/accounts/types/CalendarChannel';
|
||||
@ -13,6 +14,10 @@ import { TabList } from '@/ui/layout/tab/components/TabList';
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import React from 'react';
|
||||
|
||||
const StyledCalenderContainer = styled.div`
|
||||
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
||||
`;
|
||||
|
||||
export const SettingsAccountsCalendarChannelsContainer = () => {
|
||||
const { activeTabIdState } = useTabList(
|
||||
SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID,
|
||||
@ -55,10 +60,14 @@ export const SettingsAccountsCalendarChannelsContainer = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabList
|
||||
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||
tabs={tabs}
|
||||
/>
|
||||
{tabs.length > 1 && (
|
||||
<StyledCalenderContainer>
|
||||
<TabList
|
||||
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||
tabs={tabs}
|
||||
/>
|
||||
</StyledCalenderContainer>
|
||||
)}
|
||||
{calendarChannels.map((calendarChannel) => (
|
||||
<React.Fragment key={calendarChannel.id}>
|
||||
{calendarChannel.id === activeTabId && (
|
||||
|
||||
@ -29,7 +29,6 @@ const StyledDetailsContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: ${({ theme }) => theme.spacing(6)};
|
||||
padding-top: ${({ theme }) => theme.spacing(6)};
|
||||
`;
|
||||
|
||||
export const SettingsAccountsMessageChannelDetails = ({
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { ConnectedAccount } from '@/accounts/types/ConnectedAccount';
|
||||
@ -12,6 +13,10 @@ import { TabList } from '@/ui/layout/tab/components/TabList';
|
||||
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import React from 'react';
|
||||
|
||||
const StyledMessageContainer = styled.div`
|
||||
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
||||
`;
|
||||
|
||||
export const SettingsAccountsMessageChannelsContainer = () => {
|
||||
const { activeTabIdState } = useTabList(
|
||||
SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID,
|
||||
@ -54,10 +59,14 @@ export const SettingsAccountsMessageChannelsContainer = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<TabList
|
||||
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||
tabs={tabs}
|
||||
/>
|
||||
{tabs.length > 1 && (
|
||||
<StyledMessageContainer>
|
||||
<TabList
|
||||
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||
tabs={tabs}
|
||||
/>
|
||||
</StyledMessageContainer>
|
||||
)}
|
||||
{messageChannels.map((messageChannel) => (
|
||||
<React.Fragment key={messageChannel.id}>
|
||||
{messageChannel.id === activeTabId && (
|
||||
|
||||
Reference in New Issue
Block a user