feat: added privacy policy page

This commit is contained in:
2026-01-11 20:02:59 +00:00
parent 4b689603d8
commit 0a3096dbaf
2 changed files with 105 additions and 25 deletions

26
App.tsx
View File

@@ -10,18 +10,40 @@ import PrivacyPolicy from './components/PrivacyPolicy';
const App: React.FC = () => {
const [currentPage, setCurrentPage] = useState<'home' | 'privacy'>('home');
useEffect(() => {
const handleHashChange = () => {
const hash = window.location.hash;
if (hash === '#privacy') {
setCurrentPage('privacy');
} else {
setCurrentPage('home');
}
};
// Initial check
handleHashChange();
// Listen for hash changes
window.addEventListener('hashchange', handleHashChange);
return () => window.removeEventListener('hashchange', handleHashChange);
}, []);
useEffect(() => {
window.scrollTo(0, 0);
}, [currentPage]);
const navigateToPrivacy = (e?: React.MouseEvent) => {
e?.preventDefault();
setCurrentPage('privacy');
window.location.hash = 'privacy';
};
const navigateToHome = (e?: React.MouseEvent) => {
e?.preventDefault();
setCurrentPage('home');
window.location.hash = '';
// If hash is empty, it might not trigger hashchange if it was already empty?
// Actually assigning '' to hash usually removes the hash or makes it '#'.
// Better to explicitly set history or just ensure state updates if the listener fires.
// If we rely on the listener, updating hash is enough.
};
return (