-
Notifications
You must be signed in to change notification settings - Fork 7
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
Contribution page #78
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just some variable name changes, and it should be good to ship 👍🏾
packages/web/tests/components/Contributions/ContributionsBox.test.tsx
Outdated
Show resolved
Hide resolved
packages/web/tests/components/Contributions/ContributionsBox.test.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More changes but making good progress!
</Box> | ||
<Box mt="1">Score: {cbox.score}</Box> | ||
<Box mt="1" color="gray" fontSize="xs"> | ||
{cbox.contributedAt.toString().slice(0, 10)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull in the DateTime
component from the Luxon library and use it here (and perhaps even use relative time in a meaningful way in addition to absolute time)
|
||
export const ContributionsBox: React.FC<ContributionsBoxProps> = ({ cbox }) => { | ||
return ( | ||
<Box maxW="sm" borderWidth="1px" borderRadius="lg" overflow="hidden" key={cbox.id}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hop on a call and chat about this style stuff; I think there's likely a simpler way to do this using additional Chakra components
// Get all Contributions | ||
const res = await fetch('/api/contributions'); | ||
const ContributionsList = await res.json(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to wrap this in a try catch
and we also need to make sure that res.ok
is truthy before continuing. If there's an error, we should display it meaningfully to the user via an Alert
}; | ||
|
||
describe('Contributions Box', () => { | ||
it('renders', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking to see if it renders is not sufficient. Change this description and add more meaningful evaluations to the test below (like whether the fields within a contribution box render as expected and whether the link is clickable)
// Wait utility | ||
const wait = () => new Promise<void>((resolve) => setTimeout(() => resolve(), 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this and use the waitFor
utility
Pre-Requisites
Description of Changes
Related Issues