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

Commit

Permalink
Merge branch 'develop' into EventBubbleTile
Browse files Browse the repository at this point in the history
  • Loading branch information
luixxiul committed May 2, 2022
2 parents 509a164 + 4831129 commit 5c069e0
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 79 deletions.
2 changes: 2 additions & 0 deletions res/css/structures/_SpacePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ $activeBorderColor: $primary-content;
border-radius: 12px;
padding: 4px;
width: calc(100% - 32px);
min-width: 0;
}

.mx_SpaceButton_name {
Expand Down Expand Up @@ -274,6 +275,7 @@ $activeBorderColor: $primary-content;
display: flex;
flex-direction: column;
max-width: 250px;
min-width: 0;
flex-grow: 1;

.mx_BaseAvatar:not(.mx_UserMenu_userAvatar_BaseAvatar) .mx_BaseAvatar_initial {
Expand Down
1 change: 1 addition & 0 deletions res/css/views/messages/_MLocationBody.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ limitations under the License.
z-index: 0; // keeps the entire map under the message action bar

border-radius: $timeline-image-border-radius;
cursor: pointer;
}
}

Expand Down
27 changes: 14 additions & 13 deletions res/css/views/right_panel/_UserInfo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ limitations under the License.

.mx_UserInfo_container {
padding: 8px 16px;

.mx_UserInfo_container_verifyButton {
margin-top: $spacing-8;
}
}

.mx_UserInfo_separator {
Expand Down Expand Up @@ -193,10 +197,7 @@ limitations under the License.
}

.mx_UserInfo_field {
cursor: pointer;
color: $accent;
line-height: $font-16px;
margin: 8px 0;

&.mx_UserInfo_destructive {
color: $alert;
Expand Down Expand Up @@ -228,14 +229,18 @@ limitations under the License.
padding-bottom: 0;

> :not(h3) {
margin-left: 8px;
margin-inline-start: $spacing-8;
display: flex;
flex-flow: column;
align-items: flex-start;
row-gap: $spacing-8;
}
}

.mx_UserInfo_devices {
.mx_UserInfo_device {
display: flex;
margin: 8px 0;
margin: $spacing-8 0;

&.mx_UserInfo_device_verified {
.mx_UserInfo_device_trusted {
Expand All @@ -250,7 +255,7 @@ limitations under the License.

.mx_UserInfo_device_name {
flex: 1;
margin-right: 5px;
margin: 0 5px;
word-break: break-word;
}
}
Expand All @@ -259,20 +264,16 @@ limitations under the License.
.mx_E2EIcon {
// don't squeeze
flex: 0 0 auto;
margin: 2px 5px 0 0;
margin: 0;
width: 12px;
height: 12px;
}

.mx_UserInfo_expand {
display: flex;
margin-top: 11px;
column-gap: 5px; // cf: mx_UserInfo_device_name
margin-bottom: 11px;
}
}

.mx_AccessibleButton.mx_AccessibleButton_hasKind {
padding: 8px 18px;
}
}

.mx_UserInfo.mx_UserInfo_smallAvatar {
Expand Down
1 change: 1 addition & 0 deletions res/css/views/rooms/_EventBubbleTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ limitations under the License.

.mx_MPollBody {
width: 550px; // to prevent timestamp overlapping summary text
max-width: 100%; // prevent overflowing a reply tile

.mx_MPollBody_totalVotes {
// align summary text with corner timestamp
Expand Down
2 changes: 2 additions & 0 deletions src/Lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import { setSentryUser } from "./sentry";
import SdkConfig from "./SdkConfig";
import { DialogOpener } from "./utils/DialogOpener";
import { Action } from "./dispatcher/actions";
import AbstractLocalStorageSettingsHandler from "./settings/handlers/AbstractLocalStorageSettingsHandler";

const HOMESERVER_URL_KEY = "mx_hs_url";
const ID_SERVER_URL_KEY = "mx_is_url";
Expand Down Expand Up @@ -878,6 +879,7 @@ async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void
const registrationTime = window.localStorage.getItem("mx_registration_time");

window.localStorage.clear();
AbstractLocalStorageSettingsHandler.clear();

try {
await StorageManager.idbDelete("account", "mx_access_token");
Expand Down
11 changes: 3 additions & 8 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ export interface IRoomState {
// this is true if we are fully scrolled-down, and are looking at
// the end of the live timeline. It has the effect of hiding the
// 'scroll to bottom' knob, among a couple of other things.
atEndOfLiveTimeline: boolean;
// used by componentDidUpdate to avoid unnecessary checks
atEndOfLiveTimelineInit: boolean;
atEndOfLiveTimeline?: boolean;
showTopUnreadMessagesBar: boolean;
statusBarVisible: boolean;
// We load this later by asking the js-sdk to suggest a version for us.
Expand Down Expand Up @@ -257,8 +255,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
isPeeking: false,
showRightPanel: false,
joining: false,
atEndOfLiveTimeline: true,
atEndOfLiveTimelineInit: false,
showTopUnreadMessagesBar: false,
statusBarVisible: false,
canReact: false,
Expand Down Expand Up @@ -692,9 +688,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// in render() prevents the ref from being set on first mount, so we try and
// catch the messagePanel when it does mount. Because we only want the ref once,
// we use a boolean flag to avoid duplicate work.
if (this.messagePanel && !this.state.atEndOfLiveTimelineInit) {
if (this.messagePanel && this.state.atEndOfLiveTimeline === undefined) {
this.setState({
atEndOfLiveTimelineInit: true,
atEndOfLiveTimeline: this.messagePanel.isAtEndOfLiveTimeline(),
});
}
Expand Down Expand Up @@ -2102,7 +2097,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}
let jumpToBottom;
// Do not show JumpToBottomButton if we have search results showing, it makes no sense
if (!this.state.atEndOfLiveTimeline && !this.state.searchResults) {
if (this.state.atEndOfLiveTimeline === false && !this.state.searchResults) {
jumpToBottom = (<JumpToBottomButton
highlight={this.state.room.getUnreadNotificationCount(NotificationCountType.Highlight) > 0}
numUnreadMessages={this.state.numUnreadMessages}
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
/* return true if the content is fully scrolled down and we are
* at the end of the live timeline.
*/
public isAtEndOfLiveTimeline = (): boolean => {
public isAtEndOfLiveTimeline = (): boolean | undefined => {
return this.messagePanel.current?.isAtBottom()
&& this.timelineWindow
&& !this.timelineWindow.canPaginate(EventTimeline.FORWARDS);
Expand Down
70 changes: 57 additions & 13 deletions src/components/views/right_panel/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,17 @@ function DevicesSection({ devices, userId, loading }: { devices: IDevice[], user
let expandButton;
if (expandSectionDevices.length) {
if (isExpanded) {
expandButton = (<AccessibleButton className="mx_UserInfo_expand mx_linkButton"
expandButton = (<AccessibleButton
kind="link"
className="mx_UserInfo_expand"
onClick={() => setExpanded(false)}
>
<div>{ expandHideCaption }</div>
</AccessibleButton>);
} else {
expandButton = (<AccessibleButton className="mx_UserInfo_expand mx_linkButton"
expandButton = (<AccessibleButton
kind="link"
className="mx_UserInfo_expand"
onClick={() => setExpanded(true)}
>
<div className={expandIconClasses} />
Expand Down Expand Up @@ -331,6 +335,7 @@ const MessageButton = ({ userId }: { userId: string }) => {

return (
<AccessibleButton
kind="link"
onClick={async (ev) => {
if (busy) return;
setBusy(true);
Expand Down Expand Up @@ -383,6 +388,7 @@ const UserOptionsSection: React.FC<{

ignoreButton = (
<AccessibleButton
kind="link"
onClick={onIgnoreToggle}
className={classNames("mx_UserInfo_field", { mx_UserInfo_destructive: !isIgnored })}
>
Expand Down Expand Up @@ -413,14 +419,22 @@ const UserOptionsSection: React.FC<{
const room = cli.getRoom(member.roomId);
if (room?.getEventReadUpTo(member.userId)) {
readReceiptButton = (
<AccessibleButton onClick={onReadReceiptButton} className="mx_UserInfo_field">
<AccessibleButton
kind="link"
onClick={onReadReceiptButton}
className="mx_UserInfo_field"
>
{ _t('Jump to read receipt') }
</AccessibleButton>
);
}

insertPillButton = (
<AccessibleButton onClick={onInsertPillButton} className="mx_UserInfo_field">
<AccessibleButton
kind="link"
onClick={onInsertPillButton}
className="mx_UserInfo_field"
>
{ _t('Mention') }
</AccessibleButton>
);
Expand Down Expand Up @@ -448,15 +462,23 @@ const UserOptionsSection: React.FC<{
};

inviteUserButton = (
<AccessibleButton onClick={onInviteUserButton} className="mx_UserInfo_field">
<AccessibleButton
kind="link"
onClick={onInviteUserButton}
className="mx_UserInfo_field"
>
{ _t('Invite') }
</AccessibleButton>
);
}
}

const shareUserButton = (
<AccessibleButton onClick={onShareUserClick} className="mx_UserInfo_field">
<AccessibleButton
kind="link"
onClick={onShareUserClick}
className="mx_UserInfo_field"
>
{ _t('Share Link to User') }
</AccessibleButton>
);
Expand Down Expand Up @@ -624,7 +646,11 @@ const RoomKickButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBas
member.membership === "invite" ? _t("Disinvite from space") : _t("Remove from space")
: member.membership === "invite" ? _t("Disinvite from room") : _t("Remove from room");

return <AccessibleButton className="mx_UserInfo_field mx_UserInfo_destructive" onClick={onKick}>
return <AccessibleButton
kind="link"
className="mx_UserInfo_field mx_UserInfo_destructive"
onClick={onKick}
>
{ kickLabel }
</AccessibleButton>;
};
Expand All @@ -642,7 +668,11 @@ const RedactMessagesButton: React.FC<IBaseProps> = ({ member }) => {
});
};

return <AccessibleButton className="mx_UserInfo_field mx_UserInfo_destructive" onClick={onRedactAllMessages}>
return <AccessibleButton
kind="link"
className="mx_UserInfo_field mx_UserInfo_destructive"
onClick={onRedactAllMessages}
>
{ _t("Remove recent messages") }
</AccessibleButton>;
};
Expand Down Expand Up @@ -739,7 +769,11 @@ const BanToggleButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBa
mx_UserInfo_destructive: !isBanned,
});

return <AccessibleButton className={classes} onClick={onBanOrUnban}>
return <AccessibleButton
kind="link"
className={classes}
onClick={onBanOrUnban}
>
{ label }
</AccessibleButton>;
};
Expand Down Expand Up @@ -809,7 +843,11 @@ const MuteToggleButton: React.FC<IBaseRoomProps> = ({ member, room, powerLevels,
});

const muteLabel = muted ? _t("Unmute") : _t("Mute");
return <AccessibleButton className={classes} onClick={onMuteToggle}>
return <AccessibleButton
kind="link"
className={classes}
onClick={onMuteToggle}
>
{ muteLabel }
</AccessibleButton>;
};
Expand Down Expand Up @@ -1212,7 +1250,11 @@ const BasicUserInfo: React.FC<{
// FIXME this should be using cli instead of MatrixClientPeg.matrixClient
if (isSynapseAdmin && member.userId.endsWith(`:${MatrixClientPeg.getHomeserverName()}`)) {
synapseDeactivateButton = (
<AccessibleButton onClick={onSynapseDeactivate} className="mx_UserInfo_field mx_UserInfo_destructive">
<AccessibleButton
kind="link"
className="mx_UserInfo_field mx_UserInfo_destructive"
onClick={onSynapseDeactivate}
>
{ _t("Deactivate user") }
</AccessibleButton>
);
Expand Down Expand Up @@ -1290,8 +1332,9 @@ const BasicUserInfo: React.FC<{
if (canVerify) {
if (hasCrossSigningKeys !== undefined) {
// Note: mx_UserInfo_verifyButton is for the end-to-end tests
verifyButton = (
verifyButton = (<div className="mx_UserInfo_container_verifyButton">
<AccessibleButton
kind="link"
className="mx_UserInfo_field mx_UserInfo_verifyButton"
onClick={() => {
if (hasCrossSigningKeys) {
Expand All @@ -1303,7 +1346,7 @@ const BasicUserInfo: React.FC<{
>
{ _t("Verify") }
</AccessibleButton>
);
</div>);
} else if (!showDeviceListSpinner) {
// HACK: only show a spinner if the device section spinner is not shown,
// to avoid showing a double spinner
Expand All @@ -1316,6 +1359,7 @@ const BasicUserInfo: React.FC<{
if (member.userId == cli.getUserId()) {
editDevices = (<div>
<AccessibleButton
kind="link"
className="mx_UserInfo_field"
onClick={() => {
dis.dispatch({
Expand Down
1 change: 1 addition & 0 deletions src/components/views/rooms/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class SearchBar extends React.Component<IProps, IState> {
}

private onSearch = (): void => {
if (!this.searchTerm.current.value.trim()) return;
this.props.onSearch(this.searchTerm.current.value, this.state.scope);
};

Expand Down
2 changes: 0 additions & 2 deletions src/contexts/RoomContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const RoomContext = createContext<IRoomState>({
isPeeking: false,
showRightPanel: true,
joining: false,
atEndOfLiveTimeline: true,
atEndOfLiveTimelineInit: false,
showTopUnreadMessagesBar: false,
statusBarVisible: false,
canReact: false,
Expand Down
Loading

0 comments on commit 5c069e0

Please sign in to comment.