Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

style changes

Steven Tey47416c6b9303
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/allowed-hostnames.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/allowed-hostnames.tsx
index ae1e986c6a..b81edc1ffb 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/allowed-hostnames.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/allowed-hostnames.tsx
@@ -1,50 +1,28 @@
"use client";
import useWorkspace from "@/lib/swr/use-workspace";
-import { ThreeDots } from "@/ui/shared/icons";
-import {
- Button,
- CardList,
- InfoTooltip,
- LoadingSpinner,
- Popover,
-} from "@dub/ui";
+import { Button, CardList, CircleCheck, LoadingSpinner, Trash } from "@dub/ui";
import { cn, validDomainRegex } from "@dub/utils";
-import { CheckCircle, Delete } from "lucide-react";
import Link from "next/link";
-import {
- createContext,
- Dispatch,
- SetStateAction,
- useContext,
- useState,
-} from "react";
+import { useState } from "react";
import { toast } from "sonner";
-export const HostnamesContext = createContext<{
- openMenu: string | null;
- setOpenMenu: Dispatch<SetStateAction<string | null>>;
-}>({
- openMenu: null,
- setOpenMenu: () => {},
-});
-
export const AllowedHostnames = () => {
- const [openMenu, setOpenMenu] = useState<string | null>(null);
const { allowedHostnames, loading } = useWorkspace();
return (
- <div className="grid gap-5 divide-yellow-200 pt-0">
+ <div className="grid gap-5 rounded-lg border border-neutral-200 p-5">
<div className="flex flex-col gap-1">
<h2 className="text-xl font-semibold tracking-tight text-black">
Allowed Hostnames
</h2>
- <p className="text-sm text-gray-500">
- Allow click tracking from specific hostnames.{" "}
+ <p className="text-sm text-neutral-500">
+ Specify a list of hostnames where client-side click tracking will be
+ allowed on.{" "}
<Link
href="https://dub.co/help/article/default-dub-domains"
target="_blank"
- className="underline transition-colors hover:text-gray-800"
+ className="underline transition-colors hover:text-neutral-800"
>
Learn more.
</Link>
@@ -52,13 +30,11 @@ export const AllowedHostnames = () => {
</div>
<div className="grid grid-cols-1 gap-3">
<AddHostnameForm />
- <HostnamesContext.Provider value={{ openMenu, setOpenMenu }}>
- <CardList variant="compact" loading={loading}>
- {allowedHostnames?.map((hostname) => (
- <AllowedHostnameCard key={hostname} hostname={hostname} />
- ))}
- </CardList>
- </HostnamesContext.Provider>
+ <CardList variant="compact" loading={loading}>
+ {allowedHostnames?.map((hostname) => (
+ <AllowedHostnameCard key={hostname} hostname={hostname} />
+ ))}
+ </CardList>
</div>
</div>
);
@@ -114,25 +90,18 @@ const AddHostnameForm = () => {
addHostname();
}}
>
- <div className="flex-1">
- <label htmlFor="name" className="flex items-center space-x-2">
- <h2 className="text-sm font-medium text-gray-900">Hostname</h2>
- <InfoTooltip content="Allow click tracking from specific hostnames." />
- </label>
- <div className="relative mt-2 rounded-md shadow-sm">
- <input
- type="text"
- required
- value={hostname}
- onChange={(e) => setHostname(e.target.value)}
- autoFocus
- autoComplete="off"
- placeholder="example.com"
- className={cn(
- "block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm",
- )}
- />
- </div>
+ <div className="relative mt-2 flex-1 rounded-md shadow-sm">
+ <input
+ type="text"
+ required
+ value={hostname}
+ onChange={(e) => setHostname(e.target.value)}
+ autoComplete="off"
+ placeholder="example.com"
+ className={cn(
+ "block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
+ )}
+ />
</div>
<Button
@@ -141,7 +110,7 @@ const AddHostnameForm = () => {
onClick={addHostname}
disabled={!isHostnameValid || hostname.length === 0}
loading={processing}
- className="w-fit"
+ className="w-40"
/>
</form>
);
@@ -150,11 +119,6 @@ const AddHostnameForm = () => {
const AllowedHostnameCard = ({ hostname }: { hostname: string }) => {
const { id, allowedHostnames, mutate } = useWorkspace();
const [processing, setProcessing] = useState(false);
- const { openMenu, setOpenMenu } = useContext(HostnamesContext);
-
- const setOpenPopover = (open: boolean) => {
- setOpenMenu(open ? hostname : null);
- };
const deleteHostname = async () => {
if (!confirm("Are you sure you want to delete this hostname?")) {
@@ -184,8 +148,6 @@ const AllowedHostnameCard = ({ hostname }: { hostname: string }) => {
setProcessing(false);
};
- const openPopover = openMenu === hostname;
-
return (
<CardList.Card
key={hostname}
@@ -193,51 +155,31 @@ const AllowedHostnameCard = ({ hostname }: { hostname: string }) => {
"flex items-center justify-between gap-5 sm:gap-8 md:gap-12 text-sm transition-opacity",
processing && "opacity-50",
)}
+ hoverStateEnabled={false}
>
<div className="flex min-w-0 grow items-center gap-3">
- <CheckCircle className="size-4 text-green-500" />
- <span className="min-w-0 truncate whitespace-nowrap text-gray-800">
+ <CircleCheck className="size-4 text-green-500" />
+ <span className="min-w-0 truncate whitespace-nowrap font-medium text-neutral-800">
{hostname}
</span>
</div>
<div className="flex items-center gap-5 sm:gap-8 md:gap-12">
- <Popover
- content={
- <div className="grid w-full gap-px p-2 sm:w-48">
- <Button
- text="Delete"
- variant="danger-outline"
- onClick={() => {
- setOpenPopover(false);
- deleteHostname();
- }}
- icon={<Delete className="h-4 w-4" />}
- shortcut="X"
- className="h-9 px-2 font-medium"
- />
- </div>
+ <Button
+ variant="outline"
+ className={cn(
+ "h-8 px-1.5 outline-none transition-all duration-200",
+ "border-transparent data-[state=open]:border-neutral-500 sm:group-hover/card:data-[state=closed]:border-neutral-200",
+ )}
+ icon={
+ processing ? (
+ <LoadingSpinner className="size-4 shrink-0" />
+ ) : (
+ <Trash className="size-4" />
+ )
}
- align="end"
- openPopover={openPopover}
- setOpenPopover={setOpenPopover}
- >
- <Button
- variant="secondary"
- className={cn(
- "h-8 px-1.5 outline-none transition-all duration-200",
- "border-transparent data-[state=open]:border-gray-500 sm:group-hover/card:data-[state=closed]:border-gray-200",
- )}
- icon={
- processing ? (
- <LoadingSpinner className="h-5 w-5 shrink-0" />
- ) : (
- <ThreeDots className="h-5 w-5 shrink-0" />
- )
- }
- onClick={() => setOpenPopover(!openPopover)}
- />
- </Popover>
+ onClick={deleteHostname}
+ />
</div>
</CardList.Card>
);
diff --git a/apps/web/ui/workspaces/conversion-tracking-toggle.tsx b/apps/web/ui/workspaces/conversion-tracking-toggle.tsx
index d71aa55e3e..0969ca1529 100644
--- a/apps/web/ui/workspaces/conversion-tracking-toggle.tsx
+++ b/apps/web/ui/workspaces/conversion-tracking-toggle.tsx
@@ -2,7 +2,7 @@
import { clientAccessCheck } from "@/lib/api/tokens/permissions";
import useWorkspace from "@/lib/swr/use-workspace";
-import { SquareChart, Switch, TooltipContent } from "@dub/ui";
+import { Switch, TooltipContent } from "@dub/ui";
import { ComponentProps, useEffect, useId, useState } from "react";
import { toast } from "sonner";
import { mutate } from "swr";
@@ -13,9 +13,6 @@ export function ConversionTrackingToggle() {
return (
<div className="flex items-center justify-between gap-4 rounded-lg border border-gray-200 bg-white p-5">
<div className="flex min-w-0 items-center gap-4">
- <div className="hidden rounded-md border border-gray-200 p-3 sm:block">
- <SquareChart className="size-5" />
- </div>
<div className="overflow-hidden">
<label
htmlFor={`${id}-switch`}