Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3269629
D5280.id17352.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5280.id17352.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 4:00 AM (14 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2512110
Default Alt Text
D5280.id17352.diff (2 KB)
Attached To
Mode
D5280: [web] Notifications dialog - disable background option
Attached
Detach File
Event Timeline
Log In to Comment