feat: enhance room navigation with sub-room indicators and styling adjustments
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Chip,
|
||||
Icon,
|
||||
@@ -28,13 +27,14 @@ function getServerFromRoomId(roomId: string): string {
|
||||
type UnjoinedSubRoomItemProps = {
|
||||
roomId: string;
|
||||
depth: number;
|
||||
isLast?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays an unjoined sub-room with a Join button.
|
||||
* Used when a parent room has sub-rooms that the user hasn't joined yet.
|
||||
*/
|
||||
export function UnjoinedSubRoomItem({ roomId, depth }: UnjoinedSubRoomItemProps) {
|
||||
export function UnjoinedSubRoomItem({ roomId, depth, isLast = false }: UnjoinedSubRoomItemProps) {
|
||||
const mx = useMatrixClient();
|
||||
const viaServers = [getServerFromRoomId(roomId)].filter(Boolean);
|
||||
|
||||
@@ -43,17 +43,32 @@ export function UnjoinedSubRoomItem({ roomId, depth }: UnjoinedSubRoomItemProps)
|
||||
);
|
||||
|
||||
const canJoin = joinState.status === AsyncStatus.Idle || joinState.status === AsyncStatus.Error;
|
||||
const paddingLeft = depth > 0 ? `${depth * 24}px` : undefined;
|
||||
const paddingLeft = depth > 0 ? '30px' : undefined;
|
||||
|
||||
let treeIcon = '';
|
||||
if (depth > 0) {
|
||||
treeIcon = isLast ? '╰' : '├';
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
style={{ paddingLeft, padding: `${config.space.S100} ${config.space.S200}` }}
|
||||
style={{ paddingLeft, padding: `${config.space.S100} ${config.space.S200}`, minHeight: '1.5rem' }}
|
||||
alignItems="Center"
|
||||
gap="200"
|
||||
>
|
||||
<Avatar size="200" radii="400">
|
||||
<Icon src={Icons.Hash} size="100" />
|
||||
</Avatar>
|
||||
{treeIcon && (
|
||||
<span style={{
|
||||
paddingRight: '2px',
|
||||
opacity: 0.5,
|
||||
fontFamily: 'monospace',
|
||||
fontSize: '14px',
|
||||
lineHeight: '1',
|
||||
userSelect: 'none',
|
||||
marginLeft: '-10px'
|
||||
}}>
|
||||
{treeIcon}
|
||||
</span>
|
||||
)}
|
||||
<Box grow="Yes" alignItems="Center" gap="100">
|
||||
<Text size="T300" truncate style={{ opacity: 0.7 }}>
|
||||
{roomId}
|
||||
|
||||
Reference in New Issue
Block a user