Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -27,19 +27,23 @@ interface OptionProps extends ComponentProps<typeof RovingAccessibleButton> {
|
|||
|
||||
export const Option: React.FC<OptionProps> = ({ inputRef, children, endAdornment, className, ...props }) => {
|
||||
const [onFocus, isActive, ref] = useRovingTabIndex(inputRef);
|
||||
return <AccessibleButton
|
||||
{...props}
|
||||
className={classNames(className, "mx_SpotlightDialog_option")}
|
||||
onFocus={onFocus}
|
||||
inputRef={ref}
|
||||
tabIndex={-1}
|
||||
aria-selected={isActive}
|
||||
role="option"
|
||||
>
|
||||
{ children }
|
||||
<div className="mx_SpotlightDialog_option--endAdornment">
|
||||
<kbd className="mx_SpotlightDialog_enterPrompt" aria-hidden>↵</kbd>
|
||||
{ endAdornment }
|
||||
</div>
|
||||
</AccessibleButton>;
|
||||
return (
|
||||
<AccessibleButton
|
||||
{...props}
|
||||
className={classNames(className, "mx_SpotlightDialog_option")}
|
||||
onFocus={onFocus}
|
||||
inputRef={ref}
|
||||
tabIndex={-1}
|
||||
aria-selected={isActive}
|
||||
role="option"
|
||||
>
|
||||
{children}
|
||||
<div className="mx_SpotlightDialog_option--endAdornment">
|
||||
<kbd className="mx_SpotlightDialog_enterPrompt" aria-hidden>
|
||||
↵
|
||||
</kbd>
|
||||
{endAdornment}
|
||||
</div>
|
||||
</AccessibleButton>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -32,14 +32,13 @@ interface Props {
|
|||
}
|
||||
|
||||
export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsId }: Props): JSX.Element {
|
||||
let name = room.name
|
||||
|| getDisplayAliasForAliasSet(room.canonical_alias ?? "", room.aliases ?? [])
|
||||
|| _t('Unnamed room');
|
||||
let name =
|
||||
room.name || getDisplayAliasForAliasSet(room.canonical_alias ?? "", room.aliases ?? []) || _t("Unnamed room");
|
||||
if (name.length > MAX_NAME_LENGTH) {
|
||||
name = `${name.substring(0, MAX_NAME_LENGTH)}...`;
|
||||
}
|
||||
|
||||
let topic = room.topic || '';
|
||||
let topic = room.topic || "";
|
||||
// Additional truncation based on line numbers is done via CSS,
|
||||
// but to ensure that the DOM is not polluted with a huge string
|
||||
// we give it a hard limit before rendering.
|
||||
|
@ -50,18 +49,20 @@ export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsI
|
|||
return (
|
||||
<div className="mx_SpotlightDialog_result_publicRoomDetails">
|
||||
<div className="mx_SpotlightDialog_result_publicRoomHeader">
|
||||
<span id={labelId} className="mx_SpotlightDialog_result_publicRoomName">{ name }</span>
|
||||
<span id={labelId} className="mx_SpotlightDialog_result_publicRoomName">
|
||||
{name}
|
||||
</span>
|
||||
<span id={descriptionId} className="mx_SpotlightDialog_result_publicRoomAlias">
|
||||
{ room.canonical_alias ?? room.room_id }
|
||||
{room.canonical_alias ?? room.room_id}
|
||||
</span>
|
||||
</div>
|
||||
<div id={detailsId} className="mx_SpotlightDialog_result_publicRoomDescription">
|
||||
<span className="mx_SpotlightDialog_result_publicRoomMemberCount">
|
||||
{ _t("%(count)s Members", {
|
||||
{_t("%(count)s Members", {
|
||||
count: room.num_joined_members,
|
||||
}) }
|
||||
})}
|
||||
</span>
|
||||
{ topic && (
|
||||
{topic && (
|
||||
<>
|
||||
·
|
||||
<span
|
||||
|
@ -69,7 +70,7 @@ export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsI
|
|||
dangerouslySetInnerHTML={{ __html: linkifyAndSanitizeHtml(topic) }}
|
||||
/>
|
||||
</>
|
||||
) }
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -41,27 +41,33 @@ export function RoomResultContextMenus({ room }: Props) {
|
|||
let generalMenu: JSX.Element;
|
||||
if (generalMenuPosition !== null) {
|
||||
if (room.isSpaceRoom()) {
|
||||
generalMenu = <SpaceContextMenu
|
||||
{...contextMenuBelow(generalMenuPosition)}
|
||||
space={room}
|
||||
onFinished={() => setGeneralMenuPosition(null)}
|
||||
/>;
|
||||
generalMenu = (
|
||||
<SpaceContextMenu
|
||||
{...contextMenuBelow(generalMenuPosition)}
|
||||
space={room}
|
||||
onFinished={() => setGeneralMenuPosition(null)}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
generalMenu = <RoomGeneralContextMenu
|
||||
{...contextMenuBelow(generalMenuPosition)}
|
||||
room={room}
|
||||
onFinished={() => setGeneralMenuPosition(null)}
|
||||
/>;
|
||||
generalMenu = (
|
||||
<RoomGeneralContextMenu
|
||||
{...contextMenuBelow(generalMenuPosition)}
|
||||
room={room}
|
||||
onFinished={() => setGeneralMenuPosition(null)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let notificationMenu: JSX.Element;
|
||||
if (notificationMenuPosition !== null) {
|
||||
notificationMenu = <RoomNotificationContextMenu
|
||||
{...contextMenuBelow(notificationMenuPosition)}
|
||||
room={room}
|
||||
onFinished={() => setNotificationMenuPosition(null)}
|
||||
/>;
|
||||
notificationMenu = (
|
||||
<RoomNotificationContextMenu
|
||||
{...contextMenuBelow(notificationMenuPosition)}
|
||||
room={room}
|
||||
onFinished={() => setNotificationMenuPosition(null)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const notificationMenuClasses = classNames("mx_SpotlightDialog_option--notifications", {
|
||||
|
@ -86,7 +92,7 @@ export function RoomResultContextMenus({ room }: Props) {
|
|||
title={room.isSpaceRoom() ? _t("Space options") : _t("Room options")}
|
||||
isExpanded={generalMenuPosition !== null}
|
||||
/>
|
||||
{ !room.isSpaceRoom() && (
|
||||
{!room.isSpaceRoom() && (
|
||||
<ContextMenuTooltipButton
|
||||
className={notificationMenuClasses}
|
||||
onClick={(ev: ButtonEvent) => {
|
||||
|
@ -99,9 +105,9 @@ export function RoomResultContextMenus({ room }: Props) {
|
|||
title={_t("Notification options")}
|
||||
isExpanded={notificationMenuPosition !== null}
|
||||
/>
|
||||
) }
|
||||
{ generalMenu }
|
||||
{ notificationMenu }
|
||||
)}
|
||||
{generalMenu}
|
||||
{notificationMenu}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,13 +27,15 @@ interface TooltipOptionProps extends ComponentProps<typeof RovingAccessibleToolt
|
|||
|
||||
export const TooltipOption: React.FC<TooltipOptionProps> = ({ inputRef, className, ...props }) => {
|
||||
const [onFocus, isActive, ref] = useRovingTabIndex(inputRef);
|
||||
return <AccessibleTooltipButton
|
||||
{...props}
|
||||
className={classNames(className, "mx_SpotlightDialog_option")}
|
||||
onFocus={onFocus}
|
||||
inputRef={ref}
|
||||
tabIndex={-1}
|
||||
aria-selected={isActive}
|
||||
role="option"
|
||||
/>;
|
||||
return (
|
||||
<AccessibleTooltipButton
|
||||
{...props}
|
||||
className={classNames(className, "mx_SpotlightDialog_option")}
|
||||
onFocus={onFocus}
|
||||
inputRef={ref}
|
||||
tabIndex={-1}
|
||||
aria-selected={isActive}
|
||||
role="option"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue