Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
import type { FirstStepsChecklistVM } from "./first-steps-checklist.vm.js";
|
||||
import type { VMState } from "../index.js";
|
||||
|
||||
export type WelcomeSetupData = {
|
||||
readonly firstName: string | null;
|
||||
readonly workspaceName: string;
|
||||
readonly dashboardHref: string;
|
||||
readonly checklist: NonNullable<FirstStepsChecklistVM["data"]>;
|
||||
readonly nextItem: NonNullable<FirstStepsChecklistVM["data"]>["items"][number] | null;
|
||||
};
|
||||
|
||||
export type WelcomeSetupVM = VMState<WelcomeSetupData>;
|
||||
|
||||
export function toWelcomeSetupVM(input: {
|
||||
readonly firstName: string | null;
|
||||
readonly workspaceName: string;
|
||||
readonly dashboardHref: string;
|
||||
readonly checklist: FirstStepsChecklistVM;
|
||||
}): WelcomeSetupVM {
|
||||
if (input.checklist.status === "error") {
|
||||
return { status: "error", error: input.checklist.error };
|
||||
}
|
||||
if (input.checklist.status !== "ready" || !input.checklist.data) {
|
||||
return input.checklist.status === "loading" || input.checklist.status === "idle" ? { status: input.checklist.status } : { status: "empty" };
|
||||
}
|
||||
|
||||
return {
|
||||
status: "ready",
|
||||
data: {
|
||||
firstName: input.firstName?.trim() || null,
|
||||
workspaceName: input.workspaceName,
|
||||
dashboardHref: input.dashboardHref,
|
||||
checklist: input.checklist.data,
|
||||
nextItem: input.checklist.data.items.find((item) => !item.completed) ?? null,
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user