From 0c3f08750b035c704c1c200316027f2c4a659523 Mon Sep 17 00:00:00 2001 From: J <80164315+jbolns@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:27:13 +0200 Subject: [PATCH] Improvs > Misc Formatting & Add Gateway --- src/components/CategoriesPreview.astro | 7 +- src/components/MainNavLangs.astro | 1 + src/i18n/ui.ts | 17 +++-- src/i18n/utils.ts | 2 +- src/layouts/BlogRoll.astro | 3 +- src/pages/blog/[lang]/[...page].astro | 2 +- src/pages/en/gateway.astro | 94 ++++++++++++++++++++++++++ src/pages/index.astro | 5 +- 8 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 src/pages/en/gateway.astro diff --git a/src/components/CategoriesPreview.astro b/src/components/CategoriesPreview.astro index 2e4b76e..cac7084 100644 --- a/src/components/CategoriesPreview.astro +++ b/src/components/CategoriesPreview.astro @@ -1,12 +1,9 @@ --- // IMPORTS -// Config & content -import { languages } from "@i18n/ui"; - -// TYPES type MultiArray = { [key: string]: string[] }; +import { languages } from "@i18n/ui"; -// FUNCTIONS & ACTIONS +// ACTIONS const { tags, locale, current } = Astro.props; let dict: MultiArray = {}; diff --git a/src/components/MainNavLangs.astro b/src/components/MainNavLangs.astro index 46936e5..9490fe5 100644 --- a/src/components/MainNavLangs.astro +++ b/src/components/MainNavLangs.astro @@ -7,6 +7,7 @@ import { getRoutes, sanitizeRoutes } from "@i18n/utils"; // ACTIONS // Get locale const { locale } = Astro.props; + // Determine current slug from pathname const currentPath = Astro.url.pathname; const parts = currentPath.split("/"); diff --git a/src/i18n/ui.ts b/src/i18n/ui.ts index e96d95e..8381db1 100644 --- a/src/i18n/ui.ts +++ b/src/i18n/ui.ts @@ -6,15 +6,17 @@ import type { Multi, Links, Misc } from "@types" // ALL LANGUAGES export const languages: Multi = { - en: 'English', - es: 'Español', - fi: 'Suomi', + en: "English", + es: "Español", + fi: "Suomi", }; // DEFAULT LANGUAGE -export const defaultLang = 'en'; +export const defaultLang = "en"; +// COLLECTION NAMES +export const listOfCollections = ["blog"] // TOP-LEVEL NAVIGATION // @@ -68,7 +70,8 @@ export type Sections = { [key: string]: Multi } -// VARIOUS STRINGS USED ACROSS WEBSITE +// MISC STRINGS +// Strings for animation wrapper export const wrapperStrings: Misc = { w1: { en: "Click here to load animation", @@ -97,6 +100,7 @@ export const wrapperStrings: Misc = { } } +// Strings used in CV export const cvStrings: Misc = { mode: { en: "View mode", @@ -135,6 +139,7 @@ export const cvStrings: Misc = { } } +// Strings for tag and icon labels requiring small adjustments export const labelStrings: Misc = { coding: { en: "coding", @@ -153,9 +158,9 @@ export const labelStrings: Misc = { }, } +// OG strings used in header export const ogStrings: Multi = { en: "en_GB", es: "es_ES", fi: "fi_FI" - } diff --git a/src/i18n/utils.ts b/src/i18n/utils.ts index 9860afc..56bcab3 100644 --- a/src/i18n/utils.ts +++ b/src/i18n/utils.ts @@ -28,7 +28,7 @@ export function getRoutes(slug = ""): Multi | string { let match = -1 const allRoutes = Object.values(routes) - allRoutes.forEach((group,i) => Object.values(group).map((val) => val === slug ? match = i : "")) + allRoutes.forEach((group,i) => Object.values(group).map((val) => val === decodeURI(slug) ? match = i : "")) let group match >= 0 ? group = allRoutes[match] : "" diff --git a/src/layouts/BlogRoll.astro b/src/layouts/BlogRoll.astro index 2e3b45d..789dad9 100644 --- a/src/layouts/BlogRoll.astro +++ b/src/layouts/BlogRoll.astro @@ -2,11 +2,10 @@ // IMPORTS import BaseLayout from "@layouts/BaseLayout.astro"; import { site, sections } from "@i18n/sections"; -import CategoriesPreview from "@components/CategoriesPreview.astro"; // ACTIONS // Get props from child component -const { tags, locale, section } = Astro.props; +const { locale, section } = Astro.props; --- diff --git a/src/pages/en/gateway.astro b/src/pages/en/gateway.astro new file mode 100644 index 0000000..3661b17 --- /dev/null +++ b/src/pages/en/gateway.astro @@ -0,0 +1,94 @@ +--- +// IMPORTS +import BaseLayout from "@layouts/BaseLayout.astro"; +import { site } from "@i18n/sections"; +import { defaultLang } from "@i18n/ui"; + +// ACTIONS +// Get locale from folder structure +const locale = defaultLang; +--- + + +
+

+ (For clarity, this page is only available in English.) +

+ +

Services

+

Click the button below to pay for services rendered.1, 2

+

Do NOT use this gateway to book services.3

+ + + +

Products

+

+ All products I offer can be used in "ugly mode" without + activation. To make a voluntary payment to get make the user interface prettier, click the button below.1, 2, 5 +

+ + + + + Notes +
    +
  1. + Payments are final and confirm satisfaction with products/services. +
  2. +
  3. Payments are handled via Stripe.
  4. +
  5. + Payments for services that have not been pre-arranged, agreed, and + contracted with me will be treated as voluntary payments relating to + an open-source or open-access resource of my choice. +
  6. +
  7. + By clicking the button you accept the applicable sections of the Terms & Conditions. +
  8. + +
  9. + After payment, Stripe will send an invoice to the email you entered in + the payment information. The invoice number is the activation code + needed to disable "ugly mode". +
  10. + +
+
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro index 3af0f0e..f658ce3 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,12 +3,11 @@ import type { Multi } from "@types"; import { ViewTransitions } from "astro:transitions"; import BaseHead from "@components/BaseHead.astro"; -import { languages } from "@i18n/ui"; +import { languages, defaultLang } from "@i18n/ui"; import { sanitizeRoutes } from "@i18n/utils"; import { site } from "@i18n/sections"; -import { defaultLang } from "@i18n/ui"; -// FUNCTIONS & ACTIONS +// ACTIONS const locale: keyof Multi = defaultLang; ---