Skip to content

Commit

Permalink
feat(page): add loading overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-heimbuch committed Jul 14, 2024
1 parent 0d551f3 commit 32cd1c1
Show file tree
Hide file tree
Showing 5 changed files with 1,394 additions and 263 deletions.
15 changes: 9 additions & 6 deletions apps/page/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
import node from '@astrojs/node';
import vue from '@astrojs/vue';

Expand All @@ -7,11 +8,13 @@ import tailwind from '@astrojs/tailwind';
// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: node({
mode: 'standalone'
// adapter: node({
// mode: 'standalone'
// }),
adapter: cloudflare({
platformProxy: {
enabled: true
}
}),
integrations: [
vue({ appEntrypoint: '/src/app' }),
tailwind()
]
integrations: [vue({ appEntrypoint: '/src/app' }), tailwind()]
});
9 changes: 5 additions & 4 deletions apps/page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"@podlove/types": "workspace:*",
"@podlove/clients": "workspace:*",
"@podlove/webvtt-parser": "workspace:*",
"@astrojs/check": "0.3.1",
"@astrojs/node": "6.1.0",
"@astrojs/tailwind": "5.0.2",
"@astrojs/vue": "4.0.0",
"@astrojs/check": "0.8.1",
"@astrojs/node": "8.3.2",
"@astrojs/tailwind": "5.1.0",
"@astrojs/vue": "4.5.0",
"@astrojs/cloudflare": "11.0.1",
"astro": "4.11.5",
"vue": "3.2.30",
"fast-xml-parser": "4.3.2",
Expand Down
30 changes: 26 additions & 4 deletions apps/page/src/features/LoadingOverlay.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
<template>
<custom-transition type="fade">
<div class="fixed top-0 left-0 w-screen h-screen z-50 bg-gray-100" v-if="!state.initialized"></div>
</custom-transition>
<div
class="fixed top-0 left-0 w-screen h-screen z-50 bg-gray-100 loading-overlay"
:class="{ done, hidden }"
></div>
</template>

<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { mapState } from 'redux-vuex';
import { selectors } from '../logic/store';
import CustomTransition from '../components/CustomTransition.vue';
const hidden = ref(false);
const state = mapState<{ initialized: boolean }>({
initialized: selectors.colors.initialized
});
const done = computed(() => state.initialized);
watch(done, () => {
setTimeout(() => {
hidden.value = true;
}, 250);
});
</script>

<style scoped>
.loading-overlay {
opacity: 1;
transition: opacity 250ms;
}
.loading-overlay.done {
opacity: 0;
}
</style>
2 changes: 1 addition & 1 deletion apps/page/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const lang = getLanguage();
<Colors client:only="vue" />
<LoadingOverlay client:load />
<LoadingBar client:only="vue" />
<PageHeader client:idle transition:persis="header" />
<PageHeader client:idle transition:persist="header" />
<main transition:animate="fade">
<slot></slot>
</main>
Expand Down
Loading

0 comments on commit 32cd1c1

Please sign in to comment.