diff --git a/components/index.ts b/components/index.ts index c9c0537492..a1ef4db7b1 100644 --- a/components/index.ts +++ b/components/index.ts @@ -1,4 +1,5 @@ export * from "./providers/AccountInfo"; +export * from "./providers/DateWithTime"; export * from "./providers/ScanStatus"; export * from "./ui/header/Header"; export * from "./ui/sidebar"; diff --git a/components/providers/AccountInfo.tsx b/components/providers/AccountInfo.tsx index 99ad95a3b9..7cab849d54 100644 --- a/components/providers/AccountInfo.tsx +++ b/components/providers/AccountInfo.tsx @@ -40,7 +40,7 @@ export const AccountInfo: React.FC = ({ }; return ( -
+
{getIcon()}
{getProviderLogo()}
diff --git a/components/providers/DateWithTime.tsx b/components/providers/DateWithTime.tsx new file mode 100644 index 0000000000..9895483e31 --- /dev/null +++ b/components/providers/DateWithTime.tsx @@ -0,0 +1,27 @@ +import { format, parseISO } from "date-fns"; +import React from "react"; + +interface DateWithTimeProps { + dateTime: string; // e.g., "2024-07-17T09:55:14.191475Z" + showTime?: boolean; +} + +export const DateWithTime: React.FC = ({ + dateTime, + showTime = true, +}) => { + const date = parseISO(dateTime); + const formattedDate = format(date, "MMM dd, yyyy"); + const formattedTime = format(date, "p 'UTC'"); + + return ( +
+
+ {formattedDate} + {showTime && ( + {formattedTime} + )} +
+
+ ); +}; diff --git a/components/providers/ScanStatus.tsx b/components/providers/ScanStatus.tsx index e0d826edbd..d181cbc187 100644 --- a/components/providers/ScanStatus.tsx +++ b/components/providers/ScanStatus.tsx @@ -18,8 +18,8 @@ export const ScanStatus: React.FC = ({ const formattedDuration = formatDuration(duration, { delimiter: ", " }); return ( -
-
+
+
{status} {formattedDuration}