fix types
Co-authored-by: Petter Sæterøy <potetmos1@users.noreply.github.com>
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
import benker from '@assets/studioBenker.png';
|
import benker from '@assets/studioBenker.png';
|
||||||
const { lang = 'no' } = Astro.props;
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const t = translations[lang].about;
|
const t = translations[lang].about;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
const { lang = 'no' } = Astro.props;
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const t = translations[lang].faq;
|
const t = translations[lang].faq;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
import logo from '@assets/logo.png';
|
import logo from '@assets/logo.png';
|
||||||
import DNS from '@assets/DNS-logo-hvit.png';
|
import DNS from '@assets/DNS-logo-hvit.png';
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
import Links from '@components/Links.astro';
|
import Links from '@components/Links.astro';
|
||||||
const { lang = 'no' } = Astro.props;
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const t = translations[lang].footer;
|
const t = translations[lang].footer;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
import logo from '@assets/logo.png';
|
import logo from '@assets/logo.png';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
const { lang = 'no' } = Astro.props;
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const t = translations[lang].hero;
|
const t = translations[lang].hero;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
---
|
---
|
||||||
import NavLink from '@components/NavLink.astro';
|
import NavLink from '@components/NavLink.astro';
|
||||||
|
import { translations, type Lang } from '@data/i18n';
|
||||||
import { translations } from '@data/i18n.js';
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const { lang = 'no' } = Astro.props;
|
|
||||||
const t = translations[lang].nav;
|
const t = translations[lang].nav;
|
||||||
const { pathname } = Astro.url;
|
const { pathname } = Astro.url;
|
||||||
|
|
||||||
function getLangSwitchPath(path, lang) {
|
function getLangSwitchPath(path: string, lang: string) {
|
||||||
if (lang === 'no') {
|
if (lang === 'no') {
|
||||||
if (path === '/') return '/en/';
|
if (path === '/') return '/en/';
|
||||||
if (path.startsWith('/en/')) return path.replace('/en/', '/');
|
if (path.startsWith('/en/')) return path.replace('/en/', '/');
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
---
|
---
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
const { lang = 'no', data } = Astro.props;
|
const { lang = 'no', data } = Astro.props as { lang?: Lang, data: any };
|
||||||
const t = translations[lang].program;
|
const t = translations[lang].program;
|
||||||
|
|
||||||
const convertDate = (date) => {
|
type ProgramItem = {
|
||||||
|
time: string;
|
||||||
|
event: string;
|
||||||
|
price?: string | null;
|
||||||
|
cost?: string | null;
|
||||||
|
url?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertDate = (date: string | Date) => {
|
||||||
let d = date;
|
let d = date;
|
||||||
if (!(d instanceof Date)) {
|
if (!(d instanceof Date)) {
|
||||||
d = new Date(d);
|
d = new Date(d);
|
||||||
@ -26,7 +34,7 @@ const convertDate = (date) => {
|
|||||||
<div id="program-list" class="w-125 p-6 border-1 border-white rounded-2xl even:bg-slottsblaa even:text-white bg-gyllen-beige flex flex-col gap-2">
|
<div id="program-list" class="w-125 p-6 border-1 border-white rounded-2xl even:bg-slottsblaa even:text-white bg-gyllen-beige flex flex-col gap-2">
|
||||||
<h2 class="font-bold text-xl">{convertDate(date)}</h2>
|
<h2 class="font-bold text-xl">{convertDate(date)}</h2>
|
||||||
<ul>
|
<ul>
|
||||||
{items.map((item) => {
|
{(items as ProgramItem[]).map((item) => {
|
||||||
const price = item.price || item.cost;
|
const price = item.price || item.cost;
|
||||||
return (
|
return (
|
||||||
<li class="flex justify-between">
|
<li class="flex justify-between">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { translations } from '@data/i18n.js';
|
import { translations, type Lang } from '@data/i18n';
|
||||||
const { lang = 'no' } = Astro.props;
|
const { lang = 'no' } = Astro.props as { lang?: Lang };
|
||||||
const t = translations[lang].vors;
|
const t = translations[lang].vors;
|
||||||
|
|
||||||
const videoUrl = "https://www.youtube.com/watch?v=t7T4RPBpTVY";
|
const videoUrl = "https://www.youtube.com/watch?v=t7T4RPBpTVY";
|
||||||
|
@ -93,4 +93,6 @@ export const translations = {
|
|||||||
dnsAlt: "Logo for the Norwegian Student Society",
|
dnsAlt: "Logo for the Norwegian Student Society",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
} as const;
|
||||||
|
|
||||||
|
export type Lang = keyof typeof translations;
|
Reference in New Issue
Block a user