From 74f1cf8d84e22f88792e03d155d6dab6cd2666d0 Mon Sep 17 00:00:00 2001 From: Manuel Brandstetter Date: Tue, 21 Nov 2023 19:23:25 +0100 Subject: [PATCH] Changes --- astro.config.mjs | 8 +- package.json | 3 +- pnpm-lock.yaml | 16 +++- src/pages/{ => [lang]}/Legal/Cookies.astro | 0 src/pages/{ => [lang]}/Legal/Legal.scss | 0 src/pages/{ => [lang]}/Legal/Privacy.astro | 0 src/pages/{ => [lang]}/Legal/Terms.astro | 0 src/pages/[lang]/index.astro | 29 +++++++ src/pages/index.astro | 20 ----- src/utils/directus.ts | 26 +++++++ .../ReachNewHeights/ReachNewHeights.astro | 66 ++++++++++++++++ src/views/ReachNewHeights/ReachNewHeights.tsx | 77 ------------------- 12 files changed, 139 insertions(+), 106 deletions(-) rename src/pages/{ => [lang]}/Legal/Cookies.astro (100%) rename src/pages/{ => [lang]}/Legal/Legal.scss (100%) rename src/pages/{ => [lang]}/Legal/Privacy.astro (100%) rename src/pages/{ => [lang]}/Legal/Terms.astro (100%) create mode 100644 src/pages/[lang]/index.astro delete mode 100644 src/pages/index.astro create mode 100644 src/utils/directus.ts create mode 100644 src/views/ReachNewHeights/ReachNewHeights.astro delete mode 100644 src/views/ReachNewHeights/ReachNewHeights.tsx diff --git a/astro.config.mjs b/astro.config.mjs index 8bac5d1..998c209 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -4,8 +4,8 @@ import react from "@astrojs/react"; // https://astro.build/config export default defineConfig({ - integrations: [react()], - redirects: { - "/legal": "/legal/privacy", - }, + integrations: [react()], + redirects: { + "/legal": "/legal/privacy", + }, }); diff --git a/package.json b/package.json index 661fd39..f0373c5 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@astrojs/react": "^3.0.4", + "@directus/sdk": "^13.0.2", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", "astro": "^3.5.3", @@ -21,10 +22,10 @@ }, "devDependencies": { "@typescript-eslint/parser": "^6.10.0", - "prettier-plugin-astro": "^0.12.1", "eslint": "^8.53.0", "eslint-plugin-astro": "^0.29.1", "eslint-plugin-jsx-a11y": "^6.8.0", + "prettier-plugin-astro": "^0.12.1", "sass": "^1.69.5" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 066bd64..717e051 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,13 +1,12 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - dependencies: '@astrojs/react': specifier: ^3.0.4 version: 3.0.4(@types/react-dom@18.2.15)(@types/react@18.2.37)(react-dom@18.2.0)(react@18.2.0)(vite@4.4.9) + '@directus/sdk': + specifier: ^13.0.2 + version: 13.0.2 '@types/react': specifier: ^18.2.37 version: 18.2.37 @@ -398,6 +397,11 @@ packages: to-fast-properties: 2.0.0 dev: false + /@directus/sdk@13.0.2: + resolution: {integrity: sha512-KECQM0w8xlgr5EklX+Jb9+dIzXyvJFjRfhiIAI7l/b0WEtVaCfvRMIrJXR3XsLeVW9u2nu+b/TffOyTMSLjm2w==} + engines: {node: '>=18.0.0'} + dev: false + /@esbuild/android-arm64@0.18.17: resolution: {integrity: sha512-9np+YYdNDed5+Jgr1TdWBsozZ85U1Oa3xW0c7TWqH0y2aGghXtZsuT8nYRbzOMcl0bXZXjOGbksoTtVOlWrRZg==} engines: {node: '>=12'} @@ -5382,3 +5386,7 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} dev: false + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/src/pages/Legal/Cookies.astro b/src/pages/[lang]/Legal/Cookies.astro similarity index 100% rename from src/pages/Legal/Cookies.astro rename to src/pages/[lang]/Legal/Cookies.astro diff --git a/src/pages/Legal/Legal.scss b/src/pages/[lang]/Legal/Legal.scss similarity index 100% rename from src/pages/Legal/Legal.scss rename to src/pages/[lang]/Legal/Legal.scss diff --git a/src/pages/Legal/Privacy.astro b/src/pages/[lang]/Legal/Privacy.astro similarity index 100% rename from src/pages/Legal/Privacy.astro rename to src/pages/[lang]/Legal/Privacy.astro diff --git a/src/pages/Legal/Terms.astro b/src/pages/[lang]/Legal/Terms.astro similarity index 100% rename from src/pages/Legal/Terms.astro rename to src/pages/[lang]/Legal/Terms.astro diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro new file mode 100644 index 0000000..204ccc6 --- /dev/null +++ b/src/pages/[lang]/index.astro @@ -0,0 +1,29 @@ +--- +import type { GetStaticPaths } from "astro"; +import ReachNewHeights from "../../views/ReachNewHeights/ReachNewHeights.astro"; +import Choices from "../../components/Choices"; +import { Uniqueness } from "../../components/Uniqueness"; +import { Mobile } from "../../components/Mobile"; +import Layout from "../../layouts/Layout.astro"; +import TargetUser from "../../views/TargetUser/TargetUser.astro"; +import Features from "../../views/Features/Features.astro"; +import { AboutUs } from "../../views/AboutUs/AboutUs"; + +export const getStaticPaths = (() => { + return [ + {params: {lang: "en"}}, + {params: {lang: "de"}}, + ]; +}) satisfies GetStaticPaths; + +--- + + + + + + + + + + diff --git a/src/pages/index.astro b/src/pages/index.astro deleted file mode 100644 index 082b5ca..0000000 --- a/src/pages/index.astro +++ /dev/null @@ -1,20 +0,0 @@ ---- -import { ReachNewHeights } from "../views/ReachNewHeights/ReachNewHeights"; -import Choices from "../components/Choices"; -import { Uniqueness } from "../components/Uniqueness"; -import { Mobile } from "../components/Mobile"; -import Layout from "../layouts/Layout.astro"; -import TargetUser from "../views/TargetUser/TargetUser.astro"; -import Features from "../views/Features/Features.astro"; -import { AboutUs } from "../views/AboutUs/AboutUs"; ---- - - - - - - - - - - diff --git a/src/utils/directus.ts b/src/utils/directus.ts new file mode 100644 index 0000000..66a7271 --- /dev/null +++ b/src/utils/directus.ts @@ -0,0 +1,26 @@ +import {createDirectus, readItems, rest, staticToken} from '@directus/sdk'; + +const directusUrl = import.meta.env.DIRECTUS_URL; +const directusToken = import.meta.env.DIRECTUS_TOKEN; + +const directusClient = createDirectus(directusUrl) + .with(staticToken(directusToken)) + .with(rest()); + +export default async function getTranslatedContent(collection: string, language: string) { + const content = await directusClient.request<{id: string, translations: [Record]}>(readItems(collection, { + deep: { + translations: { + _filter: { + languages_code: { + _eq: language + }, + }, + }, + }, + fields: ['*', 'translations.*'], + limit: 1 + })); + + return content.translations[0]; +} diff --git a/src/views/ReachNewHeights/ReachNewHeights.astro b/src/views/ReachNewHeights/ReachNewHeights.astro new file mode 100644 index 0000000..4b0738b --- /dev/null +++ b/src/views/ReachNewHeights/ReachNewHeights.astro @@ -0,0 +1,66 @@ +--- +import { Link } from "../../components/Link/Link"; +//import Icon from "../../components/Icon"; +import "./ReachNewHeights.scss"; +import getTranslatedContent from "../../utils/directus"; + +const {lang} = Astro.params; +const content = await getTranslatedContent("Hero_Section", lang!); +--- + + +
+
+
+
+

{content.header}

+

{content.paragraph}

+
+
+ {content.cta} + {content.detailsButton} +
+
+ Reach new heights + Reach new heights +
+
+ What is it about? + What is it about? +

{content.detailsHeader1}

+

{content.detailsText1}

+
+ +
+ How can it be used? + How can it be used? +

{content.detailsHeader2}

+

{content.detailsText2}

+
+
+
+
diff --git a/src/views/ReachNewHeights/ReachNewHeights.tsx b/src/views/ReachNewHeights/ReachNewHeights.tsx deleted file mode 100644 index 7966d4a..0000000 --- a/src/views/ReachNewHeights/ReachNewHeights.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { Link } from "../../components/Link/Link"; -import Icon from "../../components/Icon"; -import "./ReachNewHeights.scss"; - -export const ReachNewHeights = () => { - return ( -
-
-
-
-

- Erreiche mit deinem Team neue Erfolge und startet - eure erste Retrospektive. -

-

- Beginnt unmittelbar eure erste gemeinsame Sitzung - es ist keine - Registrierung erforderlich und es ist absolut kostenlos. -

-
-
- Jetzt loslegen - }> - Wie es funktioniert - -
-
- Reach new heights - Reach new heights -
-
- What is it about? - What is it about? -

Worum geht es?

-

- Scrumlr ist ein kooperatives Tool zum{" "} - Austausch von Ideen, Meinungen und Feedback. -

-
- -
- How can it be used? - How can it be used? -

Wie wird es genutzt?

-

- Scrumlr ist jederzeit und auf allen Endgeräten verfügbar - einfach{" "} - Website aufrufen und auf Start klicken. -

-
-
-
-
- ); -};