Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/components/ui/NavbarFirebaseAuthGithub.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { useEffect } from "react";
import ReactDOM from "react-dom/client";
import React, { useEffect, useState } from "react";
import { createPortal } from "react-dom";
import FirebaseAuthGithub from "./FirebaseAuthGithub";

const NavbarFirebaseAuthGithub: React.FC = () => {
const [container, setContainer] = useState<HTMLElement | null>(null);

useEffect(() => {
const container = document.getElementById("firebase-auth-github-navbar");
if (container && !container.hasChildNodes()) {
const root = ReactDOM.createRoot(container);
root.render(<FirebaseAuthGithub />);
}
const el = document.getElementById("firebase-auth-github-navbar");
setContainer(el);
}, []);
return null;

return container ? createPortal(<FirebaseAuthGithub />, container) : null;
};

export default NavbarFirebaseAuthGithub;
35 changes: 7 additions & 28 deletions src/pages/badges/github-badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,6 @@ import Head from '@docusaurus/Head';
import { motion, HTMLMotionProps } from 'framer-motion';
import type { ReactElement } from 'react';
import Layout from '@theme/Layout';
import { useColorMode } from '@docusaurus/theme-common';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

// Safe hook for color mode that handles SSR
function useSafeColorMode() {
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

let colorMode = 'light';
let isDark = false;

if (mounted && ExecutionEnvironment.canUseDOM) {
try {
const { useColorMode: useColorModeHook } = require('@docusaurus/theme-common');
const colorModeResult = useColorModeHook();
colorMode = colorModeResult.colorMode;
isDark = colorMode === 'dark';
} catch (error) {
console.warn('Failed to get color mode:', error);
}
}

return { colorMode, isDark, mounted };
}
import styles from './github-badges.module.css';

type MotionDivProps = HTMLMotionProps<"div">;
Expand All @@ -38,7 +11,13 @@ type MotionTrProps = HTMLMotionProps<"tr">;
import Link from '@docusaurus/Link';

const GithubBadgesContent = (): React.ReactElement => {
const { colorMode, isDark, mounted } = useSafeColorMode();
const [isDark, setIsDark] = useState(false);
useEffect(() => {
try {
const theme = document.documentElement.getAttribute('data-theme');
setIsDark(theme === 'dark');
} catch {}
}, []);

// Scroll to top button logic
useEffect(() => {
Expand Down
35 changes: 7 additions & 28 deletions src/pages/careers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,6 @@ import Layout from "@theme/Layout";
import Head from "@docusaurus/Head";
import { motion } from "framer-motion";
import Link from "@docusaurus/Link";
import { useColorMode } from '@docusaurus/theme-common';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

// Safe hook for color mode that handles SSR
function useSafeColorMode() {
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

let colorMode = 'light';
let isDark = false;

if (mounted && ExecutionEnvironment.canUseDOM) {
try {
const { useColorMode: useColorModeHook } = require('@docusaurus/theme-common');
const colorModeResult = useColorModeHook();
colorMode = colorModeResult.colorMode;
isDark = colorMode === 'dark';
} catch (error) {
console.warn('Failed to get color mode:', error);
}
}

return { colorMode, isDark, mounted };
}

// Animation variants for consistent animations
const fadeIn = {
Expand Down Expand Up @@ -151,7 +124,13 @@ const testimonials = [
];

function CareersContent() {
const { colorMode, isDark, mounted } = useSafeColorMode();
const [isDark, setIsDark] = useState(false);
useEffect(() => {
try {
const theme = document.documentElement.getAttribute('data-theme');
setIsDark(theme === 'dark');
} catch {}
}, []);
const [activeTestimonial, setActiveTestimonial] = useState(0);

useEffect(() => {
Expand Down
35 changes: 7 additions & 28 deletions src/pages/get-started/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,6 @@ import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { motion, useAnimation, useInView } from "framer-motion";
import Head from '@docusaurus/Head';
import { useColorMode } from '@docusaurus/theme-common';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

// Safe hook for color mode that handles SSR
function useSafeColorMode() {
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

let colorMode = 'light';
let isDark = false;

if (mounted && ExecutionEnvironment.canUseDOM) {
try {
const { useColorMode: useColorModeHook } = require('@docusaurus/theme-common');
const colorModeResult = useColorModeHook();
colorMode = colorModeResult.colorMode;
isDark = colorMode === 'dark';
} catch (error) {
console.warn('Failed to get color mode:', error);
}
}

return { colorMode, isDark, mounted };
}
import styles from "./styles.module.css";

// Type definitions
Expand Down Expand Up @@ -635,7 +608,13 @@ const LearningPath = ({

function GetStartedContent() {
const { siteConfig } = useDocusaurusContext();
const { colorMode, isDark, mounted } = useSafeColorMode();
const [isDark, setIsDark] = useState(false);
useEffect(() => {
try {
const theme = document.documentElement.getAttribute('data-theme');
setIsDark(theme === 'dark');
} catch {}
}, []);
type CompletedPaths = Record<string, boolean>;

const [completedPaths, setCompletedPaths] = useState<CompletedPaths>(() => {
Expand Down
2 changes: 0 additions & 2 deletions src/theme/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import Layout from "@theme-original/Layout";
import NavbarFirebaseAuthGithub from "@site/src/components/ui/NavbarFirebaseAuthGithub";
import NewsletterPopup from '../components/NewsLetterPopup';


Expand All @@ -10,7 +9,6 @@ export default function CustomLayout({ children, ...props }) {
return (
<>
<Layout {...props}>
<NavbarFirebaseAuthGithub />
{children}
</Layout>
<NewsletterPopup />
Expand Down
13 changes: 4 additions & 9 deletions src/theme/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React from 'react';
import { Analytics } from '@vercel/analytics/react';
import OriginalRoot from '@theme-original/Root';

// Default implementation, that you can customize
export default function Root({children}) {
return (
<>
{children}
<Analytics />
</>
);
// Delegate entirely to the original Root to preserve all providers during SSG
export default function Root(props) {
return <OriginalRoot {...props} />;
}
Loading