Use settings hooks in forward dialog
...to dynamically watch for layout changes. Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
c78167977a
commit
4ef69fcbf6
1 changed files with 8 additions and 6 deletions
|
@ -22,7 +22,7 @@ import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||||
|
|
||||||
import {_t} from "../../../languageHandler";
|
import {_t} from "../../../languageHandler";
|
||||||
import dis from "../../../dispatcher/dispatcher";
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import {useSettingValue, useFeatureEnabled} from "../../../hooks/useSettings";
|
||||||
import {UIFeature} from "../../../settings/UIFeature";
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
import {Layout} from "../../../settings/Layout";
|
import {Layout} from "../../../settings/Layout";
|
||||||
import {IDialogProps} from "./IDialogProps";
|
import {IDialogProps} from "./IDialogProps";
|
||||||
|
@ -174,14 +174,16 @@ const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCr
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
const lcQuery = query.toLowerCase();
|
const lcQuery = query.toLowerCase();
|
||||||
|
|
||||||
|
const spacesEnabled = useFeatureEnabled("feature_spaces");
|
||||||
|
const flairEnabled = useFeatureEnabled(UIFeature.Flair);
|
||||||
|
const previewLayout = useSettingValue("layout");
|
||||||
|
|
||||||
const rooms = useMemo(() => sortRooms(
|
const rooms = useMemo(() => sortRooms(
|
||||||
cli.getVisibleRooms().filter(
|
cli.getVisibleRooms().filter(
|
||||||
room => room.getMyMembership() === "join" &&
|
room => room.getMyMembership() === "join" &&
|
||||||
!(SettingsStore.getValue("feature_spaces") && room.isSpaceRoom()),
|
!(spacesEnabled && room.isSpaceRoom()),
|
||||||
),
|
),
|
||||||
), [cli]).filter(room => room.name.toLowerCase().includes(lcQuery));
|
), [cli, spacesEnabled]).filter(room => room.name.toLowerCase().includes(lcQuery));
|
||||||
|
|
||||||
const previewLayout = SettingsStore.getValue("layout");
|
|
||||||
|
|
||||||
return <BaseDialog
|
return <BaseDialog
|
||||||
title={_t("Forward message")}
|
title={_t("Forward message")}
|
||||||
|
@ -198,7 +200,7 @@ const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCr
|
||||||
<EventTile
|
<EventTile
|
||||||
mxEvent={mockEvent}
|
mxEvent={mockEvent}
|
||||||
layout={previewLayout}
|
layout={previewLayout}
|
||||||
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
enableFlair={flairEnabled}
|
||||||
permalinkCreator={permalinkCreator}
|
permalinkCreator={permalinkCreator}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue