Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FILE-20 - always show multiple badges in the UI #58

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/components/StatsGrid/StatsGridConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,34 @@ export const columnDefs = [
},
valueFormatter: (params: any) => params.data.idShort,
cellRenderer: (params: any) => {
const badges = [];
const badgeMap: Record<string, string> = {
sunrise: "🌅️",
core: "⭐️",
cassini: "🛰",
};

for (const property in badgeMap) {
if (params.data[property as keyof typeof badgeMap]) {
badges.push(badgeMap[property]);
}
}

return (
<>
<button type="button" onClick={() => copy(params.data.id)}>
<CopyIcon className="cursor-pointer text-slate-600 hover:text-slate-500" />
</button>{" "}
{params.valueFormatted} {params.data.sunrise ? <span>🌅️</span> : null}
{params.data.core ? <span>⭐️</span> : null}
{params.data.cassini ? <span>🛰</span> : null}
{params.valueFormatted}
<div className="absolute top-[15px] pl-4">
{badges.map((badge, idx) => {
return (
<span className="ml-1" key={idx}>
{badge}
</span>
);
})}
</div>
</>
);
},
Expand Down
Loading