Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: initial commit for developer site
Brad Barbine685c18f7653
diff --git a/apps/carbon/app/lib/swagger-docs-schema.ts b/apps/carbon/app/lib/swagger-docs-schema.tsindex a76ff452c0..a5aff5a8db 100644--- a/apps/carbon/app/lib/swagger-docs-schema.ts+++ b/apps/carbon/app/lib/swagger-docs-schema.ts@@ -16257,6 +16257,9 @@ export default {{$ref: "#/parameters/rowFilter.user.updatedAt",},+ {+ $ref: "#/parameters/rowFilter.user.developer",+ },{$ref: "#/parameters/select",},@@ -16346,6 +16349,9 @@ export default {{$ref: "#/parameters/rowFilter.user.updatedAt",},+ {+ $ref: "#/parameters/rowFilter.user.developer",+ },{$ref: "#/parameters/preferReturn",},@@ -16389,6 +16395,9 @@ export default {{$ref: "#/parameters/rowFilter.user.updatedAt",},+ {+ $ref: "#/parameters/rowFilter.user.developer",+ },{$ref: "#/parameters/body.user",},@@ -39440,6 +39449,11 @@ export default {format: "timestamp with time zone",type: "string",},+ developer: {+ default: false,+ format: "boolean",+ type: "boolean",+ },},type: "object",},@@ -55410,6 +55424,13 @@ export default {in: "query",type: "string",},+ "rowFilter.user.developer": {+ name: "developer",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },"body.modelUpload": {name: "modelUpload",description: "modelUpload",diff --git a/apps/carbon/app/services/session.server.ts b/apps/carbon/app/services/session.server.tsindex 6241b71eab..82ef482b79 100644--- a/apps/carbon/app/services/session.server.ts+++ b/apps/carbon/app/services/session.server.ts@@ -8,6 +8,7 @@ import {SESSION_KEY,SESSION_MAX_AGE,SESSION_SECRET,+ VERCEL_URL,} from "~/config/env";import { redis } from "@carbon/redis";@@ -32,6 +33,15 @@ async function assertAuthSession(return authSession;}+// Function to extract domain from URL+function removeSubdomain(url: string): string {+ const parts = url.split("/")[0].split(".");++ const domain = parts.slice(-2).join(".");++ return domain;+}+const sessionStorage = createCookieSessionStorage({cookie: {name: "carbon",@@ -40,6 +50,7 @@ const sessionStorage = createCookieSessionStorage({sameSite: "lax",secrets: [SESSION_SECRET],secure: NODE_ENV === "production",+ domain: NODE_ENV === "production" ? removeSubdomain(VERCEL_URL) : undefined,},});diff --git a/apps/website/.eslintrc.js b/apps/developers/.eslintrc.mjssimilarity index 100%rename from apps/website/.eslintrc.jsrename to apps/developers/.eslintrc.mjsdiff --git a/apps/developers/.gitignore b/apps/developers/.gitignorenew file mode 100644index 0000000000..4a02fe5c58--- /dev/null+++ b/apps/developers/.gitignore@@ -0,0 +1,10 @@+node_modules++.cache+.vercel+.output++build+public/build+api/index.js*+api/_assets*diff --git a/apps/developers/README.md b/apps/developers/README.mdnew file mode 100644index 0000000000..6ce7de97bb--- /dev/null+++ b/apps/developers/README.md@@ -0,0 +1,31 @@+# Carbon++ERP Application built with:++- [Remix](https://remix.run)+- [Supabase](https://supabase.com/)+- [Postgres](https://postgresql.org/)+- [shadcn](https://ui.shadcn.com/)+- [Redis](https://redis.io)++## Code Organization++### `app/components`++Reusable react components that are specific to this project (and remix). Shared components should live in `packages/react` if they don't rely on some application-specific library. For example, the `Table` relies on some remix internals, so it lives in `app/components`, but the `Date` component is framework agnostic, so it lives in `packages/react`.++### `app/jobs`++Where background tasks are defined.++### `app/modules`++Where services, ui and form validators are defined for each module.++### `app/routes`++File-based route definitions using `remix`. This is where the services and interfaces meet. Each route is loaded in parallel for performance, so each route is responsible for defining it's own authorization and data needs. Each route has three parts (none are required):++1. `export async function loader`: The data that the route returns, which can be accessed via `GET` or `useLoaderData` in the component (3)+2. `export async function action`: The actions (`POST` or `DELETE`) for the route, which can be accessed via http methods or through the `ValidatedForm` component.+3. `export default function`: The nested react component for the route. This renders inside the `<Outlet/>` component of the parent route.diff --git a/apps/developers/app/components/Avatar.tsx b/apps/developers/app/components/Avatar.tsxnew file mode 100644index 0000000000..2ebc4a9b7b--- /dev/null+++ b/apps/developers/app/components/Avatar.tsx@@ -0,0 +1,20 @@+import type { AvatarProps as AvatarBaseProps } from "@carbon/react";+import { Avatar as AvatarBase } from "@carbon/react";+import { forwardRef } from "react";+import { getStoragePath } from "~/utils/path";++type AvatarProps = AvatarBaseProps & {+ path?: string | null;+ bucket?: string;+};++const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(+ ({ name, path, bucket = "avatars", ...props }, ref) => {+ const imagePath = path ? getStoragePath(bucket, path) : undefined;++ return <AvatarBase src={imagePath} name={name} ref={ref} {...props} />;+ }+);+Avatar.displayName = "Avatar";++export default Avatar;diff --git a/apps/developers/app/components/Breadcrumb.tsx b/apps/developers/app/components/Breadcrumb.tsxnew file mode 100644index 0000000000..b40ff26794--- /dev/null+++ b/apps/developers/app/components/Breadcrumb.tsx@@ -0,0 +1,86 @@+import { Button, cn, getValidChildren } from "@carbon/react";+import type { LinkProps } from "@remix-run/react";+import { Link } from "@remix-run/react";+import type { ComponentProps } from "react";+import { cloneElement, forwardRef } from "react";+import { LuChevronRight } from "react-icons/lu";++const Breadcrumbs = forwardRef<+ HTMLElement,+ ComponentProps<"nav"> & {+ useReactRouter?: boolean;+ }+>(({ className, children, useReactRouter = true, ...props }, ref) => {+ const validChildren = getValidChildren(children);+ const count = validChildren.length;+ const clones = validChildren.map((child, index) =>+ cloneElement(child, {+ isFirstChild: index === 0,+ isLastChild: index === count - 1,+ })+ );+ return (+ <nav+ aria-label="Breadcrumb"+ ref={ref}+ className={cn("reset flex", className)}+ {...props}+ >+ <ol className="inline-flex items-center space-x-1">{clones}</ol>+ </nav>+ );+});+Breadcrumbs.displayName = "Breadcrumbs";++const BreadcrumbItem = forwardRef<+ HTMLLIElement,+ ComponentProps<"li"> & {+ isFirstChild?: boolean;+ isLastChild?: boolean;+ }+>(({ className, children, isFirstChild, isLastChild, ...props }, ref) => (+ <li+ ref={ref}+ className={cn("inline-flex items-center", className)}+ {...props}+ >+ {!isFirstChild && (+ <span className="text-muted-foreground">+ <LuChevronRight />+ </span>+ )}+ {children}+ </li>+));+BreadcrumbItem.displayName = "BreadcrumbItem";++const BreadcrumbLink = forwardRef<+ HTMLAnchorElement,+ LinkProps & {+ isCurrentPage?: boolean;+ }+>(({ className, children, isCurrentPage, ...props }, ref) => {+ return (+ <Button+ variant="ghost"+ className={cn(+ "px-2 outline-none focus-visible:ring-transparent",+ className+ )}+ asChild+ >+ {isCurrentPage ? (+ <span aria-current="page" ref={ref} {...props}>+ {children}+ </span>+ ) : (+ <Link ref={ref} {...props} prefetch="intent">+ {children}+ </Link>+ )}+ </Button>+ );+});+BreadcrumbLink.displayName = "BreadcrumbLink";++export { BreadcrumbItem, BreadcrumbLink, Breadcrumbs };diff --git a/apps/developers/app/components/Combobox.tsx b/apps/developers/app/components/Combobox.tsxnew file mode 100644index 0000000000..7ab0f6c8be--- /dev/null+++ b/apps/developers/app/components/Combobox.tsx@@ -0,0 +1,131 @@+import {+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandTrigger,+ HStack,+ IconButton,+ Popover,+ PopoverContent,+ PopoverTrigger,+ ScrollArea,+ cn,+} from "@carbon/react";+import type { ComponentPropsWithoutRef } from "react";+import { forwardRef, useState } from "react";+import { MdClose } from "react-icons/md";+import { RxCheck } from "react-icons/rx";++export type ComboboxProps = Omit<+ ComponentPropsWithoutRef<"button">,+ "onChange"+> & {+ size?: "sm" | "md" | "lg";+ value?: string;+ options: {+ label: string;+ value: string;+ helper?: string;+ }[];+ isClearable?: boolean;+ isReadOnly?: boolean;+ placeholder?: string;+ onChange?: (selected: string) => void;+};++const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(+ (+ {+ size,+ value,+ options,+ isClearable,+ isReadOnly,+ placeholder,+ onChange,+ ...props+ },+ ref+ ) => {+ const [open, setOpen] = useState(false);+ return (+ <HStack spacing={1}>+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <CommandTrigger+ size={size}+ role="combobox"+ className={cn("min-w-[160px]", !value && "text-muted-foreground")}+ ref={ref}+ onClick={() => setOpen(true)}+ {...props}+ >+ {value ? (+ options.find((option) => option.value === value)?.label+ ) : (+ <span className="!text-muted-foreground">+ {placeholder ?? "Select"}+ </span>+ )}+ </CommandTrigger>+ </PopoverTrigger>+ <PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0">+ <Command>+ <CommandInput placeholder="Search..." className="h-9" />+ <ScrollArea className="overflow-auto max-h-96">+ <CommandEmpty>No option found.</CommandEmpty>+ <CommandGroup>+ {options.map((option) => (+ <CommandItem+ value={+ typeof option.label === "string"+ ? option.label + option.helper+ : undefined+ }+ key={option.value}+ onSelect={() => {+ onChange?.(option.value);+ setOpen(false);+ }}+ >+ {option.helper ? (+ <div className="flex flex-col">+ <p>{option.label}</p>+ <p className="text-xs text-muted-foreground">+ {option.helper}+ </p>+ </div>+ ) : (+ option.label+ )}+ <RxCheck+ className={cn(+ "ml-auto h-4 w-4",+ option.value === value ? "opacity-100" : "opacity-0"+ )}+ />+ </CommandItem>+ ))}+ </CommandGroup>+ </ScrollArea>+ </Command>+ </PopoverContent>+ </Popover>+ {isClearable && !isReadOnly && value && (+ <IconButton+ variant="ghost"+ aria-label="Clear"+ icon={<MdClose />}+ onClick={() => onChange?.("")}+ size={size === "sm" ? "md" : size}+ />+ )}+ </HStack>+ );+ }+);+Combobox.displayName = "Combobox";++export default Combobox;diff --git a/apps/developers/app/components/CreateableCombobox.tsx b/apps/developers/app/components/CreateableCombobox.tsxnew file mode 100644index 0000000000..f513ea220a--- /dev/null+++ b/apps/developers/app/components/CreateableCombobox.tsx@@ -0,0 +1,161 @@+import {+ Command,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandTrigger,+ HStack,+ IconButton,+ Popover,+ PopoverContent,+ PopoverTrigger,+ cn,+} from "@carbon/react";+import type { ComponentPropsWithoutRef } from "react";+import { forwardRef, useState } from "react";+import { MdClose } from "react-icons/md";+import { RxCheck } from "react-icons/rx";++export type CreatableComboboxProps = Omit<+ ComponentPropsWithoutRef<"button">,+ "onChange"+> & {+ size?: "sm" | "md" | "lg";+ value?: string;+ options: {+ label: string;+ value: string;+ helper?: string;+ }[];+ selected?: string[];+ isClearable?: boolean;+ isReadOnly?: boolean;+ label?: string;+ placeholder?: string;+ onChange?: (selected: string) => void;+ onCreateOption?: (inputValue: string) => void;+};++const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(+ (+ {+ size,+ value,+ options,+ selected,+ isClearable,+ isReadOnly,+ placeholder,+ onChange,+ label,+ ...props+ },+ ref+ ) => {+ const [open, setOpen] = useState(false);+ const [search, setSearch] = useState("");+ const isExactMatch = options.some((option) =>+ [option.label.toLowerCase(), option.helper?.toLowerCase()].includes(+ search.toLowerCase()+ )+ );++ return (+ <HStack spacing={1}>+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <CommandTrigger+ size={size}+ role="combobox"+ className={cn("min-w-[160px]", !value && "text-muted-foreground")}+ ref={ref}+ {...props}+ onClick={() => setOpen(true)}+ >+ {value ? (+ options.find((option) => option.value === value)?.label+ ) : (+ <span className="!text-muted-foreground">+ {placeholder ?? "Select"}+ </span>+ )}+ </CommandTrigger>+ </PopoverTrigger>+ <PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0">+ <Command>+ <CommandInput+ value={search}+ onValueChange={setSearch}+ placeholder="Search..."+ className="h-9"+ />+ <CommandGroup>+ {options.map((option) => {+ const isSelected = !!selected?.includes(option.value);+ return (+ <CommandItem+ value={+ typeof option.label === "string"+ ? option.label.replace(/"/g, '\\"') ++ option.helper?.replace(/"/g, '\\"')+ : undefined+ }+ key={option.value}+ onSelect={() => {+ if (!isSelected) onChange?.(option.value);+ setOpen(false);+ }}+ >+ {option.helper ? (+ <div className="flex flex-col">+ <p>{option.label}</p>+ <p className="text-xs text-muted-foreground">+ {option.helper}+ </p>+ </div>+ ) : (+ option.label+ )}+ <RxCheck+ className={cn(+ "ml-auto h-4 w-4",+ isSelected || option.value === value+ ? "opacity-100"+ : "opacity-0"+ )}+ />+ </CommandItem>+ );+ })}+ {!isExactMatch && (+ <CommandItem+ onSelect={() => {+ props.onCreateOption?.(search);+ }}+ value={search?.replace(/"/g, '\\"').trim() || ""}+ className="cursor-pointer"+ >+ <span>Create</span>+ <span className="ml-1 font-bold">{search || label}</span>+ </CommandItem>+ )}+ </CommandGroup>+ </Command>+ </PopoverContent>+ </Popover>+ {isClearable && !isReadOnly && value && (+ <IconButton+ variant="ghost"+ aria-label="Clear"+ icon={<MdClose />}+ onClick={() => onChange?.("")}+ size={size === "sm" ? "md" : size}+ />+ )}+ </HStack>+ );+ }+);+CreatableCombobox.displayName = "CreatableCombobox";++export default CreatableCombobox;diff --git a/apps/developers/app/components/CreateableMultiSelect.tsx b/apps/developers/app/components/CreateableMultiSelect.tsxnew file mode 100644index 0000000000..8448b54331--- /dev/null+++ b/apps/developers/app/components/CreateableMultiSelect.tsx@@ -0,0 +1,233 @@+import {+ Badge,+ BadgeCloseButton,+ Button,+ Command,+ CommandGroup,+ CommandInput,+ CommandItem,+ HStack,+ IconButton,+ Popover,+ PopoverContent,+ PopoverTrigger,+ cn,+ multiSelectTriggerVariants,+} from "@carbon/react";+import { getColor } from "@carbon/utils";+import type { ComponentPropsWithoutRef } from "react";+import { forwardRef, useId, useState } from "react";+import { MdClose } from "react-icons/md";+import { RxCheck, RxMagnifyingGlass } from "react-icons/rx";+import { useMode } from "~/hooks/useMode";++export type CreatableMultiSelectProps = Omit<+ ComponentPropsWithoutRef<"button">,+ "onChange"+> & {+ size?: "sm" | "md" | "lg";+ value: string[];+ options: {+ label: string;+ value: string;+ helper?: string;+ }[];+ selected?: string[];+ isClearable?: boolean;+ isReadOnly?: boolean;+ label?: string;+ placeholder?: string;+ onChange: (selected: string[]) => void;+ onCreateOption?: (inputValue: string) => void;+};++const CreatableMultiSelect = forwardRef<+ HTMLButtonElement,+ CreatableMultiSelectProps+>(+ (+ {+ size,+ value,+ options,+ selected,+ isClearable,+ isReadOnly,+ placeholder,+ onChange,+ label,+ className,+ ...props+ },+ ref+ ) => {+ const [open, setOpen] = useState(false);+ const [search, setSearch] = useState("");+ const isExactMatch = options.some((option) =>+ [option.label.toLowerCase(), option.helper?.toLowerCase()].includes(+ search.toLowerCase()+ )+ );++ const id = useId();++ const handleUnselect = (item: string) => {+ onChange(value.filter((i) => i !== item));+ };++ const hasSelections = value.length > 0;++ return (+ <HStack spacing={1}>+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <Button+ aria-controls={id}+ aria-expanded={open}+ role="combobox"+ tabIndex={0}+ variant="secondary"+ className={cn(+ multiSelectTriggerVariants({ size, hasSelections }),+ "bg-transparent px-2",+ className+ )}+ isDisabled={isReadOnly}+ onClick={() => {+ if (!isReadOnly) setOpen(!open);+ }}+ onKeyDown={(e) => {+ if ((e.key === "Enter" || e.key === " ") && !isReadOnly) {+ setOpen(!open);+ }+ }}+ asChild+ >+ <div>+ {hasSelections ? (+ <div className="flex gap-1 flex-wrap">+ {value.map((item) => (+ <SelectedOption+ key={item.toString()}+ item={item}+ options={options}+ onUnselect={handleUnselect}+ />+ ))}+ </div>+ ) : (+ <span className="text-muted-foreground">+ {placeholder ?? "Search..."}+ </span>+ )}++ <RxMagnifyingGlass className="h-4 w-4 shrink-0 opacity-50" />+ </div>+ </Button>+ </PopoverTrigger>+ <PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0">+ <Command>+ <CommandInput+ placeholder="Search..."+ value={search}+ onValueChange={setSearch}+ className="h-9"+ />+ <CommandGroup className="max-h-64 overflow-auto">+ {options.map((option) => (+ <CommandItem+ key={option.value}+ onSelect={() => {+ onChange(+ value.includes(option.value)+ ? value.filter((item) => item !== option.value)+ : [...value, option.value]+ );+ setOpen(true);+ }}+ >+ <RxCheck+ className={cn(+ "mr-2 h-4 w-4",+ value.includes(option.value)+ ? "opacity-100"+ : "opacity-0"+ )}+ />+ {option.label}+ </CommandItem>+ ))}+ {!isExactMatch && (+ <CommandItem+ onSelect={() => {+ props.onCreateOption?.(search);+ setSearch("");+ }}+ value={search?.replace(/"/g, '\\"').trim() || ""}+ className="cursor-pointer"+ >+ <span>Create</span>+ <span className="ml-1 font-bold">{search || label}</span>+ </CommandItem>+ )}+ </CommandGroup>+ </Command>+ </PopoverContent>+ </Popover>+ {isClearable && !isReadOnly && value && (+ <IconButton+ variant="ghost"+ aria-label="Clear"+ icon={<MdClose />}+ onClick={() => onChange?.([])}+ size={size === "sm" ? "md" : size}+ />+ )}+ </HStack>+ );+ }+);+CreatableMultiSelect.displayName = "CreatableMultiSelect";++export default CreatableMultiSelect;++function SelectedOption({+ isReadOnly,+ item,+ options,+ onUnselect,+}: {+ isReadOnly?: boolean;+ item: string;+ options: CreatableMultiSelectProps["options"];+ onUnselect: (item: string) => void;+}) {+ const mode = useMode();+ const label = options.find((o) => o.value === item)?.label ?? "";+ const colors = getColor(label, mode);++ return (+ <Badge key={item} onClick={() => onUnselect(item)} style={colors}>+ {options.find((option) => option.value === item)?.label}+ <BadgeCloseButton+ tabIndex={-1}+ disabled={isReadOnly}+ style={{ color: colors.color }}+ onKeyDown={(e) => {+ if (e.key === "Enter" && !isReadOnly) {+ onUnselect(item);+ }+ }}+ onMouseDown={(e) => {+ e.preventDefault();+ e.stopPropagation();+ }}+ onClick={(e) => {+ e.preventDefault();+ e.stopPropagation();+ if (!isReadOnly) onUnselect(item);+ }}+ />+ </Badge>+ );+}diff --git a/apps/developers/app/components/Enumerable.tsx b/apps/developers/app/components/Enumerable.tsxnew file mode 100644index 0000000000..a160522b1d--- /dev/null+++ b/apps/developers/app/components/Enumerable.tsx@@ -0,0 +1,22 @@+import { getColor } from "@carbon/utils";++import type { BadgeProps } from "@carbon/react";+import { Badge } from "@carbon/react";+import { useMode } from "~/hooks/useMode";++type EnumerableProps = BadgeProps & {+ value: string | null;+};++const Enumerable = ({ value, ...props }: EnumerableProps) => {+ const mode = useMode();+ if (!value) return null;+ const style = getColor(value, mode);+ return (+ <Badge style={style} {...props}>+ {value}+ </Badge>+ );+};++export { Enumerable };diff --git a/apps/developers/app/components/Form/Array.tsx b/apps/developers/app/components/Form/Array.tsxnew file mode 100644index 0000000000..6f02aadf12--- /dev/null+++ b/apps/developers/app/components/Form/Array.tsx@@ -0,0 +1,98 @@+import type { InputProps } from "@carbon/react";+import {+ Button,+ FormControl,+ FormErrorMessage,+ FormLabel,+ HStack,+ IconButton,+ Input as InputBase,+ VStack,+} from "@carbon/react";+import { useField, useFieldArray } from "@carbon/remix-validated-form";+import { forwardRef, useRef } from "react";+import { flushSync } from "react-dom";+import { IoMdAdd, IoMdClose } from "react-icons/io";++type FormArrayProps = InputProps & {+ name: string;+ label?: string;+ isRequired?: boolean;+};++const Array = forwardRef<HTMLInputElement, FormArrayProps>(+ ({ name, label, isRequired, ...rest }, ref) => {+ const listRef = useRef<HTMLDivElement>(null);+ const [items, { push, remove }, error] = useFieldArray<string>(name);+ const onAdd = () => {+ flushSync(() => {+ push("");+ });+ const lastInput = listRef.current?.querySelectorAll("input")?.[+ items.length+ ] as HTMLInputElement | undefined;+ lastInput?.focus();+ };++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={`${name}`}>{label}</FormLabel>}+ <VStack className="mb-4" ref={listRef}>+ {items.map((item, index) => (+ <ArrayInput+ key={`${item}-${index}`}+ id={`${name}[${index}]`}+ name={`${name}[${index}]`}+ ref={index === 0 ? ref : undefined}+ onRemove={() => remove(index)}+ {...rest}+ />+ ))}+ <Button variant="secondary" leftIcon={<IoMdAdd />} onClick={onAdd}>+ New Option+ </Button>+ </VStack>+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Array.displayName = "Array";++type ArrayInputProps = InputProps & {+ name: string;+ onRemove: () => void;+};++const ArrayInput = forwardRef<HTMLInputElement, ArrayInputProps>(+ ({ name, onRemove, ...rest }, ref) => {+ const { getInputProps, error } = useField(name);++ return (+ <FormControl isInvalid={!!error} isRequired>+ <HStack className="w-full content-between">+ <InputBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ })}+ />+ <IconButton+ variant="ghost"+ aria-label="Remove item"+ icon={<IoMdClose />}+ onClick={onRemove}+ />+ </HStack>++ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++ArrayInput.displayName = "ArrayInput";++export default Array;diff --git a/apps/developers/app/components/Form/ArrayNumeric.tsx b/apps/developers/app/components/Form/ArrayNumeric.tsxnew file mode 100644index 0000000000..8866eaabaf--- /dev/null+++ b/apps/developers/app/components/Form/ArrayNumeric.tsx@@ -0,0 +1,125 @@+import type { InputProps } from "@carbon/react";+import {+ Button,+ FormControl,+ FormErrorMessage,+ FormLabel,+ HStack,+ IconButton,+ NumberDecrementStepper,+ NumberField,+ NumberIncrementStepper,+ NumberInput,+ NumberInputGroup,+ NumberInputStepper,+ VStack,+} from "@carbon/react";+import { useField, useFieldArray } from "@carbon/remix-validated-form";+import { forwardRef, useRef } from "react";+import { flushSync } from "react-dom";+import { IoMdAdd, IoMdClose } from "react-icons/io";+import { LuChevronDown, LuChevronUp } from "react-icons/lu";++type FormArrayNumericProps = InputProps & {+ name: string;+ label?: string;+ isRequired?: boolean;+ defaults?: number[];+};++const ArrayNumeric = forwardRef<HTMLInputElement, FormArrayNumericProps>(+ ({ name, label, isDisabled, isRequired, defaults, ...rest }, ref) => {+ const listRef = useRef<HTMLDivElement>(null);+ const [items, { push, remove }, error] = useFieldArray<number>(name);+ const onAdd = () => {+ flushSync(() => {+ const next = defaults?.[items.length] ?? 0;+ push(next);+ });+ const lastInput = listRef.current?.querySelectorAll(+ "input[inputmode='numeric']"+ )?.[items.length] as HTMLInputElement | undefined;+ lastInput?.focus();+ };++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={`${name}`}>{label}</FormLabel>}+ <VStack className="mb-4" ref={listRef}>+ {items.map((item, index) => (+ <ArrayNumericInput+ key={`${item}-${index}`}+ id={`${name}[${index}]`}+ name={`${name}[${index}]`}+ onRemove={() => remove(index)}+ {...rest}+ />+ ))}+ <Button+ isDisabled={isDisabled}+ variant="secondary"+ leftIcon={<IoMdAdd />}+ onClick={onAdd}+ >+ Add {label ?? "Option"}+ </Button>+ </VStack>+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++ArrayNumeric.displayName = "ArrayNumeric";++type ArrayNumericInputProps = InputProps & {+ name: string;+ onRemove: () => void;+};++const ArrayNumericInput = ({+ name,+ onRemove,+ ...rest+}: ArrayNumericInputProps) => {+ const { getInputProps, error } = useField(name);++ return (+ <FormControl isInvalid={!!error} isRequired>+ <HStack className="w-full content-between">+ <NumberField+ // @ts-ignore+ {...getInputProps({+ id: name,+ ...rest,+ })}+ >+ <NumberInputGroup className="relative">+ <NumberInput />++ <NumberInputStepper>+ <NumberIncrementStepper>+ <LuChevronUp size="1em" strokeWidth="3" />+ </NumberIncrementStepper>+ <NumberDecrementStepper>+ <LuChevronDown size="1em" strokeWidth="3" />+ </NumberDecrementStepper>+ </NumberInputStepper>+ </NumberInputGroup>+ </NumberField>+ <IconButton+ variant="ghost"+ aria-label="Remove item"+ icon={<IoMdClose />}+ onClick={onRemove}+ />+ </HStack>++ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+};++ArrayNumericInput.displayName = "ArrayNumericInput";++export default ArrayNumeric;diff --git a/apps/developers/app/components/Form/Boolean.tsx b/apps/developers/app/components/Form/Boolean.tsxnew file mode 100644index 0000000000..04e72a2cbb--- /dev/null+++ b/apps/developers/app/components/Form/Boolean.tsx@@ -0,0 +1,56 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ HStack,+ Switch,+} from "@carbon/react";+import { useControlField, useField } from "@carbon/remix-validated-form";+import { forwardRef } from "react";++type FormBooleanProps = {+ name: string;+ label?: string;+ helperText?: string;+ description?: string;+ onChange?: (value: boolean) => void;+};++const Boolean = forwardRef<HTMLInputElement, FormBooleanProps>(+ ({ name, label, description, helperText, onChange, ...props }, ref) => {+ const { getInputProps, error } = useField(name);+ const [value, setValue] = useControlField<boolean>(name);++ return (+ <FormControl isInvalid={!!error} className="pt-2">+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <HStack>+ <Switch+ {...getInputProps()}+ checked={value}+ onCheckedChange={(checked) => {+ setValue(checked);+ onChange?.(checked);+ }}+ aria-label={label}+ {...props}+ />+ {description && (+ <p className="text-muted-foreground text-sm">{description}</p>+ )}+ </HStack>++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+ }+);++Boolean.displayName = "Boolean";++export default Boolean;diff --git a/apps/developers/app/components/Form/Combobox.tsx b/apps/developers/app/components/Form/Combobox.tsxnew file mode 100644index 0000000000..292e06bc6e--- /dev/null+++ b/apps/developers/app/components/Form/Combobox.tsx@@ -0,0 +1,76 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { Combobox as ComboboxBase } from "~/components";+import type { ComboboxProps as ComboboxBaseProps } from "~/components/Combobox";++export type ComboboxProps = Omit<ComboboxBaseProps, "onChange"> & {+ name: string;+ label?: string;+ isOptional?: boolean;+ helperText?: string;+ onChange?: (newValue: { value: string; label: string } | null) => void;+};++const Combobox = ({+ name,+ label,+ isOptional = false,+ helperText,+ ...props+}: ComboboxProps) => {+ const { getInputProps, error } = useField(name);+ const [value, setValue] = useControlField<string | undefined>(name);++ const onChange = (value: string) => {+ if (value) {+ props?.onChange?.(props.options.find((o) => o.value === value) ?? null);+ } else {+ props?.onChange?.(null);+ }+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && (+ <FormLabel htmlFor={name} isOptional={isOptional}>+ {label}+ </FormLabel>+ )}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={value}+ />+ <ComboboxBase+ {...props}+ value={value}+ onChange={(newValue) => {+ setValue(newValue ?? "");+ onChange(newValue ?? "");+ }}+ isClearable={isOptional && !props.isReadOnly}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++Combobox.displayName = "Combobox";++export default Combobox;diff --git a/apps/developers/app/components/Form/ComboboxControlled.tsx b/apps/developers/app/components/Form/ComboboxControlled.tsxnew file mode 100644index 0000000000..884a9ce897--- /dev/null+++ b/apps/developers/app/components/Form/ComboboxControlled.tsx@@ -0,0 +1,79 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";+import { useEffect } from "react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { Combobox as ComboboxBase } from "~/components";+import type { ComboboxProps as ComboboxBaseProps } from "~/components/Combobox";++export type ComboboxProps = Omit<ComboboxBaseProps, "onChange"> & {+ name: string;+ label?: string;+ helperText?: string;+ options: { value: string | number; label: string }[];+ onChange?: (newValue: { value: string; label: string } | null) => void;+};++const ComboboxControlled = ({+ name,+ label,+ helperText,+ options,+ ...props+}: ComboboxProps) => {+ const { getInputProps, error } = useField(name);+ const [controlValue, setControlValue] = useControlField<string | undefined>(+ name+ );++ useEffect(() => {+ setControlValue(props.value ?? "");+ }, [props.value, setControlValue]);++ const onChange = (value: string) => {+ if (value) {+ props?.onChange?.(options.find((o) => o.value === value) ?? null);+ } else {+ props?.onChange?.(null);+ }+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={controlValue}+ />+ <ComboboxBase+ {...props}+ options={options}+ value={controlValue}+ onChange={(newValue) => {+ setControlValue(newValue ?? "");+ onChange(newValue ?? "");+ }}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++ComboboxControlled.displayName = "ComboboxControlled";++export default ComboboxControlled;diff --git a/apps/developers/app/components/Form/CreatableCombobox.tsx b/apps/developers/app/components/Form/CreatableCombobox.tsxnew file mode 100644index 0000000000..f7a951d0ce--- /dev/null+++ b/apps/developers/app/components/Form/CreatableCombobox.tsx@@ -0,0 +1,82 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";+import { forwardRef, useEffect } from "react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { CreatableCombobox as CreatableComboboxBase } from "~/components";+import type { CreatableComboboxProps as CreatableComboboxBaseProps } from "~/components/CreateableCombobox";++export type CreatableComboboxProps = Omit<+ CreatableComboboxBaseProps,+ "onChange"+> & {+ name: string;+ label?: string;+ helperText?: string;+ isOptional?: boolean;+ onChange?: (newValue: { value: string; label: string } | null) => void;+};++const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(+ ({ name, label, helperText, isOptional = false, ...props }, ref) => {+ const { getInputProps, error } = useField(name);+ const [value, setValue] = useControlField<string | undefined>(name);++ useEffect(() => {+ if (props.value) setValue(props.value);+ }, [props.value, setValue]);++ const onChange = (value: string) => {+ if (value) {+ props?.onChange?.(props.options.find((o) => o.value === value) ?? null);+ } else {+ props?.onChange?.(null);+ }+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && (+ <FormLabel htmlFor={name} isOptional={isOptional}>+ {label}+ </FormLabel>+ )}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={value}+ />+ <CreatableComboboxBase+ ref={ref}+ {...props}+ value={value?.replace(/"/g, '\\"')}+ onChange={(newValue) => {+ setValue(newValue?.replace(/"/g, '\\"') ?? "");+ onChange(newValue?.replace(/"/g, '\\"') ?? "");+ }}+ isClearable={isOptional && !props.isReadOnly}+ label={label}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+ }+);++CreatableCombobox.displayName = "CreatableCombobox";++export default CreatableCombobox;diff --git a/apps/developers/app/components/Form/CreatableMultiSelect.tsx b/apps/developers/app/components/Form/CreatableMultiSelect.tsxnew file mode 100644index 0000000000..5514deee4c--- /dev/null+++ b/apps/developers/app/components/Form/CreatableMultiSelect.tsx@@ -0,0 +1,80 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";+import { forwardRef, useEffect } from "react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { CreatableMultiSelect as CreatableMultiSelectBase } from "~/components";+import type { CreatableMultiSelectProps as CreatableMultiSelectBaseProps } from "~/components/CreateableMultiSelect";++export type CreatableMultiSelectProps = Omit<+ CreatableMultiSelectBaseProps,+ "onChange" | "value"+> & {+ name: string;+ label?: string;+ helperText?: string;+ isOptional?: boolean;+ value?: string[];+ onChange?: (newValue: string[]) => void;+};++const CreatableMultiSelect = forwardRef<+ HTMLButtonElement,+ CreatableMultiSelectProps+>(({ name, label, helperText, isOptional = false, ...props }, ref) => {+ const { error } = useField(name);+ const [value, setValue] = useControlField<string[] | undefined>(name);++ useEffect(() => {+ if (props.value) setValue(props.value);+ }, [props.value, setValue]);++ const onChange = (value: string[]) => {+ setValue(value);+ props.onChange?.(value);+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && (+ <FormLabel htmlFor={name} isOptional={isOptional}>+ {label}+ </FormLabel>+ )}+ {(value ?? []).filter(Boolean).map((selection, index) => (+ <input+ key={`${name}[${index}]`}+ type="hidden"+ name={`${name}[${index}]`}+ value={selection}+ />+ ))}+ <CreatableMultiSelectBase+ ref={ref}+ {...props}+ value={(value ?? []).map((v) => v.replace(/"/g, '\\"'))}+ onChange={(newValue) => {+ setValue((newValue ?? []).map((v) => v.replace(/"/g, '\\"') ?? ""));+ onChange((newValue ?? []).map((v) => v.replace(/"/g, '\\"') ?? ""));+ }}+ isClearable={isOptional && !props.isReadOnly}+ label={label}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+});++CreatableMultiSelect.displayName = "CreatableMultiSelect";++export default CreatableMultiSelect;diff --git a/apps/developers/app/components/Form/DatePicker.tsx b/apps/developers/app/components/Form/DatePicker.tsxnew file mode 100644index 0000000000..8ef5c77ca1--- /dev/null+++ b/apps/developers/app/components/Form/DatePicker.tsx@@ -0,0 +1,40 @@+import {+ DatePicker as DatePickerBase,+ FormControl,+ FormErrorMessage,+ FormLabel,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import type { CalendarDate } from "@internationalized/date";+import { parseDate } from "@internationalized/date";+import { useState } from "react";++type DatePickerProps = { name: string; label?: string; isDisabled?: boolean };++const DatePicker = ({ name, label, isDisabled = false }: DatePickerProps) => {+ const { error, defaultValue, validate } = useField(name);+ const [date, setDate] = useState<CalendarDate | undefined>(+ defaultValue ? parseDate(defaultValue) : undefined+ );++ const onChange = (date: CalendarDate) => {+ setDate(date);+ validate();+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <input type="hidden" name={name} value={date?.toString()} />+ <DatePickerBase+ value={date}+ //@ts-ignore+ onChange={onChange}+ isDisabled={isDisabled}+ />+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+};++export default DatePicker;diff --git a/apps/developers/app/components/Form/Hidden.tsx b/apps/developers/app/components/Form/Hidden.tsxnew file mode 100644index 0000000000..a7e21bd6a4--- /dev/null+++ b/apps/developers/app/components/Form/Hidden.tsx@@ -0,0 +1,38 @@+import type { InputProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ Input as InputBase,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import { forwardRef } from "react";++type HiddenProps = InputProps & {+ name: string;+ value?: string | number;+};++const Hidden = forwardRef<HTMLInputElement, HiddenProps>(+ ({ name, value, ...rest }, ref) => {+ const { getInputProps, error } = useField(name);++ return (+ <FormControl isInvalid={!!error}>+ <InputBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ })}+ value={value}+ type="hidden"+ />+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Hidden.displayName = "Hidden";++export default Hidden;diff --git a/apps/developers/app/components/Form/Input.tsx b/apps/developers/app/components/Form/Input.tsxnew file mode 100644index 0000000000..cc0b295ddc--- /dev/null+++ b/apps/developers/app/components/Form/Input.tsx@@ -0,0 +1,69 @@+import type { InputProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ Input as InputBase,+ InputGroup,+ InputLeftAddon,+ InputRightAddon,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import { forwardRef } from "react";++type FormInputProps = InputProps & {+ name: string;+ label?: string;+ isOptional?: boolean;+ helperText?: string;+ prefix?: string;+ suffix?: string;+};++const Input = forwardRef<HTMLInputElement, FormInputProps>(+ (+ { name, label, isOptional = false, helperText, prefix, suffix, ...rest },+ ref+ ) => {+ const { getInputProps, error } = useField(name);++ return (+ <FormControl isInvalid={!!error}>+ {label && (+ <FormLabel htmlFor={name} isOptional={isOptional}>+ {label}+ </FormLabel>+ )}+ {prefix || suffix ? (+ <InputGroup>+ {prefix && <InputLeftAddon children={prefix} />}+ <InputBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ })}+ />+ {suffix && <InputRightAddon children={suffix} />}+ </InputGroup>+ ) : (+ <InputBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ })}+ />+ )}++ {helperText && <FormHelperText>{helperText}</FormHelperText>}+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Input.displayName = "Input";++export default Input;diff --git a/apps/developers/app/components/Form/InputControlled.tsx b/apps/developers/app/components/Form/InputControlled.tsxnew file mode 100644index 0000000000..6a8740f448--- /dev/null+++ b/apps/developers/app/components/Form/InputControlled.tsx@@ -0,0 +1,94 @@+import type { InputProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ Input as InputBase,+ InputGroup,+ InputLeftAddon,+ InputRightAddon,+} from "@carbon/react";+import { useControlField, useField } from "@carbon/remix-validated-form";+import type { ChangeEvent } from "react";+import { forwardRef, useEffect } from "react";++type FormInputControlledProps = Omit<InputProps, "value" | "onChange"> & {+ name: string;+ label?: string;+ isUppercase?: boolean;+ isRequired?: boolean;+ helperText?: string;+ prefix?: string;+ suffix?: string;+ value: string;+ onChange?: (newValue: string) => void;+};++const InputControlled = forwardRef<HTMLInputElement, FormInputControlledProps>(+ (+ {+ name,+ label,+ isRequired,+ helperText,+ prefix,+ suffix,+ value,+ className,+ onChange,+ isUppercase,+ ...rest+ },+ ref+ ) => {+ const { getInputProps, error } = useField(name);+ const [controlValue, setControlValue] = useControlField<string>(name);++ useEffect(() => {+ setControlValue(isUppercase ? uppercase(value) : value);+ }, [isUppercase, setControlValue, value]);++ const handleChange = (e: ChangeEvent<HTMLInputElement>) => {+ setControlValue(e.target.value);+ if (onChange && typeof onChange === "function") {+ onChange(isUppercase ? uppercase(e.target.value) : e.target.value);+ }+ };++ return (+ <FormControl+ isInvalid={!!error}+ isRequired={isRequired}+ className={className}+ >+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <InputGroup>+ {prefix && <InputLeftAddon children={prefix} />}+ <InputBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ // @ts-ignore+ value: controlValue,+ })}+ onChange={handleChange}+ value={controlValue}+ />+ {suffix && <InputRightAddon children={suffix} />}+ </InputGroup>+ {helperText && <FormHelperText>{helperText}</FormHelperText>}+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++function uppercase(value?: string) {+ return value?.toUpperCase() ?? "";+}++InputControlled.displayName = "InputControlled";++export default InputControlled;diff --git a/apps/developers/app/components/Form/MultiSelect.tsx b/apps/developers/app/components/Form/MultiSelect.tsxnew file mode 100644index 0000000000..7aff4386c4--- /dev/null+++ b/apps/developers/app/components/Form/MultiSelect.tsx@@ -0,0 +1,67 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { MultiSelect as MultiSelectBase } from "~/components";+import type { MultiSelectProps as MultiSelectBaseProps } from "~/components/MultiSelect";++export type MultiSelectProps = Omit<+ MultiSelectBaseProps,+ "onChange" | "value"+> & {+ name: string;+ label?: string;+ helperText?: string;+ onChange?: (newValue: { value: string; label: string }[]) => void;+};++const MultiSelect = ({+ name,+ label,+ helperText,+ ...props+}: MultiSelectProps) => {+ const { error } = useField(name);+ const [value, setValue] = useControlField<string[]>(name);++ const onChange = (value: string[]) => {+ props?.onChange?.(props.options.filter((o) => value.includes(o.value)));+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ {value.filter(Boolean).map((selection, index) => (+ <input+ key={`${name}[${index}]`}+ type="hidden"+ name={`${name}[${index}]`}+ value={selection}+ />+ ))}+ <MultiSelectBase+ {...props}+ value={value.filter(Boolean)}+ onChange={(newValue) => {+ setValue(newValue ?? "");+ onChange(newValue ?? "");+ }}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++MultiSelect.displayName = "MultiSelect";++export default MultiSelect;diff --git a/apps/developers/app/components/Form/Number.tsx b/apps/developers/app/components/Form/Number.tsxnew file mode 100644index 0000000000..9073c4d795--- /dev/null+++ b/apps/developers/app/components/Form/Number.tsx@@ -0,0 +1,62 @@+import type { NumberFieldProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ NumberDecrementStepper,+ NumberField,+ NumberIncrementStepper,+ NumberInput,+ NumberInputGroup,+ NumberInputStepper,+} from "@carbon/react";++import { useField } from "@carbon/remix-validated-form";+import { forwardRef } from "react";+import { LuChevronDown, LuChevronUp } from "react-icons/lu";++type FormNumberProps = NumberFieldProps & {+ name: string;+ label?: string;+ isRequired?: boolean;+ helperText?: string;+};++const Number = forwardRef<HTMLInputElement, FormNumberProps>(+ ({ name, label, isRequired, isReadOnly, helperText, ...rest }, ref) => {+ const { getInputProps, error } = useField(name);++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <NumberField+ {...getInputProps({+ id: name,+ ...rest,+ })}+ >+ <NumberInputGroup className="relative">+ <NumberInput isReadOnly={isReadOnly} />+ {!isReadOnly && (+ <NumberInputStepper>+ <NumberIncrementStepper>+ <LuChevronUp size="1em" strokeWidth="3" />+ </NumberIncrementStepper>+ <NumberDecrementStepper>+ <LuChevronDown size="1em" strokeWidth="3" />+ </NumberDecrementStepper>+ </NumberInputStepper>+ )}+ </NumberInputGroup>+ </NumberField>+ {helperText && <FormHelperText>{helperText}</FormHelperText>}+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Number.displayName = "Number";++export default Number;diff --git a/apps/developers/app/components/Form/NumberControlled.tsx b/apps/developers/app/components/Form/NumberControlled.tsxnew file mode 100644index 0000000000..0cf9523c7b--- /dev/null+++ b/apps/developers/app/components/Form/NumberControlled.tsx@@ -0,0 +1,88 @@+import type { NumberFieldProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ NumberDecrementStepper,+ NumberField,+ NumberIncrementStepper,+ NumberInput,+ NumberInputGroup,+ NumberInputStepper,+} from "@carbon/react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { forwardRef, useEffect } from "react";+import { LuChevronDown, LuChevronUp } from "react-icons/lu";++type FormNumberProps = NumberFieldProps & {+ name: string;+ label?: string;+ isRequired?: boolean;+ helperText?: string;+ value: number;+ onChange?: (newValue: number) => void;+};++const Number = forwardRef<HTMLInputElement, FormNumberProps>(+ (+ {+ name,+ label,+ isRequired,+ isReadOnly,+ helperText,+ value,+ onChange,+ ...rest+ },+ ref+ ) => {+ const { getInputProps, error } = useField(name);+ const [controlValue, setControlValue] = useControlField<number>(name);++ useEffect(() => {+ setControlValue(value);+ }, [setControlValue, value]);++ const handleChange = (newValue: number) => {+ setControlValue(newValue);+ onChange?.(newValue);+ };++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <NumberField+ {...getInputProps({+ id: name,+ ...rest,+ })}+ value={controlValue}+ onChange={handleChange}+ >+ <NumberInputGroup className="relative">+ <NumberInput isReadOnly={isReadOnly} />+ {!isReadOnly && (+ <NumberInputStepper>+ <NumberIncrementStepper>+ <LuChevronUp size="1em" strokeWidth="3" />+ </NumberIncrementStepper>+ <NumberDecrementStepper>+ <LuChevronDown size="1em" strokeWidth="3" />+ </NumberDecrementStepper>+ </NumberInputStepper>+ )}+ </NumberInputGroup>+ </NumberField>+ {helperText && <FormHelperText>{helperText}</FormHelperText>}+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Number.displayName = "Number";++export default Number;diff --git a/apps/developers/app/components/Form/Password.tsx b/apps/developers/app/components/Form/Password.tsxnew file mode 100644index 0000000000..f6817dd9d1--- /dev/null+++ b/apps/developers/app/components/Form/Password.tsx@@ -0,0 +1,56 @@+import type { InputProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormLabel,+ IconButton,+ Input,+ InputGroup,+ InputRightElement,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import { forwardRef, useState } from "react";+import { BiHide, BiShowAlt } from "react-icons/bi";++type FormPasswordProps = InputProps & {+ name: string;+ label?: string;+ isRequired?: boolean;+};++const Password = forwardRef<HTMLInputElement, FormPasswordProps>(+ ({ name, label, isRequired, ...rest }, ref) => {+ const { getInputProps, error } = useField(name);+ const [passwordVisible, setPasswordVisible] = useState(false);++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <InputGroup>+ <Input+ {...getInputProps({+ id: name,+ ...rest,+ })}+ ref={ref}+ type={passwordVisible ? "text" : "password"}+ />+ <InputRightElement className="w-[2.75rem]">+ <IconButton+ aria-label={passwordVisible ? "Show password" : "Hide password"}+ icon={passwordVisible ? <BiShowAlt /> : <BiHide />}+ variant="ghost"+ tabIndex={-1}+ onClick={() => setPasswordVisible(!passwordVisible)}+ />+ </InputRightElement>+ </InputGroup>+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++Password.displayName = "Password";++export default Password;diff --git a/apps/developers/app/components/Form/Radios.tsx b/apps/developers/app/components/Form/Radios.tsxnew file mode 100644index 0000000000..75a17eaf5a--- /dev/null+++ b/apps/developers/app/components/Form/Radios.tsx@@ -0,0 +1,50 @@+import {+ FormControl,+ FormErrorMessage,+ FormLabel,+ RadioGroup,+ RadioGroupItem,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import { useId } from "react";++type RadiosProps = {+ name: string;+ label?: string;+ options: { label: string; value: string }[];+ orientation?: "horizontal" | "vertical";+};++const Radios = ({+ name,+ label,+ options,+ orientation = "vertical",+}: RadiosProps) => {+ const { getInputProps, error } = useField(name);+ const id = useId();++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <RadioGroup+ {...getInputProps({+ // @ts-ignore+ id: name,+ })}+ name={name}+ orientation={orientation}+ >+ {options.map(({ label, value }) => (+ <div key={value} className="flex items-center space-x-2">+ <RadioGroupItem value={value} id={`${id}:${value}`} />+ <label htmlFor={`${id}:${value}`}>{label}</label>+ </div>+ ))}+ </RadioGroup>+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+};++export default Radios;diff --git a/apps/developers/app/components/Form/Select.tsx b/apps/developers/app/components/Form/Select.tsxnew file mode 100644index 0000000000..cdb1166473--- /dev/null+++ b/apps/developers/app/components/Form/Select.tsx@@ -0,0 +1,76 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { Select as SelectBase } from "~/components";+import type { SelectProps as SelectBaseProps } from "~/components/Select";++export type SelectProps = Omit<SelectBaseProps, "onChange"> & {+ name: string;+ label?: string;+ helperText?: string;+ isOptional?: boolean;+ onChange?: (newValue: { value: string; label: string } | null) => void;+};++const Select = ({+ name,+ label,+ helperText,+ isOptional = false,+ ...props+}: SelectProps) => {+ const { getInputProps, error } = useField(name);+ const [value, setValue] = useControlField<string | undefined>(name);++ const onChange = (value: string) => {+ if (value) {+ props?.onChange?.(props.options.find((o) => o.value === value) ?? null);+ } else {+ props?.onChange?.(null);+ }+ };++ return (+ <FormControl isInvalid={!!error} className={props.className}>+ {label && (+ <FormLabel htmlFor={name} isOptional={isOptional}>+ {label}+ </FormLabel>+ )}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={value ?? undefined}+ />+ <SelectBase+ {...props}+ value={value}+ onChange={(newValue) => {+ setValue(newValue ?? "");+ onChange(newValue ?? "");+ }}+ isClearable={isOptional && !props.isReadOnly}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++Select.displayName = "Select";++export default Select;diff --git a/apps/developers/app/components/Form/SelectControlled.tsx b/apps/developers/app/components/Form/SelectControlled.tsxnew file mode 100644index 0000000000..dbfbcb4e4b--- /dev/null+++ b/apps/developers/app/components/Form/SelectControlled.tsx@@ -0,0 +1,79 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+} from "@carbon/react";+import { useEffect } from "react";++import { useControlField, useField } from "@carbon/remix-validated-form";+import { Select as SelectBase } from "~/components";+import type { SelectProps as SelectBaseProps } from "~/components/Select";++export type SelectProps = Omit<SelectBaseProps, "onChange"> & {+ name: string;+ label?: string;+ helperText?: string;+ options: { value: string | number; label: string }[];+ onChange?: (newValue: { value: string; label: string } | null) => void;+};++const SelectControlled = ({+ name,+ label,+ helperText,+ options,+ ...props+}: SelectProps) => {+ const { getInputProps, error } = useField(name);+ const [controlValue, setControlValue] = useControlField<string | undefined>(+ name+ );++ useEffect(() => {+ setControlValue(props.value ?? "");+ }, [props.value, setControlValue]);++ const onChange = (value: string) => {+ if (value) {+ props?.onChange?.(options.find((o) => o.value === value) ?? null);+ } else {+ props?.onChange?.(null);+ }+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={controlValue}+ />+ <SelectBase+ {...props}+ options={options}+ value={controlValue}+ onChange={(newValue) => {+ setControlValue(newValue ?? "");+ onChange(newValue ?? "");+ }}+ className="w-full"+ />++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++SelectControlled.displayName = "SelectControlled";++export default SelectControlled;diff --git a/apps/developers/app/components/Form/Submit.tsx b/apps/developers/app/components/Form/Submit.tsxnew file mode 100644index 0000000000..aea038c9dd--- /dev/null+++ b/apps/developers/app/components/Form/Submit.tsx@@ -0,0 +1,30 @@+import type { ButtonProps } from "@carbon/react";+import { Button } from "@carbon/react";+import { useIsSubmitting } from "@carbon/remix-validated-form";+import { useNavigation } from "@remix-run/react";+import { forwardRef } from "react";++type SubmitProps = ButtonProps & { formId?: string; text?: string };++export const Submit = forwardRef<HTMLButtonElement, SubmitProps>(+ ({ formId, children, isDisabled, ...props }, ref) => {+ const isSubmitting = useIsSubmitting(formId);+ const transition = useNavigation();+ const isIdle = transition.state === "idle";+ return (+ <Button+ ref={ref}+ form={formId}+ type="submit"+ disabled={isDisabled || isSubmitting}+ isLoading={isSubmitting}+ isDisabled={isDisabled || isSubmitting || !isIdle}+ {...props}+ >+ {children}+ </Button>+ );+ }+);+Submit.displayName = "Submit";+export default Submit;diff --git a/apps/developers/app/components/Form/Textarea.tsx b/apps/developers/app/components/Form/Textarea.tsxnew file mode 100644index 0000000000..6928a6b729--- /dev/null+++ b/apps/developers/app/components/Form/Textarea.tsx@@ -0,0 +1,55 @@+import type { TextareaProps } from "@carbon/react";+import {+ FormControl,+ FormErrorMessage,+ FormLabel,+ Textarea as TextAreaBase,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import type { ChangeEvent } from "react";+import { forwardRef, useState } from "react";++type FormTextArea = TextareaProps & {+ name: string;+ label?: string;+ characterLimit?: number;+ isRequired?: boolean;+};++const TextArea = forwardRef<HTMLTextAreaElement, FormTextArea>(+ ({ name, label, characterLimit, isRequired, ...rest }, ref) => {+ const { getInputProps, error, defaultValue } = useField(name);+ const [characterCount, setCharacterCount] = useState(+ defaultValue?.length ?? 0+ );++ const onChange = (e: ChangeEvent<HTMLTextAreaElement>) => {+ if (characterLimit) setCharacterCount(e.target.value.length);+ };++ return (+ <FormControl isInvalid={!!error} isRequired={isRequired}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <TextAreaBase+ ref={ref}+ {...getInputProps({+ id: name,+ ...rest,+ })}+ maxLength={characterLimit}+ onChange={onChange}+ />+ {characterLimit && (+ <p className="text-sm text-muted-foreground">+ {characterCount} of {characterLimit}+ </p>+ )}+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+ }+);++TextArea.displayName = "TextArea";++export default TextArea;diff --git a/apps/developers/app/components/Form/TimePicker.tsx b/apps/developers/app/components/Form/TimePicker.tsxnew file mode 100644index 0000000000..dd8dfebd80--- /dev/null+++ b/apps/developers/app/components/Form/TimePicker.tsx@@ -0,0 +1,51 @@+import {+ FormControl,+ FormErrorMessage,+ FormLabel,+ TimePicker as TimePickerBase,+} from "@carbon/react";+import { useField } from "@carbon/remix-validated-form";+import type {+ CalendarDateTime,+ Time,+ ZonedDateTime,+} from "@internationalized/date";+import { parseTime } from "@internationalized/date";+import { useState } from "react";++type TimePickerProps = {+ name: string;+ label?: string;+ minValue?: TimeValue;+ maxValue?: TimeValue;+ onChange?: (date: TimeValue) => void;+};+type TimeValue = Time | CalendarDateTime | ZonedDateTime;++const TimePicker = ({ name, label, onChange }: TimePickerProps) => {+ const { error, defaultValue, validate } = useField(name);+ const [date, setDate] = useState<TimeValue | null>(+ defaultValue ? parseTime(defaultValue) : null+ );++ const handleChange = (date: TimeValue) => {+ setDate(date);+ validate();+ onChange?.(date);+ };++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <input type="hidden" name={name} value={date?.toString()} />+ <TimePickerBase+ value={date ?? undefined}+ //@ts-ignore+ onChange={handleChange}+ />+ {error && <FormErrorMessage>{error}</FormErrorMessage>}+ </FormControl>+ );+};++export default TimePicker;diff --git a/apps/developers/app/components/Form/Timezone.tsx b/apps/developers/app/components/Form/Timezone.tsxnew file mode 100644index 0000000000..8de7f777f3--- /dev/null+++ b/apps/developers/app/components/Form/Timezone.tsx@@ -0,0 +1,94 @@+import {+ FormControl,+ FormErrorMessage,+ FormHelperText,+ FormLabel,+ HStack,+ IconButton,+ Select as SelectBase,+ SelectContent,+ SelectGroup,+ SelectItem,+ SelectLabel,+ SelectTrigger,+ SelectValue,+} from "@carbon/react";+import { useControlField, useField } from "@carbon/remix-validated-form";+import { timezones } from "@carbon/utils";+import { MdClose } from "react-icons/md";+import type { SelectProps } from "./Select";++type TimezoneProps = Omit<SelectProps, "options"> & {+ size?: "sm" | "md" | "lg";+};++const Timezone = ({+ name,+ label,+ helperText,+ isReadOnly,+ isClearable,+ placeholder,+ size,+ ...props+}: TimezoneProps) => {+ const { getInputProps, error } = useField(name);+ const [value, setValue] = useControlField<string | undefined>(name);++ return (+ <FormControl isInvalid={!!error}>+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}+ <input+ {...getInputProps({+ id: name,+ })}+ type="hidden"+ name={name}+ id={name}+ value={value ?? undefined}+ />+ <HStack spacing={1}>+ <SelectBase+ value={value}+ onValueChange={(value) => setValue(value)}+ disabled={isReadOnly}+ >+ <SelectTrigger size={size} className="min-w-[160px]">+ <SelectValue placeholder={placeholder} />+ </SelectTrigger>+ <SelectContent>+ {timezones.map(({ label, options }) => (+ <SelectGroup key={label}>+ <SelectLabel>{label}</SelectLabel>+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectGroup>+ ))}+ </SelectContent>+ </SelectBase>+ {isClearable && !isReadOnly && value && (+ <IconButton+ variant="ghost"+ aria-label="Clear"+ icon={<MdClose />}+ onClick={() => setValue("")}+ size={size === "sm" ? "md" : size}+ />+ )}+ </HStack>++ {error ? (+ <FormErrorMessage>{error}</FormErrorMessage>+ ) : (+ helperText && <FormHelperText>{helperText}</FormHelperText>+ )}+ </FormControl>+ );+};++Timezone.displayName = "Timezone";++export default Timezone;diff --git a/apps/developers/app/components/Form/index.ts b/apps/developers/app/components/Form/index.tsnew file mode 100644index 0000000000..8c5d83dbb4--- /dev/null+++ b/apps/developers/app/components/Form/index.ts@@ -0,0 +1,43 @@+import Array from "./Array";+import ArrayNumeric from "./ArrayNumeric";+import Boolean from "./Boolean";+import Combobox from "./Combobox";+import ComboboxControlled from "./ComboboxControlled";+import CreatableCombobox from "./CreatableCombobox";+import DatePicker from "./DatePicker";+import Hidden from "./Hidden";+import Input from "./Input";+import InputControlled from "./InputControlled";+import Number from "./Number";+import NumberControlled from "./NumberControlled";+import Password from "./Password";+import Radios from "./Radios";+import Select from "./Select";+import SelectControlled from "./SelectControlled";+import Submit from "./Submit";+import TextArea from "./Textarea";+import TimePicker from "./TimePicker";+import Timezone from "./Timezone";++export {+ Array,+ ArrayNumeric,+ Boolean,+ Combobox,+ ComboboxControlled,+ CreatableCombobox,+ DatePicker,+ Hidden,+ Input,+ InputControlled,+ Number,+ NumberControlled,+ Password,+ Radios,+ Select,+ SelectControlled,+ Submit,+ TextArea,+ TimePicker,+ Timezone,+};diff --git a/apps/developers/app/components/Hyperlink.tsx b/apps/developers/app/components/Hyperlink.tsxnew file mode 100644index 0000000000..8989c448b1--- /dev/null+++ b/apps/developers/app/components/Hyperlink.tsx@@ -0,0 +1,37 @@+import { cn } from "@carbon/react";+import type { LinkProps } from "@remix-run/react";+import { Link } from "@remix-run/react";+import type { ComponentProps, PropsWithChildren } from "react";++const Hyperlink = ({+ children,+ className,+ ...props+}:+ | PropsWithChildren<LinkProps>+ | PropsWithChildren<ComponentProps<"span">>) => {+ return "to" in props && props.to ? (+ <Link+ prefetch="intent"+ className={cn(+ "text-foreground hover:underline cursor-pointer",+ className+ )}+ {...props}+ >+ {children}+ </Link>+ ) : (+ <span+ className={cn(+ "text-foreground hover:underline cursor-pointer",+ className+ )}+ {...props}+ >+ {children}+ </span>+ );+};++export default Hyperlink;diff --git a/apps/developers/app/components/Layout/Background.tsx b/apps/developers/app/components/Layout/Background.tsxnew file mode 100644index 0000000000..4b422bc053--- /dev/null+++ b/apps/developers/app/components/Layout/Background.tsx@@ -0,0 +1,9 @@+const Background = () => {+ return (+ <div className="background">+ <div className="gradient dark:hidden" />+ </div>+ );+};++export default Background;diff --git a/apps/developers/app/components/Layout/index.ts b/apps/developers/app/components/Layout/index.tsnew file mode 100644index 0000000000..8afbe8602b--- /dev/null+++ b/apps/developers/app/components/Layout/index.ts@@ -0,0 +1,3 @@+import Topbar from "../Topbar";+import Background from "./Background";+export { Background, Topbar };diff --git a/apps/developers/app/components/MultiSelect.tsx b/apps/developers/app/components/MultiSelect.tsxnew file mode 100644index 0000000000..44f02c0ea0--- /dev/null+++ b/apps/developers/app/components/MultiSelect.tsx@@ -0,0 +1,150 @@+import {+ Badge,+ BadgeCloseButton,+ Button,+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ Popover,+ PopoverContent,+ PopoverTrigger,+ cn,+ multiSelectTriggerVariants,+} from "@carbon/react";+import type { ComponentPropsWithoutRef } from "react";+import { forwardRef, useId, useState } from "react";+import { RxCheck, RxMagnifyingGlass } from "react-icons/rx";++export type MultiSelectProps = Omit<+ ComponentPropsWithoutRef<"button">,+ "onChange" | "value"+> & {+ size?: "sm" | "md" | "lg";+ value: string[];+ options: {+ label: string;+ value: string;+ }[];+ isReadOnly?: boolean;+ placeholder?: string;+ onChange: (selected: string[]) => void;+};++const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(+ (+ {+ size,+ value,+ options,+ isReadOnly,+ placeholder,+ onChange,+ className,+ ...props+ },+ ref+ ) => {+ const [open, setOpen] = useState(false);+ const id = useId();++ const handleUnselect = (item: string) => {+ onChange(value.filter((i) => i !== item));+ };++ const hasSelections = value.length > 0;++ return (+ <Popover>+ <PopoverTrigger asChild>+ <Button+ aria-controls={id}+ aria-expanded={open}+ role="combobox"+ tabIndex={0}+ variant="secondary"+ className={cn(+ multiSelectTriggerVariants({ size, hasSelections }),+ "bg-transparent px-2",+ className+ )}+ onClick={() => setOpen(!open)}+ onKeyDown={() => setOpen(!open)}+ asChild+ >+ <div>+ {hasSelections ? (+ <div className="flex gap-1 flex-wrap">+ {value.map((item) => (+ <Badge+ key={item}+ variant="secondary"+ onClick={() => handleUnselect(item)}+ >+ {options.find((option) => option.value === item)?.label}+ <BadgeCloseButton+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ handleUnselect(item);+ }+ }}+ onMouseDown={(e) => {+ e.preventDefault();+ e.stopPropagation();+ }}+ onClick={(e) => {+ e.preventDefault();+ e.stopPropagation();+ handleUnselect(item);+ }}+ />+ </Badge>+ ))}+ </div>+ ) : (+ <span className="text-muted-foreground">+ {placeholder ?? "Select"}+ </span>+ )}++ <RxMagnifyingGlass className="h-4 w-4 shrink-0 opacity-50" />+ </div>+ </Button>+ </PopoverTrigger>+ <PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0">+ <Command>+ <CommandInput placeholder="Search..." className="h-9" />+ <CommandEmpty>No option found.</CommandEmpty>+ <CommandGroup className="max-h-64 overflow-auto">+ {options.map((option) => (+ <CommandItem+ key={option.value}+ onSelect={() => {+ onChange(+ value.includes(option.value)+ ? value.filter((item) => item !== option.value)+ : [...value, option.value]+ );+ setOpen(true);+ }}+ >+ <RxCheck+ className={cn(+ "mr-2 h-4 w-4",+ value.includes(option.value) ? "opacity-100" : "opacity-0"+ )}+ />+ {option.label}+ </CommandItem>+ ))}+ </CommandGroup>+ </Command>+ </PopoverContent>+ </Popover>+ );+ }+);+MultiSelect.displayName = "MultiSelect";++export default MultiSelect;diff --git a/apps/developers/app/components/Navigation/IconSidebar.tsx b/apps/developers/app/components/Navigation/IconSidebar.tsxnew file mode 100644index 0000000000..7c3686b9b9--- /dev/null+++ b/apps/developers/app/components/Navigation/IconSidebar.tsx@@ -0,0 +1,163 @@+import { Button, VStack, cn, useDisclosure } from "@carbon/react";+import { Link, useMatches } from "@remix-run/react";+import { noop } from "@tanstack/react-table";+import type { AnchorHTMLAttributes } from "react";+import { forwardRef } from "react";+import type { IconType } from "react-icons";+import { BsFillHexagonFill } from "react-icons/bs";+import { z } from "zod";+import { useOptimisticLocation, useUser } from "~/hooks";++export const ModuleHandle = z.object({+ module: z.string(),+});++type NavLink = {+ to: string;+ icon: IconType;+ name: string;+};++const links: NavLink[] = [];++const IconSidebar = () => {+ const { company } = useUser();++ const navigationPanel = useDisclosure();+ const location = useOptimisticLocation();+ const currentModule = getModule(location.pathname);++ const matchedModules = useMatches().reduce((acc, match) => {+ if (match.handle) {+ const result = ModuleHandle.safeParse(match.handle);+ if (result.success) {+ acc.add(result.data.module);+ }+ }++ return acc;+ }, new Set<string>());++ return (+ <div className="w-14 h-full flex-col z-50 hidden sm:flex">+ <nav+ data-state={navigationPanel.isOpen ? "expanded" : "collapsed"}+ className={cn(+ "bg-background group py-2 z-10 h-full w-14 data-[state=expanded]:w-[13rem]",+ "border-r border-border data-[state=expanded]:shadow-xl",+ "transition-width duration-200",+ "hide-scrollbar flex flex-col justify-between overflow-y-auto"+ )}+ onMouseEnter={navigationPanel.onOpen}+ onMouseLeave={navigationPanel.onClose}+ >+ <VStack+ spacing={1}+ className="flex flex-col justify-between h-full px-2"+ >+ <VStack spacing={1}>+ <Button isIcon asChild variant="ghost" size="lg">+ <Link to="/">+ {company?.logo ? (+ <img+ src={company.logo}+ alt={`${company.name} logo`}+ className="w-full h-auto rounded"+ />+ ) : (+ <BsFillHexagonFill />+ )}+ </Link>+ </Button>+ {links.map((link) => {+ const m = getModule(link.to);++ const moduleMatches = matchedModules.has(m);++ const isActive = currentModule === m || moduleMatches;+ return (+ <NavigationIconLink+ key={link.name}+ link={link}+ isActive={isActive}+ isOpen={navigationPanel.isOpen}+ onClick={navigationPanel.onClose}+ />+ );+ })}+ </VStack>+ </VStack>+ </nav>+ </div>+ );+};++interface NavigationIconButtonProps+ extends AnchorHTMLAttributes<HTMLAnchorElement> {+ link: NavLink;+ isActive?: boolean;+ isOpen?: boolean;+}++const NavigationIconLink = forwardRef<+ HTMLAnchorElement,+ NavigationIconButtonProps+>(+ (+ { link, isActive = false, isOpen = false, onClick = noop, ...props },+ ref+ ) => {+ const iconClasses = [+ "absolute left-3 top-3 flex rounded-md items-center items-center justify-center", // Layout+ ];++ const classes = [+ "relative",+ "h-10 w-10 group-data-[state=expanded]:w-full",+ "transition-all duration-200",+ "flex items-center rounded-md",+ "group-data-[state=collapsed]:justify-center",+ "group-data-[state=expanded]:-space-x-2",+ "hover:bg-active/80 hover:text-active-foreground",+ `${+ isActive+ ? "bg-active text-active-foreground shadow-sm hover:text-active-foreground hover:bg-active/90"+ : "hover:text-active-foreground"+ }`,+ "group/item",+ ];++ return (+ <Link+ role="button"+ aria-current={isActive}+ ref={ref}+ to={link.to}+ {...props}+ onClick={onClick}+ className={cn(classes, props.className)}+ prefetch="intent"+ >+ <link.icon className={cn(...iconClasses)} />++ <span+ aria-hidden={isOpen || undefined}+ className={cn(+ "min-w-[128px] text-sm",+ "absolute left-7 group-data-[state=expanded]:left-12",+ "opacity-0 group-data-[state=expanded]:opacity-100"+ )}+ >+ {link.name}+ </span>+ </Link>+ );+ }+);+NavigationIconLink.displayName = "NavigationIconLink";++export default IconSidebar;++function getModule(link: string) {+ return link.split("/")?.[2];+}diff --git a/apps/developers/app/components/Navigation/index.ts b/apps/developers/app/components/Navigation/index.tsnew file mode 100644index 0000000000..06570f64f1--- /dev/null+++ b/apps/developers/app/components/Navigation/index.ts@@ -0,0 +1,3 @@+import IconSidebar from "./IconSidebar";++export { IconSidebar };diff --git a/apps/developers/app/components/OperatingSystem.tsx b/apps/developers/app/components/OperatingSystem.tsxnew file mode 100644index 0000000000..374dbdfc84--- /dev/null+++ b/apps/developers/app/components/OperatingSystem.tsx@@ -0,0 +1,33 @@+import type { ReactNode } from "react";+import { createContext, useContext } from "react";++export type OperatingSystemPlatform = "mac" | "windows";++type OperatingSystemContext = {+ platform: OperatingSystemPlatform;+};++type OperatingSystemContextProviderProps = {+ platform: OperatingSystemPlatform;+ children: ReactNode;+};++const Context = createContext<OperatingSystemContext | null>(null);++export const OperatingSystemContextProvider = ({+ platform,+ children,+}: OperatingSystemContextProviderProps) => {+ return <Context.Provider value={{ platform }}>{children}</Context.Provider>;+};++const throwIfNoProvider = () => {+ throw new Error(+ "Please wrap your application in an OperatingSystemContextProvider."+ );+};++export const useOperatingSystem = () => {+ const { platform } = useContext(Context) ?? throwIfNoProvider();+ return { platform };+};diff --git a/apps/developers/app/components/Select.tsx b/apps/developers/app/components/Select.tsxnew file mode 100644index 0000000000..2f790ad962--- /dev/null+++ b/apps/developers/app/components/Select.tsx@@ -0,0 +1,83 @@+import {+ HStack,+ IconButton,+ Select as SelectBase,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@carbon/react";+import type { ComponentPropsWithoutRef } from "react";+import { forwardRef } from "react";+import { MdClose } from "react-icons/md";++export type SelectProps = Omit<+ ComponentPropsWithoutRef<"button">,+ "onChange"+> & {+ size?: "sm" | "md" | "lg";+ value?: string;+ options: {+ label: string;+ value: string;+ }[];+ isClearable?: boolean;+ isReadOnly?: boolean;+ placeholder?: string;+ onChange: (selected: string) => void;+};++const Select = forwardRef<HTMLButtonElement, SelectProps>(+ (+ {+ size,+ value,+ options,+ isClearable,+ isReadOnly,+ placeholder,+ onChange,+ ...props+ },+ ref+ ) => {+ return (+ <HStack spacing={1}>+ <SelectBase+ value={value}+ onValueChange={(value) => onChange(value)}+ disabled={isReadOnly}+ >+ <SelectTrigger+ ref={ref}+ size={size}+ // isReadOnly={isReadOnly}+ {...props}+ className="min-w-[160px]"+ >+ <SelectValue placeholder={placeholder} />+ </SelectTrigger>+ <SelectContent>+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </SelectBase>+ {isClearable && !isReadOnly && value && (+ <IconButton+ variant="ghost"+ aria-label="Clear"+ icon={<MdClose />}+ onClick={() => onChange("")}+ size={size === "sm" ? "md" : size}+ />+ )}+ </HStack>+ );+ }+);+Select.displayName = "Select";++export default Select;diff --git a/apps/developers/app/components/ShortcutKey.tsx b/apps/developers/app/components/ShortcutKey.tsxnew file mode 100644index 0000000000..16f6e6d2e8--- /dev/null+++ b/apps/developers/app/components/ShortcutKey.tsx@@ -0,0 +1,83 @@+import { cn } from "@carbon/react";+import { Fragment } from "react";+import {+ HiChevronDown,+ HiChevronLeft,+ HiChevronRight,+ HiChevronUp,+} from "react-icons/hi2";+import type { Modifier, ShortcutDefinition } from "~/hooks/useShortcutKeys";+import { useOperatingSystem } from "./OperatingSystem";++export const variants = {+ small:+ "text-[0.6rem] font-medium min-w-[17px] rounded-[2px] px-1 ml-1 -mr-0.5 grid place-content-center border border-dimmed/40 text-text-dimmed group-hover:text-text-bright/80 group-hover:border-dimmed/60 transition uppercase",+ medium:+ "text-[0.75rem] font-medium min-w-[17px] rounded-[2px] px-1 ml-1 -mr-0.5 grid place-content-center border border-dimmed/40 text-text-dimmed group-hover:text-text-bright/80 group-hover:border-dimmed/60 transition uppercase",+};++export type ShortcutKeyVariant = keyof typeof variants;++type ShortcutKeyProps = {+ shortcut: ShortcutDefinition;+ variant: ShortcutKeyVariant;+ className?: string;+};++export const ShortcutKey = ({+ shortcut,+ variant,+ className,+}: ShortcutKeyProps) => {+ const { platform } = useOperatingSystem();+ const isMac = platform === "mac";+ let relevantShortcut =+ "mac" in shortcut ? (isMac ? shortcut.mac : shortcut.windows) : shortcut;+ const modifiers = relevantShortcut.modifiers ?? [];+ const character = keyString(relevantShortcut.key, isMac, variant);++ return (+ <span className={cn(variants[variant], className)}>+ {modifiers.map((k) => (+ <Fragment key={k}>{modifierString(k, isMac)}</Fragment>+ ))}+ {character}+ </span>+ );+};++function keyString(key: String, isMac: boolean, size: "small" | "medium") {+ key = key.toLowerCase();++ const className = size === "small" ? "w-2.5 h-4" : "w-3 h-5";++ switch (key) {+ case "enter":+ return isMac ? "↵" : key;+ case "arrowdown":+ return <HiChevronDown className={className} />;+ case "arrowup":+ return <HiChevronUp className={className} />;+ case "arrowleft":+ return <HiChevronLeft className={className} />;+ case "arrowright":+ return <HiChevronRight className={className} />;+ default:+ return key;+ }+}++function modifierString(modifier: Modifier, isMac: boolean) {+ switch (modifier) {+ case "alt":+ return isMac ? "⌥" : "Alt+";+ case "ctrl":+ return isMac ? "⌃" : "Ctrl+";+ case "meta":+ return isMac ? "⌘" : "⊞+";+ case "shift":+ return isMac ? "⇧" : "Shift+";+ case "mod":+ return isMac ? "⌘" : "Ctrl+";+ }+}diff --git a/apps/developers/app/components/Topbar/AvatarMenu.tsx b/apps/developers/app/components/Topbar/AvatarMenu.tsxnew file mode 100644index 0000000000..5ad274418d--- /dev/null+++ b/apps/developers/app/components/Topbar/AvatarMenu.tsx@@ -0,0 +1,42 @@+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@carbon/react";+import { Form } from "@remix-run/react";+import { LuLogOut } from "react-icons/lu";+import { Avatar } from "~/components";+import { useUser } from "~/hooks";+import { path } from "~/utils/path";++const AvatarMenu = () => {+ const user = useUser();+ const name = `${user.firstName} ${user.lastName}`;++ return (+ <DropdownMenu>+ <DropdownMenuTrigger className="outline-none focus-visible:outline-none">+ <Avatar path={user.avatarUrl} name={name} />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-56">+ <DropdownMenuLabel>Signed in as {name}</DropdownMenuLabel>+ <DropdownMenuSeparator />++ <Form method="post" action={path.to.logout}>+ <DropdownMenuItem asChild>+ <button type="submit" className="w-full">+ <DropdownMenuIcon icon={<LuLogOut />} />+ <span>Sign Out</span>+ </button>+ </DropdownMenuItem>+ </Form>+ </DropdownMenuContent>+ </DropdownMenu>+ );+};++export default AvatarMenu;diff --git a/apps/developers/app/components/Topbar/ModeSwitcher.tsx b/apps/developers/app/components/Topbar/ModeSwitcher.tsxnew file mode 100644index 0000000000..b7ea337ed7--- /dev/null+++ b/apps/developers/app/components/Topbar/ModeSwitcher.tsx@@ -0,0 +1,40 @@+import { IconButton } from "@carbon/react";+import { useFetcher } from "@remix-run/react";+import { BiLaptop, BiMoon, BiSun } from "react-icons/bi";+import { useMode } from "~/hooks/useMode";+import type { action } from "~/root";+import { path } from "~/utils/path";++const ModeSwitcher = () => {+ const mode = useMode();+ const nextMode = mode === "dark" ? "light" : "dark";+ const modeLabel = {+ light: <BiSun />,+ dark: <BiMoon />,+ system: <BiLaptop />,+ };++ const fetcher = useFetcher<typeof action>();++ return (+ <fetcher.Form+ action={path.to.root}+ method="post"+ onSubmit={() => {+ document.body.removeAttribute("style");+ }}+ className="hidden sm:block"+ >+ <input type="hidden" name="mode" value={nextMode} />++ <IconButton+ icon={modeLabel[nextMode]}+ aria-label="Light Mode"+ variant="ghost"+ type="submit"+ />+ </fetcher.Form>+ );+};++export default ModeSwitcher;diff --git a/apps/developers/app/components/Topbar/Topbar.tsx b/apps/developers/app/components/Topbar/Topbar.tsxnew file mode 100644index 0000000000..edc853cde0--- /dev/null+++ b/apps/developers/app/components/Topbar/Topbar.tsx@@ -0,0 +1,19 @@+import { HStack } from "@carbon/react";++import AvatarMenu from "./AvatarMenu";+import ModeSwitcher from "./ModeSwitcher";++const Topbar = () => {+ return (+ <div className="flex bg-background text-foreground border-b border-border px-4 top-0 sticky z-10 space-x-4 justify-between items-center">+ <span className="font-mono font-bold uppercase">Developers</span>++ <HStack spacing={2} className="justify-end py-2">+ <ModeSwitcher />+ <AvatarMenu />+ </HStack>+ </div>+ );+};++export default Topbar;diff --git a/apps/developers/app/components/Topbar/index.ts b/apps/developers/app/components/Topbar/index.tsnew file mode 100644index 0000000000..65efcbb275--- /dev/null+++ b/apps/developers/app/components/Topbar/index.ts@@ -0,0 +1,5 @@+import AvatarMenu from "./AvatarMenu";+import Topbar from "./Topbar";++export default Topbar;+export { AvatarMenu };diff --git a/apps/developers/app/components/index.ts b/apps/developers/app/components/index.tsnew file mode 100644index 0000000000..d546f4f9a8--- /dev/null+++ b/apps/developers/app/components/index.ts@@ -0,0 +1,23 @@+import Avatar from "./Avatar";+import { BreadcrumbItem, BreadcrumbLink, Breadcrumbs } from "./Breadcrumb";+import Combobox from "./Combobox";+import CreatableCombobox from "./CreateableCombobox";+import CreatableMultiSelect from "./CreateableMultiSelect";+import Hyperlink from "./Hyperlink";+import MultiSelect from "./MultiSelect";+import Select from "./Select";+import { ShortcutKey } from "./ShortcutKey";++export {+ Avatar,+ BreadcrumbItem,+ BreadcrumbLink,+ Breadcrumbs,+ Combobox,+ CreatableCombobox,+ CreatableMultiSelect,+ Hyperlink,+ MultiSelect,+ Select,+ ShortcutKey,+};diff --git a/apps/developers/app/config/env.ts b/apps/developers/app/config/env.tsnew file mode 100644index 0000000000..b68ee8c9e1--- /dev/null+++ b/apps/developers/app/config/env.ts@@ -0,0 +1,93 @@+import { isBrowser } from "@carbon/utils";++declare global {+ interface Window {+ env: {+ SUPABASE_URL: string;+ SUPABASE_ANON_PUBLIC: string;+ POSTHOG_API_HOST: string;+ POSTHOG_PROJECT_PUBLIC_KEY: string;+ };+ }+}++declare global {+ namespace NodeJS {+ interface ProcessEnv {+ POSTHOG_API_HOST: string;+ POSTHOG_PROJECT_PUBLIC_KEY: string;+ SESSION_SECRET: string;+ SESSION_KEY: string;+ SESSION_ERROR_KEY: string;+ SUPABASE_ANON_PUBLIC: string;+ SUPABASE_URL: string;+ SUPABASE_SERVICE_ROLE: string;+ VERCEL_URL: string;+ }+ }+}++type EnvOptions = {+ isSecret?: boolean;+ isRequired?: boolean;+};++export function getEnv(+ name: string,+ { isRequired, isSecret }: EnvOptions = { isSecret: true, isRequired: true }+) {+ if (isBrowser && isSecret) return "";++ const source = (isBrowser ? window.env : process.env) ?? {};++ const value = source[name as keyof typeof source];++ if (!value && isRequired) {+ throw new Error(`${name} is not set`);+ }++ return value;+}++/**+ * Server env+ */+export const SUPABASE_SERVICE_ROLE = getEnv("SUPABASE_SERVICE_ROLE");+export const SESSION_SECRET = getEnv("SESSION_SECRET");+export const SESSION_KEY = "auth";+export const SESSION_ERROR_KEY = "error";+export const SESSION_MAX_AGE = 60 * 60 * 24 * 7; // 7 days;+export const REFRESH_ACCESS_TOKEN_THRESHOLD = 60 * 10; // 10 minutes left before token expires++/**+ * Shared envs+ */+export const VERCEL_URL = getEnv("VERCEL_URL", { isSecret: false });+export const NODE_ENV = getEnv("NODE_ENV", {+ isSecret: false,+ isRequired: false,+});+export const POSTHOG_API_HOST = getEnv("POSTHOG_API_HOST", {+ isSecret: false,+});+export const POSTHOG_PROJECT_PUBLIC_KEY = getEnv("POSTHOG_PROJECT_PUBLIC_KEY", {+ isSecret: false,+});+export const SUPABASE_API_URL = getEnv("SUPABASE_API_URL", { isSecret: false });+export const SUPABASE_ANON_PUBLIC = getEnv("SUPABASE_ANON_PUBLIC", {+ isSecret: false,+});++export function getBrowserEnv() {+ return {+ SUPABASE_API_URL,+ SUPABASE_ANON_PUBLIC,+ POSTHOG_API_HOST,+ POSTHOG_PROJECT_PUBLIC_KEY,+ VERCEL_URL,+ };+}++export function isVercel() {+ return VERCEL_URL.includes("vercel.app");+}diff --git a/apps/developers/app/entry.client.tsx b/apps/developers/app/entry.client.tsxnew file mode 100644index 0000000000..61978319b0--- /dev/null+++ b/apps/developers/app/entry.client.tsx@@ -0,0 +1,34 @@+import { I18nProvider } from "@react-aria/i18n";+import { RemixBrowser } from "@remix-run/react";+import posthog from "posthog-js";+import { startTransition, useEffect } from "react";+import { hydrateRoot } from "react-dom/client";+import { OperatingSystemContextProvider } from "~/components/OperatingSystem";+import { POSTHOG_API_HOST, POSTHOG_PROJECT_PUBLIC_KEY } from "~/config/env";++function PosthogInit() {+ useEffect(() => {+ posthog.init(POSTHOG_PROJECT_PUBLIC_KEY, {+ api_host: POSTHOG_API_HOST,+ autocapture: false,+ capture_pageview: false,+ });+ }, []);+ return null;+}++startTransition(() => {+ hydrateRoot(+ document,+ <OperatingSystemContextProvider+ platform={window.navigator.userAgent.includes("Mac") ? "mac" : "windows"}+ >+ <I18nProvider+ locale={navigator.language ?? navigator.languages?.[0] ?? "en-US"}+ >+ <RemixBrowser />+ </I18nProvider>+ <PosthogInit />+ </OperatingSystemContextProvider>+ );+});diff --git a/apps/developers/app/entry.server.tsx b/apps/developers/app/entry.server.tsxnew file mode 100644index 0000000000..f819ed41f3--- /dev/null+++ b/apps/developers/app/entry.server.tsx@@ -0,0 +1,178 @@+import { I18nProvider } from "@react-aria/i18n";+import type { EntryContext, LoaderFunctionArgs } from "@remix-run/node";+import { createReadableStreamFromReadable } from "@remix-run/node"; // or cloudflare/deno+import { RemixServer } from "@remix-run/react";+import { parseAcceptLanguage } from "intl-parse-accept-language";+import isbot from "isbot";+import { renderToPipeableStream } from "react-dom/server";+import { PassThrough } from "stream";+import type { OperatingSystemPlatform } from "~/components/OperatingSystem";+import { OperatingSystemContextProvider } from "~/components/OperatingSystem";+import logger from "~/lib/logger";+import { installAndLockGlobals } from "./utils/installGlobals";++const ABORT_DELAY = 30000;++// Workaround for vite single fetch mode+installAndLockGlobals();++export default function handleRequest(+ request: Request,+ responseStatusCode: number,+ responseHeaders: Headers,+ remixContext: EntryContext+) {+ const acceptLanguage = request.headers.get("accept-language");+ const locales = parseAcceptLanguage(acceptLanguage, {+ validate: Intl.DateTimeFormat.supportedLocalesOf,+ });++ // get whether it's a mac or pc from the headers+ const platform: OperatingSystemPlatform = request.headers+ .get("user-agent")+ ?.includes("Mac")+ ? "mac"+ : "windows";++ // If the request is from a bot, we want to wait for the full+ // response to render before sending it to the client. This+ // ensures that bots can see the full page content.+ if (isbot(request.headers.get("user-agent"))) {+ return handleBotRequest(+ request,+ responseStatusCode,+ responseHeaders,+ remixContext,+ locales,+ platform+ );+ }++ return handleBrowserRequest(+ request,+ responseStatusCode,+ responseHeaders,+ remixContext,+ locales,+ platform+ );+}++function handleBotRequest(+ request: Request,+ responseStatusCode: number,+ responseHeaders: Headers,+ remixContext: EntryContext,+ locales: string[],+ platform: OperatingSystemPlatform+) {+ return new Promise((resolve, reject) => {+ let shellRendered = false;+ const { pipe, abort } = renderToPipeableStream(+ <OperatingSystemContextProvider platform={platform}>+ <I18nProvider locale={locales?.[0] ?? "en-US"}>+ <RemixServer+ context={remixContext}+ url={request.url}+ abortDelay={ABORT_DELAY}+ />+ </I18nProvider>+ </OperatingSystemContextProvider>,+ {+ onAllReady() {+ shellRendered = true;+ const body = new PassThrough();+ const stream = createReadableStreamFromReadable(body);++ responseHeaders.set("Content-Type", "text/html");++ resolve(+ new Response(stream, {+ headers: responseHeaders,+ status: responseStatusCode,+ })+ );++ pipe(body);+ },+ onShellError(error: unknown) {+ reject(error);+ },+ onError(error: unknown) {+ responseStatusCode = 500;+ // Log streaming rendering errors from inside the shell. Don't log+ // errors encountered during initial shell rendering since they'll+ // reject and get logged in handleDocumentRequest.+ if (shellRendered) {+ console.error(error);+ }+ },+ }+ );++ setTimeout(abort, ABORT_DELAY);+ });+}++function handleBrowserRequest(+ request: Request,+ responseStatusCode: number,+ responseHeaders: Headers,+ remixContext: EntryContext,+ locales: string[],+ platform: OperatingSystemPlatform+) {+ return new Promise((resolve, reject) => {+ let shellRendered = false;+ const { pipe, abort } = renderToPipeableStream(+ <OperatingSystemContextProvider platform={platform}>+ <I18nProvider locale={locales?.[0] ?? "en-US"}>+ <RemixServer+ context={remixContext}+ url={request.url}+ abortDelay={ABORT_DELAY}+ />+ </I18nProvider>+ </OperatingSystemContextProvider>,+ {+ onShellReady() {+ shellRendered = true;+ const body = new PassThrough();+ const stream = createReadableStreamFromReadable(body);++ responseHeaders.set("Content-Type", "text/html");++ resolve(+ new Response(stream, {+ headers: responseHeaders,+ status: responseStatusCode,+ })+ );++ pipe(body);+ },+ onShellError(error: unknown) {+ reject(error);+ },+ onError(error: unknown) {+ responseStatusCode = 500;+ // Log streaming rendering errors from inside the shell. Don't log+ // errors encountered during initial shell rendering since they'll+ // reject and get logged in handleDocumentRequest.+ if (shellRendered) {+ console.error(error);+ }+ },+ }+ );++ setTimeout(abort, ABORT_DELAY);+ });+}++export function handleError(+ error: unknown,+ { request, params, context }: LoaderFunctionArgs+) {+ logger.error(error, request);+}diff --git a/apps/developers/app/hooks/index.ts b/apps/developers/app/hooks/index.tsnew file mode 100644index 0000000000..854350efff--- /dev/null+++ b/apps/developers/app/hooks/index.ts@@ -0,0 +1,6 @@+import { useMode } from "./useMode";+import { useOptimisticLocation } from "./useOptimisticLocation";+import { useUrlParams } from "./useUrlParams";+import { useUser } from "./useUser";++export { useMode, useOptimisticLocation, useUrlParams, useUser };diff --git a/apps/developers/app/hooks/useMode.tsx b/apps/developers/app/hooks/useMode.tsxnew file mode 100644index 0000000000..619332f725--- /dev/null+++ b/apps/developers/app/hooks/useMode.tsx@@ -0,0 +1,32 @@+import { useFetchers } from "@remix-run/react";+import type { Mode } from "~/types/validators";+import { modeValidator } from "~/types/validators";+import { path } from "~/utils/path";+import { useRouteData } from "./useRouteData";++export function useOptimisticMode() {+ const fetchers = useFetchers();+ const modeFetcher = fetchers.find((f) => f.formAction === "/");++ if (modeFetcher && modeFetcher.formData) {+ const mode = { mode: modeFetcher.formData.get("mode") };+ const submission = modeValidator.safeParse(mode);++ if (submission.success) {+ return submission.data.mode;+ }+ }+}++export function useMode() {+ const optimisticMode = useOptimisticMode();+ const routeData = useRouteData<{ mode: Mode }>(path.to.root);++ let mode = routeData?.mode ?? "dark";++ if (optimisticMode && optimisticMode !== "system") {+ mode = optimisticMode;+ }++ return mode;+}diff --git a/apps/developers/app/hooks/useOptimisticLocation.ts b/apps/developers/app/hooks/useOptimisticLocation.tsnew file mode 100644index 0000000000..84eb784fa9--- /dev/null+++ b/apps/developers/app/hooks/useOptimisticLocation.ts@@ -0,0 +1,13 @@+// credit: Matt Aitken at trigger.dev+import { useLocation, useNavigation } from "@remix-run/react";++export function useOptimisticLocation() {+ const navigation = useNavigation();+ const location = useLocation();++ if (navigation.state === "idle" || !navigation.location) {+ return location;+ }++ return navigation.location;+}diff --git a/apps/developers/app/hooks/useRouteData.tsx b/apps/developers/app/hooks/useRouteData.tsxnew file mode 100644index 0000000000..9c6f2bf54a--- /dev/null+++ b/apps/developers/app/hooks/useRouteData.tsx@@ -0,0 +1,11 @@+import { useMatches } from "@remix-run/react";+import { useMemo } from "react";++export function useRouteData<T>(path: string): T | undefined {+ const matchingRoutes = useMatches();+ const route = useMemo(+ () => matchingRoutes.find((route) => route.pathname === path),+ [matchingRoutes, path]+ );+ return (route?.data as T) || undefined;+}diff --git a/apps/developers/app/hooks/useUrlParams.tsx b/apps/developers/app/hooks/useUrlParams.tsxnew file mode 100644index 0000000000..df815dfcaf--- /dev/null+++ b/apps/developers/app/hooks/useUrlParams.tsx@@ -0,0 +1,43 @@+import { useSearchParams, useSubmit } from "@remix-run/react";+import { useCallback } from "react";++export function useUrlParams(): [+ URLSearchParams,+ (+ params: Record<string, string | string[] | number | undefined | null>+ ) => void+] {+ const submit = useSubmit();+ const [searchParams] = useSearchParams();++ const setSearchParams = useCallback(+ (params: Record<string, string | string[] | number | undefined | null>) => {+ Object.entries(params).forEach(([name, value]) => {+ if (value) {+ if (Array.isArray(value)) {+ if (value.length === 0) {+ searchParams.delete(name);+ } else {+ value.forEach((v, i) => {+ if (i === 0) {+ searchParams.set(name, v.toString());+ } else {+ searchParams.append(name, v.toString());+ }+ });+ }+ } else {+ searchParams.set(name, value.toString());+ }+ } else {+ searchParams.delete(name);+ }+ });++ submit(searchParams);+ },+ [submit, searchParams]+ );++ return [searchParams, setSearchParams];+}diff --git a/apps/developers/app/hooks/useUser.tsx b/apps/developers/app/hooks/useUser.tsxnew file mode 100644index 0000000000..1de0128234--- /dev/null+++ b/apps/developers/app/hooks/useUser.tsx@@ -0,0 +1,62 @@+import { path } from "~/utils/path";+import { useRouteData } from "./useRouteData";++type PersonalData = {+ id: string;+ email: string;+ firstName: string;+ lastName: string;+ avatarUrl: string | null;+};++type Company = {+ id: string;+ name: string;+ logo: string | null;+};++type User = PersonalData & {+ company: Company;+};++export function useUser(): User {+ const data = useRouteData<{+ company: unknown;+ user: unknown;+ }>(path.to.authenticatedRoot);++ if (+ data?.company &&+ isCompany(data.company) &&+ data?.user &&+ isUser(data.user)+ ) {+ return {+ ...data.user,+ company: data.company,+ };+ }++ // TODO: force logout -- the likely cause is development changes+ throw new Error(+ "useUser must be used within an authenticated route. If you are seeing this error, you are likely in development and have changed the session variables. Try deleting the cookies."+ );+}++function isCompany(value: any): value is Company {+ return (+ typeof value.id === "string" &&+ typeof value.name === "string" &&+ (typeof value.logo === "string" || value.logo === null)+ );+}++function isUser(value: any): value is User {+ return (+ typeof value.id === "string" &&+ typeof value.email === "string" &&+ typeof value.firstName === "string" &&+ typeof value.lastName === "string" &&+ "avatarUrl" in value+ );+}diff --git a/apps/developers/app/lib/logger.ts b/apps/developers/app/lib/logger.tsnew file mode 100644index 0000000000..22124d46fd--- /dev/null+++ b/apps/developers/app/lib/logger.ts@@ -0,0 +1,5 @@+import Logger from "@carbon/logger";++const logger = Logger.create("developers");++export default logger;diff --git a/apps/developers/app/lib/supabase/client.ts b/apps/developers/app/lib/supabase/client.tsnew file mode 100644index 0000000000..3133e2354d--- /dev/null+++ b/apps/developers/app/lib/supabase/client.ts@@ -0,0 +1,58 @@+import type { Database } from "@carbon/database";+import { isBrowser } from "@carbon/utils";+import { createClient } from "@supabase/supabase-js";++import {+ SUPABASE_ANON_PUBLIC,+ SUPABASE_API_URL,+ SUPABASE_SERVICE_ROLE,+} from "~/config/env";++const getSupabaseClient = (supabaseKey: string, accessToken?: string) => {+ const global = accessToken+ ? {+ global: {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ },+ },+ }+ : {};++ const client = createClient<Database>(SUPABASE_API_URL, supabaseKey, {+ auth: {+ autoRefreshToken: false,+ persistSession: false,+ },+ ...global,+ });++ return client;+};++/**+ * Provides a Supabase Client for the logged in user or get back a public and safe client without admin privileges+ *+ * It's a per request scoped client to prevent access token leaking over multiple concurrent requests and from different users.+ *+ */+export const getSupabase = (accessToken?: string) => {+ return getSupabaseClient(SUPABASE_ANON_PUBLIC, accessToken);+};++/**+ * Provides a Supabase Admin Client with full admin privileges+ *+ * It's a per request scoped client, to prevent access token leaking`.+ *+ */+export const getSupabaseServiceRole = () => {+ if (isBrowser)+ throw new Error(+ "getSupabaseServiceRole is not available in browser and should NOT be used in insecure environments"+ );++ return getSupabaseClient(SUPABASE_SERVICE_ROLE);+};++export const supabaseClient = getSupabase();diff --git a/apps/developers/app/lib/supabase/index.ts b/apps/developers/app/lib/supabase/index.tsnew file mode 100644index 0000000000..26a0fa6c27--- /dev/null+++ b/apps/developers/app/lib/supabase/index.ts@@ -0,0 +1,4 @@+import { getSupabase, getSupabaseServiceRole } from "./client";+import { SupabaseProvider, useSupabase } from "./provider";++export { SupabaseProvider, getSupabase, getSupabaseServiceRole, useSupabase };diff --git a/apps/developers/app/lib/supabase/provider.tsx b/apps/developers/app/lib/supabase/provider.tsxnew file mode 100644index 0000000000..52e0af1944--- /dev/null+++ b/apps/developers/app/lib/supabase/provider.tsx@@ -0,0 +1,91 @@+import type { Database } from "@carbon/database";+import { useInterval } from "@carbon/react";+import { isBrowser } from "@carbon/utils";+import { useFetcher } from "@remix-run/react";+import type { SupabaseClient } from "@supabase/supabase-js";+import type { PropsWithChildren } from "react";+import {+ createContext,+ useContext,+ useEffect,+ useMemo,+ useRef,+ useState,+} from "react";++import type { AuthSession } from "~/services/auth";+import { path } from "~/utils/path";+import { getSupabase } from "./client";++const SupabaseContext = createContext<{+ supabase: SupabaseClient<Database> | undefined;+ accessToken: string | undefined;+}>({ supabase: undefined, accessToken: undefined });++export const SupabaseProvider = ({+ children,+ session,+}: PropsWithChildren<{+ session: Partial<AuthSession>;+}>) => {+ const { accessToken, refreshToken, expiresIn, expiresAt } = session;+ const [browserSessionExpiresAt, setBrowserSessionExpiresAt] = useState<+ number | undefined+ >();+ const initialLoad = useRef(true);+ const [supabase, setSupabaseClient] = useState<SupabaseClient | undefined>(+ () => {+ // prevents server side initial state+ // init a default anonymous client in browser until we have an auth token+ if (isBrowser) return getSupabase();+ }+ );+ const refresh = useFetcher<{}>();++ useInterval(() => {+ if (!initialLoad.current && expiresIn) {+ refresh.submit(null, {+ method: "post",+ action: path.to.refreshSession,+ });+ }++ initialLoad.current = false;+ }, expiresIn);++ if (isBrowser && expiresAt !== browserSessionExpiresAt && accessToken) {+ // recreate a supabase client to force provider's consumer to rerender+ setSupabaseClient(getSupabase(accessToken));+ setBrowserSessionExpiresAt(expiresAt);+ }++ useEffect(() => {+ if (!supabase || !accessToken || !refreshToken) return;++ supabase.auth.setSession({+ access_token: accessToken,+ refresh_token: refreshToken,+ });+ }, [accessToken, refreshToken, supabase]);++ const value = useMemo(+ () => ({ supabase, accessToken }),+ [supabase, accessToken]+ );++ return (+ <SupabaseContext.Provider value={value}>+ {children}+ </SupabaseContext.Provider>+ );+};++export const useSupabase = () => {+ const context = useContext(SupabaseContext);++ if (isBrowser && context === undefined) {+ throw new Error(`useSupabase must be used within a SupabaseProvider.`);+ }++ return context;+};diff --git a/apps/developers/app/root.tsx b/apps/developers/app/root.tsxnew file mode 100644index 0000000000..21b0fa7156--- /dev/null+++ b/apps/developers/app/root.tsx@@ -0,0 +1,179 @@+import { Button, Heading, toast } from "@carbon/react";+import { validator } from "@carbon/remix-validated-form";+import type {+ ActionFunctionArgs,+ LoaderFunctionArgs,+ MetaFunction,+} from "@remix-run/node";+import { json } from "@remix-run/node";+import {+ Links,+ Meta,+ Outlet,+ Scripts,+ ScrollRestoration,+ isRouteErrorResponse,+ useLoaderData,+ useRouteError,+} from "@remix-run/react";+import { Analytics } from "@vercel/analytics/react";+import React, { useEffect } from "react";+import { getBrowserEnv } from "~/config/env";+import { getMode, setMode } from "~/services/mode.server";+import Background from "~/styles/background.css?url";+import NProgress from "~/styles/nprogress.css?url";+import Tailwind from "~/styles/tailwind.css?url";+import { error } from "~/utils/result";+import { useMode } from "./hooks/useMode";+import { getSessionFlash } from "./services/session.server";+import { modeValidator } from "./types/validators";++export function links() {+ return [+ { rel: "stylesheet", href: Tailwind },+ { rel: "stylesheet", href: Background },+ { rel: "stylesheet", href: NProgress },+ { rel: "stylesheet", href: "/assets/theme.css" },+ ];+}++export const meta: MetaFunction = () => {+ return [+ {+ title: "CarbonOS Developers",+ },+ ];+};++export async function loader({ request }: LoaderFunctionArgs) {+ const {+ POSTHOG_API_HOST,+ POSTHOG_PROJECT_PUBLIC_KEY,+ SUPABASE_API_URL,+ SUPABASE_ANON_PUBLIC,+ } = getBrowserEnv();++ const sessionFlash = await getSessionFlash(request);++ return json(+ {+ env: {+ POSTHOG_API_HOST,+ POSTHOG_PROJECT_PUBLIC_KEY,+ SUPABASE_API_URL,+ SUPABASE_ANON_PUBLIC,+ },+ mode: getMode(request),+ result: sessionFlash?.result,+ },+ {+ headers: sessionFlash?.headers,+ }+ );+}++export async function action({ request }: ActionFunctionArgs) {+ const validation = await validator(modeValidator).validate(+ await request.formData()+ );++ if (validation.error) {+ return json(error(validation.error, "Invalid mode"), {+ status: 400,+ });+ }++ return json(+ {},+ {+ headers: { "Set-Cookie": setMode(validation.data.mode) },+ }+ );+}++function Document({+ children,+ title = "CarbonOS",+ mode = "dark",+}: {+ children: React.ReactNode;+ title?: string;+ mode?: "light" | "dark";+}) {+ return (+ <html lang="en" className={`${mode} h-full overflow-x-hidden`}>+ <head>+ <meta charSet="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <Meta />+ <title>{title}</title>+ <Links />+ </head>+ <body className="h-full bg-background antialiased selection:bg-[#00cc9937] selection:text-[#007763fd] dark:selection:bg-[#00fff61d] dark:selection:text-[#67ffded2]">+ {children}++ <ScrollRestoration />+ <Scripts />+ <Analytics />+ </body>+ </html>+ );+}++export default function App() {+ const loaderData = useLoaderData<typeof loader>();+ const env = loaderData?.env ?? {};+ const result = loaderData?.result;++ /* Toast Messages */+ useEffect(() => {+ if (result?.success === true) {+ toast.success(result.message);+ } else if (result?.message) {+ toast.error(result.message);+ }+ }, [result]);++ /* Dark/Light Mode */+ const mode = useMode();++ return (+ <Document mode={mode}>+ <Outlet />+ <script+ dangerouslySetInnerHTML={{+ __html: `window.env = ${JSON.stringify(env)}`,+ }}+ />+ </Document>+ );+}++export function ErrorBoundary() {+ const error = useRouteError();++ const message = isRouteErrorResponse(error)+ ? error.data.message ?? error.data+ : error instanceof Error+ ? error.message+ : String(error);++ return (+ <Document title="Error!">+ <div className="dark">+ <div className="flex flex-col w-full h-screen bg-zinc-900 items-center justify-center space-y-4 ">+ <img+ src="/carbon-logo-light.png"+ alt="Carbon Logo"+ className="block max-w-[60px]"+ />+ <Heading size="h1">Something went wrong</Heading>+ <p className="text-muted-foreground max-w-2xl">{message}</p>+ <Button onClick={() => (window.location.href = "/")}>+ Back Home+ </Button>+ </div>+ </div>+ </Document>+ );+}diff --git a/apps/developers/app/routes/_index.tsx b/apps/developers/app/routes/_index.tsxnew file mode 100644index 0000000000..f508a6421b--- /dev/null+++ b/apps/developers/app/routes/_index.tsx@@ -0,0 +1,16 @@+import { redirect, type LoaderFunctionArgs } from "@remix-run/node";+import { requireAuthSession } from "~/services/session.server";+import { path } from "~/utils/path";++export async function loader({ request }: LoaderFunctionArgs) {+ await requireAuthSession(request);+ throw redirect(path.to.authenticatedRoot);+}++export default function IndexRoute() {+ return (+ <p>+ Oops. You shouldn't see this page. Eventually it will be a landing page.+ </p>+ );+}diff --git a/apps/developers/app/routes/_public+/_layout.tsx b/apps/developers/app/routes/_public+/_layout.tsxnew file mode 100644index 0000000000..e2f9dbaf8a--- /dev/null+++ b/apps/developers/app/routes/_public+/_layout.tsx@@ -0,0 +1,17 @@+import { VStack } from "@carbon/react";+import { Outlet } from "@remix-run/react";+import { Background } from "~/components/Layout";++export default function PublicRoute() {+ return (+ <div className="flex min-h-screen min-w-screen">+ <VStack+ spacing={8}+ className="items-center justify-start pt-[20vh] mx-auto max-w-lg z-[3]"+ >+ <Outlet />+ </VStack>+ <Background />+ </div>+ );+}diff --git a/apps/developers/app/routes/_public+/callback.tsx b/apps/developers/app/routes/_public+/callback.tsxnew file mode 100644index 0000000000..b478cf3a34--- /dev/null+++ b/apps/developers/app/routes/_public+/callback.tsx@@ -0,0 +1,130 @@+import { validator } from "@carbon/remix-validated-form";+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { useFetcher } from "@remix-run/react";+import { useEffect, useRef } from "react";+import { getSupabaseServiceRole } from "~/lib/supabase";+import { supabaseClient } from "~/lib/supabase/client";+import { callbackValidator } from "~/services/auth/auth.models";+import { refreshAccessToken } from "~/services/auth/auth.server";+import {+ commitAuthSession,+ destroyAuthSession,+ flash,+ getAuthSession,+} from "~/services/session.server";++import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";+import { error } from "~/utils/result";++export async function loader({ request }: LoaderFunctionArgs) {+ const authSession = await getAuthSession(request);++ if (authSession) await destroyAuthSession(request);++ return json({});+}++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);++ const validation = await validator(callbackValidator).validate(+ await request.formData()+ );++ if (validation.error) {+ return json(error(validation.error, "Invalid callback form"), {+ status: 400,+ });+ }++ const { refreshToken, userId } = validation.data;+ const supabaseServiceClient = getSupabaseServiceRole();+ const companies = await supabaseServiceClient+ .from("userToCompany")+ .select("companyId")+ .eq("userId", userId);+ if (!companies.data || companies.data.length < 1) {+ return json(error(companies.error, "No companies found for user"), {+ status: 500,+ });+ }+ const authSession = await refreshAccessToken(+ refreshToken,+ companies.data?.[0].companyId+ );+ if (!authSession) {+ return redirect(+ path.to.root,+ await flash(request, error(authSession, "Invalid refresh token"))+ );+ }++ return redirect(path.to.authenticatedRoot, {+ headers: {+ "Set-Cookie": await commitAuthSession(request, {+ authSession,+ }),+ },+ });+}++export default function AuthCallback() {+ const fetcher = useFetcher<{}>();+ const isAuthenticating = useRef(false);++ useEffect(() => {+ const {+ data: { subscription },+ } = supabaseClient.auth.onAuthStateChange((event, supabaseSession) => {+ if (+ ["SIGNED_IN", "INITIAL_SESSION"].includes(event) &&+ !isAuthenticating.current+ ) {+ isAuthenticating.current = true;++ // supabase sdk has ability to read url fragment that contains your token after third party provider redirects you here+ // this fragment url looks like https://.....#access_token=evxxxxxxxx&refresh_token=xxxxxx, and it's not readable server-side (Oauth security)+ // supabase auth listener gives us a user session, based on what it founds in this fragment url+ // we can't use it directly, client-side, because we can't access sessionStorage from here++ // we should not trust what's happen client side+ // so, we only pick the refresh token, and let's back-end getting user session from it+ const refreshToken = supabaseSession?.refresh_token;+ const userId = supabaseSession?.user.id;++ if (!refreshToken || !userId) return;++ const formData = new FormData();+ formData.append("refreshToken", refreshToken);+ formData.append("userId", userId);++ fetcher.submit(formData, { method: "post" });+ }+ });++ return () => {+ // prevent memory leak. Listener stays alive 👨🎤+ subscription.unsubscribe();+ };+ }, [fetcher]);++ return (+ <div className="flex flex-col items-center justify-center">+ <div>+ <img+ src="/carbon-logo-dark.png"+ alt="Carbon Logo"+ className="block dark:hidden max-w-[100px] mb-3"+ />+ <img+ src="/carbon-logo-light.png"+ alt="Carbon Logo"+ className="hidden dark:block max-w-[100px] mb-3"+ />+ </div>+ <p className="text-muted-foreground">Loading...</p>+ </div>+ );+}diff --git a/apps/developers/app/routes/_public+/forgot-password.tsx b/apps/developers/app/routes/_public+/forgot-password.tsxnew file mode 100644index 0000000000..037e5259ac--- /dev/null+++ b/apps/developers/app/routes/_public+/forgot-password.tsx@@ -0,0 +1,127 @@+import {+ Alert,+ AlertDescription,+ AlertTitle,+ Button,+ VStack,+} from "@carbon/react";+import {+ ValidatedForm,+ validationError,+ validator,+} from "@carbon/remix-validated-form";+import type {+ ActionFunctionArgs,+ LoaderFunctionArgs,+ MetaFunction,+} from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Link, useActionData } from "@remix-run/react";+import { LuAlertCircle, LuCheckCircle } from "react-icons/lu";++import { Input, Submit } from "~/components/Form";+import { forgotPasswordValidator } from "~/services/auth";+import { getUserByEmail, sendMagicLink } from "~/services/auth/auth.server";+import { getAuthSession } from "~/services/session.server";+import type { Result } from "~/types";+import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";+import { error, success } from "~/utils/result";++export const meta: MetaFunction = () => {+ return [+ {+ title: "Carbon Developers | Forgot Password",+ },+ ];+};++export async function loader({ request }: LoaderFunctionArgs) {+ const authSession = await getAuthSession(request);+ if (authSession) throw redirect(path.to.authenticatedRoot);+ return null;+}++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const validation = await validator(forgotPasswordValidator).validate(+ await request.formData()+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const { email } = validation.data;+ const user = await getUserByEmail(email);++ if (user.data && user.data.active) {+ const authSession = await sendMagicLink(email);++ if (!authSession) {+ return json(error(authSession, "Failed to send magic link"), {+ status: 500,+ });+ }+ }++ return json(success("Success"));+}++export default function ForgotPasswordRoute() {+ const actionData = useActionData<Result>();++ return (+ <>+ <div className="flex flex-col items-center justify-center">+ <img+ src="/carbon-logo-dark.png"+ alt="Carbon Logo"+ className="block dark:hidden max-w-[100px] mb-3"+ />+ <img+ src="/carbon-logo-light.png"+ alt="Carbon Logo"+ className="hidden dark:block max-w-[100px] mb-3"+ />+ <h3 className="font-mono font-bold leading-loose uppercase text-xl">+ Developers+ </h3>+ </div>+ {actionData?.success ? (+ <Alert+ variant="success"+ className="h-[240px] [&>svg]:left-8 [&>svg]:top-8 p-8"+ >+ <LuCheckCircle className="w-4 h-4" />+ <AlertTitle>Success</AlertTitle>+ <AlertDescription>+ If you have an account, you should receive an email shortly with a+ link to log in.+ </AlertDescription>+ </Alert>+ ) : (+ <div className="rounded-lg bg-card border border-border shadow-lg p-8 w-[380px]">+ <ValidatedForm validator={forgotPasswordValidator} method="post">+ <VStack spacing={4}>+ <p>Please enter your email address to search for your account.</p>+ {actionData?.success === false && (+ <Alert variant="destructive">+ <LuAlertCircle className="w-4 h-4" />+ <AlertTitle>{actionData?.message}</AlertTitle>+ </Alert>+ )}+ <Input name="email" label="Email" />+ <Submit size="lg" className="w-full">+ Reset Password+ </Submit>+ <Button variant="link" asChild className="w-full">+ <Link to={path.to.login}>Back to login</Link>+ </Button>+ </VStack>+ </ValidatedForm>+ </div>+ )}+ </>+ );+}diff --git a/apps/developers/app/routes/_public+/healthcheck.tsx b/apps/developers/app/routes/_public+/healthcheck.tsxnew file mode 100644index 0000000000..e7015c1f64--- /dev/null+++ b/apps/developers/app/routes/_public+/healthcheck.tsx@@ -0,0 +1,14 @@+import { getSupabaseServiceRole } from "~/lib/supabase";++export async function loader() {+ try {+ const client = getSupabaseServiceRole();+ const test = await client.from("attributeDataType").select("*");+ if (test.error !== null) throw test.error;+ return new Response("OK");+ } catch (error: unknown) {+ // eslint-disable-next-line no-console+ console.log("healthcheck ❌", { error });+ return new Response("ERROR", { status: 500 });+ }+}diff --git a/apps/developers/app/routes/_public+/login.tsx b/apps/developers/app/routes/_public+/login.tsxnew file mode 100644index 0000000000..a2566361b7--- /dev/null+++ b/apps/developers/app/routes/_public+/login.tsx@@ -0,0 +1,127 @@+import { Alert, AlertTitle, Button, VStack } from "@carbon/react";+import {+ ValidatedForm,+ validationError,+ validator,+} from "@carbon/remix-validated-form";+import type {+ ActionFunctionArgs,+ LoaderFunctionArgs,+ MetaFunction,+} from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Link, useActionData, useSearchParams } from "@remix-run/react";+import posthog from "posthog-js";+import { LuAlertCircle } from "react-icons/lu";++import { Hidden, Input, Password, Submit } from "~/components/Form";+import { loginValidator } from "~/services/auth";+import {+ signInWithEmail,+ verifyAuthSession,+} from "~/services/auth/auth.server";+import { commitAuthSession, getAuthSession } from "~/services/session.server";+import type { Result } from "~/types";+import { assertIsPost, safeRedirect } from "~/utils/http";+import { path } from "~/utils/path";+import { error } from "~/utils/result";++export const meta: MetaFunction = () => {+ return [{ title: "Carbon Developers | Login" }];+};++export async function loader({ request }: LoaderFunctionArgs) {+ const authSession = await getAuthSession(request);+ if (authSession && (await verifyAuthSession(authSession))) {+ if (authSession) throw redirect(path.to.authenticatedRoot);+ }++ return null;+}++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const validation = await validator(loginValidator).validate(+ await request.formData()+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const { email, password, redirectTo } = validation.data;++ const authSession = await signInWithEmail(email, password);++ if (!authSession) {+ // delay on incorrect password as minimal brute force protection+ await new Promise((resolve) => setTimeout(resolve, 2000));+ return json(error(authSession, "Invalid email/password"), {+ status: 500,+ });+ }++ throw redirect(safeRedirect(redirectTo), {+ headers: {+ "Set-Cookie": await commitAuthSession(request, {+ authSession,+ }),+ },+ });+}++export default function LoginRoute() {+ const result = useActionData<Result>();+ const [searchParams] = useSearchParams();+ const redirectTo = searchParams.get("redirectTo") ?? undefined;++ const handleClick = () => {+ posthog.capture("sign_in_clicked");+ };++ return (+ <>+ <div className="flex flex-col items-center justify-center">+ <img+ src="/carbon-logo-dark.png"+ alt="Carbon Logo"+ className="block dark:hidden max-w-[100px] mb-3"+ />+ <img+ src="/carbon-logo-light.png"+ alt="Carbon Logo"+ className="hidden dark:block max-w-[100px] mb-3"+ />+ <h3 className="font-mono font-bold leading-loose uppercase text-xl">+ Developers+ </h3>+ </div>+ <div className="rounded-lg bg-card border border-border shadow-lg p-8 w-[380px]">+ <ValidatedForm+ validator={loginValidator}+ defaultValues={{ redirectTo }}+ method="post"+ >+ <VStack spacing={4}>+ {result && result?.message && (+ <Alert variant="destructive">+ <LuAlertCircle className="w-4 h-4" />+ <AlertTitle>{result?.message}</AlertTitle>+ </Alert>+ )}++ <Input name="email" label="Email" />+ <Password name="password" label="Password" type="password" />+ <Hidden name="redirectTo" value={redirectTo} type="hidden" />+ <Submit size="lg" className="w-full" onClick={handleClick}>+ Sign In+ </Submit>+ <Button variant="link" asChild className="w-full">+ <Link to={path.to.forgotPassword}>Forgot Password</Link>+ </Button>+ </VStack>+ </ValidatedForm>+ </div>+ </>+ );+}diff --git a/apps/developers/app/routes/_public+/logout.tsx b/apps/developers/app/routes/_public+/logout.tsxnew file mode 100644index 0000000000..29edb92907--- /dev/null+++ b/apps/developers/app/routes/_public+/logout.tsx@@ -0,0 +1,16 @@+import type { ActionFunctionArgs } from "@remix-run/node";+import { redirect } from "@remix-run/node";++import { destroyAuthSession } from "~/services/session.server";+import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);++ return destroyAuthSession(request);+}++export async function loader() {+ throw redirect(path.to.root);+}diff --git a/apps/developers/app/routes/_public+/refresh-session.tsx b/apps/developers/app/routes/_public+/refresh-session.tsxnew file mode 100644index 0000000000..9b7f008545--- /dev/null+++ b/apps/developers/app/routes/_public+/refresh-session.tsx@@ -0,0 +1,37 @@+import type { ActionFunctionArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { useNavigate } from "@remix-run/react";++import {+ commitAuthSession,+ refreshAuthSession,+} from "~/services/session.server";+import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";++export async function loader() {+ throw redirect(path.to.authenticatedRoot);+}++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);++ const authSession = await refreshAuthSession(request);++ return json(+ { success: true },+ {+ headers: {+ "Set-Cookie": await commitAuthSession(request, {+ authSession,+ }),+ },+ }+ );+}++export function ErrorBoundary() {+ const navigate = useNavigate();+ navigate(path.to.authenticatedRoot);+ return null;+}diff --git a/apps/developers/app/routes/_public+/request-access.tsx b/apps/developers/app/routes/_public+/request-access.tsxnew file mode 100644index 0000000000..67e5dbcfe1--- /dev/null+++ b/apps/developers/app/routes/_public+/request-access.tsx@@ -0,0 +1,46 @@+import { Button } from "@carbon/react";+import type { MetaFunction } from "@remix-run/node";+import { VERCEL_URL } from "~/config/env";+import { removeSubdomain } from "~/utils/path";++export const APP_URL = VERCEL_URL?.includes("localhost")+ ? "http://localhost:3000"+ : `https://app.${removeSubdomain(VERCEL_URL)}`;++export const meta: MetaFunction = () => {+ return [+ {+ title: "Carbon Developers | Request Access",+ },+ ];+};++export default function RequestAccessRoute() {+ return (+ <>+ <div className="flex flex-col items-center justify-center">+ <img+ src="/carbon-logo-dark.png"+ alt="Carbon Logo"+ className="block dark:hidden max-w-[100px] mb-3"+ />+ <img+ src="/carbon-logo-light.png"+ alt="Carbon Logo"+ className="hidden dark:block max-w-[100px] mb-3"+ />+ <h3 className="font-mono font-bold leading-loose uppercase text-xl">+ Developers+ </h3>+ </div>+ <div className="rounded-lg bg-card flex flex-col gap-4 border border-border shadow-lg p-8 w-[380px]">+ <p>+ Request access to the developer portal by emailing [email protected]+ </p>+ <Button size="lg" asChild>+ <a href={APP_URL}>Return to App</a>+ </Button>+ </div>+ </>+ );+}diff --git a/apps/developers/app/routes/assets+/theme[.]css.ts b/apps/developers/app/routes/assets+/theme[.]css.tsnew file mode 100644index 0000000000..50fad95997--- /dev/null+++ b/apps/developers/app/routes/assets+/theme[.]css.ts@@ -0,0 +1,25 @@+import { getThemeCode, themes } from "@carbon/utils";+import type { LoaderFunctionArgs } from "@remix-run/node";+import { getTheme } from "~/services/theme.server";++export async function loader({ request }: LoaderFunctionArgs) {+ const theme = getTheme(request) as string;++ const selectedTheme = themes.find((t) => t.name === theme);++ if (!selectedTheme) {+ return new Response("", {+ headers: {+ "Content-Type": "text/css",+ },+ });+ }++ const css = getThemeCode(selectedTheme);++ return new Response(css, {+ headers: {+ "Content-Type": "text/css",+ },+ });+}diff --git a/apps/developers/app/routes/x+/_index.tsx b/apps/developers/app/routes/x+/_index.tsxnew file mode 100644index 0000000000..d56e10f963--- /dev/null+++ b/apps/developers/app/routes/x+/_index.tsx@@ -0,0 +1,38 @@+import { Heading, cn } from "@carbon/react";+import { getLocalTimeZone } from "@internationalized/date";+import { useLocale } from "@react-aria/i18n";+import { useMemo, type ComponentProps } from "react";+import { useUser } from "~/hooks";++export default function AppIndexRoute() {+ const user = useUser();+ const { locale } = useLocale();+ const date = new Date();++ const formatter = useMemo(+ () =>+ new Intl.DateTimeFormat(locale, {+ dateStyle: "full",+ timeZone: getLocalTimeZone(),+ }),+ [locale]+ );++ return (+ <div className="p-8 w-full h-full bg-muted">+ <Heading size="h3">Hello, {user.firstName}</Heading>+ <Subheading>{formatter.format(date)}</Subheading>+ <Hr />+ </div>+ );+}++const Hr = () => (+ <hr className="h-px my-8 bg-black/10 border-0 dark:bg-white/10" />+);++const Subheading = ({ children, className }: ComponentProps<"p">) => (+ <p className={cn("text-muted-foreground text-base font-light", className)}>+ {children}+ </p>+);diff --git a/apps/developers/app/routes/x+/_layout.tsx b/apps/developers/app/routes/x+/_layout.tsxnew file mode 100644index 0000000000..afc6be5fd1--- /dev/null+++ b/apps/developers/app/routes/x+/_layout.tsx@@ -0,0 +1,103 @@+import { Toaster, TooltipProvider } from "@carbon/react";+import type { LoaderFunctionArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { Outlet, useLoaderData, useNavigation } from "@remix-run/react";+import NProgress from "nprogress";+import { useEffect } from "react";++import { Topbar } from "~/components/Layout";+import { IconSidebar } from "~/components/Navigation";+import { VERCEL_URL } from "~/config/env";+import { SupabaseProvider, getSupabase } from "~/lib/supabase";+import { getCompanies, getUser } from "~/services/auth/auth.server";+import {+ destroyAuthSession,+ requireAuthSession,+} from "~/services/session.server";+import { path, removeSubdomain } from "~/utils/path";++export const APP_URL = VERCEL_URL?.includes("localhost")+ ? "http://localhost:3000"+ : `https://app.${removeSubdomain(VERCEL_URL)}`;++export async function loader({ request }: LoaderFunctionArgs) {+ const { accessToken, companyId, expiresAt, expiresIn, userId } =+ await requireAuthSession(request, { verify: true });++ // share a client between requests+ const client = getSupabase(accessToken);++ // parallelize the requests+ const [companies, user] = await Promise.all([+ getCompanies(client, userId),+ getUser(client, userId),+ ]);++ if (user.error || !user.data) {+ await destroyAuthSession(request);+ }++ if (!user.data?.developer) {+ throw redirect(path.to.requestAccess);+ }++ const company = companies.data?.find((c) => c.companyId === companyId);+ if (!company) {+ throw redirect(APP_URL);+ }++ return json({+ session: {+ accessToken,+ expiresIn,+ expiresAt,+ },+ company,+ companies: companies.data ?? [],+ user: user.data,+ });+}++export default function AuthenticatedRoute() {+ const { session } = useLoaderData<typeof loader>();++ const transition = useNavigation();++ /* NProgress */+ useEffect(() => {+ if (+ (transition.state === "loading" || transition.state === "submitting") &&+ !NProgress.isStarted()+ ) {+ NProgress.start();+ } else {+ NProgress.done();+ }+ }, [transition.state]);++ return (+ <SupabaseProvider session={session}>+ <TooltipProvider>+ <div className="min-h-full flex flex-col">+ <div className="flex-none" />+ <div className="h-screen min-h-[0px] basis-0 flex-1">+ <div className="flex h-full">+ <IconSidebar />+ <div className="flex w-full h-full">+ <div className="w-full h-full flex-1 overflow-hidden">+ <main className="h-full flex flex-col flex-1 max-w-[100vw] sm:max-w-[calc(100vw-56px)] overflow-x-hidden bg-muted">+ <Topbar />+ <main className="flex-1 overflow-y-auto max-h-[calc(100vh-49px)]">+ <Outlet />+ </main>+ </main>+ </div>+ </div>+ </div>+ </div>+ </div>+ <Toaster position="bottom-right" />+ </TooltipProvider>+ </SupabaseProvider>+ );+}diff --git a/apps/developers/app/services/auth/auth.models.ts b/apps/developers/app/services/auth/auth.models.tsnew file mode 100644index 0000000000..6ec0975a1a--- /dev/null+++ b/apps/developers/app/services/auth/auth.models.ts@@ -0,0 +1,26 @@+import { z } from "zod";++export const loginValidator = z.object({+ email: z+ .string()+ .min(1, { message: "Email is required" })+ .email("Must be a valid email"),+ password: z.string().min(6, { message: "Password is too short" }),+ redirectTo: z.string(),+});++export const forgotPasswordValidator = z.object({+ email: z+ .string()+ .min(1, { message: "Email is required" })+ .email("Must be a valid email"),+});++export const resetPasswordValidator = z.object({+ password: z.string().min(6, { message: "Password is too short" }),+});++export const callbackValidator = z.object({+ refreshToken: z.string(),+ userId: z.string(),+});diff --git a/apps/developers/app/services/auth/auth.server.ts b/apps/developers/app/services/auth/auth.server.tsnew file mode 100644index 0000000000..750cb65899--- /dev/null+++ b/apps/developers/app/services/auth/auth.server.ts@@ -0,0 +1,153 @@+import type { Database } from "@carbon/database";+import type {+ AuthSession as SupabaseAuthSession,+ SupabaseClient,+} from "@supabase/supabase-js";+import {+ REFRESH_ACCESS_TOKEN_THRESHOLD,+ SUPABASE_API_URL,+ VERCEL_URL,+} from "~/config/env";+import logger from "~/lib/logger";+import { getSupabaseServiceRole } from "~/lib/supabase";+import type { AuthSession } from "./types";++export async function getAuthAccountByAccessToken(accessToken: string) {+ const { data, error } = await getSupabaseServiceRole().auth.getUser(+ accessToken+ );++ if (!data.user || error) return null;++ return data.user;+}++export async function getCompanies(+ client: SupabaseClient<Database>,+ userId: string+) {+ const companies = await client+ .from("companies")+ .select("*")+ .eq("userId", userId)+ .order("name");++ if (companies.error) {+ return companies;+ }++ return {+ data: companies.data.map((company) => ({+ ...company,+ logo: company.logo+ ? `${SUPABASE_API_URL}/storage/v1/object/public/public/${company.logo}`+ : null,+ })),+ error: null,+ };+}++export async function getCompaniesForUser(+ client: SupabaseClient<Database>,+ userId: string+) {+ const { data, error } = await client+ .from("userToCompany")+ .select("companyId")+ .eq("userId", userId);++ if (error) {+ logger.error(error, `Failed to get companies for user ${userId}`);+ return [];+ }++ return data?.map((row) => row.companyId) ?? [];+}++export async function getUser(client: SupabaseClient<Database>, id: string) {+ return client+ .from("user")+ .select("*")+ .eq("id", id)+ .eq("active", true)+ .single();+}++export async function getUserByEmail(email: string) {+ return getSupabaseServiceRole()+ .from("user")+ .select("*")+ .eq("email", email)+ .maybeSingle();+}++function makeAuthSession(+ supabaseSession: SupabaseAuthSession | null,+ companyId: string+): AuthSession | null {+ if (!supabaseSession) return null;++ if (!supabaseSession.refresh_token)+ throw new Error("User should have a refresh token");++ if (!supabaseSession.user?.email)+ throw new Error("User should have an email");++ return {+ accessToken: supabaseSession.access_token,+ companyId,+ refreshToken: supabaseSession.refresh_token,+ userId: supabaseSession.user.id,+ email: supabaseSession.user.email,+ expiresIn:+ (supabaseSession.expires_in ?? 3000) - REFRESH_ACCESS_TOKEN_THRESHOLD,+ expiresAt: supabaseSession.expires_at ?? -1,+ };+}++export async function sendMagicLink(email: string) {+ return getSupabaseServiceRole().auth.signInWithOtp({+ email,+ options: {+ emailRedirectTo: `${VERCEL_URL}/callback`,+ },+ });+}++export async function signInWithEmail(email: string, password: string) {+ const client = getSupabaseServiceRole();+ const { data, error } = await client.auth.signInWithPassword({+ email,+ password,+ });++ if (!data.session || error) return null;+ const companies = await getCompaniesForUser(client, data.user.id);++ return makeAuthSession(data.session, companies?.[0]);+}++export async function refreshAccessToken(+ refreshToken?: string,+ companyId?: string+): Promise<AuthSession | null> {+ if (!refreshToken) return null;++ const client = getSupabaseServiceRole();++ const { data, error } = await client.auth.refreshSession({+ refresh_token: refreshToken,+ });++ if (!data.session || error) return null;++ return makeAuthSession(data.session, companyId!);+}++export async function verifyAuthSession(authSession: AuthSession) {+ const authAccount = await getAuthAccountByAccessToken(+ authSession.accessToken+ );++ return Boolean(authAccount);+}diff --git a/apps/developers/app/services/auth/index.ts b/apps/developers/app/services/auth/index.tsnew file mode 100644index 0000000000..1966067c6f--- /dev/null+++ b/apps/developers/app/services/auth/index.ts@@ -0,0 +1,3 @@+export * from "./auth.models";+//export * from "./auth.server";+export * from "./types";diff --git a/apps/developers/app/services/auth/types.ts b/apps/developers/app/services/auth/types.tsnew file mode 100644index 0000000000..9aaa488934--- /dev/null+++ b/apps/developers/app/services/auth/types.ts@@ -0,0 +1,9 @@+export interface AuthSession {+ accessToken: string;+ refreshToken: string;+ userId: string;+ companyId: string;+ email: string;+ expiresIn: number;+ expiresAt: number;+}diff --git a/apps/developers/app/services/mode.server.ts b/apps/developers/app/services/mode.server.tsnew file mode 100644index 0000000000..7c772021f5--- /dev/null+++ b/apps/developers/app/services/mode.server.ts@@ -0,0 +1,21 @@+import * as cookie from "cookie";+import type { Mode } from "~/types/validators";++const cookieName = "mode";++export function getMode(request: Request): Mode | null {+ const cookieHeader = request.headers.get("cookie");+ const parsed = cookieHeader+ ? cookie.parse(cookieHeader)[cookieName]+ : "light";+ if (parsed === "light" || parsed === "dark") return parsed;+ return null;+}++export function setMode(mode: Mode | "system") {+ if (mode === "system") {+ return cookie.serialize(cookieName, "", { path: "/", maxAge: -1 });+ } else {+ return cookie.serialize(cookieName, mode, { path: "/", maxAge: 31536000 });+ }+}diff --git a/apps/developers/app/services/session.server.ts b/apps/developers/app/services/session.server.tsnew file mode 100644index 0000000000..647fa5b338--- /dev/null+++ b/apps/developers/app/services/session.server.ts@@ -0,0 +1,207 @@+import { createCookieSessionStorage, redirect } from "@remix-run/node";++import { getCurrentPath, isGet, makeRedirectToFromHere } from "~/utils/http";++import {+ NODE_ENV,+ REFRESH_ACCESS_TOKEN_THRESHOLD,+ SESSION_KEY,+ SESSION_MAX_AGE,+ SESSION_SECRET,+ VERCEL_URL,+} from "~/config/env";++import { redis } from "@carbon/redis";++import type { Result } from "~/types";+import { path, removeSubdomain } from "~/utils/path";+import { refreshAccessToken, verifyAuthSession } from "./auth/auth.server";+import type { AuthSession } from "./auth/types";++async function assertAuthSession(+ request: Request,+ { onFailRedirectTo }: { onFailRedirectTo?: string } = {}+) {+ const authSession = await getAuthSession(request);++ if (!authSession?.accessToken || !authSession?.refreshToken) {+ throw redirect(+ `${onFailRedirectTo || path.to.login}?${makeRedirectToFromHere(request)}`+ );+ }++ return authSession;+}++const sessionStorage = createCookieSessionStorage({+ cookie: {+ name: "carbon",+ httpOnly: true,+ path: "/",+ sameSite: "lax",+ secrets: [SESSION_SECRET],+ secure: NODE_ENV === "production",+ domain: NODE_ENV === "production" ? removeSubdomain(VERCEL_URL) : undefined,+ },+});++export async function commitAuthSession(+ request: Request,+ {+ authSession,+ }: {+ authSession?: AuthSession | null;+ } = {}+) {+ const session = await getSession(request);++ // allow user session to be null.+ // useful you want to clear session and display a message explaining why+ if (authSession !== undefined) {+ session.set(SESSION_KEY, authSession);+ }++ return sessionStorage.commitSession(session, { maxAge: SESSION_MAX_AGE });+}++export async function destroyAuthSession(request: Request) {+ const session = await getSession(request);++ // when we change to throw redirect, or callback stops working+ return redirect(path.to.login, {+ headers: {+ "Set-Cookie": await sessionStorage.destroySession(session),+ },+ });+}++export async function flash(request: Request, result: Result) {+ const session = await getSession(request);+ if (typeof result.success === "boolean") {+ session.flash("success", result.success);+ session.flash("message", result.message);+ }++ return {+ headers: { "Set-Cookie": await sessionStorage.commitSession(session) },+ };+}++export async function getAuthSession(+ request: Request+): Promise<AuthSession | null> {+ const session = await getSession(request);+ return session.get(SESSION_KEY);+}++export async function getSessionFlash(request: Request) {+ const session = await getSession(request);++ const result: Result = {+ success: session.get("success") === true,+ message: session.get("message"),+ };++ if (!result.message) return null;++ const headers = { "Set-Cookie": await sessionStorage.commitSession(session) };++ return { result, headers };+}++function getPermissionCacheKey(userId: string) {+ return `permissions:${userId}`;+}++async function getSession(request: Request) {+ const cookie = request.headers.get("Cookie");+ return sessionStorage.getSession(cookie);+}++function isExpiringSoon(expiresAt: number) {+ return (expiresAt - REFRESH_ACCESS_TOKEN_THRESHOLD) * 1000 < Date.now();+}++export async function requireAuthSession(+ request: Request,+ {+ onFailRedirectTo,+ verify,+ }: {+ onFailRedirectTo?: string;+ verify: boolean;+ } = { verify: false }+): Promise<AuthSession> {+ const authSession = await assertAuthSession(request, {+ onFailRedirectTo,+ });++ const isValidSession = verify ? await verifyAuthSession(authSession) : true;++ if (!isValidSession || isExpiringSoon(authSession.expiresAt)) {+ return refreshAuthSession(request);+ }++ return authSession;+}++export async function refreshAuthSession(+ request: Request+): Promise<AuthSession> {+ const authSession = await getAuthSession(request);++ const refreshedAuthSession = await refreshAccessToken(+ authSession?.refreshToken,+ authSession?.companyId+ );++ if (!refreshedAuthSession) {+ const redirectUrl = `${path.to.login}?${makeRedirectToFromHere(request)}`;++ // here we throw instead of return because this function promise a AuthSession and not a response object+ // https://remix.run/docs/en/v1/guides/constraints#higher-order-functions+ throw redirect(redirectUrl, {+ headers: {+ "Set-Cookie": await commitAuthSession(request, {+ authSession: null,+ }),+ },+ });+ }++ // refresh is ok and we can redirect+ if (isGet(request)) {+ // here we throw instead of return because this function promise a UserSession and not a response object+ // https://remix.run/docs/en/v1/guides/constraints#higher-order-functions+ throw redirect(getCurrentPath(request), {+ headers: {+ "Set-Cookie": await commitAuthSession(request, {+ authSession: refreshedAuthSession,+ }),+ },+ });+ }++ // we can't redirect because we are in an action, so, deal with it and don't forget to handle session commit 👮♀️+ return refreshedAuthSession;+}++export async function updateCompanySession(+ request: Request,+ companyId: string+) {+ const session = await getSession(request);+ const authSession = await getAuthSession(request);++ // allow user session to be null.+ // useful you want to clear session and display a message explaining why+ if (authSession !== undefined) {+ await redis.del(getPermissionCacheKey(authSession?.userId!));+ session.set(SESSION_KEY, {+ ...authSession,+ companyId,+ });+ }++ return sessionStorage.commitSession(session, { maxAge: SESSION_MAX_AGE });+}diff --git a/apps/developers/app/services/theme.server.ts b/apps/developers/app/services/theme.server.tsnew file mode 100644index 0000000000..6e24b6f0dc--- /dev/null+++ b/apps/developers/app/services/theme.server.ts@@ -0,0 +1,26 @@+import * as cookie from "cookie";++const cookieName = "theme";+const themes = [+ "zinc",+ "neutral",+ "red",+ "rose",+ "green",+ "blue",+ "yellow",+ "orange",+ "violet",+] as const;+type Theme = (typeof themes)[number];++export function getTheme(request: Request): Theme {+ const cookieHeader = request.headers.get("cookie");+ const parsed = cookieHeader ? cookie.parse(cookieHeader)[cookieName] : "zinc";+ if (themes.includes(parsed as Theme)) return parsed as Theme;+ return "zinc";+}++export function setTheme(theme: string) {+ return cookie.serialize(cookieName, theme, { path: "/", maxAge: 31536000 });+}diff --git a/apps/developers/app/styles/background.css b/apps/developers/app/styles/background.cssnew file mode 100644index 0000000000..0d626c7625--- /dev/null+++ b/apps/developers/app/styles/background.css@@ -0,0 +1,68 @@+/* Credit: https://cmdk.paco.me/ */++.background {+ width: 100vw;+ min-height: 100vh;+ position: fixed;+ display: flex;+ justify-content: center;+ padding: 120px 24px 160px 24px;+ pointer-events: none;+}++.background:before {+ background: radial-gradient(circle, rgba(2, 0, 36, 0) 0, #fafafa 100%);+ position: absolute;+ content: "";+ z-index: 2;+ width: 100%;+ height: 100%;+ top: 0;+}++.dark .background:before {+ background: radial-gradient(circle, rgba(2, 0, 36, 0) 0, #161616 100%);+}++.background:after {+ content: "";+ background-image: url("/grid.svg");+ z-index: 1;+ position: absolute;+ width: 100%;+ height: 100%;+ top: 0;+ opacity: 0.4;+ filter: invert(1);+}++.gradient {+ height: fit-content;+ z-index: 3;+ width: 100%;+ max-width: 640px;+ background-image: radial-gradient(+ at 27% 37%,+ hsla(215, 98%, 61%, 1) 0px,+ transparent 0%+ ),+ radial-gradient(at 97% 21%, hsla(125, 60%, 72%, 1) 0px, transparent 55%),+ radial-gradient(at 52% 99%, hsla(354, 40%, 61%, 1) 0px, transparent 55%),+ radial-gradient(at 10% 29%, hsla(256, 50%, 67%, 1) 0px, transparent 55%),+ radial-gradient(at 97% 96%, hsla(38, 40%, 74%, 1) 0px, transparent 55%),+ radial-gradient(at 33% 50%, hsla(222, 60%, 73%, 1) 0px, transparent 55%),+ radial-gradient(at 79% 53%, hsla(343, 20%, 79%, 1) 0px, transparent 55%);+ position: absolute;+ content: "";+ width: 100%;+ height: 100%;+ filter: blur(100px) saturate(150%);+ top: 80px;+ opacity: 0.15;+}++@media screen and (max-width: 640px) {+ .content {+ display: none;+ }+}diff --git a/apps/developers/app/styles/docs.css b/apps/developers/app/styles/docs.cssnew file mode 100644index 0000000000..13cecf88e8--- /dev/null+++ b/apps/developers/app/styles/docs.css@@ -0,0 +1,1592 @@+.Code {+ width: 100%;+}++.Code .prism-code {+ margin: 0;+ padding: 0.25rem;+ background-color: none;+ white-space: normal;+ word-break: break-word;+}++.Code .token-line {+ font-size: 0.875rem;+ line-height: 1.25rem;+}++.Code .token.function,+.Code .token.imports,+.Code .token.keyword.module,+.Code .token.property-access {+ --tw-text-opacity: 1 !important;+}++.Code .token.function,+.Code .token.keyword.module {+ font-style: normal !important;+}++.Code .token.console.class-name,+.Code .token.doc-comment.optional-parameter,+.Code .token.doc-comment.optional-parameter.punctuation,+.Code .token.doc-comment.parameter,+.Code .token.doc-comment.parameter.punctuation,+.Code .token.operator,+.Code .token.parameter,+.Code .token.plain,+.Code .token.punctuation {+ font-style: normal !important;+ --tw-text-opacity: 1 !important;+}++.Code .token.doc-comment.keyword,+.Code .token.keyword {+ font-style: normal !important;+}++.Code .token.string {+ font-style: normal !important;+ --tw-text-opacity: 1 !important;+}++.Code .token.constant {+ font-style: normal !important;+}++.Code .token.comment {+ font-style: normal !important;+ --tw-text-opacity: 1 !important;+}++.Code .token.number {+ --tw-text-opacity: 1 !important;+}++.Code .token.boolean,+.Code .token.doc-comment.class-name {+ --tw-text-opacity: 1;+}++.Code .codeBlock {+ margin-bottom: 0;+ overflow: hidden;+ overflow-wrap: break-word;+ white-space: pre-wrap;+}++.Code.codeBlockWrapper {+ position: relative;+}++.Code.codeBlockWrapper:hover .buttonContainer {+ visibility: visible;+ opacity: 1;+}++.Code .buttonContainer {+ right: 5px;+ top: 5px;+ opacity: 0;+ position: absolute;+ visibility: hidden;+ transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,+ bottom 0.2s ease-in-out;+}++.Code .buttonContainer button {+ border-radius: 0.25rem;+ font-size: 0.75rem;+ line-height: 1rem;+ background: #011627;+ border: 1px solid #d6deeb;+ color: #d6deeb;+ cursor: pointer;+ line-height: 12px;+ outline: none;+ padding: 4px 8px;+}++.Code.codeBlockWrapper .sbui-btn-container {+ position: absolute;+ top: 2px;+ right: 3px;+ visibility: hidden;+ opacity: 0;+}++.Code.codeBlockWrapper:hover .sbui-btn-container {+ visibility: visible;+ opacity: 1;+}++.CustomCodeBlock {+ width: 100%;+}++.CustomCodeBlock .code-with-header pre {+ border-radius: 0 0 4px 4px;+}++.CustomCodeBlock .code-with-response pre {+ border-radius: 0;+}++.CustomCodeBlock .code-header {+ color: #ccc;+ padding: 5px 15px;+ border-radius: 4px 4px 0 0;+ font-size: 0.8rem;+ font-weight: 700;+ border-bottom: 1px solid #444;+}++.FunctionBlock h4 {+ margin-top: 36px;+ margin-bottom: 12px;+}++.FunctionBlock p {+ margin-top: 0;+ margin-bottom: 24px;+}++.Docs--inner-wrapper {+ background: linear-gradient(+ 90deg,+ hsl(var(--background)) 50%,+ hsl(var(--muted)) 50%+ );+ width: 100%;+}++.dark .Docs--inner-wrapper {+ background: linear-gradient(+ 90deg,+ hsl(var(--background)) 50%,+ hsl(var(--card)) 50%+ );+}++.Docs .doc-heading {+ font-weight: bold;+ margin-top: 1rem;+ width: 50%;+ padding-left: 1.5rem;+ padding-right: 1.5rem;+ text-transform: capitalize;+ --tw-text-opacity: 1;++ -webkit-hyphens: auto;+ hyphens: auto;+ max-width: 50%;+}++.Docs .doc-section {+ display: flex;+ border-bottom-width: 1px;+ --tw-border-opacity: 1;+ border-color: hsl(var(--border) / var(--tw-border-opacity));+}++.Docs.Docs--table-editor .doc-section--introduction .text {+ width: 85%;+}++.Docs.Docs--table-editor .doc-section--client-libraries {+ flex-direction: column;+ margin-bottom: 40px;+}++.Docs.Docs--table-editor .doc-section--client-libraries .code,+.Docs.Docs--table-editor .doc-section--client-libraries .text {+ width: 100%;+ max-width: none;+}++.Docs.Docs--table-editor .doc-section--client-libraries .code {+ margin-bottom: 20px;+}++.Docs .doc-section article:first-child {+ color: var(--tw-prose-body);+ max-width: 65ch;+}++.Docs+ .doc-section+ article:first-child+ :where(p):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.25em;+ margin-bottom: 1.25em;+ font-weight: 400;+}++.Docs+ .doc-section+ article:first-child+ :where([class~="lead"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ color: var(--tw-prose-lead);+ font-size: 1.25em;+ line-height: 1.6;+ margin-top: 1.2em;+ margin-bottom: 1.2em;+}++.Docs+ .doc-section+ article:first-child+ :where(a):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ text-decoration: underline;+ font-weight: 400;+ position: relative;+ transition: all 0.18s ease;+ padding-bottom: 2px;+ opacity: 1;+ text-decoration-line: underline;+ text-decoration-color: hsl(var(--muted-foreground));+ text-decoration-thickness: 1px;+ text-underline-offset: 2px;+}++.Docs+ .doc-section+ article:first-child+ :where(strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-bold);+ font-weight: 600;+}++.Docs+ .doc-section+ article:first-child+ :where(a strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote strong):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(thead th strong):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(ol):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ list-style-type: none;+ margin-top: 1.25em;+ margin-bottom: 3rem;+ padding-left: 1rem;+ counter-reset: item;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="A"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: upper-alpha;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="a"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: lower-alpha;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="A s"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: upper-alpha;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="a s"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: lower-alpha;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="I"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: upper-roman;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="i"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: lower-roman;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="I s"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: upper-roman;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="i s"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: lower-roman;+}++.Docs+ .doc-section+ article:first-child+ :where(ol[type="1"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ list-style-type: decimal;+}++.Docs+ .doc-section+ article:first-child+ :where(ul):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ list-style-type: none;+ margin-top: 1.25em;+ margin-bottom: 1.25em;+ padding-left: 1rem;+}++.Docs+ .doc-section+ article:first-child+ :where(ol > li):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ )::marker {+ font-weight: 400;+ color: var(--tw-prose-counters);+}++.Docs+ .doc-section+ article:first-child+ :where(ul > li):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ )::marker {+ color: var(--tw-prose-bullets);+}++.Docs+ .doc-section+ article:first-child+ :where(dt):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 600;+ margin-top: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(hr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border-color: var(--tw-prose-hr);+ border-top-width: 1px;+ margin-top: 3em;+ margin-bottom: 3em;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 500;+ font-style: italic;+ color: var(--tw-prose-quotes);+ border-left-width: 0.25rem;+ border-left-color: var(--tw-prose-quote-borders);+ quotes: "\201C""\201D""\2018""\2019";+ margin-top: 1.6em;+ margin-bottom: 1.6em;+ padding-left: 1em;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote p:first-of-type):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):before {+ content: open-quote;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote p:last-of-type):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):after {+ content: close-quote;+}++.Docs+ .doc-section+ article:first-child+ :where(h1):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 800;+ font-size: 2.25em;+ margin-bottom: 0.8888889em;+ line-height: 1.1111111;+}++.Docs+ .doc-section+ article:first-child+ :where(h1 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 900;+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(h2):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 700;+ font-size: 1.5em;+ margin-top: 2em;+ margin-bottom: 1em;+ line-height: 1.3333333;+}++.Docs+ .doc-section+ article:first-child+ :where(h2 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 800;+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(h3):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 600;+ font-size: 1.25em;+ margin-top: 1.6em;+ margin-bottom: 0.6em;+ line-height: 1.6;+}++.Docs+ .doc-section+ article:first-child+ :where(h3 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 700;+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(h4):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 600;+ margin-top: 1.5em;+ margin-bottom: 0.5em;+ line-height: 1.5;+ font-size: 1.15em;+}++.Docs+ .doc-section+ article:first-child+ :where(h4 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 700;+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 2em;+ margin-bottom: 2em;+}++.Docs+ .doc-section+ article:first-child+ :where(picture):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ display: block;+ margin-top: 2em;+ margin-bottom: 2em;+}++.Docs+ .doc-section+ article:first-child+ :where(kbd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-weight: 500;+ font-family: inherit;+ color: var(--tw-prose-kbd);+ box-shadow: 0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),+ 0 3px 0 rgb(var(--tw-prose-kbd-shadows) / 10%);+ font-size: 0.875em;+ padding: 0.1875em 0.375em;+}++.Docs+ .doc-section+ article:first-child+ :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-code);+ font-weight: 400;+ font-size: 0.875em;+ padding: 0.2rem 0.4rem;+ background-color: hsl(var(--muted));+ border: 1px solid hsl(var(--muted));+ border-radius: 0.5rem;+}++.Docs+ .doc-section+ article:first-child+ :where(code):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):before {+ content: "";+}++.Docs+ .doc-section+ article:first-child+ :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)):after {+ content: "";+}++.Docs+ .doc-section+ article:first-child+ :where(a code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(h1 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(h2 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+ font-size: 0.875em;+}++.Docs+ .doc-section+ article:first-child+ :where(h3 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+ font-size: 0.9em;+}++.Docs+ .doc-section+ article:first-child+ :where(h4 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote code):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(thead th code):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ color: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(pre):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-pre-code);+ background-color: var(--tw-prose-pre-bg);+ overflow-x: auto;+ font-weight: 400;+ font-size: 0.875em;+ line-height: 1.7142857;+ margin-top: 1.7142857em;+ margin-bottom: 32px;+ border-radius: 0.375rem;+ background: none;+ padding: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(pre code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ background-color: transparent;+ border-width: 0;+ border-radius: 0;+ padding: 0;+ font-weight: inherit;+ color: inherit;+ font-size: inherit;+ font-family: inherit;+ line-height: inherit;+}++.Docs+ .doc-section+ article:first-child+ :where(pre code):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):before {+ content: none;+}++.Docs+ .doc-section+ article:first-child+ :where(pre code):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):after {+ content: none;+}++.Docs+ .doc-section+ article:first-child+ :where(table):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ width: 100%;+ table-layout: auto;+ text-align: left;+ margin-top: 2em;+ margin-bottom: 2em;+ font-size: 0.875em;+ line-height: 1.7142857;+}++.Docs+ .doc-section+ article:first-child+ :where(thead):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border-bottom-width: 1px;+ border-bottom-color: var(--tw-prose-th-borders);+}++.Docs+ .doc-section+ article:first-child+ :where(thead th):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--tw-prose-headings);+ font-weight: 600;+ vertical-align: bottom;+ padding-right: 0.5714286em;+ padding-bottom: 0.5714286em;+ padding-left: 0.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody tr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border-bottom-width: 1px;+ border-bottom-color: var(--tw-prose-td-borders);+}++.Docs+ .doc-section+ article:first-child+ :where(tbody tr:last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ border-bottom-width: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ vertical-align: baseline;+}++.Docs+ .doc-section+ article:first-child+ :where(tfoot):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border-top-width: 1px;+ border-top-color: var(--tw-prose-th-borders);+}++.Docs+ .doc-section+ article:first-child+ :where(tfoot td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ vertical-align: top;+}++.Docs+ .doc-section+ article:first-child+ :where(figcaption):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: hsl(var(--muted-foreground));+ font-size: 0.875em;+ line-height: 1.4285714;+ margin-top: 0.8571429em;+ font-family: Office Code Pro, monospace;+}++.Docs .doc-section article:first-child {+ --tw-prose-links: hsl(var(--foreground));+ --tw-prose-kbd: #111827;+ --tw-prose-kbd-shadows: 17 24 39;+ --tw-prose-invert-kbd: #fff;+ --tw-prose-invert-kbd-shadows: 255 255 255;+ --tw-prose-invert-code: #fff;+ --tw-prose-invert-pre-code: #d1d5db;+ --tw-prose-invert-pre-bg: rgba(0, 0, 0, 0.5);+ --tw-prose-invert-th-borders: #4b5563;+ --tw-prose-invert-td-borders: #374151;+ font-size: 1rem;+ line-height: 1.75;+}++.Docs+ .doc-section+ article:first-child+ :where(video):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 2em;+ margin-bottom: 2em;+}++.Docs+ .doc-section+ article:first-child+ :where(li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0.5em;+ margin-bottom: 0.5em;+}++.Docs+ .doc-section+ article:first-child+ :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ padding-left: 0.375em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ padding-left: 0.375em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > ul > li p):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0.75em;+ margin-bottom: 0.75em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > ul > li > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > ul > li > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > ol > li > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > ol > li > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul ul, ul ol, ol ul, ol ol):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0.75em;+ margin-bottom: 0.75em;+}++.Docs+ .doc-section+ article:first-child+ :where(dl):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.25em;+ margin-bottom: 1.25em;+}++.Docs+ .doc-section+ article:first-child+ :where(dd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0.5em;+ padding-left: 1.625em;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody td, tfoot td):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding: 0.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(figure):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin: 3rem 0;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(h5):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ color: var(--colors-scale12);+}++.Docs+ .doc-section+ article:first-child+ :where(h1, h2, h3, h4, h5, h6):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ font-weight: 400;+}++.Docs+ .doc-section+ article:first-child+ :where(article h2, article h3, article h4, article h5, article h6):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 2em;+ margin-bottom: 1em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ position: relative;+}++.Docs+ .doc-section+ article:first-child+ :where(ul li):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):before {+ position: absolute;+ top: 0.75rem;+ left: -1rem;+ height: 0.125rem;+ width: 0.5rem;+ border-radius: 0.25rem;+ background-color: hsl(var(--border));+ content: "";+}++.Docs+ .doc-section+ article:first-child+ :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ display: block;+ position: relative;+ padding-left: 1rem;+}++.Docs+ .doc-section+ article:first-child+ :where(ol > li):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ):before {+ position: absolute;+ top: 0.25rem;+ left: -1rem;+ height: 1.2rem;+ width: 1.2rem;+ border-radius: 0.25rem;+ background-color: hsl(var(--background));+ border: 1px solid hsl(var(--border));+ content: counter(item) " ";+ counter-increment: item;+ font-size: 12px;+ color: hsl(var(--muted-foreground));+ display: flex;+ align-items: center;+ justify-content: center;+}++.Docs+ .doc-section+ article:first-child+ :where(p img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border: 1px solid hsl(var(--border));+ border-radius: 4px;+ overflow: hidden;+}++.Docs+ .doc-section+ article:first-child+ :where(iframe):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border: 1px solid hsl(var(--border) / 0.9);+ border-radius: 0.5rem;+}++.Docs+ .doc-section+ article:first-child+ :where(td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ border-bottom: 1px solid hsl(var(--muted));+}++.Docs+ .doc-section+ article:first-child+ :where(a:hover):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+}++.Docs+ .doc-section+ article:first-child+ :where(figure.quote-figure p:first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(figure.quote-figure p:last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(figure img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin: 0;+}++.Docs .doc-section article:first-child {+ font-size: 0.875rem;+ line-height: 1.7142857;+}++.Docs+ .doc-section+ article:first-child+ :where(p):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.1428571em;+ margin-bottom: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where([class~="lead"]):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ font-size: 1.2857143em;+ line-height: 1.5555556;+ margin-top: 0.8888889em;+ margin-bottom: 0.8888889em;+}++.Docs+ .doc-section+ article:first-child+ :where(blockquote):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.3333333em;+ margin-bottom: 1.3333333em;+ padding-left: 1.1111111em;+}++.Docs+ .doc-section+ article:first-child+ :where(h1):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 2.1428571em;+ margin-top: 0;+ margin-bottom: 0.8em;+ line-height: 1.2;+}++.Docs+ .doc-section+ article:first-child+ :where(h2):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 1.4285714em;+ margin-top: 1.6em;+ margin-bottom: 0.8em;+ line-height: 1.4;+}++.Docs+ .doc-section+ article:first-child+ :where(h3):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 1.2857143em;+ margin-top: 1.5555556em;+ margin-bottom: 0.4444444em;+ line-height: 1.5555556;+}++.Docs+ .doc-section+ article:first-child+ :where(h4):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.4285714em;+ margin-bottom: 0.5714286em;+ line-height: 1.4285714;+}++.Docs+ .doc-section+ article:first-child+ :where(img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.7142857em;+ margin-bottom: 1.7142857em;+}++.Docs+ .doc-section+ article:first-child+ :where(picture):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.7142857em;+ margin-bottom: 1.7142857em;+}++.Docs+ .doc-section+ article:first-child+ :where(picture > img):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0;+ margin-bottom: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(video):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.7142857em;+ margin-bottom: 1.7142857em;+}++.Docs+ .doc-section+ article:first-child+ :where(kbd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8571429em;+ border-radius: 0.3125rem;+ padding: 0.1428571em 0.3571429em;+}++.Docs+ .doc-section+ article:first-child+ :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8571429em;+}++.Docs+ .doc-section+ article:first-child+ :where(h2 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.9em;+}++.Docs+ .doc-section+ article:first-child+ :where(h3 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8888889em;+}++.Docs+ .doc-section+ article:first-child+ :where(pre):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8571429em;+ line-height: 1.6666667;+ margin-top: 1.6666667em;+ margin-bottom: 1.6666667em;+ border-radius: 0.25rem;+ padding: 0.6666667em 1em;+}++.Docs+ .doc-section+ article:first-child+ :where(ol):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.1428571em;+ margin-bottom: 1.1428571em;+ padding-left: 1.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.1428571em;+ margin-bottom: 1.1428571em;+ padding-left: 1.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0.2857143em;+ margin-bottom: 0.2857143em;+}++.Docs+ .doc-section+ article:first-child+ :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ padding-left: 0.4285714em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ padding-left: 0.4285714em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > ul > li p):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0.5714286em;+ margin-bottom: 0.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > ul > li > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > ul > li > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > ol > li > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > ol > li > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(ul ul, ul ol, ol ul, ol ol):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0.5714286em;+ margin-bottom: 0.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(dl):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.1428571em;+ margin-bottom: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(dt):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.1428571em;+}++.Docs+ .doc-section+ article:first-child+ :where(dd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0.2857143em;+ padding-left: 1.5714286em;+}++.Docs+ .doc-section+ article:first-child+ :where(hr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 2.8571429em;+ margin-bottom: 2.8571429em;+}++.Docs+ .doc-section+ article:first-child+ :where(hr + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(h2 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(h3 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(h4 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(table):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8571429em;+ line-height: 1.5;+}++.Docs+ .doc-section+ article:first-child+ :where(thead th):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ padding-right: 1em;+ padding-bottom: 0.6666667em;+ padding-left: 1em;+}++.Docs+ .doc-section+ article:first-child+ :where(thead th:first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding-left: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(thead th:last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding-right: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody td, tfoot td):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding: 0.6666667em 1em;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody td:first-child, tfoot td:first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding-left: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(tbody td:last-child, tfoot td:last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ padding-right: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(figure):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 1.7142857em;+ margin-bottom: 1.7142857em;+}++.Docs+ .doc-section+ article:first-child+ :where(figure > *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ margin-top: 0;+ margin-bottom: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(figcaption):not(:where([class~="not-prose"], [class~="not-prose"] *)) {+ font-size: 0.8571429em;+ line-height: 1.3333333;+ margin-top: 0.6666667em;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > :first-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-top: 0;+}++.Docs+ .doc-section+ article:first-child+ :where(.prose-sm > :last-child):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ margin-bottom: 0;+}++.Docs .doc-section article:first-child {+ --tw-prose-body: hsl(var(--foreground));+ --tw-prose-headings: hsl(var(--foreground));+ --tw-prose-lead: hsl(var(--foreground));+ --tw-prose-links: hsl(var(--primary));+ --tw-prose-bold: hsl(var(--foreground));+ --tw-prose-counters: hsl(var(--foreground));+ --tw-prose-bullets: hsl(var(--muted-foreground));+ --tw-prose-hr: hsl(var(--muted));+ --tw-prose-quotes: hsl(var(--foreground));+ --tw-prose-quote-borders: hsl(var(--muted));+ --tw-prose-captions: hsl(var(--border));+ --tw-prose-code: hsl(var(--foreground));+ --tw-prose-pre-code: hsl(var(--muted-foreground));+ --tw-prose-pre-bg: hsl(var(--muted));+ --tw-prose-th-borders: hsl(var(--muted));+ --tw-prose-td-borders: hsl(var(--background-default));+ --tw-prose-invert-body: hsl(var(--background-default));+ --tw-prose-invert-headings: #fff;+ --tw-prose-invert-lead: hsl(var(--muted));+ --tw-prose-invert-links: #fff;+ --tw-prose-invert-bold: #fff;+ --tw-prose-invert-counters: hsl(var(--muted));+ --tw-prose-invert-bullets: hsl(var(--primary));+ --tw-prose-invert-hr: hsl(var(--border));+ --tw-prose-invert-quotes: hsl(var(--background-alternative-default));+ --tw-prose-invert-quote-borders: hsl(var(--border));+ --tw-prose-invert-captions: hsl(var(--muted));+}++.Docs+ .doc-section+ article:first-child+ :where(h1, h2, h3, h4, h5):not(+ :where([class~="not-prose"], [class~="not-prose"] *)+ ) {+ font-weight: 400;+}++.Docs .doc-section article:first-child {+ max-width: none;+}++.Docs.Docs--table-editor .doc-section__table-name {+ margin-top: 1rem;+}++.Docs .code-column {+ width: 50%;+ padding: 1rem 1.5rem;+ max-width: 50%;+}++.Docs .code-column a {+ transition-property: color, background-color, border-color,+ text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,+ -webkit-backdrop-filter;+ transition-property: color, background-color, border-color,+ text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,+ backdrop-filter;+ transition-property: color, background-color, border-color,+ text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,+ backdrop-filter, -webkit-backdrop-filter;+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);+ transition-duration: 0.15s;+}++.Docs .code-column a:hover {+ --tw-text-opacity: 1;+ color: hsl(var(--brand-600) / var(--tw-text-opacity));+}++.Docs .code-column p:last-child {+ padding-bottom: 0;+}++.Docs .code {+ width: 50%;+ flex: 1 1 0%;+ padding: 0.5rem 1.5rem 1rem;+ max-width: 50%;+}++.Docs .code h4 {+ margin: 0.25rem;+ padding: 0;+ font-size: 0.875rem;+ line-height: 1.25rem;+ font-weight: 400;+ text-transform: uppercase;+ --tw-text-opacity: 1;+}++.Docs .code h4:not(:first-child) {+ margin-top: 1.5rem;+}++.Docs .code code {+ margin: 0.25rem;+ padding: 0;+ background-color: none;+}++.Docs .code .is-highlighted {+ --tw-text-opacity: 1;+ color: hsl(var(--primary) / var(--tw-text-opacity));+}++.Docs .codeblock-container + .codeblock-container {+ margin-top: 3rem;+}diff --git a/apps/developers/app/styles/nprogress.css b/apps/developers/app/styles/nprogress.cssnew file mode 100644index 0000000000..7f31ea3f18--- /dev/null+++ b/apps/developers/app/styles/nprogress.css@@ -0,0 +1,16 @@+/* Make clicks pass-through */+#nprogress {+ pointer-events: none;+}++#nprogress .bar {+ background: #002aff99;++ position: fixed;+ z-index: 1031;+ top: 0;+ left: 0;++ width: 100%;+ height: 2px;+}diff --git a/apps/developers/app/styles/tailwind.css b/apps/developers/app/styles/tailwind.cssnew file mode 100644index 0000000000..f4e8409550--- /dev/null+++ b/apps/developers/app/styles/tailwind.css@@ -0,0 +1,136 @@+@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500;600;700&display=swap&display=swap");++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 200;+ src: url("/fonts/Geist-UltraLight.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 300;+ src: url("/fonts/Geist-Light.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 500;+ src: url("/fonts/Geist-Medium.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 600;+ src: url("/fonts/Geist-SemiBold.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 700;+ src: url("/fonts/Geist-Bold.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 800;+ src: url("/fonts/Geist-Black.woff2") format("woff2");+}++@font-face {+ font-family: "Triangle";+ font-style: normal;+ font-weight: 900;+ src: url("/fonts/Geist-UltraBlack.woff2") format("woff2");+}++@tailwind base;+@tailwind components;+@tailwind utilities;++@layer base {+ :root {+ --background: 0 0% 100%;+ --foreground: 240 10% 3.9%;+ --card: 0 0% 100%;+ --card-foreground: 240 10% 3.9%;+ --popover: 0 0% 100%;+ --popover-foreground: 240 10% 3.9%;+ --active: 240 5.9% 10%;+ --active-foreground: 0 0% 98%;+ --primary: 240 5.9% 10%;+ --primary-foreground: 0 0% 98%;+ --secondary: 240 4.8% 95.9%;+ --secondary-foreground: 240 5.9% 10%;+ --muted: 240 4.8% 95.9%;+ --muted-foreground: 240 3.8% 46.1%;+ --accent: 240 4.8% 89.9%;+ --accent-foreground: 240 5.9% 10%;+ --destructive: 0 72.22% 50.59%;+ --destructive-foreground: 0 0% 98%;+ --border: 240 5.9% 90%;+ --input: 240 5.9% 90%;+ --ring: 240 5% 64.9%;+ --radius: 0.5rem;+ }++ .dark {+ --background: 240 10% 3.9%;+ --foreground: 0 0% 98%;+ --card: 240 10% 3.9%;+ --card-foreground: 0 0% 98%;+ --popover: 240 10% 3.9%;+ --popover-foreground: 0 0% 98%;+ --primary: 0 0% 98%;+ --primary-foreground: 240 5.9% 10%;+ --active: 0 0% 98%;+ --active-foreground: 240 5.9% 10%;+ --secondary: 240 3.7% 15.9%;+ --secondary-foreground: 0 0% 98%;+ --muted: 240 3.7% 15.9%;+ --muted-foreground: 240 5% 64.9%;+ --accent: 240 3.7% 15.9%;+ --accent-foreground: 0 0% 98%;+ --destructive: 0 62.8% 30.6%;+ --destructive-foreground: 0 85.7% 97.3%;+ --border: 240 3.7% 15.9%;+ --input: 240 3.7% 15.9%;+ --ring: 240 4.9% 83.9%;+ }+}++@layer base {+ * {+ @apply border-border;+ }+ body {+ @apply bg-background text-foreground;+ font-feature-settings: "rlig" 1, "calt" 1;+ font-synthesis-weight: none;+ text-rendering: optimizeLegibility;+ }+}++.forgeViewer {+ position: relative;+ width: 100%;+ height: 100%;+ min-height: 400px;+}++.forgeViewer > div {+ border-radius: var(--radius);+}++p.is-editor-empty:first-child:before {+ color: var(--muted-foreground);+ content: attr(data-placeholder);+ float: left;+ height: 0;+ pointer-events: none;+}diff --git a/apps/developers/app/types/index.ts b/apps/developers/app/types/index.tsnew file mode 100644index 0000000000..3be4bbd21b--- /dev/null+++ b/apps/developers/app/types/index.ts@@ -0,0 +1,4 @@+export type Result = {+ success: boolean;+ message?: string;+};diff --git a/apps/developers/app/types/validators.ts b/apps/developers/app/types/validators.tsnew file mode 100644index 0000000000..bc6f55d020--- /dev/null+++ b/apps/developers/app/types/validators.ts@@ -0,0 +1,14 @@+import type { Validator } from "@carbon/remix-validated-form";+import { z } from "zod";++export type TypeOfValidator<U extends Validator<any>> = U extends Validator<+ infer T+>+ ? T+ : unknown;++export type Mode = "light" | "dark";++export const modeValidator = z.object({+ mode: z.enum(["light", "dark", "system"]),+});diff --git a/apps/developers/app/utils/dom.ts b/apps/developers/app/utils/dom.tsnew file mode 100644index 0000000000..d5aa965c86--- /dev/null+++ b/apps/developers/app/utils/dom.ts@@ -0,0 +1,6 @@+export function scrollIntoView(element: HTMLElement | undefined | null) {+ element?.scrollIntoView({+ inline: "nearest",+ block: "nearest",+ });+}diff --git a/apps/developers/app/utils/handle.ts b/apps/developers/app/utils/handle.tsnew file mode 100644index 0000000000..cdf10e457b--- /dev/null+++ b/apps/developers/app/utils/handle.ts@@ -0,0 +1,5 @@+export type Handle = {+ breadcrumb?: any;+ to?: string;+ module?: string;+};diff --git a/apps/developers/app/utils/http.ts b/apps/developers/app/utils/http.tsnew file mode 100644index 0000000000..02ce3e1844--- /dev/null+++ b/apps/developers/app/utils/http.ts@@ -0,0 +1,115 @@+import { path } from "./path";++export function getCurrentPath(request: Request) {+ return new URL(request.url).pathname;+}++export function makeRedirectToFromHere(request: Request) {+ const currentPath = getCurrentPath(request);+ return new URLSearchParams([["redirectTo", currentPath]]);+}++export function getRedirectTo(+ request: Request,+ defaultRedirectTo = path.to.authenticatedRoot+) {+ const url = new URL(request.url);+ return safeRedirect(url.searchParams.get("redirectTo"), defaultRedirectTo);+}++export function isGet(request: Request) {+ return request.method.toLowerCase() === "get";+}++export function isPost(request: Request) {+ return request.method.toLowerCase() === "post";+}++export function isDelete(request: Request) {+ return request.method.toLowerCase() === "delete";+}++export function notAuthorized(message: string) {+ return new Response(message, { status: 401 });+}++export function notFound(message: string) {+ return new Response(message, { status: 404 });+}++function notAllowedMethod(message: string) {+ return new Response(message, { status: 405 });+}++export function badRequest(message: string) {+ return new Response(message, { status: 400 });+}++export function getRequiredParam(+ params: Record<string, string | undefined>,+ key: string+) {+ const value = params[key];++ if (!value) {+ throw badRequest(`Missing required request param "${key}"`);+ }++ return value;+}++export function assertIsPost(request: Request, message = "Method not allowed") {+ if (!isPost(request)) {+ throw notAllowedMethod(message);+ }+}++export function assertIsDelete(+ request: Request,+ message = "Method not allowed"+) {+ if (!isDelete(request)) {+ throw notAllowedMethod(message);+ }+}++/**+ * This should be used any time the redirect path is user-provided+ * (Like the query string on our login/signup pages). This avoids+ * open-redirect vulnerabilities.+ * @param {string} to The redirect destination+ * @param {string} defaultRedirect The redirect to use if the to is unsafe.+ */+export function safeRedirect(+ to: FormDataEntryValue | string | null | undefined,+ defaultRedirect = path.to.authenticatedRoot+) {+ if (+ !to ||+ typeof to !== "string" ||+ !to.startsWith("/") ||+ to.startsWith("//")+ ) {+ return defaultRedirect;+ }++ return to;+}++export function parseNumberFromUrlParam(+ params: URLSearchParams,+ key: string,+ defaultValue: number+): number {+ const value = params.get(key);+ if (!value) {+ return defaultValue;+ }++ const parsed = parseInt(value, 10);+ if (isNaN(parsed)) {+ return defaultValue;+ }++ return parsed;+}diff --git a/apps/developers/app/utils/installGlobals.ts b/apps/developers/app/utils/installGlobals.tsnew file mode 100644index 0000000000..20581f6725--- /dev/null+++ b/apps/developers/app/utils/installGlobals.ts@@ -0,0 +1,114 @@+import { installGlobals } from "@remix-run/node";+import { IncomingMessage } from "node:http";++export function installAndLockGlobals() {+ // @ts-ignore+ if (global.__installedAndLocked) {+ return;+ }++ installGlobals({ nativeFetch: true });++ const File = global.File;+ const Headers = global.Headers;+ const Request = global.Request;+ const Response = global.Response;+ const fetch = global.fetch;+ const FormData = global.FormData;++ /* @vercel/remix expects the non-native Headers API+ see: https://github.com/vercel/remix/blob/325c03d4c395b3c48aee88b1574c4688ee59251e/packages/vercel-remix/server.ts#L105+ This adds a minimal compatibility layer, though the result is different+ when multiple values for the same header are added.+ {+ "header": [+ "value1, value2"+ ]+ }+ vs+ {+ "header": [+ "value1",+ "value2"+ ]+ }+ This should be fine, but hasn't been extensively tested.+ Need to patch the prototype here since undici holds a reference.+ */+ if (!Object.hasOwn(Headers.prototype, "raw")) {+ Object.defineProperties(Headers.prototype, {+ raw: {+ value: function raw() {+ const entries: Iterable<[string, string]> = this.entries();+ return Object.fromEntries(+ Array.from(entries).map(([k, v]) => [k, [v]])+ );+ },+ configurable: true,+ },+ });+ }++ /* @vercel/remix doesn't set duplex when initializing a steaming body+ see: https://github.com/vercel/remix/blob/325c03d4c395b3c48aee88b1574c4688ee59251e/packages/vercel-remix/server.ts#L83-L94+ */+ class PatchedRequest extends Request {+ constructor(input: RequestInfo | URL, init: RequestInit = {}) {+ let initPatched = init;+ if (+ init.body &&+ init.body instanceof IncomingMessage &&+ init.duplex === undefined+ ) {+ initPatched = {+ ...init,+ duplex: "half",+ };+ }+ super(input, initPatched);+ }+ }++ // Ignore future changes to these properties+ Object.defineProperties(global, {+ File: {+ get() {+ return File;+ },+ set() {},+ },+ Headers: {+ get() {+ return Headers;+ },+ set() {},+ },+ Request: {+ get() {+ return PatchedRequest;+ },+ set() {},+ },+ Response: {+ get() {+ return Response;+ },+ set() {},+ },+ fetch: {+ get() {+ return fetch;+ },+ set() {},+ },+ FormData: {+ get() {+ return FormData;+ },+ set() {},+ },+ });++ // @ts-ignore+ global.__installedAndLocked = true;+}diff --git a/apps/developers/app/utils/path.ts b/apps/developers/app/utils/path.tsnew file mode 100644index 0000000000..e2f3cb52ad--- /dev/null+++ b/apps/developers/app/utils/path.ts@@ -0,0 +1,40 @@+import { SUPABASE_API_URL } from "~/config/env";++const x = "/x"; // from ~/routes/x+ folder++export const path = {+ to: {+ authenticatedRoot: x,+ callback: "/callback",+ forgotPassword: "/forgot-password",+ healthcheck: "/healthcheck",+ login: "/login",+ logout: "/logout",+ refreshSession: "/refresh-session",+ requestAccess: "/request-access",+ root: "/",+ },+} as const;++export const removeSubdomain = (url?: string): string => {+ if (!url) return "localhost:3000";+ const parts = url.split("/")[0].split(".");++ const domain = parts.slice(-2).join(".");++ return domain;+};++export const getStoragePath = (bucket: string, path: string) => {+ return `${SUPABASE_API_URL}/storage/v1/object/public/${bucket}/${path}`;+};++export const requestReferrer = (request: Request) => {+ return request.headers.get("referer");+};++export const getParams = (request: Request) => {+ const url = new URL(requestReferrer(request) ?? "");+ const searchParams = new URLSearchParams(url.search);+ return searchParams.toString();+};diff --git a/apps/developers/app/utils/result.ts b/apps/developers/app/utils/result.tsnew file mode 100644index 0000000000..f704ee04f7--- /dev/null+++ b/apps/developers/app/utils/result.ts@@ -0,0 +1,24 @@+import logger from "~/lib/logger";+import type { Result } from "~/types";++export function error(error: any, message = "Request failed"): Result {+ if (error) logger.error({ error, message });++ // Removed details because it can grow too large (larger than the cookie limit)+ // const details =+ // typeof error === "object" && error !== null && "message" in error+ // ? (error.message as string)+ // : undefined;++ return {+ success: false,+ message: message,+ };+}++export function success(message = "Request succeeded"): Result {+ return {+ success: true,+ message,+ };+}diff --git a/apps/developers/app/utils/supabase.ts b/apps/developers/app/utils/supabase.tsnew file mode 100644index 0000000000..4631ac61cb--- /dev/null+++ b/apps/developers/app/utils/supabase.ts@@ -0,0 +1,7 @@+export const sanitize = (input: Record<string, any>) => {+ const output = { ...input };+ Object.keys(output).forEach((key) => {+ if (output[key] === undefined && key !== "id") output[key] = null;+ });+ return output;+};diff --git a/apps/developers/env.d.ts b/apps/developers/env.d.tsnew file mode 100644index 0000000000..1dfa1d0d2d--- /dev/null+++ b/apps/developers/env.d.ts@@ -0,0 +1,3 @@+/// <reference types="vite/client" />+/// <reference types="@remix-run/node/globals" />+/// <reference types="@vercel/remix" />diff --git a/apps/developers/package.json b/apps/developers/package.jsonnew file mode 100644index 0000000000..cda57dca1b--- /dev/null+++ b/apps/developers/package.json@@ -0,0 +1,70 @@+{+ "name": "developers",+ "type": "module",+ "dependencies": {+ "@carbon/database": "*",+ "@carbon/documents": "*",+ "@carbon/logger": "*",+ "@carbon/react": "*",+ "@carbon/redis": "*",+ "@carbon/remix-validated-form": "*",+ "@carbon/utils": "*",+ "@react-aria/i18n": "^3.11.0",+ "@remix-run/dev": "~2.10.2",+ "@remix-run/eslint-config": "~2.10.2",+ "@remix-run/node": "~2.10.2",+ "@remix-run/react": "~2.10.2",+ "@remix-run/serve": "~2.10.2",+ "@supabase/functions-js": "2.1.5",+ "@supabase/supabase-js": "^2.40.0",+ "@tailwindcss/container-queries": "^0.1.1",+ "@tailwindcss/forms": "^0.5.7",+ "@tailwindcss/line-clamp": "^0.4.4",+ "@tailwindcss/typography": "^0.5.10",+ "@vercel/analytics": "^1.2.2",+ "@vercel/remix": "2.10.2",+ "framer-motion": "^11.1.7",+ "isbot": "3.6.13",+ "react": "^18.2.0",+ "react-dom": "^18.2.0",+ "react-dropzone": "^14.2.3",+ "react-hotkeys-hook": "~4.5.0",+ "react-icons": "^5.2.1",+ "tailwind-merge": "^2.2.1",+ "tailwind-scrollbar": "^3.0.5",+ "tailwind-scrollbar-hide": "^1.1.7",+ "tailwindcss-animate": "^1.0.7",+ "zod": "^3.23.8",+ "zod-form-data": "*"+ },+ "devDependencies": {+ "@carbon/tailwind": "*",+ "@carbon/tsconfig": "*",+ "@types/react": "^18.2.74",+ "@types/react-dom": "^18.2.24",+ "autoprefixer": "10.4.14",+ "cross-env": "7.0.3",+ "nodemon": "^3.0.1",+ "npm-run-all": "^4.1.5",+ "postcss": "^8.4.33",+ "tailwind-scrollbar": "^3.0.5",+ "tailwindcss": "3.3.2",+ "typescript": "^5.2.2",+ "vite": "^5.3.3",+ "vite-tsconfig-paths": "^4.3.2",+ "wait-on": "7.2.0"+ },+ "engines": {+ "node": ">=20"+ },+ "private": true,+ "scripts": {+ "build": "remix vite:build",+ "clean": "rimraf .cache .turbo node_modules dist build",+ "dev": "PORT=3001 remix vite:dev",+ "lint": "TIMING=1 eslint \"app/**/*.ts*\"",+ "start": "remix-serve ./build/server/index.js",+ "types": "tsc"+ },+ "sideEffects": false+}diff --git a/apps/developers/postcss.config.cjs b/apps/developers/postcss.config.cjsnew file mode 100644index 0000000000..4182e2b578--- /dev/null+++ b/apps/developers/postcss.config.cjs@@ -0,0 +1 @@+module.exports = require("@carbon/tailwind/postcss.config");diff --git a/apps/developers/public/android-chrome-192x192.png b/apps/developers/public/android-chrome-192x192.pngnew file mode 100644index 0000000000..777cc381efBinary files /dev/null and b/apps/developers/public/android-chrome-192x192.png differdiff --git a/apps/developers/public/android-chrome-512x512.png b/apps/developers/public/android-chrome-512x512.pngnew file mode 100644index 0000000000..bd3fb48e59Binary files /dev/null and b/apps/developers/public/android-chrome-512x512.png differdiff --git a/apps/developers/public/apple-touch-icon.png b/apps/developers/public/apple-touch-icon.pngnew file mode 100644index 0000000000..4f8712f2c1Binary files /dev/null and b/apps/developers/public/apple-touch-icon.png differdiff --git a/apps/website/public/logo-dark.png b/apps/developers/public/carbon-logo-dark.pngsimilarity index 100%rename from apps/website/public/logo-dark.pngrename to apps/developers/public/carbon-logo-dark.pngdiff --git a/apps/website/public/logo-light.png b/apps/developers/public/carbon-logo-light.pngsimilarity index 100%rename from apps/website/public/logo-light.pngrename to apps/developers/public/carbon-logo-light.pngdiff --git a/apps/developers/public/favicon-16x16.png b/apps/developers/public/favicon-16x16.pngnew file mode 100644index 0000000000..eb216e453fBinary files /dev/null and b/apps/developers/public/favicon-16x16.png differdiff --git a/apps/developers/public/favicon-32x32.png b/apps/developers/public/favicon-32x32.pngnew file mode 100644index 0000000000..a7064d2122Binary files /dev/null and b/apps/developers/public/favicon-32x32.png differdiff --git a/apps/website/src/app/favicon.ico b/apps/developers/public/favicon.icosimilarity index 100%rename from apps/website/src/app/favicon.icorename to apps/developers/public/favicon.icodiff --git a/apps/developers/public/fonts/Geist-Black.woff2 b/apps/developers/public/fonts/Geist-Black.woff2new file mode 100644index 0000000000..c8230cbc68Binary files /dev/null and b/apps/developers/public/fonts/Geist-Black.woff2 differdiff --git a/apps/developers/public/fonts/Geist-Bold.woff2 b/apps/developers/public/fonts/Geist-Bold.woff2new file mode 100644index 0000000000..d0562e48ecBinary files /dev/null and b/apps/developers/public/fonts/Geist-Bold.woff2 differdiff --git a/apps/developers/public/fonts/Geist-Light.woff2 b/apps/developers/public/fonts/Geist-Light.woff2new file mode 100644index 0000000000..56611204f7Binary files /dev/null and b/apps/developers/public/fonts/Geist-Light.woff2 differdiff --git a/apps/developers/public/fonts/Geist-Medium.woff2 b/apps/developers/public/fonts/Geist-Medium.woff2new file mode 100644index 0000000000..76edd10515Binary files /dev/null and b/apps/developers/public/fonts/Geist-Medium.woff2 differdiff --git a/apps/developers/public/fonts/Geist-Regular.woff2 b/apps/developers/public/fonts/Geist-Regular.woff2new file mode 100644index 0000000000..2ebd0097e7Binary files /dev/null and b/apps/developers/public/fonts/Geist-Regular.woff2 differdiff --git a/apps/developers/public/fonts/Geist-SemiBold.woff2 b/apps/developers/public/fonts/Geist-SemiBold.woff2new file mode 100644index 0000000000..a6c53e8b06Binary files /dev/null and b/apps/developers/public/fonts/Geist-SemiBold.woff2 differdiff --git a/apps/developers/public/fonts/Geist-UltraBlack.woff2 b/apps/developers/public/fonts/Geist-UltraBlack.woff2new file mode 100644index 0000000000..198caeadc9Binary files /dev/null and b/apps/developers/public/fonts/Geist-UltraBlack.woff2 differdiff --git a/apps/developers/public/fonts/Geist-UltraLight.woff2 b/apps/developers/public/fonts/Geist-UltraLight.woff2new file mode 100644index 0000000000..541685251aBinary files /dev/null and b/apps/developers/public/fonts/Geist-UltraLight.woff2 differdiff --git a/apps/developers/public/grid.svg b/apps/developers/public/grid.svgnew file mode 100644index 0000000000..76e3b29f0d--- /dev/null+++ b/apps/developers/public/grid.svg@@ -0,0 +1,5 @@++<svg id="download" xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">+ <path id="Path_3" data-name="Path 3" d="M96,95h4v1H96v4H95V96H86v4H85V96H76v4H75V96H66v4H65V96H56v4H55V96H46v4H45V96H36v4H35V96H26v4H25V96H16v4H15V96H0V95H15V86H0V85H15V76H0V75H15V66H0V65H15V56H0V55H15V46H0V45H15V36H0V35H15V26H0V25H15V16H0V15H15V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h9V0h1V15h4v1H96v9h4v1H96v9h4v1H96v9h4v1H96v9h4v1H96v9h4v1H96v9h4v1H96v9h4v1H96Zm-1,0V86H86v9ZM85,95V86H76v9ZM75,95V86H66v9ZM65,95V86H56v9ZM55,95V86H46v9ZM45,95V86H36v9ZM35,95V86H26v9ZM25,95V86H16v9ZM16,85h9V76H16Zm10,0h9V76H26Zm10,0h9V76H36Zm10,0h9V76H46Zm10,0h9V76H56Zm10,0h9V76H66Zm10,0h9V76H76Zm10,0h9V76H86Zm9-10V66H86v9ZM85,75V66H76v9ZM75,75V66H66v9ZM65,75V66H56v9ZM55,75V66H46v9ZM45,75V66H36v9ZM35,75V66H26v9ZM25,75V66H16v9ZM16,65h9V56H16Zm10,0h9V56H26Zm10,0h9V56H36Zm10,0h9V56H46Zm10,0h9V56H56Zm10,0h9V56H66Zm10,0h9V56H76Zm10,0h9V56H86Zm9-10V46H86v9ZM85,55V46H76v9ZM75,55V46H66v9ZM65,55V46H56v9ZM55,55V46H46v9ZM45,55V46H36v9ZM35,55V46H26v9ZM25,55V46H16v9ZM16,45h9V36H16Zm10,0h9V36H26Zm10,0h9V36H36Zm10,0h9V36H46Zm10,0h9V36H56Zm10,0h9V36H66Zm10,0h9V36H76Zm10,0h9V36H86Zm9-10V26H86v9ZM85,35V26H76v9ZM75,35V26H66v9ZM65,35V26H56v9ZM55,35V26H46v9ZM45,35V26H36v9ZM35,35V26H26v9ZM25,35V26H16v9ZM16,25h9V16H16Zm10,0h9V16H26Zm10,0h9V16H36Zm10,0h9V16H46Zm10,0h9V16H56Zm10,0h9V16H66Zm10,0h9V16H76Zm10,0h9V16H86Z" fill="rgba(255,255,255,0.1)" fill-rule="evenodd" opacity="0.5"/>+ <path id="Path_4" data-name="Path 4" d="M6,5V0H5V5H0V6H5v94H6V6h94V5Z" fill="rgba(255,255,255,0.1)" fill-rule="evenodd"/>+</svg>diff --git a/apps/developers/public/serviceWorker.js b/apps/developers/public/serviceWorker.jsnew file mode 100644index 0000000000..790bcf811a--- /dev/null+++ b/apps/developers/public/serviceWorker.js@@ -0,0 +1,31 @@+self.addEventListener("fetch", (event) => {+ let url = new URL(event.request.url);+ let method = event.request.method;++ // any non GET request is ignored+ if (method.toLowerCase() !== "get") return;++ // If the request is for the favicons, fonts, or the built files (which are hashed in the name)+ if (+ url.pathname.includes("logo") ||+ url.pathname.includes("storage/v1/object/public/avatars")+ ) {+ event.respondWith(+ // we will open the assets cache+ caches.open("assets").then(async (cache) => {+ // if the request is cached we will use the cache+ let cacheResponse = await cache.match(event.request);+ if (cacheResponse) return cacheResponse;++ // if it's not cached we will run the fetch, cache it and return it+ // this way the next time this asset it's needed it will load from the cache+ let fetchResponse = await fetch(event.request);+ cache.put(event.request, fetchResponse.clone());++ return fetchResponse;+ })+ );+ }++ return;+});diff --git a/apps/developers/public/site.webmanifest b/apps/developers/public/site.webmanifestnew file mode 100644index 0000000000..4e209ea8a1--- /dev/null+++ b/apps/developers/public/site.webmanifest@@ -0,0 +1,19 @@+{+ "name": "Carbon",+ "short_name": "Carbon",+ "icons": [+ {+ "src": "/android-chrome-192x192.png",+ "sizes": "192x192",+ "type": "image/png"+ },+ {+ "src": "/android-chrome-512x512.png",+ "sizes": "512x512",+ "type": "image/png"+ }+ ],+ "theme_color": "#ffffff",+ "background_color": "#ffffff",+ "display": "standalone"+}diff --git a/apps/developers/tailwind.config.js b/apps/developers/tailwind.config.jsnew file mode 100644index 0000000000..5856bc01d7--- /dev/null+++ b/apps/developers/tailwind.config.js@@ -0,0 +1,4 @@+module.exports = {+ "tailwindcss/nesting": {},+ ...require("@carbon/tailwind/tailwind.config"),+};diff --git a/apps/developers/tsconfig.json b/apps/developers/tsconfig.jsonnew file mode 100644index 0000000000..819267be2b--- /dev/null+++ b/apps/developers/tsconfig.json@@ -0,0 +1,29 @@+{+ "include": [+ "env.d.ts",+ "**/*.ts",+ "**/*.tsx",+ "app/modules/documents/documents.service.ts"+ ],+ "compilerOptions": {+ "lib": ["dom", "dom.iterable", "ESNext"],+ "esModuleInterop": true,+ "jsx": "react-jsx",+ "module": "ESNext",+ "moduleResolution": "Bundler",+ "resolveJsonModule": true,+ "target": "ES2019",+ "strict": true,+ "forceConsistentCasingInFileNames": true,+ "allowJs": true,+ "baseUrl": ".",+ "paths": {+ "~/*": ["./app/*"]+ },+ "types": ["@remix-run/react/future/single-fetch.d.ts"],+ "noEmit": true,+ "isolatedModules": true,+ "skipLibCheck": true,+ "noErrorTruncation": true+ }+}diff --git a/apps/developers/vite.config.ts b/apps/developers/vite.config.tsnew file mode 100644index 0000000000..45b55c0b31--- /dev/null+++ b/apps/developers/vite.config.ts@@ -0,0 +1,57 @@+import { vitePlugin as remix } from "@remix-run/dev";+import { vercelPreset } from "@vercel/remix/vite";+import path from "node:path";+import { flatRoutes } from "remix-flat-routes";+import { defineConfig } from "vite";+import tsconfigPaths from "vite-tsconfig-paths";++export default defineConfig({+ ssr: {+ noExternal: [+ "react-tweet",+ "react-dropzone",+ "react-icons",+ "react-phone-number-input",+ ],+ },+ server: {+ port: 3001,+ },+ plugins: [+ remix({+ presets: [vercelPreset()],+ future: {+ unstable_singleFetch: true,+ },+ ignoredRouteFiles: ["**/.*"],+ serverModuleFormat: "esm",+ routes: async (defineRoutes) => {+ return flatRoutes("routes", defineRoutes, {+ // eslint-disable-next-line no-undef+ appDir: path.resolve(__dirname, "app"),+ });+ },+ }),+ tsconfigPaths(),+ ],+ resolve: {+ alias: {+ "@carbon/documents": path.resolve(+ __dirname,+ "../../packages/documents/src/index.tsx"+ ),+ "@carbon/utils": path.resolve(+ __dirname,+ "../../packages/utils/src/index.ts"+ ),+ "@carbon/remix-validated-form": path.resolve(+ __dirname,+ "../../packages/remix-validated-form/src/index.tsx"+ ),+ "@carbon/logger": path.resolve(+ __dirname,+ "../../packages/logger/src/index.ts"+ ),+ },+ },+});diff --git a/apps/website/.env.example b/apps/website/.env.exampledeleted file mode 100644index 031fee70d2..0000000000--- a/apps/website/.env.example+++ /dev/null@@ -1 +0,0 @@-HUBSPOT_ACCESS_TOKEN=****************\ No newline at end of filediff --git a/apps/website/next-env.d.ts b/apps/website/next-env.d.tsdeleted file mode 100644index 4f11a03dc6..0000000000--- a/apps/website/next-env.d.ts+++ /dev/null@@ -1,5 +0,0 @@-/// <reference types="next" />-/// <reference types="next/image-types/global" />--// NOTE: This file should not be edited-// see https://nextjs.org/docs/basic-features/typescript for more information.diff --git a/apps/website/next.config.js b/apps/website/next.config.jsdeleted file mode 100644index 97a2b6f0b0..0000000000--- a/apps/website/next.config.js+++ /dev/null@@ -1,30 +0,0 @@-const withMDX = require("@next/mdx")();--/** @type {import("next").NextConfig} */-const config = {- pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],- transpilePackages: [- "@carbon/react",- "@carbon/tailwind",- "geist",- "react-icons",- ],- eslint: {- ignoreDuringBuilds: true,- },- typescript: {- ignoreBuildErrors: true,- },- images: {- remotePatterns: [- {- protocol: "https",- hostname: "**",- },- ],- },-};--module.exports = withMDX(config);--// export default config;diff --git a/apps/website/package.json b/apps/website/package.jsondeleted file mode 100644index 88fa7012f9..0000000000--- a/apps/website/package.json+++ /dev/null@@ -1,48 +0,0 @@-{- "name": "website",- "version": "0.0.1",- "private": true,- "scripts": {- "build": "NODE_ENV=production next build",- "clean": "rimraf .next .turbo node_modules",- "dev": "next dev -p 4200",- "lint": "next lint",- "start": "next start",- "check:types": "tsc --noEmit"- },- "dependencies": {- "@calcom/embed-react": "^1.3.2",- "@carbon/react": "*",- "@hookform/resolvers": "^3.3.4",- "@hubspot/api-client": "^11.1.0",- "@mdx-js/loader": "^3.0.1",- "@mdx-js/react": "^3.0.1",- "@next/mdx": "^14.2.0",- "@radix-ui/react-navigation-menu": "^1.1.4",- "@tabler/icons-react": "3.1.0",- "@types/mdx": "^2.0.13",- "@vercel/analytics": "^1.2.2",- "d3": "^7.9.0",- "date-fns": "^3.6.0",- "framer-motion": "^11.1.7",- "geist": "^1.3.0",- "next": "14.2.3",- "next-mdx-remote": "^4.4.1",- "next-themes": "^0.3.0",- "react": "^18.2.0",- "react-dom": "^18.2.0",- "react-icons": "^5.2.1",- "react-hook-form": "^7.51.2",- "server-only": "^0.0.1",- "zod": "^3.23.8"- },- "devDependencies": {- "@carbon/tailwind": "*",- "@carbon/tsconfig": "*",- "@types/node": "^20.12.5",- "@types/react": "^18.2.74",- "@types/react-dom": "^18.2.24",- "eslint-config-carbon": "*",- "eslint-config-next": "14.2.3"- }-}diff --git a/apps/website/postcss.config.cjs b/apps/website/postcss.config.cjsdeleted file mode 100644index 12a703d900..0000000000--- a/apps/website/postcss.config.cjs+++ /dev/null@@ -1,6 +0,0 @@-module.exports = {- plugins: {- tailwindcss: {},- autoprefixer: {},- },-};diff --git a/apps/website/public/.gitkeep b/apps/website/public/.gitkeepdeleted file mode 100644index e69de29bb2..0000000000diff --git a/apps/website/public/carbon-dark-mode-accounting.jpg b/apps/website/public/carbon-dark-mode-accounting.jpgdeleted file mode 100644index e58c48e628..0000000000Binary files a/apps/website/public/carbon-dark-mode-accounting.jpg and /dev/null differdiff --git a/apps/website/public/carbon-dark-mode-documents.jpg b/apps/website/public/carbon-dark-mode-documents.jpgdeleted file mode 100644index 22db193285..0000000000Binary files a/apps/website/public/carbon-dark-mode-documents.jpg and /dev/null differdiff --git a/apps/website/public/carbon-dark-mode-manufacturing.jpg b/apps/website/public/carbon-dark-mode-manufacturing.jpgdeleted file mode 100644index 0044bcae6c..0000000000Binary files a/apps/website/public/carbon-dark-mode-manufacturing.jpg and /dev/null differdiff --git a/apps/website/public/carbon-dark-mode-permissions.jpg b/apps/website/public/carbon-dark-mode-permissions.jpgdeleted file mode 100644index b7435f03ec..0000000000Binary files a/apps/website/public/carbon-dark-mode-permissions.jpg and /dev/null differdiff --git a/apps/website/public/carbon-dark-mode-search.jpg b/apps/website/public/carbon-dark-mode-search.jpgdeleted file mode 100644index 4287ab0013..0000000000Binary files a/apps/website/public/carbon-dark-mode-search.jpg and /dev/null differdiff --git a/apps/website/public/elastic-license.webp b/apps/website/public/elastic-license.webpdeleted file mode 100644index ad9290c9d8..0000000000Binary files a/apps/website/public/elastic-license.webp and /dev/null differdiff --git a/apps/website/public/logo-full.png b/apps/website/public/logo-full.pngdeleted file mode 100644index d0f052c476..0000000000Binary files a/apps/website/public/logo-full.png and /dev/null differdiff --git a/apps/website/public/material-problem.jpg b/apps/website/public/material-problem.jpgdeleted file mode 100644index 5d8de734e0..0000000000Binary files a/apps/website/public/material-problem.jpg and /dev/null differdiff --git a/apps/website/src/app/form/page.tsx b/apps/website/src/app/form/page.tsxdeleted file mode 100644index 2f83a0d79b..0000000000--- a/apps/website/src/app/form/page.tsx+++ /dev/null@@ -1,14 +0,0 @@-"use client";--import CompanyForm from "@/components/CompanyForm";-import { Suspense } from "react";--export default function Form() {- return (- <div className="container flex flex-col w-full items-center mt-20 ">- <Suspense>- <CompanyForm />- </Suspense>- </div>- );-}diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsxdeleted file mode 100644index c9ae31a7ae..0000000000--- a/apps/website/src/app/layout.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { Footer } from "@/components/Footer";-import { Header } from "@/components/Header";-import "@/styles/tailwind.css";-import { Analytics } from "@vercel/analytics/react";-import { GeistMono } from "geist/font/mono";-import { GeistSans } from "geist/font/sans";-import type { Metadata } from "next";-import { ThemeProvider } from "next-themes";-import type { ReactElement } from "react";--export const metadata: Metadata = {- metadataBase: new URL("https://carbonos.dev"),- title: "Carbon | ERP for the builders",- description:- "Carbon is an open-source ERP to meet your exact manufacturing needs",-};--export default function Layout({ children }: { children: ReactElement }) {- return (- <html lang="en" suppressHydrationWarning>- <head></head>- <body- className={`${GeistSans.variable} ${GeistMono.variable} overflow-x-hidden radial-gradient`}- >- <ThemeProvider attribute="class">- <Header />- <main className="container mx-auto px-4 overflow-hidden md:overflow-visible">- {children}- </main>- <Footer />- </ThemeProvider>- <Analytics />- </body>- </html>- );-}diff --git a/apps/website/src/app/not-found.tsx b/apps/website/src/app/not-found.tsxdeleted file mode 100644index 555fb4d2d6..0000000000--- a/apps/website/src/app/not-found.tsx+++ /dev/null@@ -1,9 +0,0 @@-export default function NotFound() {- return (- <div className="fixed bg-[#F6F6F3] dark:bg-[#0C0C0C] top-0 right-0 bottom-0 left-0 z-10">- <h1 className="font-mono md:text-[300px] text-[140px] font-medium text-center mt-20">- 404- </h1>- </div>- );-}diff --git a/apps/website/src/app/page.tsx b/apps/website/src/app/page.tsxdeleted file mode 100644index eda4f25eb0..0000000000--- a/apps/website/src/app/page.tsx+++ /dev/null@@ -1,251 +0,0 @@-"use client";--import ContactForm from "@/components/ContactForm";-import { Tabs } from "@/components/Tabs";-import { Button, cn } from "@carbon/react";-import Image from "next/image";-import Link from "next/link";-import { BsGithub, BsLightningCharge, BsPlay } from "react-icons/bs";-import { GiSpeedometer } from "react-icons/gi";-import { GoSync } from "react-icons/go";-import { HiCode, HiFingerPrint } from "react-icons/hi";-import { TbBuildingFactory2 } from "react-icons/tb";--export default function Page() {- return (- <>- <Hero />- <ProductViews />- <OpenCore />- {/* <Calendar /> */}- </>- );-}--function Hero() {- return (- <>- <div className="my-12 sm:my-36 flex flex-col space-y-8 max-w-2xl mx-auto text-center">- <div className="text-center mb-4">- <div className="fancy-button rounded-full w-fit mx-auto relative">- <Link href="https://www.loom.com/share/7eb03a5e4d4d4836b34f173805fb7403?sid=7ed308d0-8d59-4230-a3f1-137aae3c24da">- <Button- className="border-border rounded-full"- variant="secondary"- leftIcon={<BsPlay />}- asChild- >- <div>Watch the guided tour</div>- </Button>- </Link>- </div>- </div>- <h1 className="max-w-5xl mx-auto text-5xl font-semibold tracking-tighter leading-tighter sm:text-6xl lg:text-7xl">- <span className="dark:bg-clip-text dark:text-transparent dark:bg-gradient-to-b dark:from-white dark:to-zinc-400">- ERP for- </span>{" "}- <span className="bg-gradient-to-r bg-clip-text text-transparent dark:bg-gradient-to-b dark:from-[#3ECF8E] dark:via-[#3ECF8E] dark:to-[#3ecfb2] from-black to-black">- the builders- </span>- </h1>- <div className="max-w-xl mx-auto flex flex-col items-center text-center space-y-8">- <p className="text-lg font-medium leading-tight text-foreground/60 md:text-xl lg:text-2xl">- Powerful, modern and open, Carbon makes it easy to build the system- your business needs.- </p>- <ContactForm />- </div>- </div>- </>- );-}--const ImageContainer: React.FC<{ imagePath: string }> = ({ imagePath }) => {- return (- <div- style={{- boxShadow:- "0 0 #0000004d, 0 9px 20px #0000004a, 0 37px 37px #00000042, 0 84px 50px #00000026, 0 149px 60px #0000000a, 0 233px 65px #00000003",- }}- className="max-w-5xl -mt-12 mx-auto h-[30rem] md:h-[40rem] w-full border-4 border-[#6C6C6C] p-2 bg-[#222222] rounded-[30px] shadow-xl overflow-hidden"- >- <Image- src={imagePath}- className="rounded-xl"- width="1209"- height="903"- alt="carbon manufacturing"- />- </div>- );-};--function ProductViews() {- const tabs = [- {- title: "Manufacturing",- description:- "Infinitely nestable, infinitely customizable bill of materials",- value: "manufacturing",- content: (- <ImageContainer imagePath="/carbon-dark-mode-manufacturing.jpg" />- ),- },- {- title: "Accounting",- description:- "Realtime chart of accounts with double-entry accrual accounting",- value: "accounting",- content: (- <ImageContainer imagePath={"/carbon-dark-mode-accounting.jpg"} />- ),- },- {- title: "Search",- description: "Search across all your core or custom fields",- value: "search",- content: <ImageContainer imagePath={"/carbon-dark-mode-search.jpg"} />,- },-- {- title: "Permissions",- description: "Fine-grained permissions for every user and every action",- value: "permission",- content: (- <ImageContainer imagePath={"/carbon-dark-mode-permissions.jpg"} />- ),- },- {- title: "Documents",- description: "Store and manage all your documents in one place",- value: "documents",- content: <ImageContainer imagePath={"/carbon-dark-mode-documents.jpg"} />,- },- ];-- return (- <div className="h-[20rem] md:h-[40rem] [perspective:1000px] relative b flex-col max-w-5xl mx-auto w-full items-start justify-start my-40 hidden md:flex">- <Tabs tabs={tabs} />- </div>- );-}--const features = [- {- name: "High-Performance",- icon: GiSpeedometer,- description:- "Built on best open-source technologies for incredible performance and security.",- },- {- name: "Self-Hostable",- icon: HiCode,- description:- "Unlike other open-source ERPs, you can use Carbon to build your own proprietary systems.",- },- {- name: "Serverless",- icon: GoSync,- description:- "So you can focus on your business systems, not your infrastructure.",- },- {- name: "Realtime",- icon: BsLightningCharge,- description: "All data can be accessed in realtime across applications.",- },- {- name: "Manufacturing",- icon: TbBuildingFactory2,- description: "Carbon has first-class support for American manufacturing.",- },- {- name: "Multi-Company",- icon: HiFingerPrint,- description: "Manage mutliple companies with ease, all in one place.",- },-] as const;--function OpenCore() {- return (- <section className="relative py-24 sm:py-36 lg:py-48 radial-gradient">- <div className="flex flex-col space-y-8 px-4 mx-auto lg:max-w-7xl">- <h2 className="text-4xl font-semibold tracking-tight lg:text-5xl xl:text-6xl text-center text-foreground">- Open Core- </h2>- <div className="mt-8 w-full text-center">- <Link href="https://git.new/carbon">- <div className="fancy-button rounded-full w-fit mx-auto relative mb-6">- <Button- className="border-border rounded-full"- variant="secondary"- leftIcon={<BsGithub />}- asChild- >- <div>Star us on GitHub</div>- </Button>- </div>- </Link>- </div>- <p className="mx-auto text-xl font-medium text-foreground/60 lg:max-w-3xl lg:text-2xl text-center">- Carbon is the only ERP that gives you full ownership over your- software stack. With Carbon{" "}- <span className="underline underline-offset-2">- you aren't a renter, you're an owner- </span>- .- </p>-- <div className="grid md:auto-rows-[18rem] grid-cols-1 md:grid-cols-3 gap-4 max-w-7xl mx-auto">- {features.map(({ icon: Icon, ...feature }, i) => (- <div- className={cn(- "row-span-1 group/bento items-start p-8 space-y-4 bg-black/[0.03] dark:bg-zinc-900 round transition-all duration-300 ease-in-out rounded-lg shadow group ring-2 ring-transparent hover:ring-white/10 text-left"- )}- key={feature.name.split(" ").join("-")}- >- <Icon- className="text-primary dark:text-zinc-900 w-10 h-10 dark:p-2 dark:bg-[#3ECF8E] rounded-full glow-green"- aria-hidden="true"- />- <h2 className="font-semibold text-foreground text-xl md:text-2xl lg:text-3xl tracking-tight">- {feature.name}- </h2>- <p className="font-medium text-foreground/60 text-lg">- {feature.description}- </p>- </div>- ))}- </div>- </div>- </section>- );-}--// function Calendar() {-// const { theme } = useTheme();-// useEffect(() => {-// (async function () {-// const cal = await getCalApi();-// cal("ui", {-// theme: (theme ?? "light") as "dark" | "light",-// styles: { branding: { brandColor: "#000000" } },-// hideEventTypeDetails: false,-// layout: "month_view",-// });-// })();-// // eslint-disable-next-line react-hooks/exhaustive-deps-// }, []);-// return (-// <section className="flex flex-col items-center py-24 gap-8">-// <div className="text-4xl font-semibold tracking-tight lg:text-5xl xl:text-6xl text-center text-foreground">-// Chat with us-// </div>-// <Cal-// calLink="bradbarbin/30min"-// style={{ width: "100%", height: "100%", overflow: "scroll" }}-// config={{ layout: "month_view" }}-// />-// </section>-// );-// }diff --git a/apps/website/src/app/story/page.tsx b/apps/website/src/app/story/page.tsxdeleted file mode 100644index c8f6466689..0000000000--- a/apps/website/src/app/story/page.tsx+++ /dev/null@@ -1,54 +0,0 @@-/* eslint-disable react/no-unescaped-entities */-import type { Metadata } from "next";--export const metadata: Metadata = {- title: "CarbonOS | Story",-};--export default function Page() {- return (- <div className="prose dark:prose-invert container max-w-2xl my-24 text-xl space-y-8">- <h1 className="text-3xl font-semibold sm:text-2xl lg:text-4xl xl:text-5xl text-center mb-16">- Building Carbon- </h1>-- <p>- Like a lot of people, we've been through our share of bad ERP- implementations. And like a lot of people, we've come to expect a lot- from our software.- </p>-- <h2 className="text-xl font-semibold sm:text-lg lg:text-2xl xl:text-3xl">- Source Available- </h2>- <p>- We've built Carbon for our past selves. And we've open-sourced it- because we know we're not alone. Together, we are a community of- manufacturers and developers who see a better way. And we understand- that in order to make a system that is customized to your business,- you've got to own all the code.- </p>-- <h2 className="text-xl font-semibold sm:text-lg lg:text-2xl xl:text-3xl">- Manufacturing-Focused- </h2>- <p>- Manufacturing is hard enough. It's even harder when you're trying to- make your processes match the ERP's expectations. We've built Carbon to- be flexible, and we've built it to be simple so that you can model your- business as closely as possible.- </p>-- <h2 className="text-xl font-semibold sm:text-lg lg:text-2xl xl:text-3xl">- Extensible- </h2>- <p>- The mission of CarbonOS is to become the platform upon which connected- manufacturing ecosystems are built. The goal is to provide a solid- foundation for businesses to build upon, and to provide a platform that- is flexible enough to adapt to the ever-changing needs of the- manufacturing industry.- </p>- </div>- );-}diff --git a/apps/website/src/app/submit.ts b/apps/website/src/app/submit.tsdeleted file mode 100644index ece343038b..0000000000--- a/apps/website/src/app/submit.ts+++ /dev/null@@ -1,139 +0,0 @@-"use server";-import { AssociationTypes, Client } from "@hubspot/api-client";-import {- AssociationSpecAssociationCategoryEnum,- FilterOperatorEnum,- type PublicObjectSearchRequest,-} from "@hubspot/api-client/lib/codegen/crm/contacts";-import { z } from "zod";--const hubspotClient = new Client({- accessToken: process.env.HUBSPOT_ACCESS_TOKEN,-});--type Result = {- success: boolean;- message?: string;-};--export async function createHubspotContact(- formData: FormData-): Promise<Result> {- try {- const email = formData.get("email");- if (typeof email !== "string") {- throw new Error("Email is missing or not string");- }- const contactObj = {- properties: {- email: email,- },- associations: [],- };-- await hubspotClient.crm.contacts.basicApi.create(contactObj);- return { success: true };- } catch (error) {- return { success: false, message: error.message };- }-}-async function findContactByEmail(- email: string-): Promise<- { success: true; contactId: string } | { success: false; message: string }-> {- const filter = {- propertyName: "email",- operator: FilterOperatorEnum.Eq,- value: email,- };-- try {- const publicObjectSearchRequest: PublicObjectSearchRequest = {- filterGroups: [{ filters: [filter] }],- properties: ["email"],- limit: 1,- after: null,- sorts: [],- };- const response = await hubspotClient.crm.contacts.searchApi.doSearch(- publicObjectSearchRequest- );- if (response.results.length > 0) {- return { success: true, contactId: response.results[0].id };- } else {- return { success: false, message: "No contact found." };- }- } catch (error) {- return { success: false, message: error.message };- }-}--async function associateCompanyWithContact(companyId, contactId) {- try {- await hubspotClient.crm.associations.v4.basicApi.create(- "companies",- companyId,- "contacts",- contactId,- [- {- associationCategory:- AssociationSpecAssociationCategoryEnum.HubspotDefined,- associationTypeId: AssociationTypes.companyToContact,- },- ]- );- return { success: true, message: "Association created successfully." };- } catch (error) {- return { success: false, message: error.message };- }-}--const companySchema = z.object({- companyName: z.string(),- erp: z.string(),- companySize: z.string(),- email: z.string(),-});--export async function createHubspotCompany(- prevState: any,- formData: FormData-): Promise<Result> {- try {- const data = companySchema.parse({- companyName: formData.get("companyName"),- erp: formData.get("erp"),- companySize: formData.get("companySize"),- email: formData.get("email"),- });-- const companyObj = {- properties: {- name: data.companyName,- description: data.erp ?? "",- numberofemployees: data.companySize ?? "",- },- associations: [],- };-- const createCompanyResponse =- await hubspotClient.crm.companies.basicApi.create(companyObj);-- const contact = await findContactByEmail(data.email);- if (contact.success) {- await associateCompanyWithContact(- createCompanyResponse.id,- contact.contactId- );-- return { success: true };- } else {- return contact;- }- } catch (error) {- console.error(error);- return { success: false, message: `Failed to create company` };- }-}diff --git a/apps/website/src/app/updates/[slug]/page.tsx b/apps/website/src/app/updates/[slug]/page.tsxdeleted file mode 100644index fae238bc0c..0000000000--- a/apps/website/src/app/updates/[slug]/page.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { Tag } from "@/components/Tag";-import { getBlogPosts } from "@/lib/blog";-import { MDXRemote } from "next-mdx-remote/rsc";-import Image from "next/image";-import Link from "next/link";-import { redirect } from "next/navigation";-import { BsArrowLeft } from "react-icons/bs";--export default function Page({- params: { slug },-}: {- params: { slug: string };-}) {- const post = getBlogPosts().find((post) => post.slug === slug);- if (!post) {- redirect("/updates");- }- return (- <div className="container my-24 flex gap-12 flex-col items-center">- {post && (- <article className="prose dark:prose-invert">- <Tag status={post.metadata.tag} />- <h2 className="font-medium md:text-3xl text-2xl">- {post.metadata.title}- </h2>- {post.metadata.image ? (- post.metadata.link ? (- <Link href={post.metadata.link}>- <Image- src={post.metadata.image}- alt={post.metadata.title}- width={680}- height={442}- className="my-8 cusor-pointer"- />- </Link>- ) : (- <Image- src={post.metadata.image}- alt={post.metadata.title}- width={680}- height={442}- className="my-8"- />- )- ) : null}- <MDXRemote source={post.content} />- </article>- )}- <Link href={"/updates"} className="text-muted-foreground">- <BsArrowLeft className="inline-block mr-2 " />- All posts- </Link>- </div>- );-}diff --git a/apps/website/src/app/updates/page.tsx b/apps/website/src/app/updates/page.tsxdeleted file mode 100644index 26c7bab3eb..0000000000--- a/apps/website/src/app/updates/page.tsx+++ /dev/null@@ -1,109 +0,0 @@-import ContactForm from "@/components/ContactForm";-import { Tag } from "@/components/Tag";-import { getBlogPosts } from "@/lib/blog";-import type { Metadata } from "next";-import { MDXRemote } from "next-mdx-remote/rsc";-import Image from "next/image";-import Link from "next/link";--export const metadata: Metadata = {- title: "CarbonOS | Updates",-};--export function UpdatesHeader() {- return (- <div className="py-24 w-screen flex flex-col items-center space-y-8 ">- <h1 className="text-3xl font-semibold sm:text-2xl lg:text-4xl xl:text-5xl">- Updates- </h1>- <p className="text-center text-muted-foreground text-lg">- Subscribe to learn about new features, and updates in Carbon.- </p>- <ContactForm />- </div>- );-}--export default function Page() {- const data = getBlogPosts();- const posts = data- .sort((a, b) => {- if (new Date(a.metadata.publishedAt) > new Date(b.metadata.publishedAt)) {- return -1;- }- return 1;- })- .map((post, index) => (- <Article key={post.slug} data={post} firstPost={index === 0} />- ));-- return (- <div className="container flex flex-col items-center scroll-smooth">- <UpdatesHeader />- <div className="max-w-[680px] pt-[80px] w-full">{posts}</div>- </div>- );-}--type ArticleProps = {- firstPost: boolean;- data: {- slug: string;- metadata: {- tag: string;- title: string;- image?: string;- publishedAt?: string;- link?: string;- };- content: string;- };-};--export function Article({ data }: ArticleProps) {- const formattedDate = data?.metadata?.publishedAt- ? new Date(data.metadata.publishedAt).toLocaleDateString("en-US", {- month: "long",- day: "numeric",- year: "numeric",- })- : null;- return (- <article- key={data.slug}- className="flex max-w-[750px] flex-col items-start pt-28 mb-20 -mt-28"- id={data.slug}- >- <Tag status={data.metadata.tag} />- <Link className="block " href={`/updates/${data.slug}`}>- <h2 className="font-medium text-3xl ">{data.metadata.title}</h2>- <div className="text-muted-foreground">{formattedDate}</div>- </Link>- {data.metadata.image &&- (data.metadata.link ? (- <Link href={data.metadata.link}>- <Image- src={data.metadata.image}- alt={data.metadata.title}- width={680}- height={442}- className="my-8 cusor-pointer"- />- </Link>- ) : (- <Image- src={data.metadata.image}- alt={data.metadata.title}- width={680}- height={442}- className="my-8"- />- ))}- <div>- <div className="prose prose-lg dark:prose-invert">- <MDXRemote source={data.content} />- </div>- </div>- </article>- );-}diff --git a/apps/website/src/app/updates/posts/elastic-license.mdx b/apps/website/src/app/updates/posts/elastic-license.mdxdeleted file mode 100644index 85b25a926e..0000000000--- a/apps/website/src/app/updates/posts/elastic-license.mdx+++ /dev/null@@ -1,17 +0,0 @@-----title: "The Elastic License"-publishedAt: "2024-05-09"-summary: "Why we've decided to use the Elastic license for CarbonOS"-tag: "Business"-image: "/elastic-license.webp"------The [Elastic License](https://github.com/barbinbrad/carbon/blob/main/LICENSE) is a software license that has one restriction: you can't sell a hosted version of the software. Other than that you can do anything you want with it. Most importantly, you can develop your own internal business systems on top of it without an obligation to make them open-source.--There are some open-source purists who will say that the Elastic License is not "open source" (because there is a limited on what you can do with it), so out of respect for these guys, you'll see us referring to our software as "source available" instead of "open source".--We think this is a good choice for three reasons:--1. We want people to use our ERP as a starting point for their proprietary business systems-2. We want people to learn from and improve the code-3. We want to create a sustainable long-term businessdiff --git a/apps/website/src/app/updates/posts/manufacturing-data-problem.mdx b/apps/website/src/app/updates/posts/manufacturing-data-problem.mdxdeleted file mode 100644index 75f4f796e6..0000000000--- a/apps/website/src/app/updates/posts/manufacturing-data-problem.mdx+++ /dev/null@@ -1,79 +0,0 @@-----title: "The Manufacturing Industry Has a Data Problem"-publishedAt: "2024-04-22"-summary: ""-tag: "Design"-image: "/material-problem.jpg"-link: "https://www.youtube.com/watch?v=RPx6giq9nYQ"------On a scale of 1 to 10, how messy is your materials database in your ERP?--The vast majority of the shops I’ve worked with have struggled to enforce the naming conventions they’ve chosen for their materials. As a result, they end up with hundreds or even thousands of duplicate records, which creates a lot of confusion and inefficiency.--But the problem is not the naming conventions - it’s much deeper than that.--In this article I’m going to talk about the root of this problem, how it’s impacting the industry, and what we can do to solve it.--## Information lost--The root issue at hand is that most manufacturing software companies have completely punted on figuring out how to store material data correctly. Instead, they provide a generic table for storing “items”.--The problem with that approach is that different kinds of items have different properties, and if you force them all into the same pile you lose a lot of information.--A sheet of metal has length, width, and thickness, and is made from a particular alloy. A round wooden bar has length and diameter, and is made from a particular wood. A box of disposable gloves has a glove size and a count.--Clearly, different kinds of items can have very little in common. The only way to provide a common representation for a group of unrelated items is to discard all of the structured data about the items. This is exactly what most manufacturing software does.--The result is that users try to organize their data by creating conventions. For example, you could decide to encode structured information about a material in the text description field in a specific format.--Having a convention is better than not having a convention, but a convention can’t be enforced by the software. If the software doesn’t provide users with fields to enter structured data, it requires active work on the part of the users to create good data.--This is totally backwards! Creating good data should be the path of least resistance.--So how did we get here? It turns out that solving this problem the right way is really hard.--In the next section I’ll talk about the origins of this problem, and why it’s so difficult to solve.--## A chicken and egg problem--Modeling material data accurately is a very challenging problem. But there is huge upside potential for the entire industry if this problem can be solved.--The main reason why this problem is hard is because there are so many distinct kinds of materials to model. There are essentially endless varieties of metals, woods, rubbers, and plastics.--Each substance can also exist in a variety of form factors, including sheets, rods, bars, tubes, billets, spools, etc. Different types of materials can also have additional properties like temper, or various certifications.--The point is, modeling this accurately is a massive project--If you use a software tool that does not have a detailed materials model, there isn’t a lot of incentive to keep your material data well-organized. But if there were lots of helpful features that relied on you having well-organized material data, that would be a different story.--On the flip-side, if you’re a software company that uses the generic item-based approach, it can be challenging to justify building helpful features that rely on organized material data. These features typically require the data to be stored in a structured format, which means that users would have to clean up their existing data before they could take advantage of the new functionality.--This puts the industry in a tricky situation where change can only happen if both the software companies and their users commit to moving forward together. This is a massive challenge, but let’s take a minute to explore what the future could look like if this problem were solved.--What the future could hold-Imagine you have a software system that stores material data in a structured way. Sheets have length, width, and thickness. Round tubes have length, inner diameter, and outer diameter.--With structured data, a software application can perform logic that is specific to a material type. For example, it could find all the parts in a quote package that share a thickness and nest them together to minimize scrap. Or it could automatically filter your material list based on the inner and outer diameter of the part you need to make, to show you whether you have any suitable materials in stock.--That’s just the beginning, though. If there were a common structured format for materials that was shared across the industry, systems would be able to communicate with each other about materials. For example, you could search both your own materials list and your distributor’s catalog, all without having to switch between two different software tools.--None of this is possible with unstructured data.--Most shops have a hard time enforcing conventions within their own organization. On top of that, conventions can vary wildly between different shops. Because of that, it’s impossible to build functionality that works reliably across organizations because there isn’t a single place you can look to find the information you need.--## How to move forward--The way forward is to develop a common standard that can be widely adopted by the manufacturing industry. It won’t be easy, but there are other kinds of structured data that have been successfully standardized that can serve as inspiration.--One example is addresses. You could represent an address in a single text field. As long as you put the information in the right order, the address is valid.--But the way pretty much all software represents addresses is with a common set of structured fields:--Address 1, Address 2, Address 3, City, State, Zip Code, Country--Breaking out the fields in this way allows software tools to provide valuable features like searching and filtering, but more importantly it allows different software tools to communicate about addresses in a common language. An e-commerce website can seamlessly integrate with a shipping company because they both store addresses the same way.--While researching for this article, I found very little information online about previous attempts to standardize the representation of materials in manufacturing software. If there is a standard, it certainly hasn’t found its way into common use across the industry - but please let me know if I’m missing something.--In my opinion, the best way to develop a common standard is by crowdsourcing input from the community. I’d like to get this discussion started, so if you have thoughts about this problem or would like to contribute to coming up with a solution, please reach out and let me know.diff --git a/apps/website/src/components/CompanyForm.tsx b/apps/website/src/components/CompanyForm.tsxdeleted file mode 100644index f3184ef5ed..0000000000--- a/apps/website/src/components/CompanyForm.tsx+++ /dev/null@@ -1,160 +0,0 @@-"use client";--import { createHubspotCompany } from "@/app/submit";-import {- Button,- Card,- CardContent,- CardDescription,- CardFooter,- CardHeader,- CardTitle,- FormControl,- Input,- Label,- Toaster,- toast,-} from "@carbon/react";-import { zodResolver } from "@hookform/resolvers/zod";-import Link from "next/link";-import { useRouter, useSearchParams } from "next/navigation";-import { useEffect } from "react";-import { useFormState, useFormStatus } from "react-dom";-import { useForm } from "react-hook-form";-import { z } from "zod";-import { Form, FormField, FormItem, FormMessage } from "./ui/Form";--const initialState = {- success: null,- message: null,-};--function SubmitButton() {- const { pending } = useFormStatus();- return (- <Button type="submit" aria-disabled={pending}>- Submit- </Button>- );-}--const formSchema = z.object({- companyName: z.string(),- companySize: z.string(),- jobTitle: z.string(),- erp: z.string(),-});--export default function CompanyForm() {- const form = useForm<z.infer<typeof formSchema>>({- resolver: zodResolver(formSchema),- defaultValues: {- companyName: "",- companySize: "",- jobTitle: "",- erp: "",- },- });- const searchParams = useSearchParams();- const email = searchParams.get("email");- const router = useRouter();-- const [state, formAction] = useFormState(createHubspotCompany, initialState);- useEffect(() => {- if (state.success === false) {- toast.error(state.message);- } else if (state.success === true) {- toast.success("Thank you! We'll be in touch soon.");- router.push("/");- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [state.success]);-- return (- <>- <Form {...form}>- <form action={formAction} className="w-full max-w-2xl">- <input type="hidden" name="email" value={email} />- <Card>- <CardHeader>- <CardTitle className="text-center ">- Please tell us a little more about yourself- </CardTitle>- <CardDescription className="text-center">- <Button variant="secondary" asChild>- <Link href="/">Skip</Link>- </Button>- </CardDescription>- </CardHeader>- <CardContent className="grid space-y-8">- <FormField- control={form.control}- name="companyName"- render={({ field }) => (- <FormItem>- <FormControl>- <Label>What is your company called?</Label>- <Input- type="string"- placeholder="Company name"- {...field}- />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="companySize"- render={({ field }) => (- <FormItem>- <FormControl>- <Label>How big is your company?</Label>- <Input- type="string"- placeholder="E.g. 20-50"- {...field}- />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="jobTitle"- render={({ field }) => (- <FormItem>- <FormControl>- <Label>What is your job title?</Label>- <Input type="string" placeholder="Job Title" {...field} />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="erp"- render={({ field }) => (- <FormItem>- <FormControl>- <Label>Which ERP do you use currently?</Label>- <Input type="string" placeholder="Excel" {...field} />- </FormControl>- <FormMessage />- </FormItem>- )}- />- </CardContent>- <CardFooter>- <SubmitButton />- </CardFooter>- </Card>- </form>- </Form>- <Toaster />- </>- );-}diff --git a/apps/website/src/components/ContactForm.tsx b/apps/website/src/components/ContactForm.tsxdeleted file mode 100644index e40a03d516..0000000000--- a/apps/website/src/components/ContactForm.tsx+++ /dev/null@@ -1,75 +0,0 @@-"use client";--import { createHubspotContact } from "@/app/submit";-import { Button, FormControl, Input, Toaster, toast } from "@carbon/react";-import { zodResolver } from "@hookform/resolvers/zod";-import { useRouter } from "next/navigation";-import { useForm } from "react-hook-form";-import { z } from "zod";-import { Form, FormField, FormItem, FormMessage } from "./ui/Form";--export default function ContactForm() {- const router = useRouter();-- const formSchema = z.object({- email: z.string().email(),- });- const form = useForm<z.infer<typeof formSchema>>({- resolver: zodResolver(formSchema),- defaultValues: {- email: "",- },- });-- const handleSubmit = async (data: z.infer<typeof formSchema>) => {- try {- const formData = new FormData();- formData.append("email", data.email);- const { success } = await createHubspotContact(formData);- if (success) {- const email = encodeURIComponent(data.email);- router.push(`/form?email=${email}`);- } else {- toast.error(- "Failed to create contact. It's possible that you've already subscribed."- );- }- } catch (error) {- toast.error("Failed to submit form. Please try again.");- }- };-- return (- <>- <Form {...form}>- <form- onSubmit={form.handleSubmit(handleSubmit)}- className="flex sm:flex-row flex-col gap-2 sm:items-start items-center"- >- <FormField- control={form.control}- name="email"- render={({ field }) => (- <FormItem>- <FormControl>- <Input- className="border-border w-full sm:w-fit"- size="lg"- type="email"- placeholder="Company email"- {...field}- />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <Button size="lg" className="w-full sm:w-fit" type="submit">- Subscribe- </Button>- </form>- </Form>- <Toaster />- </>- );-}diff --git a/apps/website/src/components/Footer.tsx b/apps/website/src/components/Footer.tsxdeleted file mode 100644index a0e7181369..0000000000--- a/apps/website/src/components/Footer.tsx+++ /dev/null@@ -1,17 +0,0 @@-"use client";-import { Toaster } from "@carbon/react";-import Link from "next/link";--export function Footer() {- return (- <div className="h-32 py-12 flex">- <div className="w-full justify-center items-center gap-8 flex text-foreground font-semibold">- <Link href="/story">Story</Link>- <Link href="/updates">Updates</Link>- <Link href="https://git.new/carbon">Github</Link>- <Link href="https://docs.crbnerp.com">Docs</Link>- </div>- <Toaster position="bottom-right" />- </div>- );-}diff --git a/apps/website/src/components/Header.tsx b/apps/website/src/components/Header.tsxdeleted file mode 100644index 49127eda23..0000000000--- a/apps/website/src/components/Header.tsx+++ /dev/null@@ -1,229 +0,0 @@-"use client";--import { NavigationMenu } from "@/components/Navigation";-import {- Badge,- Button,- Input,- Label,- Modal,- ModalContent,- ModalDescription,- ModalFooter,- ModalHeader,- ModalTitle,- ModalTrigger,- cn,- useDisclosure,-} from "@carbon/react";-import { motion } from "framer-motion";-import Link from "next/link";-import { usePathname } from "next/navigation";-import { BsFillHexagonFill } from "react-icons/bs";-import { GoArrowUpRight } from "react-icons/go";--const links = [- {- title: "Story",- path: "/story",- },- {- title: "Updates",- path: "/updates",- },- // {- // title: "Product",- // path: "/product",- // },- // {- // title: "Pricing",- // path: "/pricing",- // },- {- title: "Code",- path: "https://git.new/carbon",- },- {- title: "Docs",- path: "https://docs.crbnerp.com",- },-];--const listVariant = {- show: {- opacity: 1,- transition: {- staggerChildren: 0.04,- },- },- hidden: {- opacity: 0,- },-};--const itemVariant = {- hidden: { opacity: 0 },- show: { opacity: 1 },-};--export function Header() {- const pathname = usePathname();- const mobileMenu = useDisclosure();-- const toggleMenu = () => {- document.body.style.overflow = mobileMenu.isOpen ? "" : "hidden";- mobileMenu.onToggle();- };-- return (- <header className="h-12 sticky mt-4 top-4 z-50 px-2 md:px-4 md:flex justify-center">- <nav className="border border-border p-3 rounded-xl flex items-center backdrop-filter backdrop-blur-xl bg-[#FDFDFC] dark:bg-[#121212] bg-opacity-70">- <NavigationMenu>- <Link href="/" className="flex space-x-2 items-center">- <span className="sr-only">Carbon Logo</span>- <BsFillHexagonFill />-- <Badge- variant="secondary"- className="rounded-full border-border border text-xs cursor-progress"- >- Alpha- </Badge>- </Link>-- <ul className="space-x-2 font-medium text-sm hidden md:flex mx-2">- {links.map(({ path, title }) => {- const isActive = pathname.includes(path);- const isExternal = path.startsWith("http");-- return (- <Button- key={path}- variant={isActive ? "active" : "ghost"}- rightIcon={isExternal ? <GoArrowUpRight /> : undefined}- asChild- >- <Link href={path}>{title}</Link>- </Button>- );- })}- </ul>- </NavigationMenu>-- <button- type="button"- className="ml-auto md:hidden p-2"- onClick={toggleMenu}- >- <svg- xmlns="http://www.w3.org/2000/svg"- width={14}- height={14}- fill="none"- >- <path- fill="currentColor"- d="M0 12.195v-2.007h18v2.007H0Zm0-5.017V5.172h18v2.006H0Zm0-5.016V.155h18v2.007H0Z"- />- </svg>- </button>-- <Modal>- <ModalTrigger asChild>- <Button className="hidden md:inline-flex">Subscribe</Button>- </ModalTrigger>- <ModalContent className="sm:max-w-[425px]">- <ModalHeader>- <ModalTitle>Sign Up</ModalTitle>- <ModalDescription>- Enter your email address to sign up for early access.- </ModalDescription>- </ModalHeader>- <div className="grid py-4">- <div className="grid grid-cols-1 items-center">- <Label htmlFor="email" className="sr-only">- </Label>- <Input placeholder="Email" id="email" />- </div>- </div>- <ModalFooter>- <Button size="lg" type="submit">- Sign Up- </Button>- </ModalFooter>- </ModalContent>- </Modal>- </nav>-- {mobileMenu.isOpen && (- <motion.div- className="fixed bg-background top-0 right-0 left-0 bottom-0 h-screen z-10 px-2 m-[1px]"- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- >- <div className="mt-4 flex justify-between p-3 relative">- <button type="button" onClick={toggleMenu}>- <span className="sr-only">Carbon Logo</span>- <BsFillHexagonFill />- </button>-- <button- type="button"- className="ml-auto md:hidden p-2 absolute right-[10px] top-2"- onClick={toggleMenu}- >- <svg- xmlns="http://www.w3.org/2000/svg"- width={24}- height={24}- className="fill-primary"- >- <path fill="none" d="M0 0h24v24H0V0z" />- <path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />- </svg>- </button>- </div>-- <div className="h-full overflow-auto">- <motion.ul- initial="hidden"- animate="show"- className="px-3 pt-8 text-xl text-[#707070] dark:text-[#878787] space-y-8 mb-8"- variants={listVariant}- >- {links.map(({ path, title }) => {- const isActive = pathname.includes(path);-- return (- <motion.li variants={itemVariant} key={path}>- <Link- href={path}- className={cn(isActive && "text-primary")}- onClick={toggleMenu}- >- {title}- </Link>- </motion.li>- );- })}-- <motion.li- variants={itemVariant}- className="flex items-center space-x-2"- >- <Link href="https://git.new/carbon">Code</Link>- </motion.li>-- <motion.li variants={itemVariant}>- <Link className="text-xl text-primary" href="#">- Subscribe- </Link>- </motion.li>- </motion.ul>- </div>- </motion.div>- )}- </header>- );-}diff --git a/apps/website/src/components/MobileTabs.tsx b/apps/website/src/components/MobileTabs.tsxdeleted file mode 100644index c7771ced06..0000000000--- a/apps/website/src/components/MobileTabs.tsx+++ /dev/null@@ -1,61 +0,0 @@-import { useEffect, useState } from "react";-import { motion } from "framer-motion";--let interval: any;--type Card = {- id: number;- content: React.ReactNode;-};--export const MobileTabs = ({- items,- offset,- scaleFactor,-}: {- items: Card[];- offset?: number;- scaleFactor?: number;-}) => {- const CARD_OFFSET = offset || 10;- const SCALE_FACTOR = scaleFactor || 0.06;- const [cards, setCards] = useState<Card[]>(items);-- useEffect(() => {- startFlipping();-- return () => clearInterval(interval);- }, []);- const startFlipping = () => {- interval = setInterval(() => {- setCards((prevCards: Card[]) => {- const newArray = [...prevCards]; // create a copy of the array- newArray.unshift(newArray.pop()!); // move the last element to the front- return newArray;- });- }, 5000);- };-- return (- <div className="relative h-60 w-full">- {cards.map((card, index) => {- return (- <motion.div- key={card.id}- className="-mt-12 mx-auto h-96 w-full border-4 border-[#6C6C6C] p-2 bg-[#222222] rounded-xl shadow-lg"- style={{- transformOrigin: "top center",- }}- animate={{- top: index * -CARD_OFFSET,- scale: 1 - index * SCALE_FACTOR,- zIndex: cards.length - index,- }}- >- <div>{card.content}</div>- </motion.div>- );- })}- </div>- );-};diff --git a/apps/website/src/components/Navigation.tsx b/apps/website/src/components/Navigation.tsxdeleted file mode 100644index 21895a9961..0000000000--- a/apps/website/src/components/Navigation.tsx+++ /dev/null@@ -1,124 +0,0 @@-import { cn } from "@carbon/react";-import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";-import { cva } from "class-variance-authority";-import * as React from "react";-import { RxChevronDown } from "react-icons/rx";--const NavigationMenu = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.Root>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>->(({ className, children, ...props }, ref) => (- <NavigationMenuPrimitive.Root- ref={ref}- className={cn("relative z-10 flex flex-1 items-center", className)}- {...props}- >- {children}- <NavigationMenuViewport />- </NavigationMenuPrimitive.Root>-));-NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;--const NavigationMenuList = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.List>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>->(({ className, ...props }, ref) => (- <NavigationMenuPrimitive.List- ref={ref}- className={cn(- "group flex flex-1 list-none items-center justify-center space-x-1",- className- )}- {...props}- />-));-NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;--const NavigationMenuItem = NavigationMenuPrimitive.Item;--const navigationMenuTriggerStyle = cva(- "h-8 items-center justify-center rounded-md text-sm font-medium transition-colors px-3 py-2 inline-flex text-secondary-foreground hover:bg-secondary"-);--const NavigationMenuTrigger = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>->(({ className, children, ...props }, ref) => (- <NavigationMenuPrimitive.Trigger- ref={ref}- className={cn(navigationMenuTriggerStyle(), "group", className)}- {...props}- >- {children}{" "}- <RxChevronDown- className="relative top-0 ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"- aria-hidden="true"- />- </NavigationMenuPrimitive.Trigger>-));-NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;--const NavigationMenuContent = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.Content>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>->(({ className, ...props }, ref) => (- <NavigationMenuPrimitive.Content- ref={ref}- className={cn(- "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",- className- )}- {...props}- />-));-NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;--const NavigationMenuLink = NavigationMenuPrimitive.Link;--const NavigationMenuViewport = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>->(({ className, ...props }, ref) => (- <div className={cn("absolute left-0 top-full flex justify-center")}>- <NavigationMenuPrimitive.Viewport- className={cn(- "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden border border-border bg-popover text-popover-foreground shadow-none rounded-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",- className- )}- ref={ref}- {...props}- />- </div>-));-NavigationMenuViewport.displayName =- NavigationMenuPrimitive.Viewport.displayName;--const NavigationMenuIndicator = React.forwardRef<- React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>->(({ className, ...props }, ref) => (- <NavigationMenuPrimitive.Indicator- ref={ref}- className={cn(- "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",- className- )}- {...props}- >- <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />- </NavigationMenuPrimitive.Indicator>-));-NavigationMenuIndicator.displayName =- NavigationMenuPrimitive.Indicator.displayName;--export {- NavigationMenu,- NavigationMenuContent,- NavigationMenuIndicator,- NavigationMenuItem,- NavigationMenuLink,- NavigationMenuList,- NavigationMenuTrigger,- NavigationMenuViewport,- navigationMenuTriggerStyle,-};diff --git a/apps/website/src/components/Tabs.tsx b/apps/website/src/components/Tabs.tsxdeleted file mode 100644index 8817591302..0000000000--- a/apps/website/src/components/Tabs.tsx+++ /dev/null@@ -1,130 +0,0 @@-"use client";--import { cn } from "@carbon/react";-import { motion } from "framer-motion";-import { useState } from "react";--type Tab = {- title: string;- description?: string;- value: string;- content?: string | React.ReactNode | any;-};--export const Tabs = ({- tabs: propTabs,- containerClassName,- activeTabClassName,- tabClassName,- contentClassName,-}: {- tabs: Tab[];- containerClassName?: string;- activeTabClassName?: string;- tabClassName?: string;- contentClassName?: string;-}) => {- const [active, setActive] = useState<Tab>(propTabs[0]);- const [tabs, setTabs] = useState<Tab[]>(propTabs);-- const moveSelectedTabToTop = (idx: number) => {- const newTabs = [...propTabs];- const selectedTab = newTabs.splice(idx, 1);- newTabs.unshift(selectedTab[0]);- setTabs(newTabs);- setActive(newTabs[0]);- };-- const [hovering, setHovering] = useState(false);-- return (- <>- <div- className={cn(- "flex flex-row items-center justify-center [perspective:1000px] relative overflow-auto sm:overflow-visible no-visible-scrollbar max-w-full w-full",- containerClassName- )}- >- {propTabs.map((tab, idx) => (- <button- key={tab.title}- onClick={() => {- moveSelectedTabToTop(idx);- }}- onMouseEnter={() => setHovering(true)}- onMouseLeave={() => setHovering(false)}- className={cn("relative px-4 py-2 rounded-full", tabClassName)}- style={{- transformStyle: "preserve-3d",- }}- >- {active.value === tab.value && (- <motion.div- layoutId="clickedbutton"- transition={{ type: "spring", bounce: 0.3, duration: 0.6 }}- className={cn(- "absolute inset-0 bg-gray-200 dark:bg-zinc-800 rounded-full ",- activeTabClassName- )}- />- )}-- <span className="relative block text-black dark:text-white">- {tab.title}- </span>- </button>- ))}- </div>- {active?.description && (- <p className="w-full text-center text-muted-foreground my-4">- {active.description}- </p>- )}- <FadeInDiv- tabs={tabs}- active={active}- key={active.value}- hovering={hovering}- className={cn("mt-32", contentClassName)}- />- </>- );-};--export const FadeInDiv = ({- className,- tabs,- hovering,-}: {- className?: string;- key?: string;- tabs: Tab[];- active: Tab;- hovering?: boolean;-}) => {- const isActive = (tab: Tab) => {- return tab.value === tabs[0].value;- };- return (- <div className="relative w-full h-full">- {tabs.map((tab, idx) => (- <motion.div- key={tab.value}- layoutId={tab.value}- style={{- scale: 1 - idx * 0.1,- top: hovering ? idx * -50 : 0,- zIndex: -idx,- opacity: idx < 3 ? 1 - idx * 0.1 : 0,- }}- animate={{- y: isActive(tab) ? [0, 40, 0] : 0,- }}- className={cn("w-full h-full absolute top-0 left-0", className)}- >- {tab.content}- </motion.div>- ))}- </div>- );-};diff --git a/apps/website/src/components/Tag.tsx b/apps/website/src/components/Tag.tsxdeleted file mode 100644index 408a50b200..0000000000--- a/apps/website/src/components/Tag.tsx+++ /dev/null@@ -1,17 +0,0 @@-"use client";--import { cn } from "@carbon/react";--export function Tag({ status }: { status: string }) {- return (- <div- className={cn(- "border rounded-md px-2 py-1 inline-block text-[10px] font-medium mb-4 text-foreground border-foreground uppercase",- status === "Business" && "border-[#ffcc00] text-[#ffcc00]",- status === "Design" && "border-primary text-primary"- )}- >- {status}- </div>- );-}diff --git a/apps/website/src/components/mdx.tsx b/apps/website/src/components/mdx.tsxdeleted file mode 100644index 348c60e4b5..0000000000--- a/apps/website/src/components/mdx.tsx+++ /dev/null@@ -1,111 +0,0 @@-// import { MDXRemote } from "next-mdx-remote/rsc";-// import Image from "next/image";-// import Link from "next/link";-// import React from "react";-// // import { highlight } from "sugar-high";--// function Table({ data }) {-// const headers = data.headers.map((header, index) => (-// <th key={index}>{header}</th>-// ));--// const rows = data.rows.map((row, index) => (-// <tr key={index}>-// {row.map((cell, cellIndex) => (-// <td key={cellIndex}>{cell}</td>-// ))}-// </tr>-// ));--// return (-// <table>-// <thead>-// <tr>{headers}</tr>-// </thead>-// <tbody>{rows}</tbody>-// </table>-// );-// }--// function CustomLink(props) {-// const href = props.href;--// if (href.startsWith("/")) {-// return (-// <Link href={href} {...props}>-// {props.children}-// </Link>-// );-// }--// if (href.startsWith("#")) {-// return <a {...props} />;-// }--// return <a target="_blank" rel="noopener noreferrer" {...props} />;-// }--// function RoundedImage(props) {-// return <Image alt={props.alt} className="rounded-lg" {...props} />;-// }--// function Code({ children, ...props }) {-// const codeHTML = highlight(children);-// return <code dangerouslySetInnerHTML={{ __html: codeHTML }} {...props} />;-// }--// function slugify(str) {-// return str-// .toString()-// .toLowerCase()-// .trim() // Remove whitespace from both ends of a string-// .replace(/\s+/g, "-") // Replace spaces with --// .replace(/&/g, "-and-") // Replace & with 'and'-// .replace(/[^\w\-]+/g, "") // Remove all non-word characters except for --// .replace(/\-\-+/g, "-"); // Replace multiple - with single --// }--// function createHeading(level) {-// const Heading = ({ children }) => {-// const slug = slugify(children);--// return React.createElement(-// `h${level}`,-// { id: slug },-// [-// React.createElement("a", {-// href: `#${slug}`,-// key: `link-${slug}`,-// className: "anchor",-// }),-// ],-// children-// );-// };--// Heading.displayName = `Heading${level}`;--// return Heading;-// }--// const components = {-// h1: createHeading(1),-// h2: createHeading(2),-// h3: createHeading(3),-// h4: createHeading(4),-// h5: createHeading(5),-// h6: createHeading(6),-// Image: RoundedImage,-// a: CustomLink,-// code: Code,-// Table,-// };--// export function CustomMDX(props) {-// return (-// <MDXRemote-// components={{ ...components, ...(props.components || {}) }}-// source={""}-// />-// );-// }diff --git a/apps/website/src/components/ui/Form.tsx b/apps/website/src/components/ui/Form.tsxdeleted file mode 100644index 6d292abaf5..0000000000--- a/apps/website/src/components/ui/Form.tsx+++ /dev/null@@ -1,171 +0,0 @@-import * as React from "react";-import type * as LabelPrimitive from "@radix-ui/react-label";-import { Slot } from "@radix-ui/react-slot";-import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form";-import { Controller, FormProvider, useFormContext } from "react-hook-form";--import { cn, Label } from "@carbon/react";-// import { Label } from "@/components/ui/label";--const Form = FormProvider;--type FormFieldContextValue<- TFieldValues extends FieldValues = FieldValues,- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>-> = {- name: TName;-};--const FormFieldContext = React.createContext<FormFieldContextValue>(- {} as FormFieldContextValue-);--const FormField = <- TFieldValues extends FieldValues = FieldValues,- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>->({- ...props-}: ControllerProps<TFieldValues, TName>) => {- return (- <FormFieldContext.Provider value={{ name: props.name }}>- <Controller {...props} />- </FormFieldContext.Provider>- );-};--const useFormField = () => {- const fieldContext = React.useContext(FormFieldContext);- const itemContext = React.useContext(FormItemContext);- const { getFieldState, formState } = useFormContext();-- const fieldState = getFieldState(fieldContext.name, formState);-- if (!fieldContext) {- throw new Error("useFormField should be used within <FormField>");- }-- const { id } = itemContext;-- return {- id,- name: fieldContext.name,- formItemId: `${id}-form-item`,- formDescriptionId: `${id}-form-item-description`,- formMessageId: `${id}-form-item-message`,- ...fieldState,- };-};--type FormItemContextValue = {- id: string;-};--const FormItemContext = React.createContext<FormItemContextValue>(- {} as FormItemContextValue-);--const FormItem = React.forwardRef<- HTMLDivElement,- React.HTMLAttributes<HTMLDivElement>->(({ className, ...props }, ref) => {- const id = React.useId();-- return (- <FormItemContext.Provider value={{ id }}>- <div ref={ref} className={cn("space-y-2", className)} {...props} />- </FormItemContext.Provider>- );-});-FormItem.displayName = "FormItem";--const FormLabel = React.forwardRef<- React.ElementRef<typeof LabelPrimitive.Root>,- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>->(({ className, ...props }, ref) => {- const { error, formItemId } = useFormField();-- return (- <Label- ref={ref}- className={cn(error && "text-destructive", className)}- htmlFor={formItemId}- {...props}- />- );-});-FormLabel.displayName = "FormLabel";--const FormControl = React.forwardRef<- React.ElementRef<typeof Slot>,- React.ComponentPropsWithoutRef<typeof Slot>->(({ ...props }, ref) => {- const { error, formItemId, formDescriptionId, formMessageId } =- useFormField();-- return (- <Slot- ref={ref}- id={formItemId}- aria-describedby={- !error- ? `${formDescriptionId}`- : `${formDescriptionId} ${formMessageId}`- }- aria-invalid={!!error}- {...props}- />- );-});-FormControl.displayName = "FormControl";--const FormDescription = React.forwardRef<- HTMLParagraphElement,- React.HTMLAttributes<HTMLParagraphElement>->(({ className, ...props }, ref) => {- const { formDescriptionId } = useFormField();-- return (- <p- ref={ref}- id={formDescriptionId}- className={cn("text-[0.8rem] text-muted-foreground", className)}- {...props}- />- );-});-FormDescription.displayName = "FormDescription";--const FormMessage = React.forwardRef<- HTMLParagraphElement,- React.HTMLAttributes<HTMLParagraphElement>->(({ className, children, ...props }, ref) => {- const { error, formMessageId } = useFormField();- const body = error ? String(error?.message) : children;-- if (!body) {- return null;- }-- return (- <p- ref={ref}- id={formMessageId}- className={cn("text-[0.8rem] font-medium text-destructive", className)}- {...props}- >- {body}- </p>- );-});-FormMessage.displayName = "FormMessage";--export {- useFormField,- Form,- FormItem,- FormLabel,- FormControl,- FormDescription,- FormMessage,- FormField,-};diff --git a/apps/website/src/lib/blog.ts b/apps/website/src/lib/blog.tsdeleted file mode 100644index fe78112749..0000000000--- a/apps/website/src/lib/blog.ts+++ /dev/null@@ -1,56 +0,0 @@-import fs from "node:fs";-import path from "node:path";--type Metadata = {- title: string;- publishedAt: string;- summary: string;- image?: string;- link?: string;- tag: string;-};--function parseFrontmatter(fileContent: string) {- const frontmatterRegex = /---\s*([\s\S]*?)\s*---/;- const match = frontmatterRegex.exec(fileContent);- const frontMatterBlock = match![1];- const content = fileContent.replace(frontmatterRegex, "").trim();- const frontMatterLines = frontMatterBlock.trim().split("\n");- const metadata: Partial<Metadata> = {};-- frontMatterLines.forEach((line) => {- const [key, ...valueArr] = line.split(": ");- let value = valueArr.join(": ").trim();- value = value.replace(/^['"](.*)['"]$/, "$1"); // Remove quotes- metadata[key.trim() as keyof Metadata] = value;- });-- return { metadata: metadata as Metadata, content };-}--function getMDXFiles(dir: string) {- return fs.readdirSync(dir).filter((file) => path.extname(file) === ".mdx");-}--function readMDXFile(filePath: string) {- const rawContent = fs.readFileSync(filePath, "utf-8");- return parseFrontmatter(rawContent);-}--function getMDXData(dir: string) {- const mdxFiles = getMDXFiles(dir);- return mdxFiles.map((file) => {- const { metadata, content } = readMDXFile(path.join(dir, file));- const slug = path.basename(file, path.extname(file));-- return {- metadata,- slug,- content,- };- });-}--export function getBlogPosts() {- return getMDXData(path.join(process.cwd(), "src", "app", "updates", "posts"));-}diff --git a/apps/website/src/lib/supabase.ts b/apps/website/src/lib/supabase.tsdeleted file mode 100644index c61031a38c..0000000000--- a/apps/website/src/lib/supabase.ts+++ /dev/null@@ -1,10 +0,0 @@-import { createClient } from "@supabase/supabase-js";--const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;-const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;--if (!supabaseUrl || !supabaseKey) {- throw new Error("Supabase URL or Supabase Key is undefined.");-}--export const supabase = createClient(supabaseUrl, supabaseKey);diff --git a/apps/website/src/styles/tailwind.css b/apps/website/src/styles/tailwind.cssdeleted file mode 100644index f785413d91..0000000000--- a/apps/website/src/styles/tailwind.css+++ /dev/null@@ -1,130 +0,0 @@-@tailwind base;-@tailwind components;-@tailwind utilities;--.dark::selection {- background: #ffffff99;- color: var(--foreground);-}--.dark::selection {- background: #00000099;- color: var(--foreground);-}--@layer base {- :root {- --background: 0, 0%, 100%;- --foreground: 0, 0%, 7%;- --card: 45 18% 96%;- --card-foreground: 240 10% 3.9%;- --popover: 45 18% 96%;- --popover-foreground: 240 10% 3.9%;- --primary: 240 5.9% 10%;- --primary-foreground: 0 0% 98%;- --secondary: 40, 11%, 89%;- --secondary-foreground: 240 5.9% 10%;- --muted: 40, 11%, 89%;- --muted-foreground: 240 3.8% 46.1%;- --accent: 40, 10%, 94%;- --accent-foreground: 240 5.9% 10%;- --destructive: 0 84.2% 60.2%;- --destructive-foreground: 0 0% 98%;- --border: 45, 5%, 85%;- --input: 240 5.9% 90%;- --ring: 240 5.9% 10%;- --radius: 0.5rem;- }-- .dark {- --background: 0, 0%, 7%;- --foreground: 0 0% 98%;- --card: 0, 0%, 7%;- --card-foreground: 0 0% 98%;- --popover: 0, 0%, 7%;- --popover-foreground: 0 0% 98%;- --primary: 142.1 87.6% 63.3%;- --primary-foreground: 144.9 80.4% 10%;- --secondary: 0, 0%, 11%;- --secondary-foreground: 0 0% 98%;- --muted: 0, 0%, 11%;- --muted-foreground: 240 5% 64.9%;- --accent: 0, 0%, 11%;- --accent-foreground: 0 0% 98%;- --destructive: 359, 100%, 61%;- --destructive-foreground: 0, 0%, 100%;- --border: 0, 0%, 17%;- --input: 0, 0%, 11%;- --ring: 240 4.9% 83.9%;- }-}--@layer base {- * {- @apply border-border;- }- body {- font-family: var(--font-sans), system-ui, sans-serif;- @apply bg-background text-foreground;- }-}--.scrollbar-hide::-webkit-scrollbar {- display: none;-}--.scrollbar-hide {- -ms-overflow-style: none;- scrollbar-width: none;-}--.padding-hack {- overflow: hidden;- padding-bottom: 56.25%;- position: relative;- height: 0;-}--.padding-hack iframe {- left: 0;- top: 0;- height: 100%;- width: 100%;- position: absolute;-}--.fancy-button {- padding: 0.75px;- position: relative;- overflow: hidden;-}--.dark .fancy-button::before {- content: "";- position: absolute;- top: 0;- left: -50%;- width: 200%;- height: 100%;- background: linear-gradient(- 90deg,- #02fcf1,- #02defc,- #0fc576,- #3ecf8e,- #02fcb1- );- z-index: -1;-}--.radial-gradient {- background: radial-gradient(- at top center,- hsla(0, 0%, 100%, 0.04) 0,- transparent 200px- );-}--.dark .glow-green {- box-shadow: 0 0 40px -3px #3ecf8e;-}diff --git a/apps/website/tailwind.config.js b/apps/website/tailwind.config.jsdeleted file mode 100644index 0ea1cf06ca..0000000000--- a/apps/website/tailwind.config.js+++ /dev/null@@ -1 +0,0 @@-module.exports = require("@carbon/tailwind/tailwind.config");diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.jsondeleted file mode 100644index aae03fee9a..0000000000--- a/apps/website/tsconfig.json+++ /dev/null@@ -1,22 +0,0 @@-{- "extends": "@carbon/tsconfig/nextjs.json",- "compilerOptions": {- "baseUrl": ".",- "paths": {- "@/*": ["./src/*"]- },- "lib": ["dom", "dom.iterable", "esnext"],- "incremental": true,- "resolveJsonModule": true,- "strict": false- },- "include": [- "next-env.d.ts",- "next.config.js",- "**/*.ts",- "**/*.tsx",- ".next/types/**/*.ts",- "tailwind.config.ts"- ],- "exclude": ["node_modules"]-}diff --git a/package.json b/package.jsonindex 0b0222383d..688dad140f 100755--- a/package.json+++ b/package.json@@ -48,10 +48,10 @@"db:types": "npm run db:types -w @carbon/database","deploy": "turbo run deploy","dev": "turbo run dev --filter=./apps/carbon --filter=./packages/",+ "dev:developers": "turbo run dev --filter=./apps/developers --filter=./packages/","dev:docs": "turbo run dev --filter=./apps/docs","dev:mes": "turbo run dev --filter=./apps/mes","dev:packages": "turbo run dev --filter=./packages/*",- "dev:website": "turbo run dev --filter=./apps/website","generate:types": "tsx scripts/generate-db-types.ts","generate:swagger": "tsx scripts/generate-swagger-docs.ts && npx prettier --write ./apps/carbon/app/lib/swagger-docs-schema.ts ","format": "prettier --write \"**/*.{ts,tsx,md}\"",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex d9f2f1fd74..0173281ae1 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -18940,6 +18940,7 @@ export type Database = {active: boolean | nullavatarUrl: string | nullcreatedAt: string+ developer: boolean | nullemail: stringfirstName: stringfullName: string | null@@ -18952,6 +18953,7 @@ export type Database = {active?: boolean | nullavatarUrl?: string | nullcreatedAt?: string+ developer?: boolean | nullemail: stringfirstName: stringfullName?: string | null@@ -18964,6 +18966,7 @@ export type Database = {active?: boolean | nullavatarUrl?: string | nullcreatedAt?: string+ developer?: boolean | nullemail?: stringfirstName?: stringfullName?: string | nulldiff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex d9f2f1fd74..0173281ae1 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -18940,6 +18940,7 @@ export type Database = {active: boolean | nullavatarUrl: string | nullcreatedAt: string+ developer: boolean | nullemail: stringfirstName: stringfullName: string | null@@ -18952,6 +18953,7 @@ export type Database = {active?: boolean | nullavatarUrl?: string | nullcreatedAt?: string+ developer?: boolean | nullemail: stringfirstName: stringfullName?: string | null@@ -18964,6 +18966,7 @@ export type Database = {active?: boolean | nullavatarUrl?: string | nullcreatedAt?: string+ developer?: boolean | nullemail?: stringfirstName?: stringfullName?: string | nulldiff --git a/packages/database/supabase/migrations/20240830165935_developer-site.sql b/packages/database/supabase/migrations/20240830165935_developer-site.sqlnew file mode 100644index 0000000000..4c4aefa97d--- /dev/null+++ b/packages/database/supabase/migrations/20240830165935_developer-site.sql@@ -0,0 +1,2 @@++ALTER TABLE "user" ADD COLUMN "developer" BOOLEAN DEFAULT false;