diff --git a/apps/arc-web/app/lib/config.server.ts b/apps/arc-web/app/lib/config.server.ts index 90ae81b3c..6cd50efda 100644 --- a/apps/arc-web/app/lib/config.server.ts +++ b/apps/arc-web/app/lib/config.server.ts @@ -19,6 +19,10 @@ interface GitConfig { client_id: string | null; } +interface FeatureFlags { + session_sandboxes: boolean; +} + interface WebConfig { url: string; auth: AuthConfig; @@ -28,6 +32,7 @@ export interface AppConfig { web: WebConfig; api: ApiConfig; git: GitConfig; + feature_flags: FeatureFlags; } const AUTH_DEFAULTS: AuthConfig = { @@ -51,6 +56,10 @@ const GIT_DEFAULTS: GitConfig = { client_id: null, }; +const FEATURE_FLAGS_DEFAULTS: FeatureFlags = { + session_sandboxes: false, +}; + export const ARC_CONFIG_PATH = join(homedir(), ".arc", "server.toml"); function loadAppConfig(): AppConfig { @@ -67,6 +76,7 @@ function loadAppConfig(): AppConfig { const rawWebAuth = (rawWeb.auth ?? {}) as Partial; const rawApi = (raw.api ?? {}) as Partial; const rawGit = (raw.git ?? {}) as Partial; + const rawFeatureFlags = (raw.feature_flags ?? {}) as Partial; const demo = process.env.ARC_DEMO === "1"; @@ -82,6 +92,7 @@ function loadAppConfig(): AppConfig { ? { ...API_DEFAULTS, ...rawApi, authentication_strategy: "insecure_disabled" } : { ...API_DEFAULTS, ...rawApi }, git: { ...GIT_DEFAULTS, ...rawGit }, + feature_flags: { ...FEATURE_FLAGS_DEFAULTS, ...rawFeatureFlags }, }; } diff --git a/apps/arc-web/app/routes/start.tsx b/apps/arc-web/app/routes/start.tsx index 02a0b3e65..7acd20c15 100644 --- a/apps/arc-web/app/routes/start.tsx +++ b/apps/arc-web/app/routes/start.tsx @@ -20,7 +20,9 @@ import { XMarkIcon, } from "@heroicons/react/24/outline"; import { Link } from "react-router"; +import { timeAgo } from "../lib/time"; import { apiJson } from "../api-client"; +import { getAppConfig } from "../lib/config.server"; import type { PaginatedProjectList, PaginatedSessionGroupList } from "@qltysh/arc-api-client"; import type { Route } from "./+types/start"; @@ -31,6 +33,7 @@ export function meta({}: Route.MetaArgs) { } export async function loader({ request }: Route.LoaderArgs) { + const { feature_flags } = getAppConfig(); const [{ data: apiProjects }, { data: apiSessions }] = await Promise.all([ apiJson("/projects", { request }), apiJson("/sessions", { request }), @@ -41,11 +44,10 @@ export async function loader({ request }: Route.LoaderArgs) { sessions: g.sessions.map((s) => ({ id: s.id, title: s.title, - repo: s.repo, - time: s.time, + created_at: s.created_at, })), })); - return { projects, sessionGroups }; + return { projects, sessionGroups, feature_flags }; } const branches = [ @@ -62,7 +64,7 @@ function BranchIcon({ className }: { className?: string }) { ); } -function SessionSidebar({ groups }: { groups: { label: string; sessions: { id: string; title: string; repo: string; time: string }[] }[] }) { +function SessionSidebar({ groups }: { groups: { label: string; sessions: { id: string; title: string; created_at: string }[] }[] }) { return (