2020-11-13 16:42:32 +01:00
|
|
|
<script>
|
2020-11-18 20:18:18 +01:00
|
|
|
import { screenStore, routeStore } from "../store"
|
2020-11-13 16:42:32 +01:00
|
|
|
import Component from "./Component.svelte"
|
|
|
|
|
2020-11-18 20:18:18 +01:00
|
|
|
// Keep route params up to date
|
2020-11-13 16:42:32 +01:00
|
|
|
export let params
|
2020-11-23 12:29:24 +01:00
|
|
|
$: routeStore.actions.setRouteParams(params || {})
|
2020-11-13 16:42:32 +01:00
|
|
|
|
|
|
|
// Get the screen definition for the current route
|
2020-11-18 20:18:18 +01:00
|
|
|
$: screenDefinition = $screenStore.activeScreen?.props
|
2020-11-17 13:08:24 +01:00
|
|
|
|
|
|
|
// Redirect to home page if no matching route
|
2020-11-18 20:18:18 +01:00
|
|
|
$: screenDefinition == null && routeStore.actions.navigate("/")
|
2020-11-13 16:42:32 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if screenDefinition}
|
2020-11-18 20:18:18 +01:00
|
|
|
<Component definition={screenDefinition} />
|
2020-11-13 16:42:32 +01:00
|
|
|
{/if}
|