feat: product options, speedup home page, themes

This commit is contained in:
Nikita Kiselev
2025-07-21 13:37:09 +03:00
parent 51ce6ed959
commit e3cc0d4b10
18 changed files with 181 additions and 79 deletions

View File

@@ -5,22 +5,38 @@ import { VueTelegramPlugin } from 'vue-tg';
import { router } from './router';
import { createPinia } from 'pinia';
const config = {
night_auto: false,
theme: {
light: 'fantasy',
dark: 'dark',
}
};
const pinia = createPinia();
const app = createApp(App);
app
.use(pinia)
.use(router)
.use(VueTelegramPlugin);
app.mount('#app');
import { useMiniApp, useTheme } from 'vue-tg';
const productsStore = useProductsStore();
productsStore.fetchHomeProducts();
const categoriesStore = useCategoriesStore();
categoriesStore.fetchTopCategories();
const theme = useTheme();
const tg = useMiniApp();
import {useProductsStore} from "@/stores/ProductsStore.js";
import {useCategoriesStore} from "@/stores/CategoriesStore.js";
theme.onChange(() => {
document.documentElement.setAttribute('data-theme', theme.colorScheme.value);
});
if (config.night_auto) {
window.Telegram.WebApp.onEvent('themeChanged', function () {
document.documentElement.setAttribute('data-theme', config.theme[this.colorScheme]);
});
} else {
document.documentElement.setAttribute('data-theme', config.theme.light);
}
document.documentElement.setAttribute('data-theme', theme.colorScheme.value);
window.Telegram.WebApp.ready();