16 Commits

Author SHA1 Message Date
d160e6d1ca 🐛 Fix language not switching on dynamic pages
All checks were successful
Build and deploy website / build (push) Successful in 34s
2025-07-28 18:17:18 +00:00
3840766ad5 Fixed language not switching 2025-07-28 18:17:18 +00:00
e06ef027fd Update TODO
Signed-off-by: Martin Berg Alstad <git@martials.no>
2025-07-28 18:17:18 +00:00
e5a95e0c97 Start updating paraglide to v2 2025-07-28 18:17:18 +00:00
c9cb20cd38 🔥 Remove prettier 2025-07-28 18:17:18 +00:00
a77266b683 Update git domain 2025-07-28 18:17:18 +00:00
15440bb912 🎨 Fix lint errors using Biome 2025-07-28 18:17:18 +00:00
fafc48cfce 🎨 Format using Biome 2025-07-28 18:17:18 +00:00
cae5e408bd Adde Biome formatter and linter 2025-07-28 18:17:18 +00:00
869074dd89 ❄️ Add Nix shell 2025-07-28 18:17:18 +00:00
1892d38d18 📦 Update dependencies 2025-07-28 18:17:18 +00:00
d5ca576068 ✍️ Update TODO.md 2025-07-28 18:17:18 +00:00
b1061e56c6 🐛 Fix trailing slash 2025-07-28 18:17:18 +00:00
1fa2667deb 👷 Merge into single docker compose file
All checks were successful
Build and deploy website / build (push) Successful in 22s
2025-07-03 18:54:54 +02:00
19d78991c8 👷 Update ref keys and master to develop on develop step
All checks were successful
Build and deploy website / build (push) Successful in 1m3s
2025-07-03 18:39:42 +02:00
1dadaabe94 👷 Staging from develop branch
All checks were successful
Build and deploy website / build (push) Successful in 2s
2025-07-03 18:34:49 +02:00
11 changed files with 71 additions and 42 deletions

View File

@ -4,9 +4,7 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
- develop
jobs:
build:
@ -15,5 +13,9 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run docker-compose
run: docker compose up -d --build
- name: Build production
run: docker compose up -d --build prod
if: gitea.ref == 'refs/heads/master'
- name: Build develop
run: docker compose up -d --build dev
if: gitea.ref == 'refs/heads/develop'

View File

@ -9,9 +9,10 @@
- [ ] Type slug of project
## CI/CD
- [ ] Staging environment
- [ ] Deploy to staging environment on push to master
- [ ] Deploy to production environment on push tag to master
- [x] Staging environment
- [x] Deploy to staging environment on push to develop
- [x] Deploy to production environment on push to master
- [ ] Staging environment .env file
## SEO
- [ ] Meta tags on each page

View File

@ -1,9 +1,20 @@
services:
web:
container_name: martials.no
prod:
hostname: martials.no
container_name: "martials.no"
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "4321:4321"
- "4321:4321"
dev:
hostname: dev.martials.no
container_name: "dev.martials.no"
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "4322:4321"

View File

@ -1,6 +0,0 @@
import { paraglideMiddleware } from "@/paraglide/server";
import { defineMiddleware } from "astro/middleware"
export const onRequest = defineMiddleware((context, next) => {
return paraglideMiddleware(context.request, () => next());
});

View File

@ -2,11 +2,12 @@
import GiteaLink from "./links/GiteaLink.astro"
import PajamasIcon from "./icons/PajamasIcon.astro"
import ExternalLink from "./links/ExternalLink.astro"
import LanguageButtonGroup from "./LanguageButtonGroup.astro"
import LanguageButtonGroup from "./LanguageButtonGroup.svelte"
import { GIT_URL, STATUS_URL } from "astro:env/client"
import * as m from "@/paraglide/messages"
const giteaLink = `${GIT_URL}/martials/martials.no`
const pathname = Astro.url.pathname
---
<div class="divider bg-inherit"></div>
@ -28,5 +29,5 @@ const giteaLink = `${GIT_URL}/martials/martials.no`
{m.status()}
</ExternalLink>
</div>
<LanguageButtonGroup />
<LanguageButtonGroup client:load />
</div>

View File

@ -15,7 +15,7 @@ const isEnglish = pathname.startsWith("/en")
class:list={[
"btn join-item !text-cat-text border-cat-surface0",
!isEnglish ? "bg-cat-mantle" : "bg-cat-base",
]}>Norsk</LocaleLink
]} client:load>Norsk</LocaleLink
>
<LocaleLink
to={currentPath as NavLink}
@ -23,6 +23,6 @@ const isEnglish = pathname.startsWith("/en")
class:list={[
"btn join-item !text-cat-text border-cat-surface0",
isEnglish ? "bg-cat-mantle" : "bg-cat-base",
]}>English</LocaleLink
]} client:load>English</LocaleLink
>
</div>

View File

@ -0,0 +1,29 @@
<script lang="ts">
import { getLocale, type Locale, setLocale } from "@/paraglide/runtime"
const isEnglish = getLocale() === "en"
function updateLocale(lang: Locale) {
setLocale(lang)
}
</script>
<div class="join">
<button
onclick={() => updateLocale("nb")}
class={[
"btn join-item !text-cat-text border-cat-surface0",
!isEnglish ? "bg-cat-mantle" : "bg-cat-base",
]}>Norsk
</button
>
<button
onclick={() => updateLocale("en")}
class={[
"btn join-item !text-cat-text border-cat-surface0",
isEnglish ? "bg-cat-mantle" : "bg-cat-base",
]}>English
</button
>
</div>

View File

@ -11,6 +11,7 @@ interface Props extends ComponentProps {
const { to, class: clazz, lang = getLocale() } = Astro.props
---
<!-- TODO currently not working on Paraglide 2 https://github.com/opral/inlang-paraglide-js/issues/472 -->
<a href={localizeHref(to, { locale: lang })} class={clazz}>
<slot />
</a>

6
src/middleware.ts Normal file
View File

@ -0,0 +1,6 @@
import { paraglideMiddleware } from "@/paraglide/server"
import { defineMiddleware } from "astro/middleware"
export const onRequest = defineMiddleware((context, next) => {
return paraglideMiddleware(context.request, () => next());
});

View File

@ -1,17 +1,9 @@
---
import ProjectPage from "@/components/projects/ProjectPage.astro"
import { type GetStaticPathsResult } from "astro"
import "@/styles/global.css"
// Prerender the page as static HTML during build
export const prerender = true
export function getStaticPaths(): GetStaticPathsResult {
return [
{ params: { project: "homepage" } },
{ params: { project: "sb1budget" } },
]
}
// Prerender must be false for paraglide js
export const prerender = false
const { project } = Astro.params
---

View File

@ -1,19 +1,11 @@
---
import ProjectPage from "@/components/projects/ProjectPage.astro"
import { type GetStaticPathsResult } from "astro"
import "@/styles/global.css"
// Prerender the page as static HTML during build
export const prerender = true
export function getStaticPaths(): GetStaticPathsResult {
return [
{ params: { project: "homepage" } },
{ params: { project: "sb1budget" } },
]
}
// Prerender must be false for paraglide js
export const prerender = false
const { project } = Astro.params
---
<ProjectPage project={project as string} />
<ProjectPage project={ project as string } />