Skip to content

Commit bc4463a

Browse files
committed
Fix errors from lint-fix
Balance of lint-fix fixes
1 parent 0fcdffa commit bc4463a

File tree

11 files changed

+206
-147
lines changed

11 files changed

+206
-147
lines changed

special-pages/pages/new-tab/app/activity/NormalizeDataProvider.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export function SignalStateProvider({ children }) {
193193
favorites: {},
194194
urls: [],
195195
totalTrackers: 0,
196+
cookiePopUpBlocked: null,
196197
},
197198
{ activity: state.data.activity, urls: state.data.urls, totalTrackers: state.data.totalTrackers },
198199
),

special-pages/pages/new-tab/app/activity/components/Activity.examples.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const activityExamples = {
1616
factory: () => (
1717
<Activity itemCount={10} batched={false}>
1818
<Mock size={3}>
19-
<ActivityBody canBurn={false} visibility={'visible'} />
19+
<ActivityBody canBurn={false} visibility={'visible'} shouldDisplayLegacyActivity={false} />
2020
</Mock>
2121
</Activity>
2222
),
@@ -25,7 +25,7 @@ export const activityExamples = {
2525
factory: () => (
2626
<Activity itemCount={20} batched={false}>
2727
<Mock size={1}>
28-
<ActivityBody canBurn={false} visibility={'visible'} />
28+
<ActivityBody canBurn={false} visibility={'visible'} shouldDisplayLegacyActivity={false} />
2929
</Mock>
3030
</Activity>
3131
),
@@ -34,7 +34,7 @@ export const activityExamples = {
3434
factory: () => (
3535
<Activity itemCount={0} batched={false}>
3636
<Mock size={0}>
37-
<ActivityBody canBurn={false} visibility={'visible'} />
37+
<ActivityBody canBurn={false} visibility={'visible'} shouldDisplayLegacyActivity={false} />
3838
</Mock>
3939
</Activity>
4040
),
@@ -58,6 +58,7 @@ function Mock({ children, size }) {
5858
favorites: {},
5959
urls: [],
6060
totalTrackers: 0,
61+
cookiePopUpBlocked: null,
6162
},
6263
{ activity: mocks, urls: mocks.map((x) => x.url), totalTrackers: 0 },
6364
);

special-pages/pages/new-tab/app/activity/components/Activity.js

Lines changed: 19 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, Fragment } from 'preact';
1+
import { h } from 'preact';
22
import styles from './Activity.module.css';
33
// @todo legacyProtections: `stylesLegacy` can be removed once all platforms
44
// are ready for the new Protections Report
@@ -152,10 +152,8 @@ const BurnableItem = memo(
152152
}
153153

154154
// @todo legacyProtections: Once all platforms are ready for the new
155-
// protections report we can use `ActivityItem`
156-
const ActivityItemComponent = shouldDisplayLegacyActivity
157-
? ActivityItemLegacy
158-
: ActivityItem;
155+
// protections report we can use `ActivityItem`
156+
const ActivityItemComponent = shouldDisplayLegacyActivity ? ActivityItemLegacy : ActivityItem;
159157

160158
return (
161159
<ActivityItemAnimationWrapper url={id}>
@@ -172,15 +170,9 @@ const BurnableItem = memo(
172170
// @todo legacyProtections: `TrackerStatusLegacy` and
173171
// supporting prop can be removed once all platforms are
174172
// ready for the new protections report
175-
<TrackerStatusLegacy
176-
id={id}
177-
trackersFound={item.value.trackersFound}
178-
/>
173+
<TrackerStatusLegacy id={id} trackersFound={item.value.trackersFound} />
179174
) : (
180-
<TrackerStatus
181-
id={id}
182-
trackersFound={item.value.trackersFound}
183-
/>
175+
<TrackerStatus id={id} trackersFound={item.value.trackersFound} />
184176
)}
185177
<HistoryItems id={id} />
186178
</ActivityItemComponent>
@@ -209,10 +201,8 @@ const RemovableItem = memo(
209201
}
210202

211203
// @todo legacyProtections: Once all platforms are ready for the new
212-
// protections report we can use `ActivityItem`
213-
const ActivityItemComponent = shouldDisplayLegacyActivity
214-
? ActivityItemLegacy
215-
: ActivityItem;
204+
// protections report we can use `ActivityItem`
205+
const ActivityItemComponent = shouldDisplayLegacyActivity ? ActivityItemLegacy : ActivityItem;
216206

217207
return (
218208
<ActivityItemComponent
@@ -228,15 +218,9 @@ const RemovableItem = memo(
228218
// @todo legacyProtections: `TrackerStatusLegacy` and
229219
// supporting prop can be removed once all platforms are
230220
// ready for the new protections report
231-
<TrackerStatusLegacy
232-
id={id}
233-
trackersFound={item.value.trackersFound}
234-
/>
221+
<TrackerStatusLegacy id={id} trackersFound={item.value.trackersFound} />
235222
) : (
236-
<TrackerStatus
237-
id={id}
238-
trackersFound={item.value.trackersFound}
239-
/>
223+
<TrackerStatus id={id} trackersFound={item.value.trackersFound} />
240224
)}
241225
<HistoryItems id={id} />
242226
</ActivityItemComponent>
@@ -255,28 +239,14 @@ function TrackerStatus({ id, trackersFound }) {
255239
const { activity } = useContext(NormalizedDataContext);
256240
const status = useComputed(() => activity.value.trackingStatus[id]);
257241
const cookiePopUpBlocked = useComputed(() => activity.value.cookiePopUpBlocked);
258-
const {totalCount, trackerCompanies} = status.value;
259-
const other = trackerCompanies.slice(DDG_MAX_TRACKER_ICONS - 1);
260-
const adBlocking = useAdBlocking();
261-
262-
let otherIcon = null;
263-
if (other.length > 0) {
264-
const title = other.map((item) => item.displayName).join('\n');
265-
otherIcon = (
266-
<span title={title} class={styles.otherIcon}>
267-
+{other.length}
268-
</span>
269-
);
270-
}
242+
const { totalCount } = status.value;
271243

272244
if (totalCount === 0) {
273-
const text = trackersFound
274-
? t('activity_no_trackers_blocked')
275-
: t('activity_no_trackers')
245+
const text = trackersFound ? t('activity_no_trackers_blocked') : t('activity_no_trackers');
276246

277247
return (
278248
<p class={styles.companiesIconRow} data-testid="TrackerStatus">
279-
<TickPill text={text} displayTick={false}/>
249+
<TickPill text={text} displayTick={false} />
280250
</p>
281251
);
282252
}
@@ -285,15 +255,11 @@ function TrackerStatus({ id, trackersFound }) {
285255
<div class={styles.companiesIconRow} data-testid="TrackerStatus">
286256
<div class={styles.companiesText}>
287257
{totalCount > 0 && (
288-
<TickPill
289-
text={
290-
t(totalCount === 1
291-
? 'activity_countBlockedSingular'
292-
: 'activity_countBlockedPlural',
293-
{ count: String(totalCount) }
294-
)
295-
}
296-
/>
258+
<TickPill
259+
text={t(totalCount === 1 ? 'activity_countBlockedSingular' : 'activity_countBlockedPlural', {
260+
count: String(totalCount),
261+
})}
262+
/>
297263
)}
298264
{cookiePopUpBlocked && <TickPill text={t('activity_cookiePopUpBlocked')} />}
299265
</div>
@@ -407,11 +373,7 @@ export function ActivityConsumer({ showBurnAnimation, shouldDisplayLegacyActivit
407373
return (
408374
<SignalStateProvider>
409375
<ActivityConfigured>
410-
<ActivityBody
411-
canBurn={false}
412-
visibility={visibility}
413-
shouldDisplayLegacyActivity={shouldDisplayLegacyActivity}
414-
/>
376+
<ActivityBody canBurn={false} visibility={visibility} shouldDisplayLegacyActivity={shouldDisplayLegacyActivity} />
415377
</ActivityConfigured>
416378
</SignalStateProvider>
417379
);
@@ -420,11 +382,7 @@ export function ActivityConsumer({ showBurnAnimation, shouldDisplayLegacyActivit
420382
<SignalStateProvider>
421383
<BurnProvider service={service} showBurnAnimation={showBurnAnimation}>
422384
<ActivityConfigured>
423-
<ActivityBody
424-
canBurn={true}
425-
visibility={visibility}
426-
shouldDisplayLegacyActivity={shouldDisplayLegacyActivity}
427-
/>
385+
<ActivityBody canBurn={true} visibility={visibility} shouldDisplayLegacyActivity={shouldDisplayLegacyActivity} />
428386
</ActivityConfigured>
429387
</BurnProvider>
430388
</SignalStateProvider>

special-pages/pages/new-tab/app/components/Icons.js

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -606,32 +606,53 @@ export function CloseSmallIcon(props) {
606606
* @param {import('preact').JSX.SVGAttributes<SVGSVGElement>} props
607607
*/
608608
export function NewBadgeIcon(props) {
609-
return (
610-
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="16" viewBox="0 0 42 16" fill="none" {...props}>
611-
<path d="M0 3.99792C0 1.78879 1.79086 -0.0020752 4 -0.0020752H38C40.2091 -0.0020752 42 1.78879 42 3.99792V11.9979C42 14.2071 40.2091 15.9979 38 15.9979H4C1.79086 15.9979 0 14.2071 0 11.9979V3.99792Z" fill="#F9BE1A"/>
612-
<path d="M13.0913 9.1073H13.1812V3.94617H14.8032V12.0497H13.3999L9.64893 6.86707H9.55908V12.0497H7.93604V3.94617H9.35107L13.0913 9.1073Z" fill="black" fill-opacity="0.96"/>
613-
<path d="M22.144 5.3446H18.4722V7.29871H21.936V8.60144H18.4722V10.6512H22.144V12.0497H16.7759V3.94617H22.144V5.3446Z" fill="black" fill-opacity="0.96"/>
614-
<path d="M26.4663 9.73621H26.5562L28.0337 3.94617H29.4653L30.9702 9.73621H31.0601L32.312 3.94617H34.064L31.9136 12.0497H30.3247L28.7915 6.59167H28.7017L27.1851 12.0497H25.5854L23.4399 3.94617H25.2036L26.4663 9.73621Z" fill="black" fill-opacity="0.96"/>
615-
</svg>
616-
);
609+
return (
610+
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="16" viewBox="0 0 42 16" fill="none" {...props}>
611+
<path
612+
d="M0 3.99792C0 1.78879 1.79086 -0.0020752 4 -0.0020752H38C40.2091 -0.0020752 42 1.78879 42 3.99792V11.9979C42 14.2071 40.2091 15.9979 38 15.9979H4C1.79086 15.9979 0 14.2071 0 11.9979V3.99792Z"
613+
fill="#F9BE1A"
614+
/>
615+
<path
616+
d="M13.0913 9.1073H13.1812V3.94617H14.8032V12.0497H13.3999L9.64893 6.86707H9.55908V12.0497H7.93604V3.94617H9.35107L13.0913 9.1073Z"
617+
fill="black"
618+
fill-opacity="0.96"
619+
/>
620+
<path
621+
d="M22.144 5.3446H18.4722V7.29871H21.936V8.60144H18.4722V10.6512H22.144V12.0497H16.7759V3.94617H22.144V5.3446Z"
622+
fill="black"
623+
fill-opacity="0.96"
624+
/>
625+
<path
626+
d="M26.4663 9.73621H26.5562L28.0337 3.94617H29.4653L30.9702 9.73621H31.0601L32.312 3.94617H34.064L31.9136 12.0497H30.3247L28.7915 6.59167H28.7017L27.1851 12.0497H25.5854L23.4399 3.94617H25.2036L26.4663 9.73621Z"
627+
fill="black"
628+
fill-opacity="0.96"
629+
/>
630+
</svg>
631+
);
617632
}
618633

619634
/**
620635
* @param {import('preact').JSX.SVGAttributes<SVGSVGElement>} props
621636
*/
622637
export function InfoIcon(props) {
623-
return (
624-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" class="info-icon" {...props}>
625-
<path d="M8.48319 3.64453C7.73951 3.64453 7.28748 4.24239 7.28748 4.7965C7.28748 5.46726 7.79784 5.68599 8.24988 5.68599C9.08104 5.68599 9.43101 5.05897 9.43101 4.54861C9.43101 3.907 8.92064 3.64453 8.48319 3.64453Z" class="info-icon-fill"/>
626-
<path d="M8.91304 6.54504L7.08645 6.84036C7.03054 7.28244 6.95011 7.72956 6.86842 8.18373C6.71074 9.06033 6.54834 9.96319 6.54834 10.9066C6.54834 11.8434 7.10858 12.3547 7.99455 12.3547C9.00639 12.3547 9.17956 11.7196 9.21882 11.1442C8.37999 11.2659 8.19573 10.8873 8.33282 9.99619C8.46991 9.10509 8.91304 6.54504 8.91304 6.54504Z" class="info-icon-fill"/>
627-
<path
628-
fill-rule="evenodd"
629-
clip-rule="evenodd"
630-
d="M8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0ZM1.25 8C1.25 4.27208 4.27208 1.25 8 1.25C11.7279 1.25 14.75 4.27208 14.75 8C14.75 11.7279 11.7279 14.75 8 14.75C4.27208 14.75 1.25 11.7279 1.25 8Z"
631-
class="info-icon-fill"
632-
/>
633-
</svg>
634-
);
638+
return (
639+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" class="info-icon" {...props}>
640+
<path
641+
d="M8.48319 3.64453C7.73951 3.64453 7.28748 4.24239 7.28748 4.7965C7.28748 5.46726 7.79784 5.68599 8.24988 5.68599C9.08104 5.68599 9.43101 5.05897 9.43101 4.54861C9.43101 3.907 8.92064 3.64453 8.48319 3.64453Z"
642+
class="info-icon-fill"
643+
/>
644+
<path
645+
d="M8.91304 6.54504L7.08645 6.84036C7.03054 7.28244 6.95011 7.72956 6.86842 8.18373C6.71074 9.06033 6.54834 9.96319 6.54834 10.9066C6.54834 11.8434 7.10858 12.3547 7.99455 12.3547C9.00639 12.3547 9.17956 11.7196 9.21882 11.1442C8.37999 11.2659 8.19573 10.8873 8.33282 9.99619C8.46991 9.10509 8.91304 6.54504 8.91304 6.54504Z"
646+
class="info-icon-fill"
647+
/>
648+
<path
649+
fill-rule="evenodd"
650+
clip-rule="evenodd"
651+
d="M8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0ZM1.25 8C1.25 4.27208 4.27208 1.25 8 1.25C11.7279 1.25 14.75 4.27208 14.75 8C14.75 11.7279 11.7279 14.75 8 14.75C4.27208 14.75 1.25 11.7279 1.25 8Z"
652+
class="info-icon-fill"
653+
/>
654+
</svg>
655+
);
635656
}
636657

637658
/**
@@ -641,12 +662,12 @@ export function InfoIcon(props) {
641662
export function Check(props) {
642663
return (
643664
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" {...props}>
644-
<path
645-
fill-rule="evenodd"
646-
clip-rule="evenodd"
647-
d="M14.7573 2.12724C15.0304 2.35035 15.0807 2.73423 14.8576 3.00731L6.97593 13.4341C6.43147 14.1336 5.36195 14.1258 4.82836 13.4027L1.12448 9.00075C0.904738 8.7249 0.946807 8.33307 1.22265 8.11333C1.4985 7.89359 1.89033 7.93566 2.11007 8.2115L5.81395 12.6132C5.93397 12.7636 6.14954 12.7645 6.27138 12.6152L14.153 2.18824C14.3761 1.91517 14.76 1.86459 14.7573 2.12724Z"
648-
fill="white"
649-
/>
665+
<path
666+
fill-rule="evenodd"
667+
clip-rule="evenodd"
668+
d="M14.7573 2.12724C15.0304 2.35035 15.0807 2.73423 14.8576 3.00731L6.97593 13.4341C6.43147 14.1336 5.36195 14.1258 4.82836 13.4027L1.12448 9.00075C0.904738 8.7249 0.946807 8.33307 1.22265 8.11333C1.4985 7.89359 1.89033 7.93566 2.11007 8.2115L5.81395 12.6132C5.93397 12.7636 6.14954 12.7645 6.27138 12.6152L14.153 2.18824C14.3761 1.91517 14.76 1.86459 14.7573 2.12724Z"
669+
fill="white"
670+
/>
650671
</svg>
651672
);
652673
}

special-pages/pages/new-tab/app/components/TickPill/TickPill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import styles from './TickPill.module.css';
88
* @param {Object} props
99
* @param {string} props.text - The text to display next to the checkmark
1010
* @param {string} [props.className] - Additional CSS classes
11-
* @param {bool} [props.displayTick] - Display the tick or not
11+
* @param {boolean} [props.displayTick] - Display the tick or not
1212
*/
1313
export function TickPill({ text, className, displayTick = true }) {
1414
return (

special-pages/pages/new-tab/app/components/Tooltip/Tooltip.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export function Tooltip({ children, content, className }) {
2020
onMouseLeave={() => setIsVisible(false)}
2121
>
2222
{children}
23-
{isVisible && (
24-
<div class={styles.tooltip} role="tooltip" dangerouslySetInnerHTML={{__html: content}} />
25-
)}
23+
{isVisible && <div class={styles.tooltip} role="tooltip" dangerouslySetInnerHTML={{ __html: content }} />}
2624
</div>
2725
);
2826
}

special-pages/pages/new-tab/app/protections/components/Protections.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ import { ProtectionsHeadingLegacy } from './ProtectionsHeadingLegacy';
2525
* @param {()=>void} props.toggle
2626
* @param {import("@preact/signals").Signal<undefined | number | null>} props.totalCookiePopUpsBlockedSignal
2727
*/
28-
export function Protections({ expansion = 'expanded', children, blockedCountSignal, feed, toggle, setFeed, totalCookiePopUpsBlockedSignal }) {
28+
export function Protections({
29+
expansion = 'expanded',
30+
children,
31+
blockedCountSignal,
32+
feed,
33+
toggle,
34+
setFeed,
35+
totalCookiePopUpsBlockedSignal,
36+
}) {
2937
const WIDGET_ID = useId();
3038
const TOGGLE_ID = useId();
3139
const totalCookiePopUpsBlocked = totalCookiePopUpsBlockedSignal.value;
@@ -43,22 +51,22 @@ export function Protections({ expansion = 'expanded', children, blockedCountSign
4351
native side is not sending this property and we can assume it's not
4452
yet been implemented */}
4553
{totalCookiePopUpsBlocked === undefined ? (
46-
<ProtectionsHeadingLegacy
47-
blockedCountSignal={blockedCountSignal}
48-
onToggle={toggle}
49-
expansion={expansion}
50-
canExpand={true}
51-
buttonAttrs={attrs}
52-
/>
54+
<ProtectionsHeadingLegacy
55+
blockedCountSignal={blockedCountSignal}
56+
onToggle={toggle}
57+
expansion={expansion}
58+
canExpand={true}
59+
buttonAttrs={attrs}
60+
/>
5361
) : (
54-
<ProtectionsHeading
55-
blockedCountSignal={blockedCountSignal}
56-
onToggle={toggle}
57-
expansion={expansion}
58-
canExpand={true}
59-
buttonAttrs={attrs}
60-
totalCookiePopUpsBlockedSignal={totalCookiePopUpsBlockedSignal}
61-
/>
62+
<ProtectionsHeading
63+
blockedCountSignal={blockedCountSignal}
64+
onToggle={toggle}
65+
expansion={expansion}
66+
canExpand={true}
67+
buttonAttrs={attrs}
68+
totalCookiePopUpsBlockedSignal={totalCookiePopUpsBlockedSignal}
69+
/>
6270
)}
6371
<ProtectionsBody feed={feed} setFeed={setFeed} id={WIDGET_ID} expansion={expansion}>
6472
{children}

special-pages/pages/new-tab/app/protections/components/ProtectionsConsumer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export function ProtectionsConsumer() {
4040
function ProtectionsReadyState({ data, config }) {
4141
const { toggle, setFeed } = useContext(ProtectionsContext);
4242
const blockedCountSignal = useBlockedCount(data.totalCount);
43-
const totalCookiePopUpsBlockedSignal = useCookiePopUpsBlockedCount(
44-
data.totalCookiePopUpsBlocked
45-
);
43+
const totalCookiePopUpsBlockedSignal = useCookiePopUpsBlockedCount(data.totalCookiePopUpsBlocked);
4644

4745
return (
4846
<Protections

0 commit comments

Comments
 (0)