-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from RBND-studio/dev
Merge dev
- Loading branch information
Showing
65 changed files
with
13,674 additions
and
10,918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 106 additions & 40 deletions
146
...pp/(dashboard)/org/[organizationId]/project/[projectId]/flow/[flowId]/(detail)/launch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,121 @@ | ||
import { type WaitStepOptions } from "@flows/js"; | ||
import { css } from "@flows/styled-system/css"; | ||
import { Flex } from "@flows/styled-system/jsx"; | ||
import { Flex, Wrap } from "@flows/styled-system/jsx"; | ||
import type { FlowDetail } from "lib/api"; | ||
import type { FC } from "react"; | ||
import { type FC, Fragment } from "react"; | ||
import { Text } from "ui"; | ||
|
||
type Props = { | ||
flow: FlowDetail; | ||
}; | ||
|
||
export const Launch: FC<Props> = ({ flow }) => { | ||
const location = flow.publishedVersion?.location; | ||
const clickElement = flow.publishedVersion?.clickElement; | ||
const start = (flow.publishedVersion?.start ?? []) as WaitStepOptions[]; | ||
|
||
const noOptions = | ||
start.length === 0 || | ||
start.every((opt) => !opt.location && !opt.change && !opt.form && !opt.clickElement); | ||
|
||
return ( | ||
<Flex alignItems="flex-start" direction="column" gap="space8"> | ||
<Flex direction="column" gap="space8"> | ||
<Text variant="titleS">Launch</Text> | ||
<Flex alignItems="center" gap="space8"> | ||
{location ? ( | ||
<> | ||
<Text>When visiting</Text> | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg.chip", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{location}</Text> | ||
</div> | ||
</> | ||
) : null} | ||
{clickElement ? ( | ||
<> | ||
{location ? <Text>and clicking</Text> : <Text>After clicking</Text>} | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg.chip", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{clickElement}</Text> | ||
</div> | ||
</> | ||
) : null} | ||
{!location && !clickElement ? <Text color="muted">Only manually</Text> : null} | ||
</Flex> | ||
<Wrap gap="space8" direction="column" alignItems="center"> | ||
{!noOptions && | ||
start.map((startOption, i) => { | ||
const location = startOption.location; | ||
return ( | ||
<Fragment | ||
// eslint-disable-next-line react/no-array-index-key -- no better key | ||
key={i} | ||
> | ||
{i !== 0 && <Text>or</Text>} | ||
<Wrap | ||
alignItems="center" | ||
gap="space4" | ||
py="space4" | ||
px="space8" | ||
borderRadius="radius12" | ||
bor="1px" | ||
bg="bg.subtle" | ||
> | ||
{startOption.location ? ( | ||
<> | ||
<Text>When visiting</Text> | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{location}</Text> | ||
</div> | ||
</> | ||
) : null} | ||
{startOption.form ? ( | ||
<> | ||
<Text>{location ? "and submitting" : "When submitting"}</Text> | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{startOption.form.formElement}</Text> | ||
</div> | ||
</> | ||
) : null} | ||
{startOption.change ? ( | ||
<> | ||
<Text>{location ? "and changing" : "When changing"}</Text> | ||
{startOption.change.map((change, j) => ( | ||
<Fragment | ||
// eslint-disable-next-line react/no-array-index-key -- no better key | ||
key={j} | ||
> | ||
{j !== 0 && <Text>and</Text>} | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{change.element}</Text> | ||
</div> | ||
</Fragment> | ||
))} | ||
</> | ||
) : null} | ||
{startOption.clickElement ? ( | ||
<> | ||
<Text>{location ? "and clicking" : "When clicking"}</Text> | ||
<div | ||
className={css({ | ||
paddingY: "space4", | ||
paddingX: "space8", | ||
backgroundColor: "bg", | ||
bor: "1px", | ||
borderRadius: "radius8", | ||
})} | ||
> | ||
<Text weight="600">{startOption.clickElement}</Text> | ||
</div> | ||
</> | ||
) : null} | ||
</Wrap> | ||
</Fragment> | ||
); | ||
})} | ||
{noOptions ? <Text color="subtle">Only manually</Text> : null} | ||
</Wrap> | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.