Only show the sub labels filter when there are sub labels in the DB

This commit is contained in:
Nick Mowen 2022-05-11 19:43:57 -06:00
parent 5ce478c586
commit f2409171fe

View File

@ -270,18 +270,21 @@ export default function Events({ path, ...props }) {
</option> </option>
))} ))}
</select> </select>
<select {
className="basis-1/5 cursor-pointer rounded dark:bg-slate-800" filterValues.sub_labels.length > 0 && (
value={searchParams.sub_label} <select
onChange={(e) => onFilter('sub_label', e.target.value)} className="basis-1/5 cursor-pointer rounded dark:bg-slate-800"
> value={searchParams.sub_label}
<option value="all">all sub labels</option> onChange={(e) => onFilter('sub_label', e.target.value)}
{filterValues.sub_labels.map((item) => ( >
<option key={item} value={item}> <option value="all">all sub labels</option>
{item} {filterValues.sub_labels.map((item) => (
</option> <option key={item} value={item}>
))} {item}
</select> </option>
))}
</select>
)}
<div ref={datePicker} className="ml-auto"> <div ref={datePicker} className="ml-auto">
<CalendarIcon <CalendarIcon
className="h-8 w-8 cursor-pointer" className="h-8 w-8 cursor-pointer"