mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 15:51:15 +00:00
38 lines
995 B
TypeScript
38 lines
995 B
TypeScript
import type { ParentComponent } from "solid-js";
|
|
import { createEffect } from "solid-js";
|
|
import { useLocation } from "@solidjs/router";
|
|
import { AuthProvider } from "./providers/auth-provider";
|
|
import { I18nProvider } from "./providers/i18n-provider";
|
|
import { ThemeProvider } from "./providers/theme-provider";
|
|
import { Shell } from "./components/shell";
|
|
|
|
// ScrollToTop component that resets scroll position on route change
|
|
const ScrollToTop = () => {
|
|
const location = useLocation();
|
|
|
|
createEffect(() => {
|
|
// Reset scroll position whenever the pathname changes
|
|
location.pathname;
|
|
window.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
});
|
|
|
|
return null;
|
|
};
|
|
|
|
const App: ParentComponent = (props) => {
|
|
return (
|
|
<ThemeProvider>
|
|
<I18nProvider>
|
|
<AuthProvider>
|
|
<Shell>
|
|
<ScrollToTop />
|
|
{props.children}
|
|
</Shell>
|
|
</AuthProvider>
|
|
</I18nProvider>
|
|
</ThemeProvider>
|
|
);
|
|
};
|
|
|
|
export default App;
|