diff --git a/src/app/hooks/router/useExploreSelected.ts b/src/app/hooks/router/useExploreSelected.ts index f0ffdc86..7c6104d3 100644 --- a/src/app/hooks/router/useExploreSelected.ts +++ b/src/app/hooks/router/useExploreSelected.ts @@ -11,7 +11,7 @@ export const useExploreSelected = (): boolean => { return !!match; }; -export const useExploreFeaturedSelected = (): boolean => { +export const useExploringFeaturedRooms = (): boolean => { const match = useMatch({ path: getExploreFeaturedPath(), caseSensitive: true, diff --git a/src/app/pages/client/explore/Explore.tsx b/src/app/pages/client/explore/Explore.tsx index 661c6053..03f9b4a7 100644 --- a/src/app/pages/client/explore/Explore.tsx +++ b/src/app/pages/client/explore/Explore.tsx @@ -32,7 +32,7 @@ import { import { getExploreFeaturedPath, getExploreServerPath } from '../../pathUtils'; import { useClientConfig } from '../../../hooks/useClientConfig'; import { - useExploreFeaturedSelected, + useExploringFeaturedRooms, useExploreServer, } from '../../../hooks/router/useExploreSelected'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; @@ -232,8 +232,8 @@ export function Explore() { ); const [exploreServers, addServer, removeServer] = useExploreServers(); - const featuredSelected = useExploreFeaturedSelected(); const selectedServer = useExploreServer(); + const exploringFeaturedRooms = useExploringFeaturedRooms(); const exploringUnlistedServer = useMemo( () => selectedServer !== undefined && @@ -245,10 +245,12 @@ export function Explore() { const addServerCallback = useCallback( async (server: string) => { - await addServer(server); + if (server !== userServer && featuredServers.indexOf(server) === -1) { + await addServer(server); + } navigate(getExploreServerPath(server)); }, - [addServer, navigate] + [addServer, navigate, userServer, featuredServers] ); const removeServerCallback = useCallback( @@ -281,22 +283,6 @@ export function Explore() { - - - - - - - - - - Featured - - - - - - {userServer && ( )} @@ -311,7 +297,7 @@ export function Explore() { - View with Address + Explore with Address @@ -320,9 +306,25 @@ export function Explore() { - Servers + Featured + + + + + + + + + + Featured Rooms + + + + + + {featuredServers.map((server) => ( ))} + + + + + Servers + + {exploreServers.map((server) => ( View Server} + header={Add Server} >