Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { OnboardingStep } from "@toolctrl/db/prisma-browser";
|
||||
import { OnboardingStepBlockDto } from "../blocks/OnboardingBlockUtils";
|
||||
import { t as i18nT } from "i18next";
|
||||
|
||||
function parseStepToBlock(step: OnboardingStep) {
|
||||
try {
|
||||
return JSON.parse(step.block) as OnboardingStepBlockDto;
|
||||
} catch (e) {
|
||||
return {
|
||||
id: "",
|
||||
title: i18nT("shared.notSet"),
|
||||
links: [],
|
||||
gallery: [],
|
||||
input: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getStepDescription(block: OnboardingStepBlockDto) {
|
||||
return (
|
||||
<div className="flex items-center space-x-2 truncate text-sm">
|
||||
<div className="text-foreground shrink-0 font-medium">{block.title}</div>
|
||||
{block.description && (
|
||||
<>
|
||||
<div className="text-muted-foreground">•</div>
|
||||
<div className="text-muted-foreground shrink-0">{block.description}</div>
|
||||
</>
|
||||
)}
|
||||
{block.links.length > 0 && (
|
||||
<>
|
||||
<div className="text-muted-foreground">•</div>
|
||||
<div className="text-muted-foreground shrink-0">{i18nT("onboarding.stepSummary.linksCount", { count: block.links.length })}</div>
|
||||
</>
|
||||
)}
|
||||
{block.gallery.length > 0 && (
|
||||
<>
|
||||
<div className="text-muted-foreground">•</div>
|
||||
<div className="text-muted-foreground shrink-0">{i18nT("onboarding.stepSummary.galleryItemsCount", { count: block.gallery.length })}</div>
|
||||
</>
|
||||
)}
|
||||
{block.input.length > 0 && (
|
||||
<>
|
||||
<div className="text-muted-foreground">•</div>
|
||||
<div className="text-muted-foreground shrink-0">{i18nT("onboarding.stepSummary.inputFieldsCount", { count: block.input.length })}</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default {
|
||||
parseStepToBlock,
|
||||
getStepDescription,
|
||||
};
|
||||
Reference in new issue
Block a user