refactor: add conditional brand filter counts
This commit is contained in:
parent
d8bbb35228
commit
cac55f1805
|
|
@ -54,7 +54,13 @@ export const getTotalBrandAnalysis = async () => {
|
|||
brand: true,
|
||||
_count: {
|
||||
select: {
|
||||
reviews: true,
|
||||
reviews: {
|
||||
where: {
|
||||
user: {
|
||||
email: session.user.email,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ export function BrandFilter() {
|
|||
</button>
|
||||
|
||||
{brands.map((brand) => {
|
||||
if (brand.count === 0) return null;
|
||||
|
||||
const isActive =
|
||||
selectedBrand?.toLowerCase() === brand.name.toLowerCase();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue