mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 19:48:11 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 06b3286206 | |||
| 9e0e2b0225 | |||
| 4f7c3caa73 | |||
| b83b6092da | |||
| d619918c63 | |||
| 95b8247029 | |||
| 977a8adaec |
+47
-31
@@ -1,16 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="migration-info">
|
<AppModals />
|
||||||
<img src="/favicon.svg" alt="logo" width="120" />
|
<ImageFullscreenPreview v-if="store.vehiclePreviewSrc" />
|
||||||
<h1><span class="text--accent">Aplikacja</span> została przeniesiona na nową domenę!</h1>
|
|
||||||
<h1><span class="text--accent">This app</span> has been moved to a new domain!</h1>
|
<transition name="slide-bottom-anim">
|
||||||
<a href="http://pojazdownik-td2.spythere.eu/">http://pojazdownik-td2.spythere.eu/</a>
|
<MigrationInfo v-if="store.isMigrationInfoOpen" />
|
||||||
</div>
|
</transition>
|
||||||
|
|
||||||
|
<router-view></router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useStore } from './store';
|
import { useStore } from './store';
|
||||||
import { computed, watchEffect } from 'vue';
|
import ImageFullscreenPreview from './components/utils/ImageFullscreenPreview.vue';
|
||||||
|
import AppModals from './components/app/AppModals.vue';
|
||||||
|
import { computed, onMounted, watchEffect } from 'vue';
|
||||||
import { registerSW } from 'virtual:pwa-register';
|
import { registerSW } from 'virtual:pwa-register';
|
||||||
|
import MigrationInfo from './components/app/MigrationInfo.vue';
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
@@ -18,6 +23,12 @@ registerSW({
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadStockDataFromStorage();
|
||||||
|
handleMigrationInfo();
|
||||||
|
store.setupAPIData();
|
||||||
|
});
|
||||||
|
|
||||||
const currentStockString = computed(() => store.stockString);
|
const currentStockString = computed(() => store.stockString);
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
@@ -25,6 +36,35 @@ watchEffect(() => {
|
|||||||
store.chosenStorageStockName = '';
|
store.chosenStorageStockName = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleMigrationInfo() {
|
||||||
|
// Show only on old domain
|
||||||
|
if (location.hostname !== 'pojazdownik-td2.web.app') return;
|
||||||
|
|
||||||
|
const showInfo = localStorage.getItem('showMigrationInfo');
|
||||||
|
|
||||||
|
// Do not show if already acknowledged
|
||||||
|
if (showInfo === 'false') return;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
store.isMigrationInfoOpen = true;
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadStockDataFromStorage() {
|
||||||
|
const savedData = localStorage.getItem('savedStockData');
|
||||||
|
|
||||||
|
if (!savedData) {
|
||||||
|
localStorage.setItem('savedStockData', JSON.stringify({}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
store.storageStockData = JSON.parse(savedData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Wystąpił błąd podczas przetwarzania danych o składach z localStorage!', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -43,28 +83,4 @@ watchEffect(() => {
|
|||||||
font-size: calc(0.7rem + 0.75vw);
|
font-size: calc(0.7rem + 0.75vw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.migration-info {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
padding: 1em;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
font-size: 1.85em;
|
|
||||||
margin-top: 1em;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ export const useStore = defineStore('store', {
|
|||||||
...v,
|
...v,
|
||||||
group: response.vehicleGroups.find((g) => g.id == v.vehicleGroupsId)!,
|
group: response.vehicleGroups.find((g) => g.id == v.vehicleGroupsId)!,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user