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;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: ${({ theme }) => theme.spacing(6)};
|
gap: ${({ theme }) => theme.spacing(6)};
|
||||||
padding-top: ${({ theme }) => theme.spacing(6)};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
type SettingsAccountsCalendarChannelDetailsProps = {
|
type SettingsAccountsCalendarChannelDetailsProps = {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { CalendarChannel } from '@/accounts/types/CalendarChannel';
|
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 { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
const StyledCalenderContainer = styled.div`
|
||||||
|
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
||||||
|
`;
|
||||||
|
|
||||||
export const SettingsAccountsCalendarChannelsContainer = () => {
|
export const SettingsAccountsCalendarChannelsContainer = () => {
|
||||||
const { activeTabIdState } = useTabList(
|
const { activeTabIdState } = useTabList(
|
||||||
SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID,
|
SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID,
|
||||||
@ -55,10 +60,14 @@ export const SettingsAccountsCalendarChannelsContainer = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TabList
|
{tabs.length > 1 && (
|
||||||
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
|
<StyledCalenderContainer>
|
||||||
tabs={tabs}
|
<TabList
|
||||||
/>
|
tabListId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||||
|
tabs={tabs}
|
||||||
|
/>
|
||||||
|
</StyledCalenderContainer>
|
||||||
|
)}
|
||||||
{calendarChannels.map((calendarChannel) => (
|
{calendarChannels.map((calendarChannel) => (
|
||||||
<React.Fragment key={calendarChannel.id}>
|
<React.Fragment key={calendarChannel.id}>
|
||||||
{calendarChannel.id === activeTabId && (
|
{calendarChannel.id === activeTabId && (
|
||||||
|
|||||||
@ -29,7 +29,6 @@ const StyledDetailsContainer = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: ${({ theme }) => theme.spacing(6)};
|
gap: ${({ theme }) => theme.spacing(6)};
|
||||||
padding-top: ${({ theme }) => theme.spacing(6)};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const SettingsAccountsMessageChannelDetails = ({
|
export const SettingsAccountsMessageChannelDetails = ({
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { ConnectedAccount } from '@/accounts/types/ConnectedAccount';
|
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 { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
const StyledMessageContainer = styled.div`
|
||||||
|
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
||||||
|
`;
|
||||||
|
|
||||||
export const SettingsAccountsMessageChannelsContainer = () => {
|
export const SettingsAccountsMessageChannelsContainer = () => {
|
||||||
const { activeTabIdState } = useTabList(
|
const { activeTabIdState } = useTabList(
|
||||||
SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID,
|
SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID,
|
||||||
@ -54,10 +59,14 @@ export const SettingsAccountsMessageChannelsContainer = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TabList
|
{tabs.length > 1 && (
|
||||||
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
|
<StyledMessageContainer>
|
||||||
tabs={tabs}
|
<TabList
|
||||||
/>
|
tabListId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID}
|
||||||
|
tabs={tabs}
|
||||||
|
/>
|
||||||
|
</StyledMessageContainer>
|
||||||
|
)}
|
||||||
{messageChannels.map((messageChannel) => (
|
{messageChannels.map((messageChannel) => (
|
||||||
<React.Fragment key={messageChannel.id}>
|
<React.Fragment key={messageChannel.id}>
|
||||||
{messageChannel.id === activeTabId && (
|
{messageChannel.id === activeTabId && (
|
||||||
|
|||||||
Reference in New Issue
Block a user