Skip to content

Commit d85ec92

Browse files
committed
Hide sticky note give banner on Economics books details pages
[DISCO-169]
1 parent 955952c commit d85ec92

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/app/components/shell/lower-sticky-note/lower-sticky-note.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
import React from 'react';
22
import {usePutAway, useStickyData} from '../shared.js';
3+
import {useLocation} from 'react-router-dom';
34
import JITLoad from '~/helpers/jit-load';
45

6+
function useIsTemporarilyBanned() {
7+
const {pathname} = useLocation();
8+
const econBanUntil = new Date('2024-05-16').valueOf();
9+
const inBanPeriod = Date.now().valueOf() < econBanUntil;
10+
11+
return ((/princ.*econ.*/).test(pathname) && inBanPeriod);
12+
}
13+
514
export default function LowerStickyNote() {
615
const stickyData = useStickyData();
716
const [closed, PutAway] = usePutAway();
17+
const isTemporarilyBanned = useIsTemporarilyBanned();
818
const shouldNotDisplay = !stickyData || closed ||
19+
isTemporarilyBanned ||
920
stickyData.mode !== 'banner';
1021

1122
if (shouldNotDisplay) {

0 commit comments

Comments
 (0)