mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
migration
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
import {cn} from "@/lib/utils";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type connectionCircleProps = {
|
||||
date: Date
|
||||
}
|
||||
export type ConnectionCircleProps = {
|
||||
date?: Date | null;
|
||||
};
|
||||
|
||||
export const ConnectionCircle = ({ date }: ConnectionCircleProps) => {
|
||||
let style = "bg-gray-300 border-gray-400";
|
||||
|
||||
export const ConnectionCircle = ({date}: connectionCircleProps) => {
|
||||
if (date) {
|
||||
const now = Date.now();
|
||||
const timestamp = new Date(date).getTime();
|
||||
const interval = now - timestamp;
|
||||
|
||||
let style = "";
|
||||
const interval = new Date().getTime() - new Date(date).getTime()
|
||||
if (interval < 10000) {
|
||||
style = "bg-green-400 border-green-600"
|
||||
} else if (1000 <= interval && interval <= 20000) {
|
||||
style = "bg-orange-400 border-orange-600"
|
||||
} else {
|
||||
style = "bg-red-400 border-red-600"
|
||||
if (interval < 10000) {
|
||||
style = "bg-green-400 border-green-600";
|
||||
} else if (interval <= 20000) {
|
||||
style = "bg-orange-400 border-orange-600";
|
||||
} else {
|
||||
style = "bg-red-400 border-red-600";
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div color="red" className={cn("w-5 h-5 rounded-3xl border-4", style)}/>
|
||||
)
|
||||
}
|
||||
return <div className={cn("w-5 h-5 rounded-full border-4", style)} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user