Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Show bubble tile timestamps for bubble layout inside the bubble #7622

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions res/css/views/messages/_CallEvent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ limitations under the License.
}
}

.mx_MessageTimestamp {
margin-left: 16px;
}

&.mx_CallEvent_narrow {
height: unset;
width: 290px;
Expand Down
9 changes: 8 additions & 1 deletion res/css/views/messages/_EventTileBubble.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
max-width: 75%;
box-sizing: border-box;
display: grid;
grid-template-columns: 24px minmax(0, 1fr) min-content;
grid-template-columns: 24px minmax(0, 1fr) min-content min-content;

&::before, &::after {
position: relative;
Expand Down Expand Up @@ -57,4 +57,11 @@ limitations under the License.
grid-column: 2;
grid-row: 2;
}

.mx_MessageTimestamp {
grid-column: 4;
grid-row: 1 / 3;
align-self: center;
margin-left: 16px;
}
}
8 changes: 8 additions & 0 deletions res/css/views/rooms/_EventBubbleTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,14 @@ limitations under the License.
}
}

.mx_EventTile.mx_EventTile_bubbleContainer[data-layout=bubble],
.mx_EventTile.mx_EventTile_leftAlignedBubble[data-layout=bubble] {
.mx_EventTile_line > a {
// hide this timestamp as the tile will render its own
display: none;
}
}

.mx_EventTile.mx_EventTile_bubbleContainer[data-layout=bubble],
.mx_EventTile.mx_EventTile_leftAlignedBubble[data-layout=bubble],
.mx_EventTile.mx_EventTile_info[data-layout=bubble],
Expand Down
10 changes: 10 additions & 0 deletions src/components/views/messages/CallEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const MAX_NON_NARROW_WIDTH = 450 / 70 * 100;
interface IProps {
mxEvent: MatrixEvent;
callEventGrouper: CallEventGrouper;
timestamp?: JSX.Element;
}

interface IState {
Expand Down Expand Up @@ -145,6 +146,7 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
>
<span> { _t("Accept") } </span>
</AccessibleButton>
{ this.props.timestamp }
</div>
);
}
Expand All @@ -157,6 +159,7 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
<div className="mx_CallEvent_content">
{ _t("Call declined") }
{ this.renderCallBackButton(_t("Call back")) }
{ this.props.timestamp }
</div>
);
} else if (([CallErrorCode.UserHangup, "user hangup"].includes(hangupReason) || !hangupReason)) {
Expand All @@ -174,13 +177,15 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
return (
<div className="mx_CallEvent_content">
{ text }
{ this.props.timestamp }
</div>
);
} else if (hangupReason === CallErrorCode.InviteTimeout) {
return (
<div className="mx_CallEvent_content">
{ _t("No answer") }
{ this.renderCallBackButton(_t("Call back")) }
{ this.props.timestamp }
</div>
);
}
Expand Down Expand Up @@ -215,20 +220,23 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
/>
{ _t("Connection failed") }
{ this.renderCallBackButton(_t("Retry")) }
{ this.props.timestamp }
</div>
);
}
if (state === CallState.Connected) {
return (
<div className="mx_CallEvent_content">
<Clock seconds={this.state.length} />
{ this.props.timestamp }
</div>
);
}
if (state === CallState.Connecting) {
return (
<div className="mx_CallEvent_content">
{ _t("Connecting") }
{ this.props.timestamp }
</div>
);
}
Expand All @@ -237,13 +245,15 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
<div className="mx_CallEvent_content">
{ _t("Missed call") }
{ this.renderCallBackButton(_t("Call back")) }
{ this.props.timestamp }
</div>
);
}

return (
<div className="mx_CallEvent_content">
{ _t("The call is in an unknown state!") }
{ this.props.timestamp }
</div>
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/views/messages/EncryptionEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ import { objectHasDiff } from "../../../utils/objects";

interface IProps {
mxEvent: MatrixEvent;
timestamp?: JSX.Element;
}

const ALGORITHM = "m.megolm.v1.aes-sha2";

const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({ mxEvent }, ref) => {
const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({ mxEvent, timestamp }, ref) => {
const cli = useContext(MatrixClientContext);
const roomId = mxEvent.getRoomId();
const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(roomId);
Expand Down Expand Up @@ -60,6 +61,7 @@ const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({ mxEvent }, ref) =>
className="mx_cryptoEvent mx_cryptoEvent_icon"
title={_t("Encryption enabled")}
subtitle={subtitle}
timestamp={timestamp}
/>;
}

Expand All @@ -68,6 +70,7 @@ const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({ mxEvent }, ref) =>
className="mx_cryptoEvent mx_cryptoEvent_icon"
title={_t("Encryption enabled")}
subtitle={_t("Ignored attempt to disable encryption")}
timestamp={timestamp}
/>;
}

Expand All @@ -76,6 +79,7 @@ const EncryptionEvent = forwardRef<HTMLDivElement, IProps>(({ mxEvent }, ref) =>
title={_t("Encryption not enabled")}
subtitle={_t("The encryption used by this room isn't supported.")}
ref={ref}
timestamp={timestamp}
/>;
});

Expand Down
10 changes: 9 additions & 1 deletion src/components/views/messages/EventTileBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,23 @@ import classNames from "classnames";
interface IProps {
className: string;
title: string;
timestamp?: JSX.Element;
subtitle?: ReactNode;
children?: ReactChildren;
}

const EventTileBubble = forwardRef<HTMLDivElement, IProps>(({ className, title, subtitle, children }, ref) => {
const EventTileBubble = forwardRef<HTMLDivElement, IProps>(({
className,
title,
timestamp,
subtitle,
children,
}, ref) => {
return <div className={classNames("mx_EventTileBubble", className)} ref={ref}>
<div className="mx_EventTileBubble_title">{ title }</div>
{ subtitle && <div className="mx_EventTileBubble_subtitle">{ subtitle }</div> }
{ children }
{ timestamp }
</div>;
});

Expand Down
4 changes: 4 additions & 0 deletions src/components/views/messages/MJitsiWidgetEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";

interface IProps {
mxEvent: MatrixEvent;
timestamp?: JSX.Element;
}

@replaceableComponent("views.messages.MJitsiWidgetEvent")
Expand Down Expand Up @@ -54,20 +55,23 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
return <EventTileBubble
className="mx_MJitsiWidgetEvent"
title={_t('Video conference ended by %(senderName)s', { senderName })}
timestamp={this.props.timestamp}
/>;
} else if (prevUrl) {
// modified
return <EventTileBubble
className="mx_MJitsiWidgetEvent"
title={_t('Video conference updated by %(senderName)s', { senderName })}
subtitle={joinCopy}
timestamp={this.props.timestamp}
/>;
} else {
// assume added
return <EventTileBubble
className="mx_MJitsiWidgetEvent"
title={_t("Video conference started by %(senderName)s", { senderName })}
subtitle={joinCopy}
timestamp={this.props.timestamp}
/>;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
interface IProps {
/* the MatrixEvent to show */
mxEvent: MatrixEvent;
timestamp?: JSX.Element;
}

@replaceableComponent("views.messages.MKeyVerificationConclusion")
Expand Down Expand Up @@ -133,6 +134,7 @@ export default class MKeyVerificationConclusion extends React.Component<IProps>
className={classes}
title={title}
subtitle={userLabelForEventRoom(request.otherUserId, mxEvent.getRoomId())}
timestamp={this.props.timestamp}
/>;
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/views/messages/MKeyVerificationRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import RightPanelStore from '../../../stores/right-panel/RightPanelStore';

interface IProps {
mxEvent: MatrixEvent;
timestamp?: JSX.Element;
}

@replaceableComponent("views.messages.MKeyVerificationRequest")
Expand Down Expand Up @@ -168,6 +169,7 @@ export default class MKeyVerificationRequest extends React.Component<IProps> {
className="mx_cryptoEvent mx_cryptoEvent_icon"
title={title}
subtitle={subtitle}
timestamp={this.props.timestamp}
>
{ stateNode }
</EventTileBubble>;
Expand Down
2 changes: 2 additions & 0 deletions src/components/views/messages/RoomCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
interface IProps {
/* the MatrixEvent to show */
mxEvent: MatrixEvent;
timestamp?: JSX.Element;
}

@replaceableComponent("views.messages.RoomCreate")
Expand Down Expand Up @@ -65,6 +66,7 @@ export default class RoomCreate extends React.Component<IProps> {
className="mx_CreateEvent"
title={_t("This room is a continuation of another conversation.")}
subtitle={link}
timestamp={this.props.timestamp}
/>;
}
}
20 changes: 12 additions & 8 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1273,12 +1273,13 @@ export default class EventTile extends React.Component<IProps, IState> {
? this.props.mxEvent.getTs()
: thread?.lastReply.getTs();

const timestamp = showTimestamp && ts ?
<MessageTimestamp
showRelative={this.props.tileShape === TileShape.ThreadPanel}
showTwelveHour={this.props.isTwelveHour}
ts={ts}
/> : null;
const messageTimestamp = <MessageTimestamp
showRelative={this.props.tileShape === TileShape.ThreadPanel}
showTwelveHour={this.props.isTwelveHour}
ts={ts}
/>;

const timestamp = showTimestamp && ts ? messageTimestamp : null;

const keyRequestHelpText =
<div className="mx_EventTile_keyRequestInfo_tooltip_contents">
Expand Down Expand Up @@ -1339,9 +1340,10 @@ export default class EventTile extends React.Component<IProps, IState> {
{ timestamp }
</a>;

const useIRCLayout = this.props.layout == Layout.IRC;
const useIRCLayout = this.props.layout === Layout.IRC;
const groupTimestamp = !useIRCLayout ? linkedTimestamp : null;
const ircTimestamp = useIRCLayout ? linkedTimestamp : null;
const bubbleTimestamp = this.props.layout === Layout.Bubble ? messageTimestamp : null;
const groupPadlock = !useIRCLayout && !isBubbleMessage && this.renderE2EPadlock();
const ircPadlock = useIRCLayout && !isBubbleMessage && this.renderE2EPadlock();

Expand Down Expand Up @@ -1567,7 +1569,8 @@ export default class EventTile extends React.Component<IProps, IState> {
{ groupTimestamp }
{ groupPadlock }
{ replyChain }
<EventTileType ref={this.tile}
<EventTileType
ref={this.tile}
mxEvent={this.props.mxEvent}
forExport={this.props.forExport}
replacingEventId={this.props.replacingEventId}
Expand All @@ -1580,6 +1583,7 @@ export default class EventTile extends React.Component<IProps, IState> {
callEventGrouper={this.props.callEventGrouper}
getRelationsForEvent={this.props.getRelationsForEvent}
isSeeingThroughMessageHiddenForModeration={isSeeingThroughMessageHiddenForModeration}
timestamp={bubbleTimestamp}
/>
{ keyRequestInfo }
{ actionBar }
Expand Down