Add defaults when no tags

This commit is contained in:
pmoharana-cmd 2025-01-04 13:16:41 -05:00
parent 78170f7553
commit 6eaf4e3729
3 changed files with 30 additions and 10 deletions

View File

@ -106,7 +106,11 @@ export default function ResourceTable({ data, setData }: ResourceTableProps) {
), ),
cell: (info) => ( cell: (info) => (
<div className="flex flex-wrap gap-2 items-center px-2"> <div className="flex flex-wrap gap-2 items-center px-2">
<Tag>{info.getValue()}</Tag> <Tag>
{info.getValue().length != 0
? info.getValue()
: "no program"}
</Tag>
</div> </div>
), ),
}), }),

View File

@ -115,7 +115,11 @@ export default function ServiceTable({ data, setData }: ServiceTableProps) {
), ),
cell: (info) => ( cell: (info) => (
<div className="flex flex-wrap gap-2 items-center px-2"> <div className="flex flex-wrap gap-2 items-center px-2">
<Tag>{info.getValue()}</Tag> <Tag>
{info.getValue().length != 0
? info.getValue()
: "no program"}
</Tag>
</div> </div>
), ),
}), }),
@ -128,9 +132,13 @@ export default function ServiceTable({ data, setData }: ServiceTableProps) {
), ),
cell: (info) => ( cell: (info) => (
<div className="flex flex-wrap gap-2 items-center px-2"> <div className="flex flex-wrap gap-2 items-center px-2">
{info.getValue().map((tag: string, index: number) => { {info.getValue().length > 0 ? (
return <Tag key={index}>{tag}</Tag>; info.getValue().map((tag: string, index: number) => {
})} return <Tag key={index}>{tag}</Tag>;
})
) : (
<Tag>no requirements</Tag>
)}
</div> </div>
), ),
}), }),

View File

@ -97,8 +97,12 @@ export default function UserTable({ data, setData }: UserTableProps) {
</> </>
), ),
cell: (info) => ( cell: (info) => (
<div className="flex ml-2 flex-wrap gap-2 items-center"> <div className="flex flex-wrap gap-2 items-center px-2">
<Tag>{info.getValue()}</Tag> <Tag>
{info.getValue().length != 0
? info.getValue()
: "no role"}
</Tag>
</div> </div>
), ),
}), }),
@ -122,9 +126,13 @@ export default function UserTable({ data, setData }: UserTableProps) {
), ),
cell: (info) => ( cell: (info) => (
<div className="flex ml-2 flex-wrap gap-2 items-center"> <div className="flex ml-2 flex-wrap gap-2 items-center">
{info.getValue().map((tag: string, index: number) => { {info.getValue().length > 0 ? (
return <Tag key={index}>{tag}</Tag>; info.getValue().map((tag: string, index: number) => {
})} return <Tag key={index}>{tag}</Tag>;
})
) : (
<Tag>no programs</Tag>
)}
</div> </div>
), ),
}), }),