Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 159x 139x 140x 1x 233x 1x | import { CollapsibleCard } from "../../ui/collapsible";
import { MultiSelect } from "../../ui/multi-select";
import type { ProFormSectionProps } from "./types";
import { FileText } from "lucide-react";
export function ServicesExpertiseSection({
pro,
onUpdateField,
serviceCategories = [],
materialTags = {},
isLoadingTaxonomy = false,
}: ProFormSectionProps) {
return (
<CollapsibleCard
title="Services & Expertise"
description="What services and expertise does this pro offer?"
icon={<FileText className="h-5 w-5" />}
defaultOpen={(pro.serviceCategoryIds?.length || 0) > 0}
>
<div className="space-y-4 pt-4">
{isLoadingTaxonomy ? (
<div className="animate-pulse space-y-4">
<div className="h-10 bg-background-muted rounded" />
<div className="h-10 bg-background-muted rounded" />
<div className="h-10 bg-background-muted rounded" />
</div>
) : (
<>
<div className="space-y-2">
<label
htmlFor="admin-service-categories"
id="admin-service-categories-label"
className="text-sm font-medium text-foreground-default"
>
Service Categories
</label>
<MultiSelect
id="admin-service-categories"
aria-labelledby="admin-service-categories-label"
options={serviceCategories.flatMap((cat) => [
{ value: cat.id, label: cat.name },
...(cat.children || []).map((child) => ({
value: child.id,
label: `${cat.name} > ${child.name}`,
})),
])}
selected={pro.serviceCategoryIds || []}
onChange={(values) =>
onUpdateField(
"serviceCategoryIds",
values.length > 0 ? values : null,
)
}
placeholder="Select service categories"
/>
</div>
<div className="space-y-2">
<label
htmlFor="admin-material-tags"
id="admin-material-tags-label"
className="text-sm font-medium text-foreground-default"
>
Material Tags
</label>
<MultiSelect
id="admin-material-tags"
aria-labelledby="admin-material-tags-label"
options={Object.entries(materialTags).flatMap(
([category, tags]) =>
tags.map((tag) => ({
value: tag.id,
label: `${tag.name} (${category})`,
})),
)}
selected={pro.materialTagIds || []}
onChange={(values) =>
onUpdateField(
"materialTagIds",
values.length > 0 ? values : null,
)
}
placeholder="Select materials"
/>
</div>
</>
)}
</div>
</CollapsibleCard>
);
}
|