Skip to content

Commit 84f9abb

Browse files
authored
feat(aci-toggle): ui adjustments (#3297)
* feat(aci-toggle): ui adjustments * feat(aci-toggle): resolve comments
1 parent 11e6979 commit 84f9abb

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed

i18n/en-US.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,11 @@ boxui.accessStats.accessStatsViewDetails = View Details
829829
# The label for the view category of access stats for box notes
830830
boxui.accessStats.accessStatsViews = Views
831831
# Description text about advanced content insights.
832-
boxui.advancedContentInsights.advancedContentInsightsDescription = Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details. {helpLink}
832+
boxui.advancedContentInsights.advancedContentInsightsDescription = Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details.
833833
# Advanced Content Insights toggle title
834-
boxui.advancedContentInsights.advancedContentInsightsTitle = Advanced Insights
835-
# Text for a link that goes to an external page with more information about Advanced Content Insights
836-
boxui.advancedContentInsights.learnMore = Learn more.
834+
boxui.advancedContentInsights.advancedContentInsightsTitleDisabled = Activate Engagement Insights
835+
# Advanced Content Insights toggle title
836+
boxui.advancedContentInsights.advancedContentInsightsTitleEnabled = Engagement Insights is activated
837837
# Text for an icon aria label to convey an external user of the enterprise
838838
boxui.avatar.externalUser = External user
839839
# Text for the beta badge

src/features/advanced-content-insights/AdvancedContentInsightsToggle.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
@import '../../styles/variables';
2+
13
.AdvancedContentInsightsToggle {
24
margin-bottom: 0;
35

46
.toggle-simple-label {
57
display: flex;
68
}
9+
10+
.toggle-simple-description {
11+
color: $bdl-gray;
12+
}
713
}
814

915
.AdvancedContentInsightsToggle-icon {

src/features/advanced-content-insights/AdvancedContentInsightsToggle.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ const AdvancedContentInsightsToggle = ({
2323
isDisabled,
2424
onChange = noop,
2525
}: Props) => {
26-
const helpLink = !hasTooltip && (
27-
<a href="https://support.box.com" rel="noopener noreferrer" target="_blank">
28-
<FormattedMessage {...messages.learnMore} />
29-
</a>
30-
);
31-
32-
const description = <FormattedMessage {...messages.advancedContentInsightsDescription} values={{ helpLink }} />;
26+
const description = <FormattedMessage {...messages.advancedContentInsightsDescription} />;
3327
const label = (
3428
<>
35-
<FormattedMessage {...messages.advancedContentInsightsTitle} />
29+
<FormattedMessage
30+
{...(isChecked
31+
? messages.advancedContentInsightsTitleEnabled
32+
: messages.advancedContentInsightsTitleDisabled)}
33+
/>
3634
{hasTooltip && (
3735
<Tooltip text={description}>
3836
<div className="AdvancedContentInsightsToggle-icon">
@@ -47,7 +45,7 @@ const AdvancedContentInsightsToggle = ({
4745
<Toggle
4846
className="AdvancedContentInsightsToggle"
4947
data-testid="insights-toggle"
50-
description={!hasTooltip && description}
48+
description={!hasTooltip && !isChecked && description}
5149
isDisabled={isDisabled}
5250
isOn={isChecked}
5351
label={label}

src/features/advanced-content-insights/__tests__/__snapshots__/AdvancedContentInsightsToggle.test.tsx.snap

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ exports[`features/advanced-content-insights/AdvancedContentInsightsToggle should
1010
label={
1111
<React.Fragment>
1212
<FormattedMessage
13-
defaultMessage="Advanced Insights"
14-
id="boxui.advancedContentInsights.advancedContentInsightsTitle"
13+
defaultMessage="Engagement Insights is activated"
14+
id="boxui.advancedContentInsights.advancedContentInsightsTitleEnabled"
1515
/>
1616
<Tooltip
1717
constrainToScrollParent={false}
@@ -20,13 +20,8 @@ exports[`features/advanced-content-insights/AdvancedContentInsightsToggle should
2020
position="top-center"
2121
text={
2222
<FormattedMessage
23-
defaultMessage="Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details. {helpLink}"
23+
defaultMessage="Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details."
2424
id="boxui.advancedContentInsights.advancedContentInsightsDescription"
25-
values={
26-
Object {
27-
"helpLink": false,
28-
}
29-
}
3025
/>
3126
}
3227
theme="default"
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import { defineMessages } from 'react-intl';
22

33
const messages = defineMessages({
4-
advancedContentInsightsTitle: {
5-
defaultMessage: 'Advanced Insights',
4+
advancedContentInsightsTitleEnabled: {
5+
defaultMessage: 'Engagement Insights is activated',
66
description: 'Advanced Content Insights toggle title',
7-
id: 'boxui.advancedContentInsights.advancedContentInsightsTitle',
7+
id: 'boxui.advancedContentInsights.advancedContentInsightsTitleEnabled',
8+
},
9+
advancedContentInsightsTitleDisabled: {
10+
defaultMessage: 'Activate Engagement Insights',
11+
description: 'Advanced Content Insights toggle title',
12+
id: 'boxui.advancedContentInsights.advancedContentInsightsTitleDisabled',
813
},
914
advancedContentInsightsDescription: {
1015
defaultMessage:
11-
'Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details. {helpLink}',
16+
'Get actionable insights into how viewers are engaging with this content. Measure average time spent, page-by-page engagement, per person and per visit details.',
1217
description: 'Description text about advanced content insights.',
1318
id: 'boxui.advancedContentInsights.advancedContentInsightsDescription',
1419
},
15-
learnMore: {
16-
defaultMessage: 'Learn more.',
17-
description:
18-
'Text for a link that goes to an external page with more information about Advanced Content Insights',
19-
id: 'boxui.advancedContentInsights.learnMore',
20-
},
2120
});
2221

2322
export default messages;

0 commit comments

Comments
 (0)