Skip to content

Commit

Permalink
feat: Feedback when has specifications but filtering returns empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomenezes committed Jul 18, 2024
1 parent 24f4ef1 commit 40f444b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions apps/web/src/components/specification/SpecificationListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ const NoSpecifications: FC = () => (
</Center>
);

const NoSpecificationsFiltered: FC<{
quantity: number;
filterName: string;
}> = ({ filterName, quantity }) => {
const filterType = filterName === JSON_ABI ? "JSON ABI" : "ABI Params";
return (
<Center py="lg">
<Group gap="xs">
<Title order={3} c="dimmed">
{quantity > 1 &&
`You have ${quantity} specifications, but none of them are the type`}{" "}
{quantity === 1 &&
`You have one specification but it is not the type`}
</Title>
<Badge>{filterType}</Badge>
</Group>
</Center>
);
};

type ModeFilter = "all" | Modes;

type FilterByMode = (value: {
Expand Down Expand Up @@ -283,6 +303,14 @@ export const SpecificationListView: FC = () => {
/>
<NewSpecificationButton />
</Group>

{isNilOrEmpty(filteredSpecs) && (
<NoSpecificationsFiltered
filterName={filter}
quantity={specifications?.length ?? 0}
/>
)}

<Grid justify="flex-start" align="stretch">
{filteredSpecs?.map((spec) => (
<Grid.Col span={{ base: 12, md: 6 }} key={spec.id}>
Expand Down

0 comments on commit 40f444b

Please sign in to comment.