diff --git a/documentation/docusaurus.config.js b/documentation/docusaurus.config.js index f29d0e6f..dbbec6fb 100644 --- a/documentation/docusaurus.config.js +++ b/documentation/docusaurus.config.js @@ -126,17 +126,6 @@ const siteConfig = { include: ["**/*.{js}"], }, ], - [ - 'docusaurus-plugin-dotenv', - { - safe: false, // If false ignore safe-mode, if true load './.env.example', if a string load that file as the sample - systemvars: false, // Set to true if you would rather load all system variables as well (useful for CI purposes) - silent: false, // If true, all warnings will be suppressed - expand: false, // Allows your variables to be "expanded" for reusability within your .env file - defaults: false, // Adds support for dotenv-defaults. If set to true, uses ./.env.defaults - ignoreStub: false - } - ], async function tailwindcss() { return { name: "docusaurus-tailwindcss", @@ -221,14 +210,6 @@ const siteConfig = { ] ), ], - webpack(config, { isServer, webpack }) { - config.plugins.push( - new webpack.DefinePlugin({ - 'process.env.REACT_APP_FOLLOWERS_ACCESS_KEY': JSON.stringify(process.env.REACT_APP_FOLLOWERS_ACCESS_KEY), - }) - ); - return config; - }, themeConfig: { prism: { theme: require("prism-react-renderer/themes/github"), @@ -378,6 +359,8 @@ const siteConfig = { }, }, customFields: { + // Put your custom environment here + AccessKey: process.env.REACT_APP_FOLLOWERS_ACCESS_KEY, /** Footer Fields */ footerDescription: '', contactTitle: "Contact", diff --git a/documentation/src/context/CommunityStats/index.tsx b/documentation/src/context/CommunityStats/index.tsx index f74e3063..28d12583 100644 --- a/documentation/src/context/CommunityStats/index.tsx +++ b/documentation/src/context/CommunityStats/index.tsx @@ -7,6 +7,7 @@ import React, { useMemo, useState, } from "react"; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; interface ICommunityStatsContext { githubStarCount: number; @@ -33,9 +34,10 @@ interface ICommunityStatsContext { export const CommunityStatsContext = createContext< ICommunityStatsContext | undefined >(undefined); -const followersAccessKey = process.env.REACT_APP_FOLLOWERS_ACCESS_KEY || 'default_key'; export const CommunityStatsProvider: FC = ({ children }) => { + const { siteConfig } = useDocusaurusContext(); + const followersAccessKey = siteConfig.customFields.AccessKey; const [loading, setLoading] = useState(true); const [githubStarCount, setGithubStarCount] = useState(0); const [githubFollowersCount, setGithubFollowersCount] = useState(0); @@ -151,7 +153,7 @@ export const CommunityStatsProvider: FC = ({ children }) => { ); const fetchTotalLCProblem = await fetch( - `https://alfa-leetcode-api.onrender.com/problems?limit=3100`, + `https://alfa-leetcode-api.onrender.com/problems?limit=4000`, { method: "GET", headers: { diff --git a/documentation/src/prepverse-theme/about-section/leetcode-section.tsx b/documentation/src/prepverse-theme/about-section/leetcode-section.tsx index 30082bab..811d1c7a 100644 --- a/documentation/src/prepverse-theme/about-section/leetcode-section.tsx +++ b/documentation/src/prepverse-theme/about-section/leetcode-section.tsx @@ -147,11 +147,20 @@ const LeecodeBadges = ({ className }: { className?: string }) => { )} -
- {renderBadgesByCategory("Competition Medals", leetcodeBadgeImg.filter(badge => badge.displayName.includes("Annual Badge") || badge.displayName.includes("Days Badge")))} - {renderBadgesByCategory("Daily Medals", leetcodeBadgeImg.filter(badge => badge.displayName.includes("LeetCoding Challenge")))} - {renderBadgesByCategory("Study Plan Medals", leetcodeBadgeImg.filter(badge => !badge.displayName.includes("Annual Badge") && !badge.displayName.includes("LeetCoding Challenge") && !badge.displayName.includes("Days Badge")))} -
+ {loading ? ( + + ) : ( +
+ {renderBadgesByCategory("Competition Medals", leetcodeBadgeImg.filter(badge => badge.displayName.includes("Annual Badge") || badge.displayName.includes("Days Badge")))} + {renderBadgesByCategory("Daily Medals", leetcodeBadgeImg.filter(badge => badge.displayName.includes("LeetCoding Challenge")))} + {renderBadgesByCategory("Study Plan Medals", leetcodeBadgeImg.filter(badge => !badge.displayName.includes("Annual Badge") && !badge.displayName.includes("LeetCoding Challenge") && !badge.displayName.includes("Days Badge")))} +
+ )} ); }; @@ -196,82 +205,91 @@ const LeecodeSolved = ({ className }: { className?: string }) => { )} -
-
-
-
-
- Solved Problems -
-
- {solvedProblem}{" "} - - {"/ "} - {totalLCProblem} - -
-
-
-
-
-
- Easy -
-
- {easySolved} - {" / "} - {totalLCEasy} -
+ {loading ? ( + + ) : ( +
+
+
+
+
+ Solved Problems +
+
+ {solvedProblem}{" "} + + {"/ "} + {totalLCProblem} +
-
-
-
-
- Medium -
-
- {mediumSolved} - {" / "} - {totalLCMedium} +
+
+
+
+ Easy +
+
+ {easySolved} + {" / "} + {totalLCEasy} +
+
-
-
-
-
-
- Hard +
+
+
+ Medium +
+
+ {mediumSolved} + {" / "} + {totalLCMedium} +
-
- {hardSolved} - {" / "} - {totalLCHard} +
+
+
+
+
+ Hard +
+
+ {hardSolved} + {" / "} + {totalLCHard} +
+
+
-
-
-
+ )}
); };