mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
zapamiętywanie stanu statystyk dnia
This commit is contained in:
@@ -26,12 +26,12 @@ import { computed, KeepAlive, onActivated, onDeactivated, reactive, Ref, ref, wa
|
|||||||
import { useStore } from '../../store/store';
|
import { useStore } from '../../store/store';
|
||||||
import JournalDailyStats from './DailyStats.vue';
|
import JournalDailyStats from './DailyStats.vue';
|
||||||
import JournalDriverStats from './JournalDriverStats.vue';
|
import JournalDriverStats from './JournalDriverStats.vue';
|
||||||
|
import StorageManager from '../../scripts/managers/storageManager';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
type TStatTab = 'daily' | 'driver';
|
type TStatTab = 'daily' | 'driver';
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const dailyStatsComp: Ref<InstanceType<typeof JournalDailyStats> | null> = ref(null);
|
const dailyStatsComp: Ref<InstanceType<typeof JournalDailyStats> | null> = ref(null);
|
||||||
|
|
||||||
@@ -57,7 +57,10 @@ let data = reactive({
|
|||||||
function onTabButtonClick(tab: TStatTab) {
|
function onTabButtonClick(tab: TStatTab) {
|
||||||
if (lastClickedTab.value == tab || !areStatsOpen.value) areStatsOpen.value = !areStatsOpen.value;
|
if (lastClickedTab.value == tab || !areStatsOpen.value) areStatsOpen.value = !areStatsOpen.value;
|
||||||
|
|
||||||
if (tab == 'daily') lastDailyStatsOpen.value = areStatsOpen.value;
|
if (tab == 'daily') {
|
||||||
|
lastDailyStatsOpen.value = areStatsOpen.value;
|
||||||
|
StorageManager.setBooleanValue('dailyStatsOpen', areStatsOpen.value);
|
||||||
|
}
|
||||||
|
|
||||||
store.currentStatsTab = tab;
|
store.currentStatsTab = tab;
|
||||||
lastClickedTab.value = tab;
|
lastClickedTab.value = tab;
|
||||||
@@ -65,6 +68,8 @@ function onTabButtonClick(tab: TStatTab) {
|
|||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
dailyStatsComp.value?.startFetchingDailyStats();
|
dailyStatsComp.value?.startFetchingDailyStats();
|
||||||
|
|
||||||
|
if (StorageManager.getBooleanValue('dailyStatsOpen')) areStatsOpen.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
onDeactivated(() => {
|
onDeactivated(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user