Skip to content

Commit

Permalink
ui(web): Add a tooltip explaining what archived means
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Apr 6, 2024
1 parent bc6ee2e commit 4cf9908
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 47 deletions.
10 changes: 9 additions & 1 deletion apps/web/app/dashboard/archive/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Bookmarks from "@/components/dashboard/bookmarks/Bookmarks";
import InfoTooltip from "@/components/ui/info-tooltip";

export default async function ArchivedBookmarkPage() {
return (
<Bookmarks
header={<p className="text-2xl">🗄️ Archive</p>}
header={
<span className="flex gap-2">
<p className="text-2xl">🗄️ Archive</p>
<InfoTooltip size={17} className="my-auto" variant="explain">
<p>Archived bookmarks won&apos;t appear in the homepage</p>
</InfoTooltip>
</span>
}
query={{ archived: true }}
showDivider={true}
/>
Expand Down
34 changes: 7 additions & 27 deletions apps/web/app/dashboard/tags/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import Link from "next/link";
import InfoTooltip from "@/components/ui/info-tooltip";
import { Separator } from "@/components/ui/separator";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { api } from "@/server/api/client";
import { Info } from "lucide-react";

function TagPill({ name, count }: { name: string; count: number }) {
return (
Expand Down Expand Up @@ -48,33 +42,19 @@ export default async function TagsPage() {

<span className="flex items-center gap-2">
<p className="text-lg">Your Tags</p>
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>
<Info size={20} />
</TooltipTrigger>
<TooltipContent>
<p>Tags that were attached at least once by you</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<InfoTooltip size={15} className="my-auto" variant="explain">
<p>Tags that were attached at least once by you</p>
</InfoTooltip>
</span>
<div className="flex flex-wrap gap-3">{tagsToPill(humanTags)}</div>

<Separator />

<span className="flex items-center gap-2">
<p className="text-lg">AI Tags</p>
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>
<Info size={20} />
</TooltipTrigger>
<TooltipContent>
<p>Tags that were only attached automatically (by AI)</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<InfoTooltip size={15} className="my-auto" variant="explain">
<p>Tags that were only attached automatically (by AI)</p>
</InfoTooltip>
</span>
<div className="flex flex-wrap gap-3">{tagsToPill(aiTags)}</div>
</div>
Expand Down
25 changes: 6 additions & 19 deletions apps/web/components/dashboard/bookmarks/EditorCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ import type { SubmitErrorHandler, SubmitHandler } from "react-hook-form";
import { useEffect, useImperativeHandle, useRef } from "react";
import { ActionButton } from "@/components/ui/action-button";
import { Form, FormControl, FormItem } from "@/components/ui/form";
import InfoTooltip from "@/components/ui/info-tooltip";
import { Separator } from "@/components/ui/separator";
import { Textarea } from "@/components/ui/textarea";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { toast } from "@/components/ui/use-toast";
import { useClientConfig } from "@/lib/clientConfig";
import { api } from "@/lib/trpc";
import { cn } from "@/lib/utils";
import { zodResolver } from "@hookform/resolvers/zod";
import { Info } from "lucide-react";
import { useForm } from "react-hook-form";
import { z } from "zod";

Expand Down Expand Up @@ -97,18 +91,11 @@ export default function EditorCard({ className }: { className?: string }) {
>
<div className="flex justify-between">
<p className="text-sm">NEW ITEM</p>
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>
<Info size={15} />
</TooltipTrigger>
<TooltipContent className="w-52">
<p className="text-center">
You can quickly focus on this field by pressing ⌘ + E
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<InfoTooltip size={15}>
<p className="text-center">
You can quickly focus on this field by pressing ⌘ + E
</p>
</InfoTooltip>
</div>
<Separator />
<FormItem className="flex-1">
Expand Down
38 changes: 38 additions & 0 deletions apps/web/components/ui/info-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { HelpCircle, Info } from "lucide-react";

export default function InfoTooltip({
className,
children,
size,
variant = "tip",
}: {
className?: string;
size?: number;
children?: React.ReactNode;
variant?: "tip" | "explain";
}) {
return (
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>
{variant === "tip" ? (
<Info className={cn("cursor-pointer", className)} size={size} />
) : (
<HelpCircle
className={cn("cursor-pointer", className)}
size={size}
/>
)}
</TooltipTrigger>
<TooltipContent>{children}</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}

0 comments on commit 4cf9908

Please sign in to comment.