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

Message layout will update according to the selected style #10170

Merged
Merged
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4d14036
message_layout_preview_update
Feb 15, 2023
fe7c791
Merge branch 'matrix-org:develop' into manancodes/message_layout_prev…
manancodes Mar 29, 2023
877774a
using_settings_watcher
Mar 29, 2023
394f3e8
Merge branch 'develop' into manancodes/message_layout_preview_update
t3chguy Jul 10, 2023
7fa50b1
Merge branch 'develop' into manancodes/message_layout_preview_update
manancodes Jul 18, 2023
19a12be
Merge branch 'matrix-org:develop' into manancodes/message_layout_prev…
manancodes Jul 18, 2023
3bae541
Update FontScalingPanel.tsx
manancodes Jul 18, 2023
4e28b9d
Marked the class property as optional
manancodes Jul 18, 2023
48263d0
Optional variable was still giving error.
manancodes Jul 19, 2023
67e15a6
Merge branch 'matrix-org:develop' into manancodes/message_layout_prev…
manancodes Jul 20, 2023
40cd969
Fix: typescript fail for layoutWatcherRef
Jul 20, 2023
1d5e4dc
Merge branch 'matrix-org:develop' into manancodes/message_layout_prev…
manancodes Sep 13, 2023
852bdc0
Merge branch 'develop' of https://github.com/manancodes/matrix-react-…
Sep 21, 2023
d6993ca
Fix: using value from SettingStore
Sep 21, 2023
0079d23
Merge branch 'matrix-org:develop' into manancodes/message_layout_prev…
manancodes Sep 21, 2023
2d59dac
Merge branch 'develop' into manancodes/message_layout_preview_update
t3chguy Sep 22, 2023
e70b8f4
Update src/components/views/settings/FontScalingPanel.tsx
manancodes Sep 22, 2023
6a9ab1d
Fix: Prettier formatting added for ESList checks
Sep 22, 2023
d04958f
Merge branch 'develop' into manancodes/message_layout_preview_update
t3chguy Sep 22, 2023
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
11 changes: 10 additions & 1 deletion src/components/views/settings/FontScalingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface IState {

export default class FontScalingPanel extends React.Component<IProps, IState> {
private readonly MESSAGE_PREVIEW_TEXT = _t("Hey you. You're the best!");

private layoutWatcherRef: string;
private unmounted = false;

public constructor(props: IProps) {
Expand All @@ -65,6 +65,14 @@ export default class FontScalingPanel extends React.Component<IProps, IState> {
const client = MatrixClientPeg.safeGet();
const userId = client.getSafeUserId();
const profileInfo = await client.getProfileInfo(userId);
this.layoutWatcherRef = SettingsStore.watchSetting("layout", null, (...[, , , value]) => {
// Update the layout for the preview window according to the user selection
if (this.state.layout !== value) {
this.setState({
layout: value,
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
});
}
});
if (this.unmounted) return;

this.setState({
Expand All @@ -76,6 +84,7 @@ export default class FontScalingPanel extends React.Component<IProps, IState> {

public componentWillUnmount(): void {
this.unmounted = true;
SettingsStore.unwatchSetting(this.layoutWatcherRef);
}

private onFontSizeChanged = (size: number): void => {
Expand Down