djledda.de main
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

80 line
2.7 KiB

  1. import { defineComponent, ref, Suspense, type VNode } from "vue";
  2. import { type RouteRecordRaw, RouterLink, RouterView, useRoute } from "vue-router";
  3. import GEMain from "@/generative-energy/GEMain.tsx";
  4. import DJEmail from "@/DJEmail.tsx";
  5. import GEDeutsch from "@/generative-energy/GEDeutsch.tsx";
  6. import GEDeutschArticle from "@/generative-energy/GEDeutschArticle.tsx";
  7. import GECalculator from "@/generative-energy/GECalculator.tsx";
  8. import DJDonate from "@/DJDonate.tsx";
  9. import { setupTooltip } from "@/DJTooltip.tsx";
  10. export const routes: RouteRecordRaw[] = [
  11. {
  12. path: "/",
  13. name: "GEMain",
  14. component: GEMain,
  15. },
  16. {
  17. path: "/calculator",
  18. name: "GECalculator",
  19. component: GECalculator,
  20. },
  21. {
  22. path: "/raypeat-deutsch",
  23. name: "GEDeutsch",
  24. component: GEDeutsch,
  25. },
  26. {
  27. path: "/raypeat-deutsch/article/:articleName",
  28. name: "GEDeutschArticle",
  29. component: GEDeutschArticle,
  30. props: ({ params }) => {
  31. if ("articleName" in params) {
  32. return { articleName: params.articleName };
  33. } else {
  34. return false;
  35. }
  36. },
  37. },
  38. ];
  39. export default defineComponent({
  40. name: "ge-root",
  41. setup() {
  42. const route = useRoute();
  43. const carrier = ref<HTMLDivElement | null>(null);
  44. setupTooltip({ carrier });
  45. return () => (
  46. <>
  47. <div ref={carrier} class="tooltip-carrier" />
  48. <main>
  49. <RouterLink class={"home-btn" + (route.name === "GEMain" ? " hide" : "")} to={{ name: "GEMain" }}>
  50. Generative Energy Home
  51. </RouterLink>
  52. <RouterView>
  53. {{
  54. default: ({ Component }: { Component: VNode }) => (Component &&
  55. (
  56. <Suspense>
  57. {{
  58. default: () => Component,
  59. fallback: () => <div>Page loading...</div>,
  60. }}
  61. </Suspense>
  62. )),
  63. }}
  64. </RouterView>
  65. <footer>
  66. <div class="bottom">
  67. <div>
  68. <a href="/">djledda.de</a> 2024 - <DJEmail>{() => "Contact"}</DJEmail>
  69. </div>
  70. <DJDonate />
  71. </div>
  72. </footer>
  73. </main>
  74. </>
  75. );
  76. },
  77. });