Page MenuHomePhabricator

D4116.id13123.diff
No OneTemporary

D4116.id13123.diff

diff --git a/web/components/enum-settings-option-info.react.js b/web/components/enum-settings-option-info.react.js
--- a/web/components/enum-settings-option-info.react.js
+++ b/web/components/enum-settings-option-info.react.js
@@ -9,26 +9,35 @@
type Props = {
+optionSelected: boolean,
+valid: boolean,
+ +styleStatementBasedOnValidity: boolean,
+children: React.Node,
};
function EnumSettingsOptionInfo(props: Props): React.Node {
- const { valid, children, optionSelected } = props;
+ const {
+ optionSelected,
+ valid,
+ styleStatementBasedOnValidity,
+ children,
+ } = props;
const optionInfoClasses = React.useMemo(
() =>
classnames({
[css.optionInfo]: true,
- [css.optionInfoInvalid]: !valid,
- [css.optionInfoInvalidSelected]: !valid && optionSelected,
+ [css.optionInfoInvalid]: styleStatementBasedOnValidity && !valid,
+ [css.optionInfoInvalidSelected]:
+ styleStatementBasedOnValidity && !valid && optionSelected,
}),
- [valid, optionSelected],
+ [styleStatementBasedOnValidity, valid, optionSelected],
);
- const icon = React.useMemo(
- () => <SWMansionIcon icon={valid ? 'check' : 'cross'} size={12} />,
- [valid],
- );
+ const icon = React.useMemo(() => {
+ if (!styleStatementBasedOnValidity) {
+ return null;
+ }
+ return <SWMansionIcon icon={valid ? 'check' : 'cross'} size={12} />;
+ }, [styleStatementBasedOnValidity, valid]);
return (
<div className={optionInfoClasses}>
{icon}
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
@@ -15,6 +15,7 @@
+statements: $ReadOnlyArray<{
+statement: string,
+isStatementValid: boolean,
+ +styleStatementBasedOnValidity: boolean,
}>,
};
@@ -23,15 +24,18 @@
const descriptionItems = React.useMemo(
() =>
- statements.map(({ statement, isStatementValid }) => (
- <EnumSettingsOptionInfo
- key={statement}
- optionSelected={selected}
- valid={isStatementValid}
- >
- {statement}
- </EnumSettingsOptionInfo>
- )),
+ statements.map(
+ ({ statement, isStatementValid, styleStatementBasedOnValidity }) => (
+ <EnumSettingsOptionInfo
+ key={statement}
+ optionSelected={selected}
+ valid={isStatementValid}
+ styleStatementBasedOnValidity={styleStatementBasedOnValidity}
+ >
+ {statement}
+ </EnumSettingsOptionInfo>
+ ),
+ ),
[selected, statements],
);
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
@@ -32,21 +32,57 @@
const IN_BACKGROUND_TAB = 'Lives in Background tab';
const focusedStatements = [
- { statement: BANNER_NOTIFS, isStatementValid: true },
- { statement: BADGE_COUNT, isStatementValid: true },
- { statement: IN_FOCUSED_TAB, isStatementValid: true },
+ {
+ statement: BANNER_NOTIFS,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: BADGE_COUNT,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: IN_FOCUSED_TAB,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
];
const badgeOnlyStatements = [
- { statement: BANNER_NOTIFS, isStatementValid: false },
- { statement: BADGE_COUNT, isStatementValid: true },
- { statement: IN_FOCUSED_TAB, isStatementValid: true },
+ {
+ statement: BANNER_NOTIFS,
+ isStatementValid: false,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: BADGE_COUNT,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: IN_FOCUSED_TAB,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
];
const backgroundStatements = [
- { statement: BANNER_NOTIFS, isStatementValid: false },
- { statement: BADGE_COUNT, isStatementValid: false },
- { statement: IN_BACKGROUND_TAB, isStatementValid: true },
+ {
+ statement: BANNER_NOTIFS,
+ isStatementValid: false,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: BADGE_COUNT,
+ isStatementValid: false,
+ styleStatementBasedOnValidity: true,
+ },
+ {
+ statement: IN_BACKGROUND_TAB,
+ isStatementValid: true,
+ styleStatementBasedOnValidity: true,
+ },
];
type Props = {
diff --git a/web/modals/threads/settings/thread-settings-privacy-tab.react.js b/web/modals/threads/settings/thread-settings-privacy-tab.react.js
--- a/web/modals/threads/settings/thread-settings-privacy-tab.react.js
+++ b/web/modals/threads/settings/thread-settings-privacy-tab.react.js
@@ -30,6 +30,7 @@
{
statement: threadTypeDescriptions[COMMUNITY_OPEN_SUBTHREAD],
isStatementValid: true,
+ styleStatementBasedOnValidity: false,
},
];
@@ -37,6 +38,7 @@
{
statement: threadTypeDescriptions[COMMUNITY_SECRET_SUBTHREAD],
isStatementValid: true,
+ styleStatementBasedOnValidity: false,
},
];

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 4:44 PM (19 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576421
Default Alt Text
D4116.id13123.diff (5 KB)

Event Timeline