Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/admin/hooks/useGroupPersonalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export interface GroupComponent {
product_group_id: string;
component_code: string;
component_name: string;
/**
* @deprecated TODO(#339): coluna não existe em product_group_components.
* Existe em product_components — herda no momento do "use group rules".
* Toggle no admin não persiste.
*/
is_personalizable: boolean;
is_active: boolean;
sort_order: number;
Expand All @@ -30,6 +35,7 @@ export interface GroupLocation {
max_width_cm: number | null;
max_height_cm: number | null;
max_area_cm2: number | null;
/** @deprecated TODO(#339): coluna não existe em product_group_locations; upload não persiste. */
area_image_url: string | null;
is_active: boolean;
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/admin/personalization-manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export interface LocationTechnique {
technique_id: string;
composed_code: string;
max_colors: number | null;
/**
* @deprecated TODO(#339): coluna não existe em product_component_location_techniques.
* Updates do toggle "definir como padrão" não persistem no DB.
*/
is_default: boolean;
is_active: boolean;
technique?: Technique;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export function usePersonalizationManager() {
max_width_cm?: number | null;
max_height_cm?: number | null;
max_area_cm2?: number | null;
/** @deprecated TODO(#339): coluna não existe; upload de imagem não persiste. */
area_image_url?: string | null;
is_active?: boolean;
}) => {
Expand Down Expand Up @@ -337,6 +338,7 @@ export function usePersonalizationManager() {
...data
}: {
id: string;
/** @deprecated TODO(#339): coluna não existe; toggle não persiste. */
is_default?: boolean;
max_colors?: number | null;
is_active?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface Location {
max_width_cm: number | null;
max_height_cm: number | null;
max_area_cm2: number | null;
/** @deprecated TODO(#339): coluna não existe; upload de imagem não persiste. */
area_image_url: string | null;
is_active: boolean;
}
Expand All @@ -59,6 +60,7 @@ export interface LocationTechnique {
technique_id: string;
composed_code: string;
max_colors: number | null;
/** @deprecated TODO(#339): coluna não existe; toggle "definir como padrão" não persiste. */
is_default: boolean;
is_active: boolean;
technique?: Technique;
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/sidebar/SidebarNavGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const SidebarNavGroup = forwardRef<HTMLDivElement, SidebarNavGroupProps>(
{!isCollapsed && item.shortcut && (
<kbd className="ml-auto hidden rounded bg-muted/30 px-1 py-0.5 font-mono text-[9px] text-muted-foreground/40 lg:inline-block">{item.shortcut}</kbd>
)}
{!isCollapsed && item.badge != null && (
{!isCollapsed && item.badge !== undefined && item.badge !== null && (
<span className="ml-auto min-w-[20px] rounded-full bg-primary/20 px-1.5 py-0.5 text-center text-[10px] font-semibold text-white">{item.badge}</span>
)}
</NavLink>
Expand All @@ -174,7 +174,7 @@ export const SidebarNavGroup = forwardRef<HTMLDivElement, SidebarNavGroupProps>(
{item.shortcut && (
<kbd className="rounded bg-muted/50 px-1 py-0.5 font-mono text-[9px] text-muted-foreground/60">{item.shortcut}</kbd>
)}
{item.badge != null && (
{item.badge !== undefined && item.badge !== null && (
<span className="rounded-full bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-white">{item.badge}</span>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/components/products/ProductPersonalizationRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ interface DbTechnique {
description?: string;
estimatedDays?: number;
max_colors?: number;
/** @deprecated TODO(#339): coluna não existe no DB; RPC nunca retorna. Sempre undefined. */
is_default?: boolean;
personalization_techniques?: { id: string; name: string; code: string; description?: string; estimated_days?: number };
}
Expand All @@ -78,6 +79,7 @@ interface DbLocation {
max_width_cm?: number | null;
max_height_cm?: number | null;
max_area_cm2?: number | null;
/** @deprecated TODO(#339): coluna não existe em product_*_locations; RPC nunca retorna. */
area_image_url?: string | null;
techniques?: DbTechnique[];
Comment on lines 67 to 84
product_group_location_techniques?: DbTechnique[];
Expand Down Expand Up @@ -118,7 +120,7 @@ interface ComponentInfo {
locations: LocationInfo[];
}

export function ProductPersonalizationRules({ productId, productSku, productName }: ProductPersonalizationRulesProps) {
export function ProductPersonalizationRules({ productId: _productId, productSku, productName }: ProductPersonalizationRulesProps) {
// Check if product uses group rules or has custom rules
const { data: productData, isLoading: loadingProduct } = useQuery({
queryKey: ["product-personalization-source", productSku],
Expand Down
10 changes: 10 additions & 0 deletions src/lib/external-db/techniques.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ export interface PromobrindPrintArea {
technique_code: string | null;
technique_name: string | null;
max_colors: number | null;
/**
* @deprecated TODO(#339): coluna não existe em product_*_location_techniques.
* Sempre `undefined` na resposta da RPC. Aguardando decisão de produto
* (limpar do front ou expor via RPC usando technique_order=1).
Comment on lines +22 to +24
*/
is_default: boolean;
/**
* @deprecated TODO(#339): coluna não existe em product_*_locations.
* Sempre `null`. Imagens com image_type='area' existem em product_images
* mas não há mapping para location_code.
*/
area_image_url: string | null;
}

Expand Down
Loading