Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

evanjscallan
Copy link
Contributor

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

evanjscallan and others added 3 commits March 12, 2023 17:37
Add links to Isabella and Netlify deployment
…ils; Typescript update; Fixed timezone discrepancy by switching to UTC
@netlify
Copy link

netlify bot commented Mar 12, 2023

Deploy Preview for orcahome ready!

Name Link
🔨 Latest commit 59118d2
🔍 Latest deploy log https://app.netlify.com/sites/orcahome/deploys/640e64568627570008a449ff
😎 Deploy Preview https://deploy-preview-93--orcahome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@evanjscallan
Copy link
Contributor Author

Anyone available for code review?

@evanjscallan
Copy link
Contributor Author

evanjscallan commented May 15, 2023

Bumping this thread--requesting a pull request review. @paulcretu @DivyanshuParwal Would you be able to assist?

return (
<>
<Button variant="contained">
{dateDiff < 8.64e7
Copy link

@shanemc-goog shanemc-goog Nov 14, 2023

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`}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: `${dayDiff} days`}
: `${dayDiff} Days`}

? `${hoursDiff} Hours`
: `< 1 Hour `
: dayDiff === 1
? `${dayDiff} Day`

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()

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

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

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants