Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: promote the new homepage at root and home
Richie McIlroy80858cc81e5c
diff --git a/apps/web/app/(site)/DesktopNavLinks.tsx b/apps/web/app/(site)/DesktopNavLinks.tsxindex bb316134e..8179d5e53 100644--- a/apps/web/app/(site)/DesktopNavLinks.tsx+++ b/apps/web/app/(site)/DesktopNavLinks.tsx@@ -1,7 +1,7 @@"use client";-import { navigationMenuTriggerStyle } from "@cap/ui";-import { classNames } from "@cap/utils";+import { navigationMenuTriggerStyle } from "@cap/ui/navigation-menu";+import { classNames } from "@cap/utils/helpers";import { ChevronDown, Clapperboard, Zap } from "lucide-react";import Link from "next/link";import { usePathname } from "next/navigation";@@ -126,10 +126,46 @@ const dropdownStyle = (width: number | undefined): CSSProperties => ({maxWidth: "calc(100vw - 2rem)",});+const BUBBLE_CSS = `+.ht-nav-bubble {+ transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1),+ width 300ms cubic-bezier(0.22, 1, 0.36, 1),+ height 300ms cubic-bezier(0.22, 1, 0.36, 1),+ opacity 180ms ease;+ animation: ht-nav-bubble-in 260ms cubic-bezier(0.22, 1, 0.36, 1);+}+@keyframes ht-nav-bubble-in {+ from { opacity: 0; scale: 0.86; }+ to { opacity: 1; scale: 1; }+}+`;+export function DesktopNavLinks() {const pathname = usePathname();const previousPathname = useRef(pathname);const [openDropdown, setOpenDropdown] = useState<string | null>(null);+ const listRef = useRef<HTMLUListElement | null>(null);+ const [bubble, setBubble] = useState<{+ x: number;+ y: number;+ w: number;+ h: number;+ } | null>(null);+ const [bubbleOn, setBubbleOn] = useState(false);++ const showBubble = (item: HTMLElement) => {+ const list = listRef.current;+ if (!list) return;+ const rect = item.getBoundingClientRect();+ const base = list.getBoundingClientRect();+ setBubble({+ x: rect.left - base.left,+ y: rect.top - base.top,+ w: rect.width,+ h: rect.height,+ });+ setBubbleOn(true);+ };useEffect(() => {if (previousPathname.current === pathname) {@@ -160,15 +196,34 @@ export function DesktopNavLinks() {return (<nav aria-label="Main">- <ul className="flex items-center px-0 space-x-0 list-none">+ <ul+ ref={listRef}+ className="relative flex items-center gap-0.5 px-0 list-none"+ onMouseLeave={() => setBubbleOn(false)}+ >+ {bubble ? (+ <span+ aria-hidden="true"+ className="ht-nav-bubble pointer-events-none absolute left-0 top-0 z-0 rounded-[8px] bg-gray-3"+ style={{+ transform: `translate(${bubble.x}px, ${bubble.y}px)`,+ width: bubble.w,+ height: bubble.h,+ opacity: bubbleOn ? 1 : 0,+ }}+ />+ ) : null}{Links.map((link) => {const isOpen = openDropdown === link.label;return (<likey={link.label}- className="relative"- onMouseEnter={() => setOpenDropdown(link.label)}+ className="relative z-10"+ onMouseEnter={(event) => {+ showBubble(event.currentTarget);+ setOpenDropdown(link.label);+ }}onMouseLeave={() =>setOpenDropdown((current) =>current === link.label ? null : current,@@ -186,34 +241,31 @@ export function DesktopNavLinks() {onClick={() => setOpenDropdown(link.label)}className={classNames(navigationMenuTriggerStyle(),- "flex gap-1 items-center px-2 py-0 text-sm font-medium text-gray-10 transition-colors hover:text-blue-9 focus:text-blue-9",- isOpen && "text-blue-9",+ "bg-transparent hover:bg-transparent focus:bg-transparent data-[state=open]:bg-transparent",+ "flex gap-1.5 items-center px-2.5 py-2 text-[14.5px] font-medium text-[rgba(17,17,17,0.85)] transition-colors hover:text-[#111111] focus:text-[#111111] xl:px-3 xl:text-[15.5px]",+ isOpen && "text-[#111111]",)}>{link.label}<ChevronDownclassName={classNames(- "size-3.5 transition-transform duration-200 ease-out",+ "size-[15px] transition-transform duration-200 ease-out",isOpen && "rotate-180",)}- strokeWidth={2.25}+ strokeWidth={2}aria-hidden="true"/></button><divclassName={classNames(- "absolute top-full left-1/2 z-50 -translate-x-1/2 pt-3 transition duration-150",+ "absolute top-full left-0 z-50 pt-3 transition duration-150",isOpen? "visible block opacity-100": "invisible hidden opacity-0",)}><div className="relative" style={dropdownStyle(link.width)}>- <span- className="absolute -top-[7px] left-1/2 z-10 size-3.5 -translate-x-1/2 rotate-45 rounded-tl-[4px] border-t border-l border-zinc-200/70 bg-white"- aria-hidden="true"- />- <div className="overflow-hidden relative bg-white rounded-2xl border shadow-xl border-zinc-200/70">+ <div className="overflow-hidden relative bg-white rounded-2xl border border-zinc-200/70"><ul className="grid grid-cols-2 gap-1.5 p-3 list-none">{link.dropdown.map((sublink) => (<li key={sublink.href}>@@ -243,7 +295,8 @@ export function DesktopNavLinks() {onClick={closeDropdown}className={classNames(navigationMenuTriggerStyle(),- "px-2 py-0 text-sm font-medium text-gray-10 hover:text-blue-9 focus:text-blue-9",+ "bg-transparent hover:bg-transparent focus:bg-transparent data-[state=open]:bg-transparent",+ "px-2.5 py-2 text-[14.5px] font-medium text-[rgba(17,17,17,0.85)] hover:text-[#111111] focus:text-[#111111] xl:px-3 xl:text-[15.5px]",)}>{link.label}@@ -253,6 +306,7 @@ export function DesktopNavLinks() {);})}</ul>+ <style>{BUBBLE_CSS}</style></nav>);}diff --git a/apps/web/app/(site)/Footer.tsx b/apps/web/app/(site)/Footer.tsxindex 3d41ad826..6a1b1b172 100644--- a/apps/web/app/(site)/Footer.tsx+++ b/apps/web/app/(site)/Footer.tsx@@ -1,12 +1,10 @@"use client";-import { Logo } from "@cap/ui";-import {- faDiscord,- faLinkedinIn,- faXTwitter,-} from "@fortawesome/free-brands-svg-icons";-import { faChevronDown } from "@fortawesome/free-solid-svg-icons";+import { Logo } from "@cap/ui/logo";+import { faDiscord } from "@fortawesome/free-brands-svg-icons/faDiscord";+import { faLinkedinIn } from "@fortawesome/free-brands-svg-icons/faLinkedinIn";+import { faXTwitter } from "@fortawesome/free-brands-svg-icons/faXTwitter";+import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import Link from "next/link";import type { ComponentProps, ReactNode } from "react";diff --git a/apps/web/app/(site)/Navbar.tsx b/apps/web/app/(site)/Navbar.tsxindex 7d4ccdb67..4be8a0f9a 100644--- a/apps/web/app/(site)/Navbar.tsx+++ b/apps/web/app/(site)/Navbar.tsx@@ -1,68 +1,75 @@-import { Button, Logo } from "@cap/ui";+import { Logo } from "@cap/ui/logo";import Image from "next/image";import Link from "next/link";import MobileMenu from "@/components/ui/MobileMenu";import { DesktopNavLinks } from "./DesktopNavLinks";+import { NavbarFrame } from "./NavbarFrame";interface NavbarProps {stars?: string;}+/**+ * Flat, full-bleed header: logo and links on the left, a text link plus an+ * outlined and a filled action on the right. It sits flush at the top of the+ * viewport so page content passes underneath it rather than around a pill.+ */export const Navbar = ({ stars }: NavbarProps) => {return (- <header className="fixed left-0 right-0 z-[51] top-4 lg:top-6">- <nav className="relative p-2 mx-auto w-full max-w-[calc(100%-20px)] bg-white rounded-full border lg:max-w-fit border-zinc-200 h-fit">- <div className="flex gap-12 justify-between items-center mx-auto max-w-5xl h-full transition-all">- <div className="flex items-center">- <Link passHref href="/home">- <Logo- className="transition-all duration-200 ease-out"- viewBoxDimensions="0 0 120 40"- style={{- width: 90,- height: 40,- }}- />- </Link>- <div className="hidden lg:flex">- <DesktopNavLinks />- </div>- </div>- <div className="hidden items-center space-x-2 lg:flex">- <Button- variant="outline"- icon={- <Image src="/github.svg" alt="Github" width={16} height={16} />- }- target="_blank"- href="https://github.com/CapSoftware/Cap"- size="sm"- className="w-full font-medium sm:w-auto"- >- {`GitHub${stars ? ` (${stars})` : ""}`}- </Button>- <Button- variant="gray"- href="/login"- size="sm"- className="w-full font-medium sm:w-auto"- >- Login- </Button>- <Button- variant="dark"- href="/signup"- size="sm"- className="w-full font-medium sm:w-auto"- >- Sign Up- </Button>- </div>- <div className="lg:hidden">- <MobileMenu stars={stars} />+ <NavbarFrame>+ <div className="flex gap-4 justify-between items-center px-5 mx-auto h-[68px] max-w-[1440px] group-data-[flat=true]:max-w-none group-data-[island=true]:h-[60px] group-data-[island=true]:px-4 lg:h-[76px] lg:px-8 lg:group-data-[island=true]:h-[64px] lg:group-data-[island=true]:px-5 xl:gap-6">+ <div className="flex gap-2 items-center lg:gap-3 xl:gap-6">+ <Link passHref href="/home" className="shrink-0">+ <Logo+ className="transition-all duration-200 ease-out"+ squaredMark+ viewBoxDimensions="0 0 120 40"+ style={{+ width: 90,+ height: 40,+ }}+ />+ </Link>+ <div className="hidden lg:flex">+ <DesktopNavLinks /></div></div>- </nav>- </header>+ <div className="hidden gap-2.5 items-center lg:flex">+ <a+ href="https://github.com/CapSoftware/Cap"+ target="_blank"+ rel="noreferrer"+ className="group relative flex gap-2 items-center px-2.5 py-2 whitespace-nowrap rounded-[8px] text-[14.5px] font-medium text-[rgba(17,17,17,0.85)] transition-colors duration-200 hover:text-[#111111] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-12 xl:px-3 xl:text-[15.5px]"+ >+ <span+ aria-hidden="true"+ className="pointer-events-none absolute inset-0 -z-10 scale-[0.86] rounded-[8px] bg-gray-3 opacity-0 transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:scale-100 group-hover:opacity-100"+ />+ <Image src="/github.svg" alt="" width={16} height={16} />+ <span>+ GitHub+ {stars ? (+ <span className="hidden xl:inline"> ({stars})</span>+ ) : null}+ </span>+ </a>+ <Link+ href="/login"+ className="inline-flex justify-center items-center px-4 whitespace-nowrap rounded-[10px] border border-gray-12 h-[42px] text-[14.5px] font-medium text-gray-12 transition-colors duration-200 hover:bg-gray-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-12 focus-visible:ring-offset-2 xl:px-5 xl:text-[15.5px]"+ >+ Login+ </Link>+ <Link+ href="/signup"+ className="inline-flex justify-center items-center px-4 whitespace-nowrap rounded-[10px] bg-gray-12 h-[42px] text-[14.5px] font-medium text-gray-1 transition-colors duration-200 hover:bg-gray-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-12 focus-visible:ring-offset-2 xl:px-5 xl:text-[15.5px]"+ >+ Sign Up+ </Link>+ </div>+ <div className="lg:hidden">+ <MobileMenu stars={stars} />+ </div>+ </div>+ </NavbarFrame>);};diff --git a/apps/web/app/(site)/NavbarFrame.tsx b/apps/web/app/(site)/NavbarFrame.tsxnew file mode 100644index 000000000..e2a883d71--- /dev/null+++ b/apps/web/app/(site)/NavbarFrame.tsx@@ -0,0 +1,105 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import { usePathname } from "next/navigation";+import { type ReactNode, useEffect, useState } from "react";++const FLAT_HEADER_ROUTES = new Set(["/", "/home"]);+const EASE = "cubic-bezier(0.22, 1, 0.36, 1)";+const SLIDE_MS = 560;+const DOCK_AT = 80;++type Phase = "docked" | "entering" | "floating" | "leaving";++export const NavbarFrame = ({ children }: { children: ReactNode }) => {+ const pathname = usePathname();+ const flat = FLAT_HEADER_ROUTES.has(pathname);+ const [phase, setPhase] = useState<Phase>("docked");++ useEffect(() => {+ if (!FLAT_HEADER_ROUTES.has(pathname)) return;+ const sentinel = document.querySelector("[data-header-sentinel]");+ if (!sentinel) return;+ const io = new IntersectionObserver(([entry]) => {+ const past = entry+ ? !entry.isIntersecting && entry.boundingClientRect.top < 0+ : false;+ setPhase((current) => {+ if (past) {+ return current === "floating" || current === "entering"+ ? current+ : "entering";+ }+ return current === "docked" || current === "leaving"+ ? current+ : "leaving";+ });+ });+ io.observe(sentinel);+ return () => io.disconnect();+ }, [pathname]);++ useEffect(() => {+ if (phase === "entering") {+ let inner = 0;+ const outer = requestAnimationFrame(() => {+ inner = requestAnimationFrame(() => setPhase("floating"));+ });+ return () => {+ cancelAnimationFrame(outer);+ cancelAnimationFrame(inner);+ };+ }+ if (phase === "leaving") {+ const dockIfAtTop = () => {+ if (window.scrollY < DOCK_AT) setPhase("docked");+ };+ dockIfAtTop();+ window.addEventListener("scroll", dockIfAtTop, { passive: true });+ const timer = setTimeout(() => setPhase("docked"), SLIDE_MS);+ return () => {+ window.removeEventListener("scroll", dockIfAtTop);+ clearTimeout(timer);+ };+ }+ }, [phase]);++ const island = flat && phase !== "docked";+ const shown = phase === "floating";++ return (+ <header+ data-flat={flat ? "true" : "false"}+ data-island={island ? "true" : "false"}+ className={classNames(+ "group pointer-events-none inset-x-0 top-0 z-[51]",+ flat && !island ? "absolute" : "fixed",+ )}+ >+ <div+ className={classNames(+ "pointer-events-auto mx-auto",+ !flat && "max-w-none border-b border-zinc-200/70 bg-white",+ flat && !island && "bg-transparent",+ island &&+ "mt-3 max-w-[calc(100%-24px)] rounded-[18px] bg-white/90 shadow-[0_0_0_1px_rgba(17,17,17,0.06)] backdrop-blur-xl lg:mt-4 lg:max-w-[min(1200px,calc(100%-32px))]",+ )}+ style={+ island+ ? {+ transform: shown+ ? "translateY(0)"+ : "translateY(calc(-100% - 24px))",+ transition:+ phase === "entering"+ ? "none"+ : `transform ${SLIDE_MS}ms ${EASE}`,+ }+ : undefined+ }+ >+ {children}+ </div>+ </header>+ );+};diff --git a/apps/web/app/(site)/home/page.tsx b/apps/web/app/(site)/home/page.tsxindex c38c236cc..386648600 100644--- a/apps/web/app/(site)/home/page.tsx+++ b/apps/web/app/(site)/home/page.tsx@@ -1,22 +1,15 @@import type { Metadata } from "next";-import { HomePage } from "@/components/pages/HomePage";-import { buildMarketingMetadata } from "@/lib/og/url";+import { HomeTwoPage } from "@/components/pages/HomeTwo";+import { homePageMetadata } from "@/components/pages/HomeTwo/metadata";export const metadata: Metadata = {- ...buildMarketingMetadata({- title: "Cap — Beautiful screen recordings, owned by you.",- description:- "Cap is the open source alternative to Loom. Lightweight, powerful, and cross-platform. Record and share in seconds.",- ogTitle: "Beautiful screen recordings, owned by you",- }),- // Duplicate of the real homepage — keep it deduped and unindexed.- alternates: { canonical: "https://cap.so/" },+ ...homePageMetadata,robots: {index: false,follow: false,},};-export default async function Home() {- return <HomePage />;+export default function Home() {+ return <HomeTwoPage />;}diff --git a/apps/web/app/(site)/layout.tsx b/apps/web/app/(site)/layout.tsxindex ccffe1738..88ac800c0 100644--- a/apps/web/app/(site)/layout.tsx+++ b/apps/web/app/(site)/layout.tsx@@ -1,4 +1,5 @@import { buildEnv } from "@cap/env";+import "@cap/ui/style";import type { PropsWithChildren } from "react";import { formatStarCount, getGitHubStars } from "@/utils/github";import { DeferredMessengerWidget } from "../Layout/DeferredMessengerWidget";diff --git a/apps/web/app/(site)/page.tsx b/apps/web/app/(site)/page.tsxindex a1f46bc92..838cd4835 100644--- a/apps/web/app/(site)/page.tsx+++ b/apps/web/app/(site)/page.tsx@@ -1,12 +1,9 @@import type { Metadata } from "next";-import { HomePage } from "@/components/pages/HomePage";+import { HomeTwoPage } from "@/components/pages/HomeTwo";+import { homePageMetadata } from "@/components/pages/HomeTwo/metadata";-export const metadata: Metadata = {- alternates: {- canonical: "/",- },-};+export const metadata: Metadata = homePageMetadata;export default function Home() {- return <HomePage />;+ return <HomeTwoPage />;}diff --git a/apps/web/app/sitemap.ts b/apps/web/app/sitemap.tsindex 7210be5bf..9d992dc63 100644--- a/apps/web/app/sitemap.ts+++ b/apps/web/app/sitemap.ts@@ -140,7 +140,13 @@ export default async function sitemap() {{ path: string; lastModified?: string }>();for (const route of combined) {- if (!uniqueByPath.has(route.path)) uniqueByPath.set(route.path, route);+ if (+ route.path !== "/home" &&+ route.path !== "/home-two" &&+ !uniqueByPath.has(route.path)+ ) {+ uniqueByPath.set(route.path, route);+ }}const dedupedRoutes = [...uniqueByPath.values()];const homeRoute = dedupedRoutes.find((route) => route.path === "/");diff --git a/apps/web/components/ui/MobileMenu.tsx b/apps/web/components/ui/MobileMenu.tsxindex 933baef2a..2fb195ecf 100644--- a/apps/web/components/ui/MobileMenu.tsx+++ b/apps/web/components/ui/MobileMenu.tsx@@ -1,7 +1,8 @@"use client";-import { Button, Logo } from "@cap/ui";-import { classNames } from "@cap/utils";+import { Button } from "@cap/ui/button";+import { Logo } from "@cap/ui/logo";+import { classNames } from "@cap/utils/helpers";import { Menu, X } from "lucide-react";import Link from "next/link";import { usePathname } from "next/navigation";@@ -203,6 +204,7 @@ const MobileMenu = ({ stars }: MobileMenuProps) => {onClick={() => setOpen(false)}><Logo+ squaredMarkviewBoxDimensions="0 0 120 40"style={{ width: 84, height: 36 }}/>diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjsindex d4b9fa746..275f3bfaa 100644--- a/apps/web/next.config.mjs+++ b/apps/web/next.config.mjs@@ -117,6 +117,11 @@ const nextConfig = {},async redirects() {return [+ {+ source: "/home-two",+ destination: "/home",+ permanent: true,+ },{source: "/roadmap",destination:diff --git a/packages/ui/src/components/icons/Logo.tsx b/packages/ui/src/components/icons/Logo.tsxindex 2235462ba..82a7dcf62 100644--- a/packages/ui/src/components/icons/Logo.tsx+++ b/packages/ui/src/components/icons/Logo.tsx@@ -4,6 +4,7 @@ export const Logo = ({showBeta,white,hideLogoName,+ squaredMark,viewBoxDimensions = "0 0 120 40",style,}: {@@ -12,6 +13,7 @@ export const Logo = ({showBeta?: boolean;white?: boolean;hideLogoName?: boolean;+ squaredMark?: boolean;style?: React.CSSProperties;viewBoxDimensions?: `${string} ${string} ${string} ${string}`;}) => {@@ -23,26 +25,31 @@ export const Logo = ({preserveAspectRatio="xMidYMid meet"fill="none"style={style}+ role="img"aria-label="Cap Logo"className={className}>- {/* <rect- width="39.5"- height="39.5"- x="0.25"- y="0.25"- fill="#fff"- rx="7.75"- ></rect> */}- {/* <rect- width="39.5"- height="39.5"- x="0.25"- y="0.25"- stroke="#E7EAF0"- strokeWidth="0.5"- rx="7.75"- ></rect> */}+ {squaredMark && (+ <>+ <rect+ width="39.5"+ height="39.5"+ x="0.25"+ y="0.25"+ fill="#fff"+ rx="7.75"+ />+ <rect+ width="39.5"+ height="39.5"+ x="0.25"+ y="0.25"+ stroke="#E7EAF0"+ strokeWidth="0.5"+ rx="7.75"+ />+ </>+ )}<pathfill="#4785FF"d="M20 36c8.837 0 16-7.163 16-16 0-8.836-7.163-16-16-16-8.836 0-16 7.164-16 16 0 8.837 7.164 16 16 16z"