Skip to content

armgit / dub

Public Imported from GitHub
0

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

833 B
Raw Blame
import {
  linksDisplayPropertyIds,
  linksSortOptions,
  linksViewModes,
} from "@/lib/links/links-display";
import * as z from "zod/v4";

export const linksDisplaySchema = z.object({
  viewMode: z.enum(linksViewModes),
  sortBy: z.enum(
    linksSortOptions.map(({ slug }) => slug) as [string, ...string[]],
  ),
  showArchived: z.boolean(),
  displayProperties: z.array(z.enum(linksDisplayPropertyIds)),
});

export const workspacePreferencesValueSchemas = {
  linksDisplay: linksDisplaySchema.nullish(),
} as const;

export const workspacePreferencesSchema = z.object(
  workspacePreferencesValueSchemas,
);

export type WorkspacePreferencesKey =
  keyof typeof workspacePreferencesValueSchemas;

export type WorkspacePreferencesValue<K extends WorkspacePreferencesKey> =
  z.infer<(typeof workspacePreferencesValueSchemas)[K]>;