Skip to content

Commit ec3cba0

Browse files
Add boolean to disable black friday (#328)
1 parent 07749ea commit ec3cba0

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

src/components/Home.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import testimonialFr from "./testimonials/testimonial.fr.json";
1515
import testimonialEn from "./testimonials/testimonial.en.json";
1616

1717
import Translate, { translate } from "@docusaurus/Translate";
18+
import { BLACK_FRIDAY_CONFIG } from "../config/blackFriday";
1819

1920
const COMPATIBILITIES = [
2021
[
@@ -263,8 +264,8 @@ const PausedOverlay = ({ videoSrc, imgSrc, alt }) => (
263264
</video>
264265
);
265266

266-
const BLACK_FRIDAY_ACTIVE = true;
267-
const blackFridayEndDate = new Date(1764633600000);
267+
const BLACK_FRIDAY_ACTIVE = BLACK_FRIDAY_CONFIG.ENABLED;
268+
const blackFridayEndDate = BLACK_FRIDAY_CONFIG.END_DATE;
268269

269270
function Home({ integrations, lang }) {
270271
const [openPanel, setOpenPanel] = React.useState(1);

src/config/blackFriday.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Black Friday configuration
3+
* Set ENABLED to false to disable all Black Friday deals across the site
4+
*/
5+
export const BLACK_FRIDAY_CONFIG = {
6+
ENABLED: false,
7+
END_DATE: new Date(1764633600000), // Dec 2, 2024 00:00:00 GMT
8+
};

src/pages/plus.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ import testimonialsEn from "../components/testimonials/testimonial.plus.en.json"
1919
import styles from "./styles.module.css";
2020

2121
import { translate } from "@docusaurus/Translate";
22+
import { BLACK_FRIDAY_CONFIG } from "../config/blackFriday";
2223

2324
const YEARLY_PLAN_ACTIVATED = false;
2425
const PRICING_TABLE_ACTIVATED = true;
25-
const BLACK_FRIDAY_ACTIVE = true;
26-
const blackFridayEndDate = new Date(1764633600000); // Same as starter-kit
26+
const BLACK_FRIDAY_ACTIVE = BLACK_FRIDAY_CONFIG.ENABLED;
27+
const blackFridayEndDate = BLACK_FRIDAY_CONFIG.END_DATE;
2728

2829
const testimonials = {
2930
fr: testimonialsFr,

src/pages/starter-kit.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
1212
import styles from "./styles.module.css";
1313

1414
import { translate } from "@docusaurus/Translate";
15+
import { BLACK_FRIDAY_CONFIG } from "../config/blackFriday";
1516

1617
const SHOW_BEELINK_T5 = false;
1718

@@ -97,7 +98,7 @@ const faqData = [
9798
];
9899

99100
const targetDate = new Date(1733104800000);
100-
const blackFridayEndDate = new Date(1764633600000); // Dec 2, 2024 00:00:00 GMT
101+
const blackFridayEndDate = BLACK_FRIDAY_CONFIG.END_DATE;
101102

102103
function Plus() {
103104
const context = useDocusaurusContext();
@@ -121,7 +122,9 @@ function Plus() {
121122
const [miniSUrl, setMiniSUrl] = useState(null);
122123
const [loading, setLoading] = useState(true);
123124
const [blackFridayTimeLeft, setBlackFridayTimeLeft] = useState(null);
124-
const [isBlackFridayActive, setIsBlackFridayActive] = useState(true);
125+
const [isBlackFridayActive, setIsBlackFridayActive] = useState(
126+
BLACK_FRIDAY_CONFIG.ENABLED
127+
);
125128

126129
console.log("isBlackFridayActive", isBlackFridayActive);
127130
const scrollTopTop = () => {

0 commit comments

Comments
 (0)