Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -17,15 +17,12 @@ limitations under the License.
|
|||
|
||||
import React from "react";
|
||||
|
||||
import {
|
||||
ICategory,
|
||||
CATEGORIES,
|
||||
CategoryName,
|
||||
} from "../../../../../accessibility/KeyboardShortcuts";
|
||||
import { ICategory, CATEGORIES, CategoryName } from "../../../../../accessibility/KeyboardShortcuts";
|
||||
import SdkConfig from "../../../../../SdkConfig";
|
||||
import { _t } from "../../../../../languageHandler";
|
||||
import {
|
||||
getKeyboardShortcutDisplayName, getKeyboardShortcutValue,
|
||||
getKeyboardShortcutDisplayName,
|
||||
getKeyboardShortcutValue,
|
||||
} from "../../../../../accessibility/KeyboardShortcutUtils";
|
||||
import { KeyboardShortcut } from "../../KeyboardShortcut";
|
||||
|
||||
|
@ -34,18 +31,21 @@ interface IKeyboardShortcutRowProps {
|
|||
}
|
||||
|
||||
// Filter out the labs section if labs aren't enabled.
|
||||
const visibleCategories = Object.entries(CATEGORIES).filter(([categoryName]) =>
|
||||
categoryName !== CategoryName.LABS || SdkConfig.get("show_labs_settings"));
|
||||
const visibleCategories = Object.entries(CATEGORIES).filter(
|
||||
([categoryName]) => categoryName !== CategoryName.LABS || SdkConfig.get("show_labs_settings"),
|
||||
);
|
||||
|
||||
const KeyboardShortcutRow: React.FC<IKeyboardShortcutRowProps> = ({ name }) => {
|
||||
const displayName = getKeyboardShortcutDisplayName(name);
|
||||
const value = getKeyboardShortcutValue(name);
|
||||
if (!displayName || !value) return null;
|
||||
|
||||
return <div className="mx_KeyboardShortcut_shortcutRow">
|
||||
{ displayName }
|
||||
<KeyboardShortcut value={value} />
|
||||
</div>;
|
||||
return (
|
||||
<div className="mx_KeyboardShortcut_shortcutRow">
|
||||
{displayName}
|
||||
<KeyboardShortcut value={value} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
interface IKeyboardShortcutSectionProps {
|
||||
|
@ -56,21 +56,28 @@ interface IKeyboardShortcutSectionProps {
|
|||
const KeyboardShortcutSection: React.FC<IKeyboardShortcutSectionProps> = ({ categoryName, category }) => {
|
||||
if (!category.categoryLabel) return null;
|
||||
|
||||
return <div className="mx_SettingsTab_section" key={categoryName}>
|
||||
<div className="mx_SettingsTab_subheading">{ _t(category.categoryLabel) }</div>
|
||||
<div> { category.settingNames.map((shortcutName) => {
|
||||
return <KeyboardShortcutRow key={shortcutName} name={shortcutName} />;
|
||||
}) } </div>
|
||||
</div>;
|
||||
return (
|
||||
<div className="mx_SettingsTab_section" key={categoryName}>
|
||||
<div className="mx_SettingsTab_subheading">{_t(category.categoryLabel)}</div>
|
||||
<div>
|
||||
{" "}
|
||||
{category.settingNames.map((shortcutName) => {
|
||||
return <KeyboardShortcutRow key={shortcutName} name={shortcutName} />;
|
||||
})}{" "}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const KeyboardUserSettingsTab: React.FC = () => {
|
||||
return <div className="mx_SettingsTab mx_KeyboardUserSettingsTab">
|
||||
<div className="mx_SettingsTab_heading">{ _t("Keyboard") }</div>
|
||||
{ visibleCategories.map(([categoryName, category]: [CategoryName, ICategory]) => {
|
||||
return <KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />;
|
||||
}) }
|
||||
</div>;
|
||||
return (
|
||||
<div className="mx_SettingsTab mx_KeyboardUserSettingsTab">
|
||||
<div className="mx_SettingsTab_heading">{_t("Keyboard")}</div>
|
||||
{visibleCategories.map(([categoryName, category]: [CategoryName, ICategory]) => {
|
||||
return <KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default KeyboardUserSettingsTab;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue