update image and season interval on navigation

This commit is contained in:
Alexander Bocken 2023-07-13 17:18:09 +02:00
parent 5769c0cea6
commit 94848e505f
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -8,11 +8,13 @@
import InstructionsPage from '$lib/components/InstructionsPage.svelte'; import InstructionsPage from '$lib/components/InstructionsPage.svelte';
import IngredientsPage from '$lib/components/IngredientsPage.svelte'; import IngredientsPage from '$lib/components/IngredientsPage.svelte';
import TitleImgParallax from '$lib/components/TitleImgParallax.svelte'; import TitleImgParallax from '$lib/components/TitleImgParallax.svelte';
import { afterNavigate } from '$app/navigation';
import {season} from '$lib/js/season_store';
export let data: PageData; export let data: PageData;
const hero_img_src = "https://new.bocken.org/static/rezepte/full/" + data.short_name + ".webp" let hero_img_src = "https://new.bocken.org/static/rezepte/full/" + data.short_name + ".webp"
const placeholder_src = "https://new.bocken.org/static/rezepte/placeholder/" + data.short_name + ".webp" let placeholder_src = "https://new.bocken.org/static/rezepte/placeholder/" + data.short_name + ".webp"
export let months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] export let months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
function season_intervals() { function season_intervals() {
let interval_arr = [] let interval_arr = []
@ -48,6 +50,12 @@
return interval_arr return interval_arr
} }
export let season_iv = season_intervals(); export let season_iv = season_intervals();
afterNavigate(() => {
hero_img_src = "https://new.bocken.org/static/rezepte/full/" + data.short_name + ".webp"
placeholder_src = "https://new.bocken.org/static/rezepte/placeholder/" + data.short_name + ".webp"
season_iv = season_intervals();
})
</script> </script>
<style> <style>
*{ *{