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

Add unread indicator to the timelineCard header icon #7156

Merged
merged 110 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
0a6c20c
add maximise widget functionality
toger5 Nov 8, 2021
a9a2c41
fix linter issues
toger5 Nov 8, 2021
cb4ae5f
fix style lint issues
toger5 Nov 8, 2021
e68c8f1
Update src/components/structures/RoomView.tsx
toger5 Nov 9, 2021
8608c59
fix typo
toger5 Nov 9, 2021
bb543a2
typo
toger5 Nov 9, 2021
4cc316d
Remove caps "AND "
toger5 Nov 10, 2021
4a3b48d
fix spelling
toger5 Nov 10, 2021
5d14783
improove readibility for continue in for
toger5 Nov 10, 2021
74f9b93
review fixes
toger5 Nov 10, 2021
cfbdf40
reuse already added icons
toger5 Nov 10, 2021
ffb0af8
more container comment fixes
toger5 Nov 10, 2021
1155ae9
fix app options button
toger5 Nov 10, 2021
cd9d193
remove error message
toger5 Nov 10, 2021
a76e7ec
fix issue not beeing able to maximise
toger5 Nov 10, 2021
04e0b42
remove maxmimisedDrawer
toger5 Nov 10, 2021
21b9549
fix centering and overflow of appDrawer
toger5 Nov 10, 2021
38f8cfe
fix hover label "Minimise widget"->"Close"
toger5 Nov 11, 2021
4aa18f7
right panel chat timeline
toger5 Nov 10, 2021
0df2b82
automatically switch to TimelineCard on maximise
toger5 Nov 10, 2021
bddb05f
fix style and compile errors
toger5 Nov 10, 2021
2ffd836
fix highlighting and labels
toger5 Nov 11, 2021
c3a6409
rename timelinePanel-> timelineCard
toger5 Nov 11, 2021
6fb6e6d
simplify previous phase access
toger5 Nov 11, 2021
98adc21
close right panel chat if no widget is maximised
toger5 Nov 11, 2021
7d8879f
fix linter
toger5 Nov 11, 2021
1fac898
only show core elements if a widget is maximised
toger5 Nov 11, 2021
1bff7f0
hide timeline card button
toger5 Nov 11, 2021
0831b60
review fixes
toger5 Nov 11, 2021
fdf7b9f
add jest test for WidgetLayoutStore
toger5 Nov 12, 2021
afef1d0
Merge branch 'develop' into toger5/maximised_widgets
toger5 Nov 12, 2021
b06490e
change accent-color
toger5 Nov 12, 2021
b3c6526
another try
toger5 Nov 12, 2021
03ec030
Merge branch 'develop' into toger5/maximised_widgets
toger5 Nov 12, 2021
a23931b
I think I have it now...(accent related commit)
toger5 Nov 12, 2021
0bcb881
fix room state always overriding user settings
toger5 Nov 15, 2021
b1ef33b
fix container border width
toger5 Nov 15, 2021
ba4d09c
change icons, change border width
toger5 Nov 15, 2021
26d5cd1
Merge branch 'toger5/widget_container_border_width' into toger5/maxim…
toger5 Nov 15, 2021
2a8bba6
use $container-border-width where needed
toger5 Nov 15, 2021
6f3a1c0
fix style lint
toger5 Nov 15, 2021
fa35b44
add !important for widget card AppTileFullWidth
toger5 Nov 15, 2021
7f0c5d6
fix bug where a widget can be open twice
toger5 Nov 15, 2021
a8d2e5e
review fixes
toger5 Nov 15, 2021
3743b74
fix awkward ternary stack
toger5 Nov 15, 2021
c6e9c82
Merge branch 'develop' into toger5/maximised_widgets
toger5 Nov 15, 2021
704ddc8
remove the now deprecated collapse button url after merge
toger5 Nov 15, 2021
0b9a544
Merge branch 'toger5/maximised_widgets' into toger5/maximised_widgets…
toger5 Nov 16, 2021
ad183fb
fix styling and move TimelineCard to the views
toger5 Nov 16, 2021
d3218f3
Merge branch 'develop' into toger5/maximised_widgets_rightPanel_timeline
toger5 Nov 16, 2021
6e1f1fe
clean up TimelinCard class
toger5 Nov 16, 2021
585ffa8
fix maximised state being loaded correctly
toger5 Nov 16, 2021
583d754
enable Read Receipts and sendReadReceiptOnLoad for timelineCard
toger5 Nov 17, 2021
d782c06
Merge branch 'develop' into toger5/maximised_widgets_rightPanel_timeline
toger5 Nov 17, 2021
f8c1388
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 17, 2021
fe1e3fa
add unreadIndicator to the timelineCard icon
toger5 Nov 17, 2021
d66a411
Update src/components/structures/RightPanel.tsx
toger5 Nov 17, 2021
6aa2e9b
fix position of dispatcher
toger5 Nov 17, 2021
596af16
fix header styles (make them prettier and simpler)
toger5 Nov 17, 2021
90e331f
fix up event tile
toger5 Nov 17, 2021
8dfa940
rename RightPanelPhases.TimelineCard -> Timeline
toger5 Nov 17, 2021
89b6266
Merge remote-tracking branch 'origin/toger5/maximised_widgets_rightPa…
toger5 Nov 17, 2021
304e788
fix style
toger5 Nov 17, 2021
d6ad1ae
code cleanup for previous phase logic
toger5 Nov 17, 2021
658eb7e
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 17, 2021
e8eafac
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 17, 2021
65c752d
remove artifacts from the previousPhase logic.
toger5 Nov 17, 2021
756630e
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 17, 2021
fb2fcca
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 17, 2021
5a3cf2b
remove unecassary imports
toger5 Nov 17, 2021
d6e80f1
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 17, 2021
495925d
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 17, 2021
20ff205
Merge branch 'develop' into toger5/maximised_widgets_rightPanel_timeline
toger5 Nov 18, 2021
3acb7a3
fix settings layout path
toger5 Nov 18, 2021
786cff8
timeline panel header fixups
toger5 Nov 18, 2021
842150c
only enable new back button behaviour if feature enabled
toger5 Nov 18, 2021
23e9fb3
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 18, 2021
f8ae27e
prevent double timeline
toger5 Nov 18, 2021
6e4bcf0
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 18, 2021
03262fe
coreElementOnly -> excludedRighPanelPhaseButtons
toger5 Nov 19, 2021
77b9c03
disable RR's
toger5 Nov 19, 2021
d097136
remove unread indicator fragments HeaderButton
toger5 Nov 19, 2021
1e3b157
dont go to room info when widget gets closed
toger5 Nov 19, 2021
7999cdf
styling stuff
toger5 Nov 19, 2021
92d8895
solve "never show two timelines" more properly
toger5 Nov 19, 2021
d5a0652
hello linter ;)
toger5 Nov 19, 2021
10f4143
fix typo(s)
toger5 Nov 19, 2021
1bf0704
Update src/components/structures/RoomView.tsx
toger5 Nov 19, 2021
f03de71
Update src/components/structures/RoomView.tsx
toger5 Nov 19, 2021
692ce50
Update res/css/structures/_RightPanel.scss
toger5 Nov 19, 2021
658362b
Update res/css/structures/_RightPanel.scss
toger5 Nov 19, 2021
91b4173
Update src/components/views/right_panel/RoomHeaderButtons.tsx
toger5 Nov 19, 2021
bd0d989
Merge branch 'develop' into toger5/maximised_widgets_rightPanel_timeline
toger5 Nov 22, 2021
e881053
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 22, 2021
f17f9f4
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 22, 2021
7c9cb5a
Merge remote-tracking branch 'origin/toger5/maximised_widgets_unread_…
toger5 Nov 22, 2021
16e414a
reveiw fixes
toger5 Nov 22, 2021
4f4b185
remove unused var (showNewMessages)
toger5 Nov 22, 2021
9251b03
add comment about RR's
toger5 Nov 22, 2021
7ea9f54
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 22, 2021
d25f73b
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 22, 2021
b1bdb2c
types should be interfaces
toger5 Nov 22, 2021
d21dc8f
fix feature flag check
toger5 Nov 24, 2021
bfdb6d1
remove viewInRoom button if a widget is maximised
toger5 Nov 29, 2021
c2f854b
Merge branch 'toger5/maximised_widgets_rightPanel_timeline' into toge…
toger5 Nov 29, 2021
0ba8f76
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 29, 2021
0bd570d
Merge branch 'develop' into toger5/maximised_widgets_only_core_nav
toger5 Nov 29, 2021
c5e23f0
Fix tricky way to still get two timelines
toger5 Nov 29, 2021
265134c
Merge branch 'toger5/maximised_widgets_only_core_nav' into toger5/max…
toger5 Nov 29, 2021
5bb6672
Merge branch 'develop' into toger5/maximised_widgets_unread_badge
toger5 Nov 29, 2021
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
71 changes: 44 additions & 27 deletions res/css/structures/_RightPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,61 @@ limitations under the License.
mask-position: center;
}

$dot-size: 8px;
$dot-size: 7px;
$pulse-color: $alert;

.mx_RightPanel_pinnedMessagesButton {
&::before {
mask-image: url('$(res)/img/element-icons/room/pin.svg');
mask-position: center;
}
}
.mx_RightPanel_headerButton_unreadIndicator_bg {
position: absolute;
right: 0;
top: 0;
margin: 4px;
width: $dot-size;
height: $dot-size;
border-radius: 50%;
transform: scale(1.6);
transform-origin: center center;
background: rgba($background, 1);
}

.mx_RightPanel_pinnedMessagesButton_unreadIndicator {
.mx_RightPanel_headerButton_unreadIndicator {
toger5 marked this conversation as resolved.
Show resolved Hide resolved
position: absolute;
right: 0;
top: 0;
margin: 4px;
width: $dot-size;
height: $dot-size;
border-radius: 50%;
transform: scale(1);
background: rgba($pulse-color, 1);
box-shadow: 0 0 0 0 rgba($pulse-color, 1);
animation: mx_RightPanel_indicator_pulse 2s infinite;
animation-iteration-count: 1;

&.mx_Indicator_gray {
background: rgba($input-darker-fg-color, 1);
box-shadow: rgba($input-darker-fg-color, 1);
}

&::after {
content: "";
position: absolute;
right: 0;
width: inherit;
height: inherit;
top: 0;
margin: 4px;
width: $dot-size;
height: $dot-size;
border-radius: 50%;
left: 0;
transform: scale(1);
background: rgba($pulse-color, 1);
box-shadow: 0 0 0 0 rgba($pulse-color, 1);
animation: mx_RightPanel_indicator_pulse 2s infinite;
animation-iteration-count: 1;

&::after {
content: "";
position: absolute;
width: inherit;
height: inherit;
top: 0;
left: 0;
transform: scale(1);
transform-origin: center center;
animation-name: mx_RightPanel_indicator_pulse_shadow;
animation-duration: inherit;
animation-iteration-count: inherit;
border-radius: 50%;
background: rgba($pulse-color, 1);
}
transform-origin: center center;
animation-name: mx_RightPanel_indicator_pulse_shadow;
animation-duration: inherit;
animation-iteration-count: inherit;
border-radius: 50%;
background: inherit;
}
}

Expand Down
43 changes: 38 additions & 5 deletions src/components/views/right_panel/RoomHeaderButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import { useReadPinnedEvents, usePinnedEvents } from './PinnedMessagesCard';
import { dispatchShowThreadsPanelEvent } from "../../../dispatcher/dispatch-actions/threads";
import SettingsStore from "../../../settings/SettingsStore";
import dis from "../../../dispatcher/dispatcher";
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
import { NotificationColor } from "../../../stores/notifications/NotificationColor";

const ROOM_INFO_PHASES = [
RightPanelPhases.RoomSummary,
Expand All @@ -45,15 +47,32 @@ const ROOM_INFO_PHASES = [
RightPanelPhases.Room3pidMemberInfo,
];

const PinnedMessagesHeaderButton = ({ room, isHighlighted, onClick }) => {
interface IUnreadIndicatorProps {
className: string;
}

const UnreadIndicator = ({ className }: IUnreadIndicatorProps) => {
return <React.Fragment>
<div className="mx_RightPanel_headerButton_unreadIndicator_bg" />
<div className={className} />
</React.Fragment>;
};

interface IHeaderButtonProps {
room: Room;
isHighlighted: boolean;
onClick: () => void;
}

const PinnedMessagesHeaderButton = ({ room, isHighlighted, onClick }: IHeaderButtonProps) => {
const pinningEnabled = useSettingValue("feature_pinning");
const pinnedEvents = usePinnedEvents(pinningEnabled && room);
const readPinnedEvents = useReadPinnedEvents(pinningEnabled && room);
if (!pinningEnabled) return null;

let unreadIndicator;
if (pinnedEvents.some(id => !readPinnedEvents.has(id))) {
unreadIndicator = <div className="mx_RightPanel_pinnedMessagesButton_unreadIndicator" />;
unreadIndicator = <UnreadIndicator className="mx_RightPanel_headerButton_unreadIndicator" />;
}

return <HeaderButton
Expand All @@ -67,16 +86,30 @@ const PinnedMessagesHeaderButton = ({ room, isHighlighted, onClick }) => {
</HeaderButton>;
};

const TimelineCardHeaderButton = ({ room, isHighlighted, onClick }) => {
const TimelineCardHeaderButton = ({ room, isHighlighted, onClick }: IHeaderButtonProps) => {
if (!SettingsStore.getValue("feature_maximised_widgets")) return null;

let unreadIndicator;
switch (RoomNotificationStateStore.instance.getRoomState(room).color) {
case NotificationColor.Grey:
unreadIndicator =
<UnreadIndicator className="mx_RightPanel_headerButton_unreadIndicator mx_Indicator_gray" />;
break;
case NotificationColor.Red:
unreadIndicator =
<UnreadIndicator className="mx_RightPanel_headerButton_unreadIndicator" />;
break;
default:
break;
}
return <HeaderButton
name="timelineCardButton"
title={_t("Chat")}
isHighlighted={isHighlighted}
onClick={onClick}
analytics={["Right Panel", "Timeline Panel Button", "click"]}
/>;
>
{ unreadIndicator }
</HeaderButton>;
};

interface IProps {
Expand Down
11 changes: 10 additions & 1 deletion src/components/views/rooms/RoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import { SearchScope } from './SearchBar';
import { ContextMenuTooltipButton } from '../../structures/ContextMenu';
import RoomContextMenu from "../context_menus/RoomContextMenu";
import { contextMenuBelow } from './RoomTile';
import { RoomNotificationStateStore } from '../../../stores/notifications/RoomNotificationStateStore';
import { NOTIFICATION_STATE_UPDATE } from '../../../stores/notifications/NotificationState';
import { RightPanelPhases } from '../../../stores/RightPanelStorePhases';

export interface ISearchInfo {
Expand Down Expand Up @@ -75,7 +77,8 @@ export default class RoomHeader extends React.Component<IProps, IState> {

constructor(props, context) {
super(props, context);

const notiStore = RoomNotificationStateStore.instance.getRoomState(props.room);
notiStore.on(NOTIFICATION_STATE_UPDATE, this.onNotificationUpdate);
this.state = {};
}

Expand All @@ -89,6 +92,8 @@ export default class RoomHeader extends React.Component<IProps, IState> {
if (cli) {
cli.removeListener("RoomState.events", this.onRoomStateEvents);
}
const notiStore = RoomNotificationStateStore.instance.getRoomState(this.props.room);
notiStore.removeListener(NOTIFICATION_STATE_UPDATE, this.onNotificationUpdate);
}

private onRoomStateEvents = (event: MatrixEvent, state: RoomState) => {
Expand All @@ -100,6 +105,10 @@ export default class RoomHeader extends React.Component<IProps, IState> {
this.rateLimitedUpdate();
};

toger5 marked this conversation as resolved.
Show resolved Hide resolved
private onNotificationUpdate = () => {
this.forceUpdate();
};

private rateLimitedUpdate = throttle(() => {
this.forceUpdate();
}, 500, { leading: true, trailing: true });
Expand Down