From 5ea894780ceee1bd39102254323d5f8430dc51d0 Mon Sep 17 00:00:00 2001 From: zuies Date: Mon, 11 Dec 2023 15:17:06 +0300 Subject: [PATCH] change platform page --- .../communityIntegrations/TcConnectedPlatformsItem.tsx | 4 +++- src/components/communitySettings/platform/TcPlatform.tsx | 2 +- .../communitySettings/platform/TcPlatformChannelList.tsx | 6 +++--- src/context/ChannelContext.tsx | 3 --- src/pages/callback.tsx | 2 +- .../community-settings/platform/{[id].tsx => index.tsx} | 6 +++--- 6 files changed, 11 insertions(+), 12 deletions(-) rename src/pages/community-settings/platform/{[id].tsx => index.tsx} (85%) diff --git a/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx b/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx index d0ab687e..8a3fc5a2 100644 --- a/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx +++ b/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx @@ -72,7 +72,9 @@ function TcConnectedPlatformsItem({ platform }: TcConnectedPlatformsItemProps) { - router.push(`/community-settings/platform/${platform.id}/`) + router.push( + `/community-settings/platform/?platformId=${platform.id}` + ) } /> diff --git a/src/components/communitySettings/platform/TcPlatform.tsx b/src/components/communitySettings/platform/TcPlatform.tsx index 763449f8..7dc798a1 100644 --- a/src/components/communitySettings/platform/TcPlatform.tsx +++ b/src/components/communitySettings/platform/TcPlatform.tsx @@ -39,7 +39,7 @@ function TcPlatform({ platformName = 'Discord' }: TcPlatformProps) { const { refreshData, selectedSubChannels } = channelContext; - const id = router.query.id as string; + const id = router.query.platformId as string; const fetchPlatform = async () => { if (id) { diff --git a/src/components/communitySettings/platform/TcPlatformChannelList.tsx b/src/components/communitySettings/platform/TcPlatformChannelList.tsx index f3e7ccb2..9baa339d 100644 --- a/src/components/communitySettings/platform/TcPlatformChannelList.tsx +++ b/src/components/communitySettings/platform/TcPlatformChannelList.tsx @@ -22,9 +22,9 @@ function TcPlatformChannelList({ const channelContext = useContext(ChannelContext); const router = useRouter(); - const id = Array.isArray(router.query.id) - ? router.query.id[0] - : router.query.id; + const id = Array.isArray(router.query.platformId) + ? router.query.platformId[0] + : router.query.platformId; const { channels, diff --git a/src/context/ChannelContext.tsx b/src/context/ChannelContext.tsx index db6addd8..d7beb09c 100644 --- a/src/context/ChannelContext.tsx +++ b/src/context/ChannelContext.tsx @@ -86,8 +86,6 @@ export const ChannelProvider = ({ children }: ChannelProviderProps) => { const data = await retrievePlatformProperties({ property, platformId }); setChannels(data); if (selectedChannels) { - console.log('dsd'); - updateSelectedSubChannels(data, selectedChannels); } else { const newSelectedSubChannels = data.reduce( @@ -171,7 +169,6 @@ export const ChannelProvider = ({ children }: ChannelProviderProps) => { updatedSelectedSubChannels[channel.channelId] = channelUpdates; }); - console.log({ updatedSelectedSubChannels }); return updatedSelectedSubChannels; }); diff --git a/src/pages/callback.tsx b/src/pages/callback.tsx index 7ae311f7..a90afc22 100644 --- a/src/pages/callback.tsx +++ b/src/pages/callback.tsx @@ -85,7 +85,7 @@ function Callback() { if (!data) { router.push('community-settings'); } - router.push(`/community-settings/platform/${data.id}`); + router.push(`/community-settings/platform/?platformId=${data.id}`); } catch (error) { console.error('Failed to create new platform:', error); } diff --git a/src/pages/community-settings/platform/[id].tsx b/src/pages/community-settings/platform/index.tsx similarity index 85% rename from src/pages/community-settings/platform/[id].tsx rename to src/pages/community-settings/platform/index.tsx index 232aa4b4..716703ef 100644 --- a/src/pages/community-settings/platform/[id].tsx +++ b/src/pages/community-settings/platform/index.tsx @@ -5,7 +5,7 @@ import TcBreadcrumbs from '../../../components/shared/TcBreadcrumbs'; import { ChannelProvider } from '../../../context/ChannelContext'; import { defaultLayout } from '../../../layouts/defaultLayout'; -function PlatformConfigurations() { +function Index() { return ( <> @@ -23,6 +23,6 @@ function PlatformConfigurations() { ); } -PlatformConfigurations.pageLayout = defaultLayout; +Index.pageLayout = defaultLayout; -export default PlatformConfigurations; +export default Index;