Dough Git

clove/pkviewer

web/src/lib/types.ts

back to web/src/lib

/* web/src/lib/types.ts */
import type { BadgeIconId, BadgeState, BadgeToneId } from "@pkviewer/shared";

/** Shapes the management and admin API return. Shared by loads and components. */

export type ManagedSystemSummary = {
  systemId: string;
  pkSystemHid: string;
  role: string;
  name: string | null;
  avatarUrl: string | null;
  slug: string | null;
  publicPath: string;
  memberCount: number | null;
  snapshotAgeMs: number | null;
  reachable: boolean;
};

export type SystemOverview = {
  systemId: string;
  pkSystemHid: string;
  name: string | null;
  avatarUrl: string | null;
  description: string | null;
  memberCount: number | null;
  slug: string | null;
  publicPath: string;
  snapshotAgeMs: number | null;
  reachable: boolean;
};

export type ManagedMemberSummary = {
  memberId: string | null;
  pkMemberHid: string;
  pkMemberUuid: string;
  name: string | null;
  displayName: string | null;
  avatarUrl: string | null;
  pronouns: string | null;
  slug: string | null;
  hasThemeOverrides: boolean;
};

export type StoredSocial = {
  id: number;
  platform: string;
  label: string | null;
  url: string;
  visible: boolean;
  sortOrder: number;
};

export type EditableLink = {
  platform: string;
  label: string;
  url: string;
};

export type SlugScope = "system" | "member";

export type SlugStatus = {
  current: { slug: string; claimedAt: number | null } | null;
  reservations: Array<{ slug: string; until: number }>;
  reservationDays: number;
};

export type ActionResult = {
  ok: boolean;
  error?: string;
};

export type AdminBadge = {
  id: string;
  label: string;
  description: string;
  icon: BadgeIconId;
  tone: BadgeToneId;
  sortOrder: number;
  retiredAt: number | null;
};

export type AdminAssignment = {
  id: number;
  subjectId: string;
  badgeId: string;
  badgeLabel: string;
  state: BadgeState;
  note: string | null;
  grantedAt: number;
  respondedAt: number | null;
  revokedAt: number | null;
  systemHid: string | null;
  slug: string | null;
};

export type AdminSection = {
  id: string;
  label: string;
  description: string | null;
  sortOrder: number;
};

export type AdminCredit = {
  id: string;
  sectionId: string;
  name: string;
  detail: string | null;
  url: string | null;
  sortOrder: number;
  visible: boolean;
};

export type BadgeDraft = {
  id: string;
  label: string;
  description: string;
  icon: string;
  tone: string;
  sortOrder: number;
};

export type DiscoveredSystem = {
  hid: string;
  uuid: string;
  name: string | null;
};