|
3 | 3 | import useWorkspace from "@/lib/swr/use-workspace";
|
4 | 4 | import { UtmTemplateProps } from "@/lib/types";
|
5 | 5 | import { UTM_PARAMETERS } from "@/ui/links/utm-builder";
|
6 |
| -import { Combobox, Tooltip } from "@dub/ui"; |
7 |
| -import { Note } from "@dub/ui/src/icons"; |
| 6 | +import { Button, Combobox, Tooltip } from "@dub/ui"; |
| 7 | +import { DiamondTurnRight } from "@dub/ui/src/icons"; |
8 | 8 | import { fetcher, getParamsFromURL } from "@dub/utils";
|
| 9 | +import { useRouter } from "next/navigation"; |
9 | 10 | import { Fragment } from "react";
|
10 | 11 | import { useFormContext } from "react-hook-form";
|
11 | 12 | import { toast } from "sonner";
|
@@ -83,8 +84,8 @@ export function UTMTemplatesCombo({
|
83 | 84 | }}
|
84 | 85 | placeholder="Templates"
|
85 | 86 | searchPlaceholder="Load or save a template..."
|
86 |
| - emptyState="No templates found" |
87 |
| - icon={Note} |
| 87 | + emptyState={<NoUTMTemplatesFound />} |
| 88 | + icon={DiamondTurnRight} |
88 | 89 | createLabel={(search) => `Save new template: "${search}"`}
|
89 | 90 | onCreate={async (search) => {
|
90 | 91 | try {
|
@@ -121,3 +122,27 @@ export function UTMTemplatesCombo({
|
121 | 122 | />
|
122 | 123 | );
|
123 | 124 | }
|
| 125 | + |
| 126 | +const NoUTMTemplatesFound = () => { |
| 127 | + const router = useRouter(); |
| 128 | + const { slug } = useWorkspace(); |
| 129 | + |
| 130 | + return ( |
| 131 | + <div className="flex h-full flex-col items-center justify-center gap-2 px-2 py-4 text-center text-sm"> |
| 132 | + <div className="flex items-center justify-center rounded-2xl border border-gray-200 bg-gray-50 p-3"> |
| 133 | + <DiamondTurnRight className="size-6 text-gray-700" /> |
| 134 | + </div> |
| 135 | + <p className="mt-2 font-medium text-gray-950">No UTM templates found</p> |
| 136 | + <p className="mx-auto mt-1 w-full max-w-[180px] text-gray-700"> |
| 137 | + Add a UTM template to easily create links with the same UTM parameters. |
| 138 | + </p> |
| 139 | + <div> |
| 140 | + <Button |
| 141 | + className="mt-1 h-8" |
| 142 | + onClick={() => router.push(`/${slug}/settings/library/utm`)} |
| 143 | + text="Add UTM template" |
| 144 | + /> |
| 145 | + </div> |
| 146 | + </div> |
| 147 | + ); |
| 148 | +}; |
0 commit comments