feat: add options to select aspect ratio and cron algo for product images
This commit is contained in:
@@ -51,7 +51,6 @@ async function fetchProducts() {
|
||||
maxPages: props.block.data.max_page_count,
|
||||
perPage: perPage,
|
||||
filters: filtersStore.applied,
|
||||
image_aspect_ratio: props.block.data.image_aspect_ratio,
|
||||
}));
|
||||
products.value = response.data;
|
||||
hasMore.value = response.meta.hasMore;
|
||||
@@ -94,7 +93,6 @@ async function onLoadMore() {
|
||||
perPage: perPage,
|
||||
maxPages: props.block.data.max_page_count,
|
||||
filters: filtersStore.applied,
|
||||
image_aspect_ratio: props.block.data.image_aspect_ratio,
|
||||
}));
|
||||
products.value.push(...response.data);
|
||||
hasMore.value = response.meta.hasMore;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<template v-if="products.length > 0">
|
||||
<div
|
||||
class="products-grid grid grid-cols-2 gap-x-4 gap-y-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8"
|
||||
class="products-grid grid grid-cols-2 gap-x-2 gap-y-2"
|
||||
>
|
||||
<RouterLink
|
||||
v-for="(product, index) in products"
|
||||
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<div v-else-if="isLoading === true"
|
||||
class="grid grid-cols-2 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8">
|
||||
class="grid grid-cols-2 gap-x-6 gap-y-10">
|
||||
<div v-for="n in 8" :key="n" class="animate-pulse space-y-2">
|
||||
<div class="aspect-square bg-gray-200 rounded-md"></div>
|
||||
<div class="h-4 bg-gray-200 rounded w-3/4"></div>
|
||||
|
||||
@@ -8,11 +8,6 @@ export const useSettingsStore = defineStore('settings', {
|
||||
store_enabled: true,
|
||||
app_name: 'OpenCart Telegram магазин',
|
||||
app_icon: '',
|
||||
app_icon192: '',
|
||||
app_icon180: '',
|
||||
app_icon152: '',
|
||||
app_icon120: '',
|
||||
manifest_url: null,
|
||||
night_auto: true,
|
||||
ya_metrika_enabled: false,
|
||||
feature_coupons: false,
|
||||
@@ -31,19 +26,15 @@ export const useSettingsStore = defineStore('settings', {
|
||||
mainpage_blocks: [],
|
||||
is_privacy_consented: true,
|
||||
privacy_policy_link: false,
|
||||
image_aspect_ratio: '1:1',
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async load() {
|
||||
console.log('Load settings');
|
||||
const settings = await fetchSettings();
|
||||
this.manifest_url = settings.manifest_url;
|
||||
this.app_name = settings.app_name;
|
||||
this.app_icon = settings.app_icon;
|
||||
this.app_icon192 = settings.app_icon192;
|
||||
this.app_icon180 = settings.app_icon180;
|
||||
this.app_icon152 = settings.app_icon152;
|
||||
this.app_icon120 = settings.app_icon120;
|
||||
this.theme.light = settings.theme_light;
|
||||
this.theme.dark = settings.theme_dark;
|
||||
this.ya_metrika_enabled = settings.ya_metrika_enabled;
|
||||
@@ -56,6 +47,7 @@ export const useSettingsStore = defineStore('settings', {
|
||||
this.texts = settings.texts;
|
||||
this.mainpage_blocks = settings.mainpage_blocks;
|
||||
this.privacy_policy_link = settings.privacy_policy_link;
|
||||
this.image_aspect_ratio = settings.image_aspect_ratio;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,13 +16,6 @@ class AppMetaInitializer {
|
||||
this.setMeta('theme-color', '#000000');
|
||||
this.setMeta('msapplication-navbutton-color', '#000000');
|
||||
this.setMeta('apple-mobile-web-app-status-bar-style', 'black-translucent');
|
||||
this.addLink('manifest', this.settings.manifest_url);
|
||||
|
||||
this.addLink('icon', this.settings.app_icon192, '192x192');
|
||||
this.addLink('apple-touch-icon', this.settings.app_icon192);
|
||||
this.addLink('apple-touch-icon', this.settings.app_icon180, '180x180');
|
||||
this.addLink('apple-touch-icon', this.settings.app_icon152, '152x152');
|
||||
this.addLink('apple-touch-icon', this.settings.app_icon120, '120x120');
|
||||
}
|
||||
|
||||
private setMeta(name: string, content: string) {
|
||||
|
||||
@@ -14,11 +14,6 @@ describe('AppMetaInitializer', () => {
|
||||
|
||||
const settings = {
|
||||
app_name: 'Test App',
|
||||
manifest_url: '/manifest.json',
|
||||
app_icon192: '/icon192.png',
|
||||
app_icon180: '/icon180.png',
|
||||
app_icon152: '/icon152.png',
|
||||
app_icon120: '/icon120.png',
|
||||
};
|
||||
|
||||
metaInitializer = new AppMetaInitializer(settings);
|
||||
@@ -43,14 +38,6 @@ describe('AppMetaInitializer', () => {
|
||||
expect(appNameMeta?.getAttribute('content')).toBe('Test App');
|
||||
});
|
||||
|
||||
it('должен создавать link теги для иконок', () => {
|
||||
metaInitializer.init();
|
||||
|
||||
const iconLink = document.querySelector('link[rel="icon"]');
|
||||
expect(iconLink).not.toBeNull();
|
||||
expect(iconLink?.getAttribute('href')).toBe('/icon192.png');
|
||||
});
|
||||
|
||||
it('должен создавать apple-touch-icon теги', () => {
|
||||
metaInitializer.init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user