-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
19 changed files
with
1,307 additions
and
8,224 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 was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
150 changes: 75 additions & 75 deletions
150
...dashboard/build/assets/vendor.11357817.js → ...dashboard/build/assets/vendor.59907391.js
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,46 @@ | ||
import { FC } from "react"; | ||
|
||
type UserStatusProps = { | ||
lastOnline?: string | null; | ||
}; | ||
|
||
export const OnlineBadge: FC<UserStatusProps> = ({ lastOnline }) => { | ||
const convertDateFormat = ( | ||
lastOnline: string | null | undefined | ||
): number | null => { | ||
if (lastOnline === null || lastOnline === undefined) { | ||
// Handle the case where lastOnline is null or undefined | ||
return null; | ||
} | ||
|
||
// Parse the input date string | ||
const gmtDate = new Date(lastOnline + "Z"); // Append 'Z' to indicate it's in GMT | ||
|
||
// Get the browser's time zone | ||
const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
|
||
// Create a new date object with the browser's time zone | ||
const localDate = new Date( | ||
gmtDate.toLocaleString(undefined, { timeZone: browserTimeZone }) | ||
); | ||
|
||
// Calculate the Unix timestamp (in seconds) | ||
const unixTimestamp = Math.floor(localDate.getTime() / 1000); | ||
|
||
return unixTimestamp; | ||
}; | ||
const currentTimeInSeconds = Math.floor(Date.now() / 1000); // Current time in seconds | ||
|
||
const unixTime = convertDateFormat(lastOnline); | ||
|
||
const timeDifferenceInSeconds = unixTime | ||
? currentTimeInSeconds - unixTime | ||
: 0; | ||
|
||
if (timeDifferenceInSeconds <= 61 && timeDifferenceInSeconds > 0) | ||
return <div className="circle pulse green"></div>; | ||
else if (timeDifferenceInSeconds === 0) | ||
return <div className="circle pulse orange"></div>; | ||
|
||
return <div className="circle pulse red"></div>; | ||
}; |
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,65 @@ | ||
import { Text } from "@chakra-ui/react"; | ||
|
||
import { FC } from "react"; | ||
import { relativeExpiryDate } from "utils/dateFormatter"; | ||
|
||
type UserStatusProps = { | ||
lastOnline: string | null; | ||
}; | ||
|
||
export const OnlineStatus: FC<UserStatusProps> = ({ lastOnline }) => { | ||
const convertDateFormat = ( | ||
lastOnline: string | null | undefined | ||
): number | null => { | ||
if (lastOnline === null || lastOnline === undefined) { | ||
// Handle the case where lastOnline is null or undefined | ||
return null; | ||
} | ||
|
||
// Parse the input date string | ||
const gmtDate = new Date(lastOnline + "Z"); // Append 'Z' to indicate it's in GMT | ||
|
||
// Get the browser's time zone | ||
const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
|
||
// Create a new date object with the browser's time zone | ||
const localDate = new Date( | ||
gmtDate.toLocaleString(undefined, { timeZone: browserTimeZone }) | ||
); | ||
|
||
// Calculate the Unix timestamp (in seconds) | ||
const unixTimestamp = Math.floor(localDate.getTime() / 1000); | ||
|
||
return unixTimestamp; | ||
}; | ||
const currentTimeInSeconds = Math.floor(Date.now() / 1000); // Current time in seconds | ||
|
||
const unixTime = convertDateFormat(lastOnline); | ||
|
||
const timeDifferenceInSeconds = unixTime | ||
? currentTimeInSeconds - unixTime | ||
: 0; | ||
|
||
const dateInfo = relativeExpiryDate(convertDateFormat(lastOnline)); | ||
|
||
return ( | ||
<> | ||
|
||
<Text | ||
display="inline-block" | ||
fontSize="xs" | ||
fontWeight="medium" | ||
ml="2" | ||
color="gray.600" | ||
_dark={{ | ||
color: "gray.400", | ||
}} | ||
> | ||
{timeDifferenceInSeconds <= 61 && timeDifferenceInSeconds > 0 && "Online"} | ||
{timeDifferenceInSeconds > 61 && `${dateInfo.time} ago`} | ||
{timeDifferenceInSeconds === 0 && "No Data"} | ||
</Text> | ||
|
||
</> | ||
); | ||
}; |
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