Page MenuHomePhabricator

D5280.id17352.diff
No OneTemporary

D5280.id17352.diff

diff --git a/web/components/enum-settings-option.react.js b/web/components/enum-settings-option.react.js
--- a/web/components/enum-settings-option.react.js
+++ b/web/components/enum-settings-option.react.js
@@ -20,6 +20,7 @@
type Props = {
+selected: boolean,
+onSelect: () => void,
+ +disabled?: boolean,
+icon: React.Node,
+title: string,
+type?: InputType,
@@ -38,6 +39,7 @@
statements,
selected,
onSelect,
+ disabled = false,
type = 'radio',
iconPosition = 'center',
} = props;
@@ -59,15 +61,15 @@
[selected, statements],
);
- const inputIcon = React.useMemo(
- () =>
- type === 'checkbox' ? (
- <Checkbox checked={selected} />
- ) : (
- <Radio checked={selected} />
- ),
- [type, selected],
- );
+ const inputIcon = React.useMemo(() => {
+ if (disabled) {
+ return null;
+ } else if (type === 'checkbox') {
+ return <Checkbox checked={selected} />;
+ } else if (type === 'radio') {
+ return <Radio checked={selected} />;
+ }
+ }, [disabled, type, selected]);
const optionContainerClasses = React.useMemo(
() =>
@@ -83,7 +85,10 @@
);
return (
- <div className={optionContainerClasses} onClick={onSelect}>
+ <div
+ className={optionContainerClasses}
+ onClick={disabled ? null : onSelect}
+ >
<div className={optionIconClasses}>{icon}</div>
<div className={css.optionContent}>
<div className={css.optionTitle}>{title}</div>
diff --git a/web/modals/threads/notifications/notifications-modal.react.js b/web/modals/threads/notifications/notifications-modal.react.js
--- a/web/modals/threads/notifications/notifications-modal.react.js
+++ b/web/modals/threads/notifications/notifications-modal.react.js
@@ -158,10 +158,11 @@
title="Background"
statements={backgroundStatements}
icon={icon}
+ disabled={isSidebar}
onSelect={onBackgroundSelected}
/>
);
- }, [isBackgroundSelected, onBackgroundSelected]);
+ }, [isBackgroundSelected, onBackgroundSelected, isSidebar]);
const dispatchActionPromise = useDispatchActionPromise();

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 5:45 AM (16 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2512110
Default Alt Text
D5280.id17352.diff (2 KB)

Event Timeline