From 70894b3d4a1ca5a603e28a2996a8e7ec34a837ac Mon Sep 17 00:00:00 2001 From: zuies Date: Thu, 30 Nov 2023 12:22:33 +0300 Subject: [PATCH] replace switch-community with select-community routes --- .../TcConfirmDeleteCommunity.tsx | 2 +- .../switchCommunity/TcSwitchCommunity.tsx | 2 +- src/components/layouts/Sidebar.tsx | 4 +- .../switch-community/index.tsx | 144 ------------------ 4 files changed, 3 insertions(+), 149 deletions(-) delete mode 100644 src/pages/community-settings/switch-community/index.tsx diff --git a/src/components/communitySettings/switchCommunity/TcConfirmDeleteCommunity.tsx b/src/components/communitySettings/switchCommunity/TcConfirmDeleteCommunity.tsx index 9ee595bd..a2cb3c42 100644 --- a/src/components/communitySettings/switchCommunity/TcConfirmDeleteCommunity.tsx +++ b/src/components/communitySettings/switchCommunity/TcConfirmDeleteCommunity.tsx @@ -46,7 +46,7 @@ function TcConfirmDeleteCommunity({ setOpenDialog(false); setCommunityNameInput(''); handleUpdatePlatforms(); - Router.push('/community-settings/switch-community'); + Router.push('/centric/select-community'); } }; diff --git a/src/components/communitySettings/switchCommunity/TcSwitchCommunity.tsx b/src/components/communitySettings/switchCommunity/TcSwitchCommunity.tsx index e433053a..bd1a1701 100644 --- a/src/components/communitySettings/switchCommunity/TcSwitchCommunity.tsx +++ b/src/components/communitySettings/switchCommunity/TcSwitchCommunity.tsx @@ -13,7 +13,7 @@ function TcSwitchCommunity() { text={'Switch account'} variant="outlined" sx={{ width: '10.5rem', padding: '0.5rem' }} - onClick={() => router.push('/community-settings/switch-community')} + onClick={() => router.push('/centric/select-community')} /> diff --git a/src/components/layouts/Sidebar.tsx b/src/components/layouts/Sidebar.tsx index 3e96d03a..6cbf80af 100644 --- a/src/components/layouts/Sidebar.tsx +++ b/src/components/layouts/Sidebar.tsx @@ -99,9 +99,7 @@ const Sidebar = () => {
- router.push('/community-settings/switch-community') - } + onClick={() => router.push('/centric/select-community')} > {guildId && guildInfoByDiscord.icon ? ( (false); - const [communityLoading, setCommunityLoading] = useState(false); - const [activeCommunity, setActiveCommunity] = useState(); - const [fetchedCommunities, setFetchedCommunities] = useState({ - limit: 10, - page: 1, - results: [], - totalPages: 0, - totalResults: 0, - }); - - const fetchCommunities = async (params: any) => { - setLoading(true); - const communities = await retrieveCommunities(params); - setFetchedCommunities(communities); - setLoading(false); - }; - - const debouncedFetchCommunities = debounce((value: string) => { - fetchCommunities({ page: 1, limit: 10, name: value }); - }, 300); - - useEffect(() => { - fetchCommunities({ page: 1, limit: 10 }); - }, []); - - const handleSelectedCommunity = () => { - setCommunityLoading(true); - StorageService.writeLocalStorage('community', activeCommunity); - if (activeCommunity) { - updateCommunity(activeCommunity); - } - router.push('/community-settings'); - }; - - return ( - <> - -
- -
- - -
- - debouncedFetchCommunities(e.target.value) - } - /> -
- {loading ? ( - - ) : ( - - setActiveCommunity(community) - } - /> - )} - - } - className="md:w-3/6 mx-auto border border-custom-gray min-h-[20rem] max-h-[25rem] overflow-y-scroll rounded-lg" - /> - - Can't see your community?{' '} - - Connect with the identifier - {' '} - that was used to grant you access. - - } - /> -
- -
-
- - } - text="Create" - variant="outlined" - onClick={() => router.push('/centric/create-new-community')} - /> -
-
-
- } - /> -
- - ); -} - -Index.pageLayout = defaultLayout; - -export default Index;