Skip to content

Commit

Permalink
Add border to badge, fix count to include IRA rebates
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamauchi committed Jun 24, 2024
1 parent 14143ff commit 3f0ea40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/components/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ const Badge: FC<{ num: number }> = ({ num }) => {
className={clsx(
'w-[22px]',
'h-[22px]',
'text-xsm',
'flex',
'flex-col',
'justify-center',
'text-center',
'text-xsm',
'bg-purple-100',
'text-color-text-primary',
'font-bold',
'leading-[22px]',
'rounded-full',
'ui-active:border',
'ui-active:border-grey-300',
)}
>
{num}
Expand Down
11 changes: 8 additions & 3 deletions src/state-incentive-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,16 @@ export const StateIncentives: FC<Props> = ({
incentives => incentives.length > 0,
).length;

const iraRebates = getRebatesFor(response, msg);

// Sort projects with nonzero incentives first, then alphabetically.
const projectOptions = (Object.keys(PROJECTS) as Project[])
.map(project => ({ project, count: incentivesByProject[project].length }))
.map(project => ({
project,
count:
incentivesByProject[project].length +
iraRebates.filter(r => r.project === project).length,
}))
.sort((a, b) => {
// "false" compares before "true"
const aStr = `${a.count === 0} ${PROJECTS[a.project].label(msg)}`;
Expand All @@ -507,8 +514,6 @@ export const StateIncentives: FC<Props> = ({
const [projectTab, setProjectTab] = useState(projectOptions[0].project);

const selectedIncentives = projectTab ? incentivesByProject[projectTab] : [];

const iraRebates = getRebatesFor(response, msg);
const selectedIraRebates = iraRebates.filter(r => r.project === projectTab);

return (
Expand Down

0 comments on commit 3f0ea40

Please sign in to comment.