fix(database): fix baseSlug format in products seed to populate product symptoms successfully + format cleanup in ArchivePage
This commit is contained in:
parent
6dafe86344
commit
717a61a225
@ -139,10 +139,6 @@ async function main() {
|
|||||||
const cleanIngredients = item.ingredients || '';
|
const cleanIngredients = item.ingredients || '';
|
||||||
const cleanDosage = item.usage_and_dosage || '';
|
const cleanDosage = item.usage_and_dosage || '';
|
||||||
const suitableFor = determineSuitableFor(baseName, cleanDesc);
|
const suitableFor = determineSuitableFor(baseName, cleanDesc);
|
||||||
const baseSlug = slugify(baseName);
|
|
||||||
const categorySlug = item.category_slug || 'supplements';
|
|
||||||
const category = await findOrCreateCategory(categorySlug);
|
|
||||||
|
|
||||||
// Split baseName into nameFa and nameEn
|
// Split baseName into nameFa and nameEn
|
||||||
let baseNameFa = baseName;
|
let baseNameFa = baseName;
|
||||||
let baseNameEn = baseName;
|
let baseNameEn = baseName;
|
||||||
@ -152,6 +148,10 @@ async function main() {
|
|||||||
baseNameFa = matchName[2].trim();
|
baseNameFa = matchName[2].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseSlug = slugify(baseNameEn);
|
||||||
|
const categorySlug = item.category_slug || 'supplements';
|
||||||
|
const category = await findOrCreateCategory(categorySlug);
|
||||||
|
|
||||||
for (const variant of item.variants) {
|
for (const variant of item.variants) {
|
||||||
const artNo = variant.art_no;
|
const artNo = variant.art_no;
|
||||||
const barcode = variant.barcode;
|
const barcode = variant.barcode;
|
||||||
|
|||||||
@ -107,8 +107,7 @@ const ArchiveProductCard: React.FC<{ product: Product, onClick: (p: Product) =>
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{compatibility && (
|
{compatibility && (
|
||||||
<div className={`absolute top-14 right-4 z-10 text-[8px] font-black uppercase tracking-widest px-3 py-1 rounded-full shadow-md flex items-center gap-1 ${
|
<div className={`absolute top-14 right-4 z-10 text-[8px] font-black uppercase tracking-widest px-3 py-1 rounded-full shadow-md flex items-center gap-1 ${compatibility.type === 'alert' ? 'bg-amber-100 text-amber-700' :
|
||||||
compatibility.type === 'alert' ? 'bg-amber-100 text-amber-700' :
|
|
||||||
compatibility.type === 'success' ? 'bg-green-100 text-green-700' : 'bg-medical-gray-100 text-medical-gray-600'
|
compatibility.type === 'success' ? 'bg-green-100 text-green-700' : 'bg-medical-gray-100 text-medical-gray-600'
|
||||||
}`}>
|
}`}>
|
||||||
{compatibility.type === 'alert' ? <AlertCircle className="w-2.5 h-2.5" /> : compatibility.type === 'success' ? <Heart className="w-2.5 h-2.5" /> : <Sparkles className="w-2.5 h-2.5" />}
|
{compatibility.type === 'alert' ? <AlertCircle className="w-2.5 h-2.5" /> : compatibility.type === 'success' ? <Heart className="w-2.5 h-2.5" /> : <Sparkles className="w-2.5 h-2.5" />}
|
||||||
@ -145,7 +144,7 @@ const ArchiveProductCard: React.FC<{ product: Product, onClick: (p: Product) =>
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-wrap gap-1 mb-6">
|
<div className="flex flex-wrap gap-1">
|
||||||
{product.symptoms.slice(0, 2).map((s, i) => (
|
{product.symptoms.slice(0, 2).map((s, i) => (
|
||||||
<span key={i} className="text-[9px] font-bold bg-medical-gray-100 text-medical-gray-500 px-2 py-0.5 rounded-md">
|
<span key={i} className="text-[9px] font-bold bg-medical-gray-100 text-medical-gray-500 px-2 py-0.5 rounded-md">
|
||||||
{s}
|
{s}
|
||||||
@ -442,8 +441,7 @@ export default function ArchivePage({
|
|||||||
<button
|
<button
|
||||||
key={s}
|
key={s}
|
||||||
onClick={() => toggleSymptom(s)}
|
onClick={() => toggleSymptom(s)}
|
||||||
className={`px-2.5 py-1 rounded-full text-[10px] font-bold transition-all border whitespace-nowrap ${
|
className={`px-2.5 py-1 rounded-full text-[10px] font-bold transition-all border whitespace-nowrap ${activeSymptoms.includes(s)
|
||||||
activeSymptoms.includes(s)
|
|
||||||
? 'bg-canina-blue border-canina-blue text-white shadow-sm shadow-canina-blue/30'
|
? 'bg-canina-blue border-canina-blue text-white shadow-sm shadow-canina-blue/30'
|
||||||
: 'bg-medical-gray-50 border-medical-gray-200 text-medical-gray-500 hover:border-canina-blue/40 hover:text-canina-blue'
|
: 'bg-medical-gray-50 border-medical-gray-200 text-medical-gray-500 hover:border-canina-blue/40 hover:text-canina-blue'
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user