refactor: simplify DutyTimelineCard component by removing TooltipProvider and Tooltip
- Removed TooltipProvider and Tooltip components from DutyTimelineCard, streamlining the button interaction for displaying contact information. - Updated the button implementation to directly handle the click event, enhancing code clarity and reducing complexity.
This commit is contained in:
@@ -15,12 +15,6 @@ import {
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { ContactLinks } from "@/components/contact/ContactLinks";
|
import { ContactLinks } from "@/components/contact/ContactLinks";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
|
||||||
Tooltip,
|
|
||||||
TooltipContent,
|
|
||||||
TooltipTrigger,
|
|
||||||
TooltipProvider,
|
|
||||||
} from "@/components/ui/tooltip";
|
|
||||||
import type { DutyWithUser } from "@/types";
|
import type { DutyWithUser } from "@/types";
|
||||||
import { Phone, ArrowLeft } from "lucide-react";
|
import { Phone, ArrowLeft } from "lucide-react";
|
||||||
|
|
||||||
@@ -120,29 +114,20 @@ export function DutyTimelineCard({ duty, isCurrent }: DutyTimelineCardProps) {
|
|||||||
{duty.full_name}
|
{duty.full_name}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-[0.8rem] text-muted row-start-3">{timeStr}</span>
|
<span className="text-[0.8rem] text-muted row-start-3">{timeStr}</span>
|
||||||
<TooltipProvider delayDuration={300}>
|
<Button
|
||||||
<Tooltip>
|
ref={frontBtnRef}
|
||||||
<TooltipTrigger asChild>
|
type="button"
|
||||||
<Button
|
variant="ghost"
|
||||||
ref={frontBtnRef}
|
size="icon"
|
||||||
type="button"
|
className="absolute right-2 top-1/2 -translate-y-1/2 size-9 rounded-full bg-surface text-accent hover:bg-accent/20"
|
||||||
variant="ghost"
|
aria-label={t("contact.show")}
|
||||||
size="icon"
|
onClick={() => {
|
||||||
className="absolute right-2 top-1/2 -translate-y-1/2 size-9 rounded-full bg-surface text-accent hover:bg-accent/20"
|
setFlipped(true);
|
||||||
aria-label={t("contact.show")}
|
setTimeout(() => backBtnRef.current?.focus(), 310);
|
||||||
onClick={() => {
|
}}
|
||||||
setFlipped(true);
|
>
|
||||||
setTimeout(() => backBtnRef.current?.focus(), 310);
|
<Phone className="size-[18px]" aria-hidden />
|
||||||
}}
|
</Button>
|
||||||
>
|
|
||||||
<Phone className="size-[18px]" aria-hidden />
|
|
||||||
</Button>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="left" sideOffset={8}>
|
|
||||||
{t("contact.show")}
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</TooltipProvider>
|
|
||||||
</div>
|
</div>
|
||||||
{/* Back */}
|
{/* Back */}
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user