-
Notifications
You must be signed in to change notification settings - Fork 29
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
LastDetection button and UserReportAPILayer Fixes/Refactoring #93
base: main
Are you sure you want to change the base?
Conversation
Add links to Isabella and Netlify deployment
…ils; Typescript update; Fixed timezone discrepancy by switching to UTC
✅ Deploy Preview for orcahome ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Anyone available for code review? |
Bumping this thread--requesting a pull request review. @paulcretu @DivyanshuParwal Would you be able to assist? |
return ( | ||
<> | ||
<Button variant="contained"> | ||
{dateDiff < 8.64e7 |
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.
extract this into a readable variable (millisInADay) and use here and on L13 instead of having two different representations of the value, that are likewise not readable.
: `< 1 Hour ` | ||
: dayDiff === 1 | ||
? `${dayDiff} Day` | ||
: `${dayDiff} days`} |
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.
: `${dayDiff} days`} | |
: `${dayDiff} Days`} |
? `${hoursDiff} Hours` | ||
: `< 1 Hour ` | ||
: dayDiff === 1 | ||
? `${dayDiff} Day` |
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.
Indent this and the next line similar to L20/L21
export const LastDetection = (props: dateProps): JSX.Element => { | ||
const currentDate: Date = new Date() | ||
const lastDate: Date = new Date(props.date) | ||
lastDate.toUTCString() |
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.
Remove these. They appear to serve no purpose
detectionQuery, | ||
variables | ||
).then((data: any): any => { | ||
//Reformatting of time data for LastDetection component |
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.
Add spaces after // on both lines
variables | ||
).then((data: any): any => { | ||
//Reformatting of time data for LastDetection component | ||
//Array time data |
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.
Can you give an example of the formation of "timestamp" and what you're converting it into so that the code is easier to understand for readability and correctness?
Fix for the time zone issue with the 'LastDetection' button. The PR is also a major overhaul of all involved components.
-Fixed 'Time since last detection/activity' button by implementing UTC into dateTime elements
-Reformatted LastDetection and UserReportAPILayer into typescript
-Refactored 'LastDetection.tsx', 'UserReportAPILayer.tsx'
-Removed context aspect of UserReportAPILayer