feat: new settings and mainpage blocks

This commit is contained in:
2025-11-11 00:30:39 +03:00
parent 5fb45000ac
commit 6176c720b1
97 changed files with 1842 additions and 1658 deletions

View File

@@ -16,7 +16,7 @@ import 'swiper/element/bundle';
import 'swiper/css/bundle';
import AppLoading from "@/AppLoading.vue";
import {useProductFiltersStore} from "@/stores/ProductFiltersStore.js";
import {useSlidersStore} from "@/stores/SlidersStore.js";
import {useBlocksStore} from "@/stores/BlocksStore.js";
register();
const pinia = createPinia();
@@ -27,23 +27,24 @@ app
.use(VueTelegramPlugin);
const settings = useSettingsStore();
useSlidersStore().fetchMainpageSlider();
const blocks = useBlocksStore();
const appLoading = createApp(AppLoading);
appLoading.mount('#app');
settings.load()
.then(() => window.Telegram.WebApp.lockOrientation())
.then(async () => {
console.debug('Load default filters for the main page');
const filtersStore = useProductFiltersStore();
filtersStore.applied = await filtersStore.fetchFiltersForMainPage();
})
.then(() => {
if (settings.app_enabled === false) {
throw new Error('App disabled (maintenance mode)');
}
})
.then(() => blocks.processBlocks(settings.mainpage_blocks))
.then(async () => {
console.debug('Load default filters for the main page');
const filtersStore = useProductFiltersStore();
filtersStore.applied = await filtersStore.fetchFiltersForMainPage();
})
.then(() => {
console.debug('[Init] Set theme attributes');
document.documentElement.setAttribute('data-theme', settings.theme[window.Telegram.WebApp.colorScheme]);
@@ -57,11 +58,6 @@ settings.load()
document.documentElement.style.setProperty(key, settings.theme.variables[key]);
}
})
.then(() => {
console.debug('[Init] Load front page categories and products.');
const categoriesStore = useCategoriesStore();
categoriesStore.fetchTopCategories();
})
.then(() => new AppMetaInitializer(settings).init())
.then(() => { appLoading.unmount(); app.mount('#app'); })
.then(() => window.Telegram.WebApp.ready())