mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 01:19:24 +00:00

* Added footer with blank links to be filled * Cookie consent to match V1 * Made scrolling work on tool search results * Made scrolling the same on tool search, tool picker and workbench * Cleaned up height variables, view height only used at workbench level <img width="1525" height="1270" alt="{F3C1B15F-A4BE-4DF0-A5A8-92D2A3B14443}" src="https://github.com/user-attachments/assets/0c23fe35-9973-45c0-85af-0002c5ff58d2" /> <img width="1511" height="1262" alt="{4DDD51C0-4BC5-4E9F-A4F2-E5F49AF5F5FD}" src="https://github.com/user-attachments/assets/2596d980-0312-4cd7-ad34-9fd3a8d1869e" /> --------- Co-authored-by: Connor Yoh <connor@stirlingpdf.com> Co-authored-by: James Brunton <jbrunton96@gmail.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import '@mantine/core/styles.css';
|
|
import '../vite-env.d.ts';
|
|
import './index.css'; // Import Tailwind CSS
|
|
import React from 'react';
|
|
import ReactDOM from 'react-dom/client';
|
|
import { ColorSchemeScript } from '@mantine/core';
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
import App from './App';
|
|
import './i18n'; // Initialize i18next
|
|
import posthog from 'posthog-js';
|
|
import { PostHogProvider } from 'posthog-js/react';
|
|
|
|
// Compute initial color scheme
|
|
function getInitialScheme(): 'light' | 'dark' {
|
|
const stored = localStorage.getItem('stirling-theme');
|
|
if (stored === 'light' || stored === 'dark') return stored;
|
|
try {
|
|
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
return prefersDark ? 'dark' : 'light';
|
|
} catch {
|
|
return 'light';
|
|
}
|
|
}
|
|
|
|
posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, {
|
|
api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
|
|
defaults: '2025-05-24',
|
|
capture_exceptions: true, // This enables capturing exceptions using Error Tracking, set to false if you don't want this
|
|
debug: false,
|
|
opt_out_capturing_by_default: false, // We handle opt-out via cookie consent
|
|
});
|
|
|
|
function updatePosthogConsent(){
|
|
if(typeof(posthog) == "undefined") {
|
|
return;
|
|
}
|
|
const optIn = (window.CookieConsent as any).acceptedCategory('analytics');
|
|
optIn?
|
|
posthog.opt_in_capturing() : posthog.opt_out_capturing();
|
|
|
|
console.log("Updated analytics consent: ", optIn? "opted in" : "opted out");
|
|
}
|
|
|
|
window.addEventListener("cc:onConsent", updatePosthogConsent);
|
|
window.addEventListener("cc:onChange", updatePosthogConsent);
|
|
|
|
const container = document.getElementById('root');
|
|
if (!container) {
|
|
throw new Error("Root container missing in index.html");
|
|
}
|
|
|
|
const root = ReactDOM.createRoot(container); // Finds the root DOM element
|
|
root.render(
|
|
<React.StrictMode>
|
|
<ColorSchemeScript defaultColorScheme={getInitialScheme()} />
|
|
<PostHogProvider
|
|
client={posthog}
|
|
>
|
|
<BrowserRouter>
|
|
<App />
|
|
</BrowserRouter>
|
|
</PostHogProvider>
|
|
</React.StrictMode>
|
|
);
|