diff --git a/pages/explore/DisplayFederatedHomeserverDomain.js b/pages/explore/DisplayFederatedHomeserverDomain.js new file mode 100644 index 00000000..d1ac3d54 --- /dev/null +++ b/pages/explore/DisplayFederatedHomeserverDomain.js @@ -0,0 +1,5 @@ +const FederatedSpan = ({ children }) => { + return {children}; +}; + +export default FederatedSpan; diff --git a/pages/explore/TreePath.js b/pages/explore/TreePath.js index 2ebba116..850c6bac 100644 --- a/pages/explore/TreePath.js +++ b/pages/explore/TreePath.js @@ -10,8 +10,9 @@ import { BreadcrumbList, BreadcrumbSeparator, } from '@/components/UI/shadcn/Breadcrumb'; +import DisplayFederatedHomeserverDomain from './DisplayFederatedHomeserverDomain'; -const TreePath = ({ selectedSpaceChildren }) => { +const TreePath = ({ selectedSpaceChildren, federated }) => { return ( <> @@ -36,7 +37,14 @@ const TreePath = ({ selectedSpaceChildren }) => { asChild className="grid w-full grid-flow-col justify-start gap-2" > - {path[0].name} + + {path[0].name} + {federated && ( + + {federated} + + )} + ); } @@ -59,6 +67,9 @@ const TreePath = ({ selectedSpaceChildren }) => { {path[0].name} + {federated && ( + {federated} + )} diff --git a/pages/explore/[[...roomId]].js b/pages/explore/[[...roomId]].js index 811aa87f..7a95d16b 100644 --- a/pages/explore/[[...roomId]].js +++ b/pages/explore/[[...roomId]].js @@ -43,6 +43,7 @@ import { Progress } from '@/components/UI/shadcn/Progress'; import ExploreMatrixActions from './manage-room/ExploreMatrixActions'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/UI/shadcn/Tabs'; import { useMediaQuery } from '@/lib/utils'; +import DisplayFederatedHomeserverDomain from './DisplayFederatedHomeserverDomain'; /** * Explore component for managing room hierarchies and content. @@ -150,6 +151,12 @@ export default function Explore() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [router.query?.roomId, matrix.initialSyncDone, cachedSpace]); + const extractHomeserverFromRoomId = (roomId) => { + const parts = roomId.split(':'); + + return parts[1]; + }; + const removeChildFromParent = async (idToRemove) => { if (idToRemove === roomId) { toast.error('You cannot remove the parent room from itself'); @@ -241,11 +248,18 @@ export default function Explore() { { accessorKey: 'name', header: 'Name', - cell: ({ row }) => ( - - {row.getValue('name')} - - ), + cell: ({ row }) => { + const homeserver = extractHomeserverFromRoomId(row.roomId); + + return ( + + {row.getValue('name')} + {homeserver !== matrixClient.getDomain() && ( + {homeserver} + )} + + ); + }, }, { id: 'actions', @@ -331,7 +345,14 @@ export default function Explore() { content={window.location.href} title={ !_.isEmpty(selectedSpaceChildren) && ( - + ) } roomName={selectedSpaceChildren[selectedSpaceChildren.length - 1][0].name} @@ -341,7 +362,7 @@ export default function Explore() { myPowerLevel={myPowerLevel} setActiveContentView={setActiveContentView} joinRule={selectedSpaceChildren[selectedSpaceChildren.length - 1][0].join_rule} - service="/explore" + service="/explore" />