diff --git a/overlay/src/app/features/room/RoomView.tsx b/overlay/src/app/features/room/RoomView.tsx index 8213401..98d102e 100644 --- a/overlay/src/app/features/room/RoomView.tsx +++ b/overlay/src/app/features/room/RoomView.tsx @@ -14,7 +14,8 @@ import { RoomTimeline } from './RoomTimeline'; import { RoomViewTyping } from './RoomViewTyping'; import { RoomTombstone } from './RoomTombstone'; import { RoomInput } from './RoomInput'; -import { RoomViewFollowing, RoomViewFollowingPlaceholder } from './RoomViewFollowing'; +import { RoomViewFollowing } from './RoomViewFollowing'; +import * as roomViewCss from './RoomViewFollowing.css'; import { Page } from '../../components/page'; import { RoomViewHeader } from './RoomViewHeader'; import { useKeyDown } from '../../hooks/useKeyDown'; @@ -116,7 +117,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) { ) : ( <> - + - +
+ + {!hideActivity && } +
- {immersive && !hideActivity && ( -
-
- -
-
- )}
{tombstoneEvent ? ( )}
- {!immersive && - (hideActivity ? ( - - ) : ( - - ))}
)} diff --git a/overlay/src/app/features/room/RoomViewFollowing.css.ts b/overlay/src/app/features/room/RoomViewFollowing.css.ts index 748ecab..b880513 100644 --- a/overlay/src/app/features/room/RoomViewFollowing.css.ts +++ b/overlay/src/app/features/room/RoomViewFollowing.css.ts @@ -2,6 +2,20 @@ import { style } from '@vanilla-extract/css'; import { recipe } from '@vanilla-extract/recipes'; import { DefaultReset, color, config, toRem } from 'folds'; +/** Floats typing + read receipts over the bottom of the timeline. */ +export const RoomViewBottomFloat = style({ + position: 'absolute', + bottom: 0, + left: 0, + right: 0, + zIndex: 1, + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + gap: config.space.S200, + pointerEvents: 'none', +}); + export const RoomViewFollowingPlaceholder = style([ DefaultReset, { @@ -15,20 +29,12 @@ export const RoomViewFollowing = recipe({ { minHeight: toRem(28), padding: `0 ${config.space.S400}`, - width: '100%', - backgroundColor: color.Surface.Container, + marginLeft: 'auto', + maxWidth: '50%', + backgroundColor: 'transparent', color: color.Surface.OnContainer, outline: 'none', - selectors: { - // Compact floating chip while the keyboard is open. - '[data-composer-flush="true"] &': { - minHeight: 0, - width: 'auto', - maxWidth: '100%', - padding: `${config.space.S100} ${config.space.S200}`, - backgroundColor: 'transparent', - }, - }, + pointerEvents: 'auto', }, ], variants: { diff --git a/overlay/src/app/features/room/message/Message.tsx b/overlay/src/app/features/room/message/Message.tsx index d71362d..19b93c6 100644 --- a/overlay/src/app/features/room/message/Message.tsx +++ b/overlay/src/app/features/room/message/Message.tsx @@ -62,6 +62,10 @@ import colorMXID from '../../../../util/colorMXID'; import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag'; import { Presence, useUserPresence } from '../../../hooks/useUserPresence'; import { useOtherUserColor } from '../../../hooks/useUserColor'; +import { useIsDirectRoom } from '../../../hooks/useRoom'; +import { useOtherUserCollectibles } from '../../../hooks/useUserCollectibles'; +import { pickAvatarDecorationUrl, pickNameplateUrl } from '../../../utils/collectibleAssets'; +import * as avatarDecorationCss from '../../../styles/AvatarDecoration.css'; export type ReactionHandler = (keyOrMxc: string, shortcode: string) => void; @@ -754,8 +758,15 @@ export const Message = as<'div', MessageProps>( ) => { const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); + const direct = useIsDirectRoom(); const senderId = mEvent.getSender() ?? ''; const senderPresence = useUserPresence(senderId); + const { assetUrls } = useOtherUserCollectibles(senderId); + const nameplateUrl = pickNameplateUrl(assetUrls); + const nameplateIsVideo = Boolean( + assetUrls['nameplate:animated'] || assetUrls['nameplate:asset.webm'] + ); + const avatarDecorationUrl = pickAvatarDecorationUrl(assetUrls); const [hover, setHover] = useState(false); const { hoverProps } = useHover({ onHoverChange: setHover }); @@ -796,6 +807,7 @@ export const Message = as<'div', MessageProps>( // Priority: custom user color > tag color (non-legacy) > colorMXID (legacy) const usernameColor = customUserColor ?? (legacyUsernameColor ? colorMXID(senderId) : tagColor); + const showNameplate = direct && hover && Boolean(nameplateUrl); const headerJSX = !collapse && ( ( {tagIconSrc && } - - {messageLayout === MessageLayout.Modern && hover && ( - <> - - {senderId} - - - | - - + + + {messageLayout === MessageLayout.Modern && hover && ( + <> + + {senderId} + + + | + + + )} + + {showNameplate && ( +
+ {nameplateIsVideo ? ( +
)} -
); @@ -857,24 +887,38 @@ export const Message = as<'div', MessageProps>( - - } - /> - +
+ + } + /> + + {avatarDecorationUrl && ( + + )} +
); @@ -959,6 +1003,10 @@ export const Message = as<'div', MessageProps>( {...focusWithinProps} ref={ref} > +
{!edit && (hover || !!menuAnchor || !!emojiBoardAnchor) && (
@@ -1247,6 +1295,7 @@ export const Message = as<'div', MessageProps>( {msgContentJSX} )} +
); } diff --git a/overlay/src/app/features/room/room-composer-mobile.css.ts b/overlay/src/app/features/room/room-composer-mobile.css.ts index 9f8beee..fc32a32 100644 --- a/overlay/src/app/features/room/room-composer-mobile.css.ts +++ b/overlay/src/app/features/room/room-composer-mobile.css.ts @@ -1,63 +1,5 @@ import { style } from '@vanilla-extract/css'; -import { recipe } from '@vanilla-extract/recipes'; -import { DefaultReset, color, config } from 'folds'; export const ComposerDock = style({ position: 'relative', }); - -/** Read receipts float above the input so they don't reserve layout height. */ -export const FollowingFloat = style({ - position: 'absolute', - bottom: '100%', - left: 0, - right: 0, - zIndex: 2, - display: 'flex', - justifyContent: 'flex-end', - pointerEvents: 'none', - padding: `0 ${config.space.S200}`, -}); - -export const FollowingFloatHit = style({ - pointerEvents: 'auto', - maxWidth: '100%', -}); - -export const RoomViewFollowingPlaceholder = style([ - DefaultReset, - { - display: 'none', - height: 0, - }, -]); - -export const RoomViewFollowing = recipe({ - base: [ - DefaultReset, - { - minHeight: 0, - padding: `${config.space.S100} ${config.space.S200}`, - width: 'auto', - maxWidth: '100%', - backgroundColor: 'transparent', - color: color.Surface.OnContainer, - outline: 'none', - }, - ], - variants: { - clickable: { - true: { - cursor: 'pointer', - selectors: { - '&:hover, &:focus-visible': { - color: color.Primary.Main, - }, - '&:active': { - color: color.Primary.Main, - }, - }, - }, - }, - }, -});