mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 18:32:10 +01:00
- Fix TopQuestionsChart with proper dark mode colors using CSS variables and shadcn/ui components - Enhance ResponseTimeDistribution with thicker bars (maxBarSize: 60) - Replace GeographicMap with dark/light mode compatible CartoDB tiles - Add custom text selection background color with primary theme color - Update all loading states to use proper CSS variables instead of hardcoded colors - Fix dashboard layout background to use bg-background instead of bg-gray-100
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
"use client";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
interface MeteorsProps {
|
|
number?: number;
|
|
minDelay?: number;
|
|
maxDelay?: number;
|
|
minDuration?: number;
|
|
maxDuration?: number;
|
|
angle?: number;
|
|
className?: string;
|
|
}
|
|
|
|
export const Meteors = ({
|
|
number = 20,
|
|
minDelay = 0.2,
|
|
maxDelay = 1.2,
|
|
minDuration = 2,
|
|
maxDuration = 10,
|
|
angle = 215,
|
|
className,
|
|
}: MeteorsProps) => {
|
|
const [meteorStyles, setMeteorStyles] = useState<Array<React.CSSProperties>>(
|
|
[],
|
|
);
|
|
|
|
useEffect(() => {
|
|
const styles = [...new Array(number)].map(() => ({
|
|
"--angle": -angle + "deg",
|
|
top: "-5%",
|
|
left: `calc(0% + ${Math.floor(Math.random() * window.innerWidth)}px)`,
|
|
animationDelay: Math.random() * (maxDelay - minDelay) + minDelay + "s",
|
|
animationDuration:
|
|
Math.floor(Math.random() * (maxDuration - minDuration) + minDuration) +
|
|
"s",
|
|
}));
|
|
setMeteorStyles(styles);
|
|
}, [number, minDelay, maxDelay, minDuration, maxDuration, angle]);
|
|
|
|
return (
|
|
<>
|
|
{[...meteorStyles].map((style, idx) => (
|
|
// Meteor Head
|
|
<span
|
|
key={idx}
|
|
style={{ ...style }}
|
|
className={cn(
|
|
"pointer-events-none absolute size-0.5 rotate-[var(--angle)] animate-meteor rounded-full bg-zinc-500 shadow-[0_0_0_1px_#ffffff10]",
|
|
className,
|
|
)}
|
|
>
|
|
{/* Meteor Tail */}
|
|
<div className="pointer-events-none absolute top-1/2 -z-10 h-px w-[50px] -translate-y-1/2 bg-gradient-to-r from-zinc-500 to-transparent" />
|
|
</span>
|
|
))}
|
|
</>
|
|
);
|
|
};
|