mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
feat(ui):resize connection indicator and add pulse effect for all use cases.
This commit is contained in:
@@ -6,14 +6,12 @@ export type ConnectionIndicatorProps = {
|
|||||||
|
|
||||||
export const ConnectionIndicator = ({date}: ConnectionIndicatorProps) => {
|
export const ConnectionIndicator = ({date}: ConnectionIndicatorProps) => {
|
||||||
let style = "bg-gray-300";
|
let style = "bg-gray-300";
|
||||||
let active = false;
|
|
||||||
|
|
||||||
if (date instanceof Date && !isNaN(date.getTime())) {
|
if (date instanceof Date && !isNaN(date.getTime())) {
|
||||||
const intervalSeconds = (Date.now() - date.getTime()) / 1000;
|
const intervalSeconds = (Date.now() - date.getTime()) / 1000;
|
||||||
|
|
||||||
if (intervalSeconds < 55) {
|
if (intervalSeconds < 55) {
|
||||||
style = "bg-green-500";
|
style = "bg-green-500";
|
||||||
active = true;
|
|
||||||
} else if (intervalSeconds <= 60) {
|
} else if (intervalSeconds <= 60) {
|
||||||
style = "bg-orange-400";
|
style = "bg-orange-400";
|
||||||
} else {
|
} else {
|
||||||
@@ -22,8 +20,8 @@ export const ConnectionIndicator = ({ date }: ConnectionIndicatorProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-4 h-4">
|
<div className="relative w-3 h-3">
|
||||||
{active && (
|
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute -inset-0.25 rounded-full opacity-60 animate-ping",
|
"absolute -inset-0.25 rounded-full opacity-60 animate-ping",
|
||||||
@@ -33,10 +31,10 @@ export const ConnectionIndicator = ({ date }: ConnectionIndicatorProps) => {
|
|||||||
animationDuration: "2s",
|
animationDuration: "2s",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative w-4 h-4 rounded-full shadow-sm animate-pulse",
|
"relative w-3 h-3 rounded-full shadow-sm animate-pulse",
|
||||||
style
|
style
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user