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.

Move menu items around

Tim Wilson7eadbb075581
diff --git a/apps/web/ui/layout/main-nav.tsx b/apps/web/ui/layout/main-nav.tsx
index 0d95963080..57fb3902cc 100644
--- a/apps/web/ui/layout/main-nav.tsx
+++ b/apps/web/ui/layout/main-nav.tsx
@@ -1,8 +1,8 @@
"use client";
-import { useKeyboardShortcut, useMediaQuery, useScroll } from "@dub/ui";
+import { useKeyboardShortcut, useMediaQuery } from "@dub/ui";
import { cn } from "@dub/utils";
-import { useParams, usePathname } from "next/navigation";
+import { usePathname } from "next/navigation";
import {
createContext,
Dispatch,
@@ -28,9 +28,7 @@ export function MainNav({
children,
toolContent,
}: PropsWithChildren<{ toolContent?: ReactNode }>) {
- const { slug } = useParams() as { slug?: string };
const pathname = usePathname();
- const scrolled = useScroll(80);
const { isMobile } = useMediaQuery();
const [isOpen, setIsOpen] = useState(false);
diff --git a/apps/web/ui/layout/sidebar/icons/gear.tsx b/apps/web/ui/layout/sidebar/icons/gear.tsx
new file mode 100644
index 0000000000..85167e5815
--- /dev/null
+++ b/apps/web/ui/layout/sidebar/icons/gear.tsx
@@ -0,0 +1,53 @@
+import { SVGProps, useEffect, useRef } from "react";
+
+export function Gear({
+ isActive,
+ ...rest
+}: { isActive?: boolean } & SVGProps<SVGSVGElement>) {
+ const ref = useRef<SVGSVGElement>(null);
+
+ useEffect(() => {
+ if (!ref.current) return;
+
+ if (isActive) {
+ ref.current.animate(
+ [{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }],
+ {
+ duration: 300,
+ },
+ );
+ }
+ }, [isActive]);
+
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ ref={ref}
+ {...rest}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="2.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M16.25,9.355v-.71c0-.51-.383-.938-.89-.994l-1.094-.122-.503-1.214,.688-.859c.318-.398,.287-.971-.074-1.332l-.502-.502c-.36-.36-.934-.392-1.332-.074l-.859,.688-1.214-.503-.122-1.094c-.056-.506-.484-.89-.994-.89h-.71c-.51,0-.938,.383-.994,.89l-.122,1.094-1.214,.503-.859-.687c-.398-.318-.971-.287-1.332,.074l-.502,.502c-.36,.36-.392,.934-.074,1.332l.688,.859-.503,1.214-1.094,.122c-.506,.056-.89,.484-.89,.994v.71c0,.51,.383,.938,.89,.994l1.094,.122,.503,1.214-.687,.859c-.318,.398-.287,.972,.074,1.332l.502,.502c.36,.36,.934,.392,1.332,.074l.859-.688,1.214,.503,.122,1.094c.056,.506,.484,.89,.994,.89h.71c.51,0,.938-.383,.994-.89l.122-1.094,1.214-.503,.859,.688c.398,.318,.971,.287,1.332-.074l.502-.502c.36-.36,.392-.934,.074-1.332l-.687-.859,.503-1.214,1.094-.122c.506-.056,.89-.484,.89-.994Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/apps/web/ui/layout/sidebar/items.ts b/apps/web/ui/layout/sidebar/items.ts
index 4d80e28e06..50b564e272 100644
--- a/apps/web/ui/layout/sidebar/items.ts
+++ b/apps/web/ui/layout/sidebar/items.ts
@@ -3,6 +3,7 @@ import {
CircleInfo,
ConnectedDots,
CubeSettings,
+ Gear,
Gear2,
Gift,
Globe,
@@ -55,6 +56,11 @@ export const ITEMS: Record<
icon: CursorRays,
href: `/${slug}/events`,
},
+ {
+ name: "Settings",
+ icon: Gear,
+ href: `/${slug}/settings`,
+ },
],
},
],
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 3eebb61759..cd07d90bfc 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -38,6 +38,7 @@ export function SidebarNav({ toolContent }: { toolContent?: ReactNode }) {
position: "absolute",
}}
transition={{ duration: 0.15, ease: "easeInOut" }}
+ className="left-0 top-0"
>
{area === "default" ? (
<Wordmark className="ml-1 h-6" />
diff --git a/apps/web/ui/layout/sidebar/user-dropdown.tsx b/apps/web/ui/layout/sidebar/user-dropdown.tsx
index 0a84ed68dc..44dc9828a7 100644
--- a/apps/web/ui/layout/sidebar/user-dropdown.tsx
+++ b/apps/web/ui/layout/sidebar/user-dropdown.tsx
@@ -3,7 +3,7 @@
import { Avatar, Badge, Popover } from "@dub/ui";
import { Gear, Icon } from "@dub/ui/src";
import Cookies from "js-cookie";
-import { Edit3, HelpCircle, LogOut } from "lucide-react";
+import { Edit3, LogOut } from "lucide-react";
import { signOut, useSession } from "next-auth/react";
import Link from "next/link";
import {
@@ -46,15 +46,7 @@ export default function UserDropdown() {
)}
<UserOption
as={Link}
- label="Help Center"
- icon={HelpCircle}
- href="https://dub.co/help"
- target="_blank"
- onClick={() => setOpenPopover(false)}
- />
- <UserOption
- as={Link}
- label="User Settings"
+ label="Account Settings"
icon={Gear}
href="/account/settings"
onClick={() => setOpenPopover(false)}
diff --git a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx b/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
index 2653c87b18..bddaf1c989 100644
--- a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
+++ b/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
@@ -9,9 +9,9 @@ import {
Popover,
useScrollProgress,
} from "@dub/ui";
-import { Book2, Check2, Gear, Plus } from "@dub/ui/src/icons";
+import { Book2, Check2, Plus } from "@dub/ui/src/icons";
import { cn, DICEBEAR_AVATAR_URL } from "@dub/utils";
-import { ChevronsUpDown } from "lucide-react";
+import { ChevronsUpDown, HelpCircle } from "lucide-react";
import { useSession } from "next-auth/react";
import Link from "next/link";
import { useParams, usePathname } from "next/navigation";
@@ -137,6 +137,21 @@ function WorkspaceSwitcherPlaceholder() {
);
}
+const LINKS = [
+ {
+ name: "Help Center",
+ icon: HelpCircle,
+ href: "https://dub.co/help",
+ target: "_blank",
+ },
+ {
+ name: "Documentation",
+ icon: Book2,
+ href: "https://dub.co/docs",
+ target: "_blank",
+ },
+];
+
function WorkspaceList({
selected,
workspaces,
@@ -152,8 +167,7 @@ function WorkspaceList({
setOpenPopover: (open: boolean) => void;
}) {
const { setShowAddWorkspaceModal } = useContext(ModalContext);
- const { slug, domain, key } = useParams() as {
- slug?: string;
+ const { domain, key } = useParams() as {
domain?: string;
key?: string;
};
@@ -162,19 +176,6 @@ function WorkspaceList({
const scrollRef = useRef<HTMLDivElement>(null);
const { scrollProgress, updateScrollProgress } = useScrollProgress(scrollRef);
- const links = useMemo(
- () => [
- { name: "Settings", icon: Gear, href: `/${slug}/settings` },
- {
- name: "Documentation",
- icon: Book2,
- href: "https://dub.co/docs",
- target: "_blank",
- },
- ],
- [slug],
- );
-
const href = useCallback(
(slug: string) => {
if (domain || key || selected.slug === "/") {
@@ -196,7 +197,7 @@ function WorkspaceList({
className="relative max-h-80 w-full space-y-0.5 overflow-auto rounded-lg bg-white text-base sm:w-64 sm:text-sm"
>
<div className="flex flex-col gap-0.5 border-b border-neutral-200 p-2">
- {links.map(({ name, icon: Icon, href, target }) => (
+ {LINKS.map(({ name, icon: Icon, href, target }) => (
<Link
key={name}
href={href}