-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2329 from HHS/al-ttahub-3316-3317-overview-widgets
QA dashboard overview FE
- Loading branch information
Showing
170 changed files
with
10,506 additions
and
1,765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { parseCheckboxEvent, NOOP, arrayExistsAndHasLength } from '../Constants'; | ||
|
||
describe('Constants', () => { | ||
describe('NOOP', () => { | ||
it('returns undefined', () => { | ||
expect(NOOP()).toBeUndefined(); | ||
}); | ||
}); | ||
|
||
describe('arrayExistsAndHasLength', () => { | ||
it('returns true if array exists and has length', () => { | ||
expect(arrayExistsAndHasLength([1])).toBeTruthy(); | ||
}); | ||
|
||
it('returns false if array does not exist', () => { | ||
expect(arrayExistsAndHasLength(null)).toBeFalsy(); | ||
}); | ||
|
||
it('returns false if array is not an array', () => { | ||
expect(arrayExistsAndHasLength('string')).toBeFalsy(); | ||
}); | ||
|
||
it('returns false if array has no length', () => { | ||
expect(arrayExistsAndHasLength([])).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
describe('parseCheckboxEvent', () => { | ||
it('returns checked and value from event', () => { | ||
const event = { | ||
target: { | ||
checked: true, | ||
value: 'shoes', | ||
}, | ||
}; | ||
expect(parseCheckboxEvent(event)).toEqual({ | ||
checked: true, | ||
value: 'shoes', | ||
}); | ||
}); | ||
|
||
it('returns null checked and value from event', () => { | ||
const event = { | ||
target: {}, | ||
}; | ||
expect(parseCheckboxEvent(event)).toEqual({ | ||
checked: null, | ||
value: null, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import moment from 'moment'; | ||
import './ClassScoreBadge.scss'; | ||
|
||
const BadgeAbove = (fontSize) => ( | ||
<span className={`ttahub-badge--success ${fontSize} text-white text-bold`}> | ||
Above all thresholds | ||
</span> | ||
); | ||
|
||
const BadgeBelowQuality = (fontSize) => ( | ||
<span className={`ttahub-badge--warning ${fontSize} text-bold`}> | ||
Below quality | ||
</span> | ||
); | ||
|
||
const BadgeBelowCompetitive = (fontSize) => ( | ||
<span className={`ttahub-badge--error ${fontSize} text-white text-bold`}> | ||
Below competitive | ||
</span> | ||
); | ||
|
||
export function getScoreBadge(key, score, received, size) { | ||
const fontSize = size || 'font-sans-2xs'; | ||
if (key === 'ES' || key === 'CO') { | ||
if (score >= 6) return BadgeAbove(fontSize); | ||
if (score < 5) return BadgeBelowCompetitive(fontSize); | ||
return BadgeBelowQuality(fontSize); | ||
} | ||
|
||
if (key === 'IS') { | ||
if (score >= 3) return BadgeAbove(fontSize); | ||
|
||
// IS is slightly more complicated. | ||
// See TTAHUB-2097 for details. | ||
const dt = moment(received, 'MM/DD/YYYY'); | ||
|
||
if (dt.isAfter('2025-08-01')) { | ||
if (score < 2.5) return BadgeBelowCompetitive(fontSize); | ||
return BadgeBelowQuality(fontSize); | ||
} | ||
|
||
if (dt.isAfter('2020-11-09') && dt.isBefore('2025-07-31')) { | ||
if (score < 2.3) return BadgeBelowCompetitive(fontSize); | ||
return BadgeBelowQuality(fontSize); | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
export default getScoreBadge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@use '../colors.scss' as *; | ||
|
||
%badge { | ||
background-color: $success-darkest; | ||
border-radius: 12px; | ||
padding: 4px 12px; | ||
} | ||
|
||
.ttahub-badge--success { | ||
@extend %badge; | ||
} | ||
|
||
.ttahub-badge--warning { | ||
background-color: $warning; | ||
@extend %badge; | ||
} | ||
|
||
.ttahub-badge--error { | ||
background-color: $error; | ||
@extend %badge; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.