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

Commit

Permalink
compact layout: disable if not modern layout and add description
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Jun 26, 2024
1 parent 2b4eb05 commit 209d241
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/components/views/settings/LayoutSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import React, { JSX, useEffect, useState } from "react";
import { InlineField, ToggleControl, Label, Root, RadioControl } from "@vector-im/compound-web";
import { HelpMessage, InlineField, Label, RadioControl, Root, ToggleControl } from "@vector-im/compound-web";

import SettingsSubsection from "./shared/SettingsSubsection";
import { _t } from "../../../languageHandler";
Expand Down Expand Up @@ -144,6 +144,7 @@ function useEventTileInfo(): EventTileInfo {
*/
function ToggleCompactLayout(): JSX.Element {
const compactLayoutEnabled = useSettingValue<boolean>("useCompactLayout");
const layout = useSettingValue<Layout>("layout");

return (
<Root
Expand All @@ -154,9 +155,16 @@ function ToggleCompactLayout(): JSX.Element {
>
<InlineField
name="compactLayout"
control={<ToggleControl name="compactLayout" defaultChecked={compactLayoutEnabled} />}
control={
<ToggleControl
disabled={layout !== Layout.Group}
name="compactLayout"
defaultChecked={compactLayoutEnabled}
/>
}
>
<Label>{_t("settings|appearance|compact_layout")}</Label>
<HelpMessage>{_t("settings|appearance|compact_layout_description")}</HelpMessage>
</InlineField>
</Root>
);
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,8 @@
"always_show_message_timestamps": "Always show message timestamps",
"appearance": {
"bundled_emoji_font": "Use bundled emoji font",
"compact_layout": "Show compact layout",
"compact_layout": "Show compact text and messages",
"compact_layout_description": "Modern layout must be selected to use this feature.",
"custom_font": "Use a system font",
"custom_font_description": "Set the name of a font installed on your system & %(brand)s will attempt to use it.",
"custom_font_name": "System font name",
Expand Down

0 comments on commit 209d241

Please sign in to comment.