import { Progress } from "@kobalte/core";
import { Show } from "solid-js";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
export function LoadingBar(props: { value: number; max: number }) {
const i18n = useI18n();
function valueToStage(value: number) {
switch (value) {
case 0:
return i18n.t("modals.loading.default");
case 1:
return i18n.t("modals.loading.double_checking");
case 2:
return i18n.t("modals.loading.downloading");
case 3:
return i18n.t("modals.loading.setup");
case 4:
return i18n.t("modals.loading.done");
default:
return i18n.t("modals.loading.default");
}
}
return (
i18n.t("modals.loading.loading", { stage: valueToStage(value) })
}
class="flex w-full flex-col gap-2"
>
);
}
export function LoadingIndicator() {
const [state, _actions] = useMegaStore();
const loadStageValue = () => {
switch (state.load_stage) {
case "fresh":
return 0;
case "checking_double_init":
return 1;
case "downloading":
return 2;
case "setup":
return 3;
case "done":
return 4;
default:
return 0;
}
};
return (
);
}