Skip to content

Commit

Permalink
PR feedback: Remove icon, add asserts, edit styled component
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilb4a committed Nov 4, 2024
1 parent 3fa1594 commit 1799cd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ import {
} from '../../useJurisdictions'
import useContestsJurisdictionAdmin from '../../JurisdictionAdmin/useContestsJurisdictionAdmin'
import { IContest } from '../../../types'
import { assert } from '../../utilities'

const ContestDiscrepanciesTable = styled(HTMLTable).attrs({
bordered: true,
striped: true,
})`
&.${Classes.HTML_TABLE} {
background: #ffffff;
border: 1px solid ${Colors.LIGHT_GRAY1};
margin-bottom: 32px;
table-layout: fixed;
width: 100%;
}
background: #ffffff;
border: 1px solid ${Colors.LIGHT_GRAY1};
margin-bottom: 32px;
table-layout: fixed;
width: 100%;
&.${Classes.HTML_TABLE} td {
td {
vertical-align: middle;
}
`
Expand All @@ -31,22 +30,22 @@ const TableHeader = styled(H6)`
}
`

/* istanbul ignore next */
function getContestName(contests: IContest[], contestId: string) {
const contest = contests.find(c => c.id === contestId)
return contest ? contest.name : `Contest Unknown: ID ${contestId}`
assert(contest !== undefined)
return contest.name
}

/* istanbul ignore next */
function getChoiceName(
contests: IContest[],
contestId: string,
choiceId: string
) {
const contest = contests.find(c => c.id === contestId)
if (!contest) return `Contest Unknown: ID ${choiceId}`
assert(contest !== undefined)
const choice = contest.choices.find(c => c.id === choiceId)
return choice ? choice.name : `Choice Unknown: ID ${choiceId}`
assert(choice !== undefined)
return choice.name
}

export interface IJurisdictionDiscrepanciesProps {
Expand Down
10 changes: 0 additions & 10 deletions client/src/components/AuditAdmin/Progress/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ const Progress: React.FC<IProgressProps> = ({
const ballotsOrBatches =
auditType === 'BATCH_COMPARISON' ? 'Batches' : 'Ballots'

const someJurisdictionHasDiscrepancies = Object.values(
discrepancyCountsQuery.data ? discrepancyCountsQuery.data : {}
).some(count => count > 0)

const columns: Column<IJurisdiction>[] = [
{
Header: 'Jurisdiction',
Expand Down Expand Up @@ -443,12 +439,6 @@ const Progress: React.FC<IProgressProps> = ({
onClick={() =>
apiDownload(`/election/${electionId}/discrepancy-report`)
}
icon={
<Icon
icon="flag"
intent={someJurisdictionHasDiscrepancies ? 'danger' : 'none'}
/>
}
>
Download Discrepancy Report
</AsyncButton>
Expand Down

0 comments on commit 1799cd5

Please sign in to comment.