Skip to content
Source
Sign inSign up

welcomeState.ts

20 lines901 Bytes

1import type { EnvironmentId } from "@t3tools/contracts";
2import * as Schema from "effect/Schema";
3​
4/**
5 * A computer's project choices on the Welcome page. They are stored until setup finishes, so a
6 * visit to Settings or an app restart during setup keeps them.
7 */
8export const WelcomeImportSelection = Schema.Struct({
9 // Projects listed when the selection changed; projects found later get the defaults.
10 knownKeys: Schema.Array(Schema.String),
11 keys: Schema.Array(Schema.String),
12 // Unchecking the main box also leaves out projects found later, until it is checked again.
13 optedOut: Schema.Boolean,
14});
15export type WelcomeImportSelection = typeof WelcomeImportSelection.Type;
16​
17export const StoredWelcomeImportSelection = Schema.NullOr(WelcomeImportSelection);
18​
19export const welcomeImportSelectionKey = (environmentId: EnvironmentId) =>
20 `t3code:welcome-import-selection:${environmentId}`;