Skip to content

Commit

Permalink
[DOC] Point cloud section to new signup form (#3448)
Browse files Browse the repository at this point in the history
To be merged when trychroma.com/signup goes live.
  • Loading branch information
itaismith authored Jan 10, 2025
1 parent 30a8ea5 commit aa27c47
Show file tree
Hide file tree
Showing 17 changed files with 328 additions and 27 deletions.
16 changes: 16 additions & 0 deletions docs/docs.trychroma.com/app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react";
import MarkdocRenderer from "@/components/markdoc/markdoc-renderer";
import sidebarConfig from "@/markdoc/content/sidebar-config";
import { AppSection } from "@/lib/content";
import { Metadata } from "next";
import { capitalize } from "@/lib/utils";

export const generateStaticParams = async () => {
const slugs: string[][] = [];
Expand Down Expand Up @@ -29,6 +31,20 @@ export const generateStaticParams = async () => {
}));
};

export async function generateMetadata({
params,
}: {
params: { slug: string[] };
}): Promise<Metadata> {
const title = `${params.slug[params.slug.length - 1]
.split("-")
.map((s) => capitalize(s))
.join(" ")} - Chroma Docs`;
return {
title,
};
}

const Page: React.FC<{ params: { slug: string[] } }> = ({ params }) => {
const { slug } = params;
return <MarkdocRenderer slug={slug} />;
Expand Down
2 changes: 2 additions & 0 deletions docs/docs.trychroma.com/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ThemeProvider from "@/components/ui/theme-provider";
import { Inter } from "next/font/google";
import Header from "@/components/header/header";
import PostHogProvider from "@/components/posthog/posthog-provider";
import CloudSignUp from "@/components/header/cloud-signup";

export const metadata: Metadata = {
title: "Chroma Docs",
Expand Down Expand Up @@ -32,6 +33,7 @@ export default function RootLayout({
<div className="absolute inset-0 bg-[url('/background.jpg')] bg-cover bg-center opacity-10 dark:invert dark:opacity-10" />
<div className="relative z-10 flex flex-col h-full">
<Header />
<CloudSignUp />
{children}
</div>
</div>
Expand Down
102 changes: 102 additions & 0 deletions docs/docs.trychroma.com/components/header/cloud-signup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
"use client";

import React, { useEffect, useState } from "react";
import { Cross2Icon } from "@radix-ui/react-icons";
import ChromaIcon from "../../public/chroma-icon.svg";
import Link from "next/link";
import Image from "next/image";

const SignUpLink: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return (
<Link
href={"https://www.trychroma.com/signup"}
target="_blank"
rel="noopener noreferrer"
className="underline"
>
{children}
</Link>
);
};

const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1000;

const CloudSignUp: React.FC = () => {
const [open, setOpen] = useState(false);
const [imageLoaded, setImageLoaded] = useState(false);

useEffect(() => {
const lastClosed = localStorage.getItem("cloudSignupLastClosed");
const now = Date.now();

if (!lastClosed || now - parseInt(lastClosed, 10) > ONE_WEEK_MS) {
setOpen(true);
}
}, []);

const handleDialogClose = () => {
setOpen(false);
localStorage.setItem("cloudSignupLastClosed", Date.now().toString());
};

return (
open && (
<div
className={`absolute bottom-4 z-20 right-4 bg-white border border-black h-48 w-[400px] flex flex-col gap-0 sm:rounded-none p-0 dark:border-white dark:border dark:bg-gray-950 ${imageLoaded ? "opacity-100" : "opacity-0"}`}
>
<div className="relative py-2 px-[3px] h-fit border-b-[1px] border-black dark:border-gray-300 dark:bg-gray-950">
<div className="flex flex-col gap-0.5">
{[...Array(7)].map((_, index) => (
<div
key={index}
className="w-full h-[1px] bg-black dark:bg-gray-300"
/>
))}
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 px-2 py-1 bg-white dark:bg-gray-950 font-mono select-none">
NEW
</div>
<div
className="absolute right-4 top-[6px] px-1 bg-white dark:bg-gray-950 cursor-pointer"
onClick={handleDialogClose}
>
<div className="flex items-center justify-center bg-white dark:bg-gray-950 border-[1px] border-black disabled:pointer-events-none focus-visible:outline-none">
<Cross2Icon className="h-5 w-5" />
<span className="sr-only">Close</span>
</div>
</div>
</div>
</div>
<div className="flex gap-5 h-full">
<div className="flex flex-col gap-3 pt-4 pl-5 ">
<div className="flex items-center gap-2 select-none">
<ChromaIcon className="w-10 h-10" />
<p className="text-lg font-bold">Chroma Cloud</p>
</div>

<div className="flex flex-col gap-2 text-sm">
<p>
Our fully managed hosted service,{" "}
<span className="font-bold">Chroma Cloud</span> is here.
</p>
<p>
<SignUpLink>Sign up</SignUpLink> for early access!
</p>
</div>
</div>
<div className="h-full flex items-start justify-end flex-shrink-0 ">
<Image
src="/cloud-art.svg"
alt="Cloud Art"
width={128}
height={155}
priority
onLoad={() => setImageLoaded(true)}
/>
</div>
</div>
</div>
)
);
};

export default CloudSignUp;
5 changes: 5 additions & 0 deletions docs/docs.trychroma.com/components/sidebar/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const MenuItem: React.FC<{ section: AppSection; active: boolean }> = ({
Coming Soon
</div>
)}
{section.override && (
<div className="absolute top-1/2 -translate-y-1/2 text-xs px-2 py-0.5 w-fit -right-12 bg-gray-800 rounded-md text-gray-200">
New
</div>
)}
</div>
</div>
</Link>
Expand Down
1 change: 1 addition & 0 deletions docs/docs.trychroma.com/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path from "path";
import fs from "fs";
import matter from "gray-matter";
import ScrollableContent from "./scrollable-content";
import CloudSignUp from "@/components/header/cloud-signup";

const generatePages = (slug: string[]): { id: string; name: string }[] => {
const dirPath = path.join(process.cwd(), "markdoc", "content", ...slug);
Expand Down
117 changes: 117 additions & 0 deletions docs/docs.trychroma.com/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
"use client";

import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { cn } from "@/lib/utils";
import { Cross2Icon } from "@radix-ui/react-icons";

const Dialog = DialogPrimitive.Root;

const DialogTrigger = DialogPrimitive.Trigger;

const DialogPortal = DialogPrimitive.Portal;

const DialogClose = DialogPrimitive.Close;

const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
)}
{...props}
/>
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed right-4 bottom-4 z-50 w-full max-w-lg gap-4 border border-zinc-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-zinc-800 dark:bg-zinc-950",
className,
)}
{...props}
>
{children}
</DialogPrimitive.Content>
</DialogPortal>
));
DialogContent.displayName = DialogPrimitive.Content.displayName;

const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className,
)}
{...props}
/>
);
DialogHeader.displayName = "DialogHeader";

const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
/>
);
DialogFooter.displayName = "DialogFooter";

const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className,
)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;

const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-zinc-500 dark:text-zinc-400", className)}
{...props}
/>
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;

export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogClose,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
};
13 changes: 4 additions & 9 deletions docs/docs.trychroma.com/context/app-context.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import React, {
createContext,
useState,
ReactNode,
useEffect,
} from "react";
import React, { createContext, useState, ReactNode, useEffect } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";

export interface AppContextValue {
Expand All @@ -13,7 +8,7 @@ export interface AppContextValue {

const AppContextDefaultValue: AppContextValue = {
language: "python",
setLanguage: () => { },
setLanguage: () => {},
};

const AppContext = createContext<AppContextValue>(AppContextDefaultValue);
Expand All @@ -27,8 +22,8 @@ export const AppContextProvider = ({ children }: { children: ReactNode }) => {
const pathname = usePathname();

useEffect(() => {
// Don't consider the hash if the user is going to a differnet path.
const anchor = (pathname === window.location.pathname) ? window.location.hash : "";
const anchor =
pathname === window.location.pathname ? window.location.hash : "";

if (language === "typescript") {
router.replace(pathname + "?lang=typescript" + anchor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The goal of this doc is to align *core* and *community* efforts for the project

## What is the core Chroma team working on right now?

- Standing up that distributed system as a managed service (aka "Hosted Chroma" - [sign up for waitlist](https://airtable.com/shrOAiDUtS2ILy5vZ)!)
- Standing up that distributed system as a managed service (aka "Hosted Chroma" - [sign up for waitlist](https://trychroma.com/signup)!)

## What did the Chroma team just complete?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

**Hosted Chroma**

Chroma Cloud, our fully managed hosted service, is in early access. Fill out the survey to jump the waitlist and get the best retrieval experience. Full access coming Q1 2025.

[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
Chroma Cloud, our fully managed hosted service is here. [Sign up here](https://trychroma.com/signup) for early access.

{% /Banner %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

**Hosted Chroma**

Chroma Cloud, our fully managed hosted service, is in early access. Fill out the survey to jump the waitlist and get the best retrieval experience. Full access coming Q1 2025.

[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
Chroma Cloud, our fully managed hosted service is here. [Sign up here](https://trychroma.com/signup) for early access.

{% /Banner %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

**Hosted Chroma**

Chroma Cloud, our fully managed hosted service, is in early access. Fill out the survey to jump the waitlist and get the best retrieval experience. Full access coming Q1 2025.

[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
Chroma Cloud, our fully managed hosted service is here. [Sign up here](https://trychroma.com/signup) for early access.

{% /Banner %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

**Hosted Chroma**

Chroma Cloud, our fully managed hosted service, is in early access. Fill out the survey to jump the waitlist and get the best retrieval experience. Full access coming Q1 2025.

[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
Chroma Cloud, our fully managed hosted service is here. [Sign up here](https://trychroma.com/signup) for early access.

{% /Banner %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

**Hosted Chroma**

Chroma Cloud, our fully managed hosted service, is in early access. Fill out the survey to jump the waitlist and get the best retrieval experience. Full access coming Q1 2025.

[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
Chroma Cloud, our fully managed hosted service is here. [Sign up here](https://trychroma.com/signup) for early access.

{% /Banner %}

Expand Down
2 changes: 1 addition & 1 deletion docs/docs.trychroma.com/markdoc/content/sidebar-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const sidebarConfig: AppSection[] = [
id: "cloud",
name: "Chroma Cloud",
icon: CloudIcon,
override: "https://airtable.com/appG6DhLoDUnTawwh/shrOAiDUtS2ILy5vZ",
override: "https://trychroma.com/signup",
},
{
id: "production",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.trychroma.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@markdoc/markdoc": "latest",
"@markdoc/next.js": "^0.3.7",
"@matejmazur/react-katex": "^3.1.3",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-menubar": "^1.0.4",
Expand Down
Loading

0 comments on commit aa27c47

Please sign in to comment.