feat: Implement forum feed layout and refactor space navigation logic to support new routing structure
This commit is contained in:
@@ -27,8 +27,12 @@ import { AddExistingModal } from '../add-existing';
|
||||
import { SpeechBubble } from '../../components/speech-bubble/SpeechBubble';
|
||||
import { SpaceOptionsMenu, type OpenAddExistingOptions } from '../space/SpaceOptionsMenu';
|
||||
import type { HierarchyItemSpace } from '../../hooks/useSpaceHierarchy';
|
||||
import { StateEvent } from '../../../types/matrix/room';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { getCanonicalAliasOrRoomId } from '../../utils/matrix';
|
||||
import { getSpaceFeedPath } from '../../pages/pathUtils';
|
||||
import { shouldShowForumLobby } from '../../utils/room';
|
||||
import { useForumBoardContextOptionally } from '../forum/ForumBoardContext';
|
||||
import { StateEvent } from '../../../types/matrix/room';
|
||||
|
||||
type LobbyMenuProps = {
|
||||
powerLevels: IPowerLevels;
|
||||
@@ -37,7 +41,9 @@ type LobbyMenuProps = {
|
||||
const LobbyMenu = forwardRef<HTMLDivElement, LobbyMenuProps>(
|
||||
({ powerLevels, requestClose }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const navigate = useNavigate();
|
||||
const space = useSpace();
|
||||
const isForum = shouldShowForumLobby(space);
|
||||
const creators = useRoomCreators(space);
|
||||
|
||||
const permissions = useRoomPermissions(creators, powerLevels);
|
||||
@@ -55,6 +61,11 @@ const LobbyMenu = forwardRef<HTMLDivElement, LobbyMenuProps>(
|
||||
requestClose();
|
||||
};
|
||||
|
||||
const handleOpenFeed = () => {
|
||||
navigate(getSpaceFeedPath(getCanonicalAliasOrRoomId(mx, space.roomId)));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Menu ref={ref} style={{ maxWidth: toRem(160), width: '100vw' }}>
|
||||
{invitePrompt && (
|
||||
@@ -67,6 +78,18 @@ const LobbyMenu = forwardRef<HTMLDivElement, LobbyMenuProps>(
|
||||
/>
|
||||
)}
|
||||
<Box direction="Column" gap="100" style={{ padding: config.space.S100 }}>
|
||||
{isForum && (
|
||||
<MenuItem
|
||||
onClick={handleOpenFeed}
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Thread} />}
|
||||
radii="300"
|
||||
>
|
||||
<Text style={{ flexGrow: 1 }} as="span" size="T300" truncate>
|
||||
Feed
|
||||
</Text>
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
onClick={handleInvite}
|
||||
variant="Primary"
|
||||
|
||||
Reference in New Issue
Block a user