mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-30 14:38:57 +02:00
🧹 Remove legacy tooltip (#838)
This commit is contained in:
parent
7a49c18477
commit
7e3932d99f
4 changed files with 20 additions and 42 deletions
|
@ -7,7 +7,6 @@ import { DateIcon } from "@/components/date-icon";
|
|||
import { ParticipantAvatarBar } from "@/components/participant-avatar-bar";
|
||||
import { useParticipants } from "@/components/participants-provider";
|
||||
import { PollStatusBadge } from "@/components/poll-status";
|
||||
import { TextSummary } from "@/components/text-summary";
|
||||
import { Trans } from "@/components/trans";
|
||||
import { IfParticipantsVisible } from "@/components/visibility";
|
||||
import { usePoll } from "@/contexts/poll";
|
||||
|
@ -110,10 +109,8 @@ export const EventCard = () => {
|
|||
{poll.description ? (
|
||||
<div className="flex gap-4">
|
||||
<TextIcon className="h-4 w-4 shrink-0 translate-y-1" />
|
||||
<div className="border-primary whitespace-pre-line leading-relaxed">
|
||||
<TruncatedLinkify>
|
||||
<TextSummary text={preventWidows(poll.description)} />
|
||||
</TruncatedLinkify>
|
||||
<div className="whitespace-pre-line leading-relaxed">
|
||||
<TruncatedLinkify>{poll.description}</TruncatedLinkify>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
|
|
@ -2,11 +2,10 @@ import { trpc } from "@rallly/backend";
|
|||
import { HelpCircleIcon } from "@rallly/icons";
|
||||
import { cn } from "@rallly/ui";
|
||||
import { Button } from "@rallly/ui/button";
|
||||
import { TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
|
||||
import Script from "next/script";
|
||||
import React from "react";
|
||||
|
||||
import Tooltip from "@/components/tooltip";
|
||||
import { Trans } from "@/components/trans";
|
||||
import { isFeedbackEnabled } from "@/utils/constants";
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
|
||||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
import ReactLinkify from "react-linkify";
|
||||
|
||||
import LegacyTooltip from "../tooltip";
|
||||
|
||||
export const truncateLink = (href: string, text: string, key: number) => {
|
||||
const textWithoutProtocol = text.replace(/^https?:\/\//i, "");
|
||||
const beginningOfPath = textWithoutProtocol.indexOf("/");
|
||||
|
@ -17,6 +16,7 @@ export const truncateLink = (href: string, text: string, key: number) => {
|
|||
<Link
|
||||
className="text-link"
|
||||
key={key}
|
||||
target="_blank"
|
||||
href={href}
|
||||
rel="nofollow noreferrer"
|
||||
>
|
||||
|
@ -26,16 +26,21 @@ export const truncateLink = (href: string, text: string, key: number) => {
|
|||
} else {
|
||||
finalText += "…";
|
||||
return (
|
||||
<LegacyTooltip
|
||||
key={key}
|
||||
content={
|
||||
<div className="max-w-md break-all font-mono text-xs">{href}</div>
|
||||
}
|
||||
>
|
||||
<Link className="text-link" href={href} rel="nofollow noreferrer">
|
||||
{finalText}
|
||||
</Link>
|
||||
</LegacyTooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Link
|
||||
className="text-link"
|
||||
target="_blank"
|
||||
href={href}
|
||||
rel="nofollow noreferrer"
|
||||
>
|
||||
{finalText}
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-md break-all font-mono text-xs">
|
||||
{href}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
|
||||
import * as React from "react";
|
||||
|
||||
export interface TooltipProps {
|
||||
children?: React.ReactNode;
|
||||
content?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const LegacyTooltip: React.FunctionComponent<TooltipProps> = ({
|
||||
className,
|
||||
children,
|
||||
content,
|
||||
}) => {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger className={className}>{children}</TooltipTrigger>
|
||||
<TooltipContent>{content}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(LegacyTooltip);
|
Loading…
Add table
Add a link
Reference in a new issue