Middleware & transitions
This commit is contained in:
		@@ -46,7 +46,7 @@ export default defineConfig({
 | 
			
		||||
    ],
 | 
			
		||||
    defaultLocale: "en",
 | 
			
		||||
    routing: {
 | 
			
		||||
      redirectToDefaultLocale: true,
 | 
			
		||||
      redirectToDefaultLocale: false,
 | 
			
		||||
      prefixDefaultLocale: true
 | 
			
		||||
    },
 | 
			
		||||
    fallback: {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ export const prerender = true;
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<SinglePage>
 | 
			
		||||
    <div class="flex flex-col h-screen">
 | 
			
		||||
    <div class="flex flex-col h-dvh">
 | 
			
		||||
        <ShowcaseTabs currentLocale={Astro.currentLocale} client:load />
 | 
			
		||||
    </div>
 | 
			
		||||
</SinglePage>
 | 
			
		||||
 
 | 
			
		||||
@@ -4,13 +4,12 @@ import { ViewTransitions } from 'astro:transitions';
 | 
			
		||||
import Navbar from "../components/Navbar.astro";
 | 
			
		||||
import "../style/index.css";
 | 
			
		||||
import { useTranslations } from '../i18n/utils';
 | 
			
		||||
//import "../style/globals.css";
 | 
			
		||||
 | 
			
		||||
const t = useTranslations(lang)
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html lang={lang} data-theme={themeOverride ? themeOverride : "theme_auto"} class="overflow-hidden">
 | 
			
		||||
<html lang={lang} data-theme={themeOverride ? themeOverride : "theme_auto"} class="overflow-hidden" transition:animate="none">
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8" />
 | 
			
		||||
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 | 
			
		||||
@@ -26,9 +25,9 @@ const t = useTranslations(lang)
 | 
			
		||||
        <script transition:persist is:raw is:inline>
 | 
			
		||||
            document.addEventListener('astro:after-swap', () => {document.documentElement.setAttribute("data-theme", localStorage.getItem("data-theme") || document.documentElement.getAttribute("data-theme"));});
 | 
			
		||||
        </script>
 | 
			
		||||
        <Navbar />
 | 
			
		||||
        <div class="bg-bkg h-dvh overflow-y-scroll snap-mandatory snap-y scroll-smooth " transition:animate="fade" style="scrollbar-width: thin;">
 | 
			
		||||
        <Navbar transition:animate="initial" transition:persist="navbar"/>
 | 
			
		||||
        <div class="bg-bkg h-dvh overflow-y-scroll snap-mandatory snap-y scroll-smooth overflow-x-clip" transition:animate="fade" style="scrollbar-width: thin;">
 | 
			
		||||
            <slot />
 | 
			
		||||
        </div>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="snap-start h-screen overflow-clip pt-14">
 | 
			
		||||
<div class="snap-start h-dvh overflow-clip pt-14">
 | 
			
		||||
	<div class="bg-bkg h-full w-full sm:grid sm:grid-cols-6 lg:grid-cols-12">
 | 
			
		||||
		<div
 | 
			
		||||
			class="sm:col-start-2 sm:col-end-6 lg:col-start-3 lg:col-end-11 xl:col-start-3 xl:col-end-11 3xl:col-start-4 3xl:col-end-10 h-full p-2 sm:p-6"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="h-screen pt-14">
 | 
			
		||||
<div class="h-dvh pt-14">
 | 
			
		||||
	<div class="bg-bkg h-full w-full sm:grid sm:grid-cols-6 lg:grid-cols-12">
 | 
			
		||||
		<div
 | 
			
		||||
			class="sm:col-start-2 sm:col-end-6 lg:col-start-3 lg:col-end-11 xl:col-start-3 xl:col-end-11 3xl:col-start-4 3xl:col-end-10 h-full p-2 sm:p-6"
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ const { Content } = await page.render();
 | 
			
		||||
      { // @ts-ignore }
 | 
			
		||||
      <Separator className="my-4"/>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-left">
 | 
			
		||||
    <div class="text-left p-3">
 | 
			
		||||
      <Content />
 | 
			
		||||
    </div>
 | 
			
		||||
  </article>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +1,32 @@
 | 
			
		||||
---
 | 
			
		||||
export const prerender = true;
 | 
			
		||||
export const prerender = true
 | 
			
		||||
 | 
			
		||||
import type { GetStaticPaths } from "astro";
 | 
			
		||||
import MainLayout from "../layouts/MainLayout.astro";
 | 
			
		||||
import Hero from "../components/Hero.astro";
 | 
			
		||||
import About from "../components/About.astro";
 | 
			
		||||
import Showcase from "../components/Showcase.astro";
 | 
			
		||||
import FloatingLinks from "../components/FloatingLinks.astro";
 | 
			
		||||
 | 
			
		||||
export const getStaticPaths = (() => {
 | 
			
		||||
  return [
 | 
			
		||||
    {params: {lang: "en"}},
 | 
			
		||||
    {params: {lang: "cs"}},
 | 
			
		||||
    {params: {lang: "de"}},
 | 
			
		||||
    {params: {lang: "fr"}}
 | 
			
		||||
  ];
 | 
			
		||||
}) satisfies GetStaticPaths;
 | 
			
		||||
//@ts-ignore
 | 
			
		||||
import { getLangFromUrl, useTranslations } from "../i18n/utils";
 | 
			
		||||
 | 
			
		||||
const { lang } = Astro.params
 | 
			
		||||
const t = useTranslations(getLangFromUrl(Astro.url));
 | 
			
		||||
 | 
			
		||||
// Don't remove
 | 
			
		||||
if (Astro.preferredLocale) {
 | 
			
		||||
  return Astro.redirect(`/${Astro.preferredLocale}/`);
 | 
			
		||||
export async function getStaticPaths() {
 | 
			
		||||
  return ["en", "fr", "cs", "de"].map((lang) => {
 | 
			
		||||
    return { params: { lang } };
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<MainLayout title="sitetitle" description="sitedescription" lang={lang}>
 | 
			
		||||
  <h1>Welcome</h1>
 | 
			
		||||
  <p>
 | 
			
		||||
    You shouldn't be here. please continue to one of the following:
 | 
			
		||||
  </p>
 | 
			
		||||
  <ul>
 | 
			
		||||
    <li><a href="/en">English Version / English</a></li>
 | 
			
		||||
    <li><a href="/cs">Czech Version / Česky</a></li>
 | 
			
		||||
    <li><a href="/de">German Version [WIP] / Deutsch [laufende Arbeiten]</a></li>
 | 
			
		||||
    <li><a href="/fr">French Version [WIP] / Français [travail en cours]</a></li>
 | 
			
		||||
  </ul>
 | 
			
		||||
<MainLayout title={t("title")} description={t("description")} lang={Astro.currentLocale} themeOverride="theme_auto">
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta http-equiv="refresh" content="0; url=https://cyrilsebek.cz/en">
 | 
			
		||||
        <script type="text/javascript">
 | 
			
		||||
            window.location.href = "https://cyrilsebek.cz/en"
 | 
			
		||||
        </script>
 | 
			
		||||
  </head>
 | 
			
		||||
  <FloatingLinks />
 | 
			
		||||
  <Hero />
 | 
			
		||||
  <About />
 | 
			
		||||
  <Showcase />
 | 
			
		||||
</MainLayout>
 | 
			
		||||
		Reference in New Issue
	
	Block a user