Merge pull request #237 from goteo/fix/add-app.svelte-missing-pages
Fix: add app.svelte missing pages
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
/// <reference types="astro/client" />
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import type { useTranslations } from "./i18n/utils";
|
||||
import type { Locale } from "../i18n/locales/index";
|
||||
|
||||
declare global {
|
||||
namespace App {
|
||||
interface Locals {
|
||||
lang: import("./i18n/store").Locale;
|
||||
t: ReturnType<typeof import("./i18n/ui").useTranslations>;
|
||||
}
|
||||
declare namespace App {
|
||||
interface Locals {
|
||||
lang: import("./src/i18n/locales/index").Locale;
|
||||
t: ReturnType<typeof import("./src/i18n/utils").useTranslations>;
|
||||
session: import("./src/auth/types").Session | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { defineMiddleware } from "astro:middleware";
|
||||
|
||||
import { getLanguage, handleProtectedRoutes, isLanguageExemptPath } from "./utils";
|
||||
import { getSession } from "../auth/session";
|
||||
import { useTranslations } from "../i18n/utils";
|
||||
|
||||
import type { Locale } from "../i18n/locales/index";
|
||||
@@ -59,6 +60,7 @@ export const onRequest = defineMiddleware(async (context: APIContext, next) => {
|
||||
//throw new Error(lang);
|
||||
context.locals.lang = lang;
|
||||
context.locals.t = useTranslations(lang);
|
||||
context.locals.session = await getSession(context.cookies);
|
||||
|
||||
const redirectPath = handleProtectedRoutes(context, lang);
|
||||
if (redirectPath) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
const { t } = Astro.locals;
|
||||
import App from "../../../components/App.svelte";
|
||||
const { t, lang, session } = Astro.locals;
|
||||
import Contributions from "../../../components/Admin/Contributions.svelte";
|
||||
---
|
||||
|
||||
<Layout title={t("metadata.title")} description={t("metadata.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper">
|
||||
<div class="flex w-full flex-col gap-10 py-10">
|
||||
<div class="flex flex-col gap-4">
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import App from "../../components/App.svelte";
|
||||
import Cart from "../../components/Checkout/Cart.svelte";
|
||||
import Summary from "../../components/Checkout/Summary.svelte";
|
||||
import Steps from "../../components/Checkout/Steps.svelte";
|
||||
import BackButton from "../../components/BackButton.astro";
|
||||
import { getPlatoniqAccountingId, getDefaultCurrency } from "../../utils/consts";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
const defaultCurrency = getDefaultCurrency();
|
||||
const accountingIdPlatoniq = Number(getPlatoniqAccountingId() || 0);
|
||||
---
|
||||
|
||||
<Layout title={t("metadata.title")} description={t("metadata.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper">
|
||||
<div class="flex flex-col gap-8 py-10 lg:flex-row">
|
||||
<div class="flex w-full flex-col gap-10 lg:w-1/2">
|
||||
|
||||
@@ -11,12 +11,8 @@ import FeaturedPromoters from "../../components/home/FeaturedPromoters.astro";
|
||||
import Resources from "../../components/home/Resources.astro";
|
||||
import Blog from "../../components/home/Blog.astro";
|
||||
import Matchfunding from "../../components/home/Matchfunding.astro";
|
||||
import { getSession } from "../../auth/session";
|
||||
import type { Locale } from "../../i18n/locales";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const locale = Astro.currentLocale as Locale;
|
||||
const session = await getSession(Astro.cookies);
|
||||
const { t, lang, session } = Astro.locals;
|
||||
---
|
||||
|
||||
<Layout
|
||||
@@ -24,7 +20,7 @@ const session = await getSession(Astro.cookies);
|
||||
description={t("metadata.description")}
|
||||
class="mb-20 gap-[72px]"
|
||||
>
|
||||
<App client:load locale={locale} session={session} />
|
||||
<App client:load locale={lang} session={session} />
|
||||
<Hero />
|
||||
<RenovationBanner />
|
||||
<Campaigns />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import App from "../../components/App.svelte";
|
||||
import ActivitySection from "../../components/profile/ActivitySection.svelte";
|
||||
import PeriodDropdown from "../../components/profile/PeriodDropdown.svelte";
|
||||
import CTACard from "../../components/profile/CTACard.svelte";
|
||||
@@ -7,7 +8,7 @@ import DonatedProjectsSection from "../../components/profile/DonatedProjectsSect
|
||||
import OwnedProjectsSection from "../../components/profile/OwnedProjectsSection.svelte";
|
||||
import MatchfundingSection from "../../components/profile/MatchfundingSection.svelte";
|
||||
|
||||
const { lang, t } = Astro.locals;
|
||||
const { lang, t, session } = Astro.locals;
|
||||
const authCookie = Astro.cookies.get("auth");
|
||||
if (!authCookie) {
|
||||
return Astro.redirect("/login?callback=/me");
|
||||
@@ -19,6 +20,7 @@ const period = Astro.url.searchParams.get("period") || new Date().getFullYear().
|
||||
---
|
||||
|
||||
<Layout title={t("me.page.title")} class="mb-20">
|
||||
<App client:load locale={lang} session={session} />
|
||||
<div
|
||||
class="wrapper flex flex-col gap-[40px] px-[16px] pt-[24px] pb-[40px] md:px-[40px] md:pt-[40px] md:pb-[40px]"
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import Summary from "../../../components/Checkout/Summary.svelte";
|
||||
import PaymentMethod from "../../../components/Checkout/PaymentMethod.astro";
|
||||
import Steps from "../../../components/Checkout/Steps.svelte";
|
||||
@@ -9,7 +10,7 @@ import { getDefaultCurrency } from "../../../utils/consts.ts";
|
||||
import { extractId } from "../../../utils/extractId";
|
||||
import { apiAccountingsIdGet, apiGatewaysGetCollection } from "../../../openapi/client/index";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
const defaultCurrency = getDefaultCurrency();
|
||||
|
||||
@@ -31,6 +32,7 @@ const { data: paymentGateways } = await apiGatewaysGetCollection();
|
||||
---
|
||||
|
||||
<Layout title={t("metadata.title")} description={t("metadata.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper">
|
||||
<div class="flex flex-col gap-8 py-10 lg:flex-row">
|
||||
<div class="flex w-full flex-col gap-10 lg:w-1/2">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import Carousel from "../../../components/Carousel.svelte";
|
||||
import CampaignCard from "../../../components/home/CampaignCard.svelte";
|
||||
import {
|
||||
@@ -12,7 +13,7 @@ import type { Project } from "../../../openapi/client";
|
||||
import { extractId } from "../../../utils/extractId";
|
||||
import type { Campaign } from "../../../types/campaign";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
const mapProjectToCard = (project: Project): Campaign => ({
|
||||
id: project.slug || "",
|
||||
@@ -118,6 +119,7 @@ try {
|
||||
title={t("payment.postPayment.title")}
|
||||
description={t("payment.postPayment.certificate.description")}
|
||||
>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<section class="wrapper flex flex-col items-start gap-6 pb-16 md:gap-10 md:pb-20">
|
||||
<div class="flex w-full items-start self-stretch">
|
||||
<div class="flex flex-1 flex-col items-start gap-4 self-stretch">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import { apiAccountingsIdGet, apiGatewayCheckoutsIdGet } from "../../../openapi/client";
|
||||
import FeedbackForm from "../../../components/Checkout/FeedbackForm.svelte";
|
||||
import Summary from "../../../components/Checkout/Summary.svelte";
|
||||
@@ -27,7 +28,7 @@ const { data: accounting } = await apiAccountingsIdGet({
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
let error = null;
|
||||
let amount: number | undefined = undefined;
|
||||
@@ -71,6 +72,7 @@ const postPaymentUrl = checkoutId
|
||||
---
|
||||
|
||||
<Layout title="Estado del pago">
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper py-10">
|
||||
{
|
||||
error ? (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import Summary from "../../../components/Checkout/Summary.svelte";
|
||||
import WalletConfirmation from "../../../components/Checkout/WalletConfirmation.astro";
|
||||
import Steps from "../../../components/Checkout/Steps.svelte";
|
||||
@@ -7,7 +8,7 @@ import { apiAccountingsIdGet } from "../../../openapi/client/index";
|
||||
import { getDefaultCurrency } from "../../../utils/consts.ts";
|
||||
import { extractId } from "../../../utils/extractId";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
const defaultCurrency = getDefaultCurrency();
|
||||
|
||||
const authCookie = Astro.cookies.get("auth");
|
||||
@@ -25,6 +26,7 @@ const { data: accounting } = await apiAccountingsIdGet({
|
||||
---
|
||||
|
||||
<Layout title={t("metadata.title")} description={t("metadata.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper">
|
||||
<div class="flex flex-row gap-8 py-10">
|
||||
<div class="flex w-1/2 flex-col gap-10">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import ProfileHero from "../../../components/profile/ProfileHero.astro";
|
||||
import ProfileInfo from "../../../components/profile/ProfileInfo.svelte";
|
||||
import Tabs from "../../../components/Tabs.svelte";
|
||||
@@ -20,7 +21,7 @@ import { getLanguage } from "../../../middleware/utils";
|
||||
import { client } from "../../../openapi/client/client.gen";
|
||||
|
||||
const { idOrHandle } = Astro.params;
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
if (!idOrHandle) {
|
||||
return Astro.redirect("/404");
|
||||
@@ -165,6 +166,7 @@ const avatarImage = user?.avatar || undefined; // Use user avatar or default pla
|
||||
description={`${t("profile.tabs.about")} ${displayName}`}
|
||||
class="mb-20"
|
||||
>
|
||||
<App client:load locale={lang} session={session} />
|
||||
{
|
||||
errorMessage ? (
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
import SingleProject from "../../../components/project/SingleProject.svelte";
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import { extractId } from "../../../utils/extractId";
|
||||
const { idOrSlug } = Astro.params;
|
||||
|
||||
@@ -17,7 +18,7 @@ if (!idOrSlug) {
|
||||
throw new Error("Project ID or Project Slug is undefined.");
|
||||
}
|
||||
|
||||
let lang = Astro.locals.lang;
|
||||
const { lang, session } = Astro.locals;
|
||||
|
||||
const { data: project, error } = await apiProjectsIdOrSlugGet({
|
||||
path: { idOrSlug },
|
||||
@@ -65,6 +66,7 @@ const { data: balancePoints } = await apiAccountingBalancePointsGetCollection({
|
||||
---
|
||||
|
||||
<Layout title={project.title} description={project.description}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<SingleProject
|
||||
{lang}
|
||||
{project}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import App from "../../components/App.svelte";
|
||||
import RegisterForm from "../../components/RegisterForm.astro";
|
||||
import Summary from "../../components/Checkout/Summary.svelte";
|
||||
import Steps from "../../components/Checkout/Steps.svelte";
|
||||
@@ -9,7 +10,7 @@ import Button from "../../components/library/Button.svelte";
|
||||
import BackButton from "../../components/BackButton.astro";
|
||||
import { itemCount } from "../../stores/cart";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
let hasCart = false;
|
||||
itemCount.subscribe((count) => {
|
||||
@@ -18,6 +19,7 @@ itemCount.subscribe((count) => {
|
||||
---
|
||||
|
||||
<Layout title={t("metadata.title")} description={t("metadata.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<main class="wrapper">
|
||||
<div class="flex flex-col gap-8 py-10 lg:flex-row">
|
||||
<div class="flex w-full flex-col gap-10 lg:w-1/2">
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import App from "../../components/App.svelte";
|
||||
import SearchFilters from "../../components/search/SearchFilters.svelte";
|
||||
import SearchResultsClient from "../../components/search/SearchResultsClient.svelte";
|
||||
|
||||
import type { Project } from "../../openapi/client/types.gen";
|
||||
|
||||
const { t, lang } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
|
||||
// Initial projects will be fetched client-side to avoid blocking SSR
|
||||
const initialProjects: Project[] = [];
|
||||
@@ -27,6 +28,7 @@ const hasInitialSearch = !!(
|
||||
---
|
||||
|
||||
<Layout title={t("search.title")} description={t("search.description")}>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<section class="wrapper">
|
||||
<!-- Page Header -->
|
||||
<div class="mb-12 text-center">
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
import Layout from "../../../layouts/Layout.astro";
|
||||
import App from "../../../components/App.svelte";
|
||||
import ReturnHeader from "../../../components/library/ReturnHeader.svelte";
|
||||
import BodyText from "../../../components/library/BodyText.svelte";
|
||||
|
||||
const { t } = Astro.locals;
|
||||
const { t, lang, session } = Astro.locals;
|
||||
const { fileName } = Astro.params;
|
||||
|
||||
const markdownFiles = import.meta.glob<{ default: any }>("../../../../static/*md");
|
||||
@@ -24,6 +25,7 @@ const Content = file.default;
|
||||
description={t("metadata.description")}
|
||||
class="mb-20 gap-[72px]"
|
||||
>
|
||||
<App client:load locale={lang} session={session} />
|
||||
<ReturnHeader client:load />
|
||||
|
||||
<BodyText client:load>
|
||||
|
||||
Reference in New Issue
Block a user