The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix empty state
Steven Teyc180deeb4120
diff --git a/apps/web/ui/modals/import-bitly-modal.tsx b/apps/web/ui/modals/import-bitly-modal.tsxindex 79653ee980..0d4bbf5683 100644--- a/apps/web/ui/modals/import-bitly-modal.tsx+++ b/apps/web/ui/modals/import-bitly-modal.tsx@@ -212,7 +212,7 @@ function ImportBitlyModal({</div>))) : (- <div className="flex flex-col items-center justify-center space-y-2 pb-2">+ <div className="flex flex-col items-center justify-center gap-2 pb-2"><ServerOff className="h-6 w-6 text-gray-500" /><p className="text-center text-sm text-gray-500">It looks like you don't have any Bitly groups with customdiff --git a/apps/web/ui/modals/import-short-modal.tsx b/apps/web/ui/modals/import-short-modal.tsxindex 98ee7c57c0..66e5f3fdcb 100644--- a/apps/web/ui/modals/import-short-modal.tsx+++ b/apps/web/ui/modals/import-short-modal.tsx@@ -8,11 +8,12 @@ import {Modal,SimpleTooltipContent,Switch,+ buttonVariants,useMediaQuery,useRouterStuff,} from "@dub/ui";-import { fetcher, nFormatter } from "@dub/utils";-import { ArrowRight } from "lucide-react";+import { cn, fetcher, nFormatter } from "@dub/utils";+import { ArrowRight, ServerOff } from "lucide-react";import { useRouter, useSearchParams } from "next/navigation";import {Dispatch,@@ -114,87 +115,106 @@ function ImportShortModal({<p className="text-sm text-gray-500">Connecting to Short.io</p></div>) : domains ? (- <form- onSubmit={async (e) => {- e.preventDefault();- setImporting(true);- toast.promise(- fetch(`/api/workspaces/${workspaceId}/import/short`, {- method: "POST",- headers: {- "Content-Type": "application/json",- },- body: JSON.stringify({- selectedDomains,- importTags,+ domains.length > 0 ? (+ <form+ onSubmit={async (e) => {+ e.preventDefault();+ setImporting(true);+ toast.promise(+ fetch(`/api/workspaces/${workspaceId}/import/short`, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ selectedDomains,+ importTags,+ }),+ }).then(async (res) => {+ if (res.ok) {+ await mutate();+ router.push(`/${slug}`);+ } else {+ setImporting(false);+ throw new Error();+ }}),- }).then(async (res) => {- if (res.ok) {- await mutate();- router.push(`/${slug}`);- } else {- setImporting(false);- throw new Error();- }- }),- {- loading: "Adding links to import queue...",- success:- "Successfully added links to import queue! You can now safely navigate from this tab – we will send you an email when your links have been fully imported.",- error: "Error adding links to import queue",- },- );- }}- className="flex flex-col space-y-4"- >- <div className="flex flex-col space-y-2">- <p className="text-sm font-medium text-gray-700">Domains</p>- {domains.map(({ id, domain, links }) => (- <div className="flex items-center justify-between space-x-2 rounded-md border border-gray-200 bg-white px-4 py-2">- <div>- <p className="font-medium text-gray-800">{domain}</p>- {links > 0 && (- <p className="text-xs text-gray-500">- {nFormatter(links)} links found- </p>- )}+ {+ loading: "Adding links to import queue...",+ success:+ "Successfully added links to import queue! You can now safely navigate from this tab – we will send you an email when your links have been fully imported.",+ error: "Error adding links to import queue",+ },+ );+ }}+ className="flex flex-col space-y-4"+ >+ <div className="flex flex-col space-y-2">+ <p className="text-sm font-medium text-gray-700">Domains</p>+ {domains.map(({ id, domain, links }) => (+ <div className="flex items-center justify-between space-x-2 rounded-md border border-gray-200 bg-white px-4 py-2">+ <div>+ <p className="font-medium text-gray-800">{domain}</p>+ {links > 0 && (+ <p className="text-xs text-gray-500">+ {nFormatter(links)} links found+ </p>+ )}+ </div>+ <Switch+ fn={() => {+ const selected = isSelected(domain);+ if (selected) {+ setSelectedDomains((prev) =>+ prev.filter((d) => d.domain !== domain),+ );+ } else {+ setSelectedDomains((prev) => [+ ...prev,+ {+ id,+ domain,+ links,+ },+ ]);+ }+ }}+ checked={isSelected(domain)}+ /></div>+ ))}+ <div className="flex items-center justify-between space-x-2 rounded-md py-1 pl-2 pr-4">+ <p className="text-xs text-gray-500">Import all tags?</p><Switch- fn={() => {- const selected = isSelected(domain);- if (selected) {- setSelectedDomains((prev) =>- prev.filter((d) => d.domain !== domain),- );- } else {- setSelectedDomains((prev) => [- ...prev,- {- id,- domain,- links,- },- ]);- }- }}- checked={isSelected(domain)}+ fn={() => setImportTags(!importTags)}+ checked={importTags}/></div>- ))}- <div className="flex items-center justify-between space-x-2 rounded-md py-1 pl-2 pr-4">- <p className="text-xs text-gray-500">Import all tags?</p>- <Switch- fn={() => setImportTags(!importTags)}- checked={importTags}- /></div>+ <Button+ text="Confirm import"+ loading={importing}+ disabled={selectedDomains.length === 0}+ />+ </form>+ ) : (+ <div className="flex flex-col items-center justify-center gap-2">+ <ServerOff className="h-6 w-6 text-gray-500" />+ <p className="max-w-md text-center text-sm text-gray-500">+ We weren't able to retrieve any links from your Short.io+ account.+ </p>+ <a+ href="mailto:[email protected]?subject=I%20need%20help%20with%20importing%20my%20Short.io%20links"+ className={cn(+ buttonVariants({ variant: "secondary" }),+ "flex h-8 items-center justify-center rounded-md border px-4 text-sm",+ )}+ >+ Contact Support+ </a></div>- <Button- text="Confirm import"- loading={importing}- disabled={selectedDomains.length === 0}- />- </form>+ )) : (// form to add API key to redis manually<formdiff --git a/apps/web/ui/shared/empty-state.tsx b/apps/web/ui/shared/empty-state.tsxindex a19a73b8b7..aff1f859a4 100644--- a/apps/web/ui/shared/empty-state.tsx+++ b/apps/web/ui/shared/empty-state.tsx@@ -32,7 +32,7 @@ export default function EmptyState({target="_blank"className={cn(buttonVariants({ variant: "secondary" }),- "flex h-8 items-center justify-center gap-2 rounded-md border px-4 text-sm transition-all",+ "flex h-8 items-center justify-center gap-2 rounded-md border px-4 text-sm",)}><span className="bg-gradient-to-r from-violet-600 to-pink-600 bg-clip-text text-transparent">diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsxindex 8548c893fc..c2fed5470e 100644--- a/packages/ui/src/button.tsx+++ b/packages/ui/src/button.tsx@@ -4,7 +4,7 @@ import { ReactNode, forwardRef } from "react";import { LoadingSpinner } from "./icons";import { Tooltip } from "./tooltip";-export const buttonVariants = cva("", {+export const buttonVariants = cva("transition-all", {variants: {variant: {primary:@@ -88,7 +88,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(// if onClick is passed, it's a "button" type, otherwise it's being used in a form, hence "submit"type={props.onClick ? "button" : "submit"}className={cn(- "group flex h-10 w-full items-center justify-center gap-2 rounded-md border px-4 text-sm transition-all",+ "group flex h-10 w-full items-center justify-center gap-2 rounded-md border px-4 text-sm",props.disabled || loading? "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400": buttonVariants({ variant }),