fix: resolve admin typescript errors from i18n category change
This commit is contained in:
1 parent
2977df0a9d
commit
93012a3bdf
3 files changed
+9
-9
No files matched your search
@@ -1471,7 +1471,7 @@ export default function PageBuilderPage() {
|
|||||||
}}
|
}}
|
||||||
className="accent-cyan-glow"
|
className="accent-cyan-glow"
|
||||||
/>
|
/>
|
||||||
<span className="text-xs font-bold font-mono">{cat.name}</span>
|
<span className="text-xs font-bold font-mono">{typeof cat.name === 'string' ? cat.name : (cat.name as any)?.th || (cat.name as any)?.en || ''}</span>
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ export default function ProductEditPage() {
|
|||||||
className="w-full px-4 py-3 bg-night-950 border border-white/10 focus:border-cyan-glow/40 rounded-xl outline-none text-sm text-white transition-all appearance-none cursor-pointer"
|
className="w-full px-4 py-3 bg-night-950 border border-white/10 focus:border-cyan-glow/40 rounded-xl outline-none text-sm text-white transition-all appearance-none cursor-pointer"
|
||||||
>
|
>
|
||||||
{categories.map(c => (
|
{categories.map(c => (
|
||||||
<option key={c.id} value={c.id}>{c.name}</option>
|
<option key={c.id} value={c.id}>{typeof c.name === 'string' ? c.name : (c.name as any)?.th || (c.name as any)?.en || ''}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -612,13 +612,13 @@ export default function ProductEditPage() {
|
|||||||
{/* Main Image Preview */}
|
{/* Main Image Preview */}
|
||||||
<div className="aspect-square rounded-2xl overflow-hidden bg-night-950 border border-white/5 p-4 flex items-center justify-center relative group">
|
<div className="aspect-square rounded-2xl overflow-hidden bg-night-950 border border-white/5 p-4 flex items-center justify-center relative group">
|
||||||
<img
|
<img
|
||||||
src={images.find(img => img.url)?.url ? fixUrl(images.find(img => img.url)!.url!) : getCategoryImage(product?.category.name || '')}
|
src={images.find(img => img.url)?.url ? fixUrl(images.find(img => img.url)!.url!) : getCategoryImage(typeof product?.category.name === 'string' ? product.category.name : (product?.category.name as any)?.en || '')}
|
||||||
className="w-full h-full object-contain transition-all duration-700"
|
className="w-full h-full object-contain transition-all duration-700"
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-0 bg-gradient-to-t from-night-950/80 to-transparent flex items-end p-6">
|
<div className="absolute inset-0 bg-gradient-to-t from-night-950/80 to-transparent flex items-end p-6">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<p className="text-cyan-glow font-bold text-xs uppercase tracking-widest">{product?.category.name}</p>
|
<p className="text-cyan-glow font-bold text-xs uppercase tracking-widest">{typeof product?.category.name === 'string' ? product.category.name : (product?.category.name as any)?.th || (product?.category.name as any)?.en || ''}</p>
|
||||||
<h3 className="text-xl font-bold text-white">{product?.scent.name}</h3>
|
<h3 className="text-xl font-bold text-white">{product?.scent.name}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ export default function ProductsPage() {
|
|||||||
>
|
>
|
||||||
<option value="">All Categories</option>
|
<option value="">All Categories</option>
|
||||||
{categories.map(c => (
|
{categories.map(c => (
|
||||||
<option key={c.id} value={c.id}>{c.name}</option>
|
<option key={c.id} value={c.id}>{typeof c.name === 'string' ? c.name : (c.name as any)?.th || (c.name as any)?.en || ''}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -307,7 +307,7 @@ export default function ProductsPage() {
|
|||||||
<img
|
<img
|
||||||
src={product.images && product.images.length > 0
|
src={product.images && product.images.length > 0
|
||||||
? fixUrl(product.images[0].url)
|
? fixUrl(product.images[0].url)
|
||||||
: getCategoryImage(product.category.name)}
|
: getCategoryImage(typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.en || '')}
|
||||||
alt=""
|
alt=""
|
||||||
className="w-full h-full object-contain grayscale-0 opacity-100 group-hover:scale-110 transition-all duration-500"
|
className="w-full h-full object-contain grayscale-0 opacity-100 group-hover:scale-110 transition-all duration-500"
|
||||||
/>
|
/>
|
||||||
@@ -320,7 +320,7 @@ export default function ProductsPage() {
|
|||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4">
|
<td className="px-6 py-4">
|
||||||
<span className="inline-block px-2.5 py-1 rounded-md bg-cyan-glow/10 text-cyan-glow text-[10px] font-bold uppercase tracking-wider border border-cyan-glow/20">
|
<span className="inline-block px-2.5 py-1 rounded-md bg-cyan-glow/10 text-cyan-glow text-[10px] font-bold uppercase tracking-wider border border-cyan-glow/20">
|
||||||
{product.category.name}
|
{typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.th || (product.category.name as any)?.en || ''}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4">
|
<td className="px-6 py-4">
|
||||||
@@ -445,7 +445,7 @@ export default function ProductsPage() {
|
|||||||
<div className="p-6 border-b border-white/5 flex items-center justify-between bg-white/[0.02]">
|
<div className="p-6 border-b border-white/5 flex items-center justify-between bg-white/[0.02]">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-xl font-bold">{selectedProduct.scent.name}</h3>
|
<h3 className="text-xl font-bold">{selectedProduct.scent.name}</h3>
|
||||||
<p className="text-xs text-slate-500 uppercase tracking-widest">{selectedProduct.category.name} Gallery</p>
|
<p className="text-xs text-slate-500 uppercase tracking-widest">{typeof selectedProduct.category.name === 'string' ? selectedProduct.category.name : (selectedProduct.category.name as any)?.th || (selectedProduct.category.name as any)?.en || ''} Gallery</p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsGalleryOpen(false)}
|
onClick={() => setIsGalleryOpen(false)}
|
||||||
@@ -494,7 +494,7 @@ export default function ProductsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-40 h-40 rounded-3xl overflow-hidden border border-white/5 p-6 bg-night-950/50 backdrop-blur-xl group">
|
<div className="w-40 h-40 rounded-3xl overflow-hidden border border-white/5 p-6 bg-night-950/50 backdrop-blur-xl group">
|
||||||
<img
|
<img
|
||||||
src={getCategoryImage(selectedProduct.category.name)}
|
src={getCategoryImage(typeof selectedProduct.category.name === 'string' ? selectedProduct.category.name : (selectedProduct.category.name as any)?.en || '')}
|
||||||
alt=""
|
alt=""
|
||||||
className="w-full h-full object-contain grayscale opacity-40 group-hover:grayscale-0 group-hover:opacity-100 transition-all duration-700"
|
className="w-full h-full object-contain grayscale opacity-40 group-hover:grayscale-0 group-hover:opacity-100 transition-all duration-700"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user