MED-104: create booking view with categories

This commit is contained in:
Danel Kungla
2025-08-28 14:11:54 +03:00
parent 31bc4b6cff
commit ad28352fc8
9 changed files with 72 additions and 18 deletions

View File

@@ -42,7 +42,7 @@ async function analysesLoader() {
const serviceCategories = productCategories.filter(
({ parent_category }) => parent_category?.handle === 'tto-categories',
);
console.log('serviceCategories', serviceCategories);
return {
analyses:
category?.products?.map<OrderAnalysisCard>(

View File

@@ -0,0 +1,31 @@
import { cache } from 'react';
import { getProductCategories } from '@lib/data';
import { ServiceCategory } from '../../_components/service-categories';
async function categoryLoader({
handle,
}: {
handle: string;
}): Promise<{ category: ServiceCategory | null }> {
const response = await getProductCategories({
handle,
fields: '*products, is_active, metadata',
});
const category = response.product_categories[0];
return {
category: {
color:
typeof category?.metadata?.color === 'string'
? category?.metadata?.color
: 'primary',
description: category?.description || '',
handle: category?.handle || '',
name: category?.name || '',
},
};
}
export const loadCategory = cache(categoryLoader);

View File

@@ -8,7 +8,7 @@ async function ttoServicesLoader() {
const response = await getProductCategories({
fields: '*products, is_active, metadata',
});
console.log('response.product_categories', response.product_categories);
const heroCategories = response.product_categories?.filter(
({ parent_category, is_active, metadata }) =>
parent_category?.handle === 'tto-categories' &&