Skip to content

Commit

Permalink
Merge pull request #285 from RBND-studio/dev
Browse files Browse the repository at this point in the history
Merge dev
  • Loading branch information
VojtechVidra committed Apr 23, 2024
2 parents cf6f866 + 9827632 commit 6a8d28a
Show file tree
Hide file tree
Showing 65 changed files with 13,674 additions and 10,918 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: 8
version: 9
- run: pnpm install
- run: pnpm web build
- run: pnpm lint
Expand All @@ -27,7 +27,7 @@ jobs:
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: 8
version: 9
- run: pnpm install
- run: pnpm web build
- run: pnpm tsc
Expand All @@ -40,7 +40,7 @@ jobs:
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: 8
version: 9
- run: pnpm install
- run: pnpm test
- run: pnpm be test:e2e
Expand All @@ -53,6 +53,6 @@ jobs:
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: 8
version: 9
- run: pnpm install
- run: pnpm spellcheck
35 changes: 34 additions & 1 deletion apps/app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
const path = require("node:path");

// eslint-disable-next-line turbo/no-undeclared-env-vars -- ignore
const dev = process.env.NODE_ENV !== "production";

const cspHeader = `
default-src 'self';
connect-src 'self' https://*.flows.sh https://*.flows-cloud.com${
dev ? " http://127.0.0.1:3005" : ""
};
script-src 'self' 'unsafe-eval' 'unsafe-inline' https://flows.sh https://*.lemonsqueezy.com https://challenges.cloudflare.com;
style-src 'self' 'unsafe-inline';
img-src 'self' blob: data:;
font-src 'self';
object-src 'none';
base-uri 'self';
form-action 'self';
frame-src https://flows-sh.lemonsqueezy.com https://challenges.cloudflare.com;
frame-ancestors 'none';
upgrade-insecure-requests;
`;

/** @type {import('next').NextConfig} */
const nextConfig = {
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: cspHeader.replace(/\n/g, ""),
},
],
},
];
},
reactStrictMode: true,
transpilePackages: ["ui", "icons", "shared"],
output: "standalone",
Expand All @@ -10,7 +43,7 @@ const nextConfig = {
optimizePackageImports: ["ui", "icons", "shared"],
},
images: {
formats: ["image/avif", "image/webp"],
formats: ["image/webp"],
remotePatterns: [
{
protocol: "https",
Expand Down
6 changes: 3 additions & 3 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prepare": "panda codegen"
},
"dependencies": {
"@flows/js": "0.0.48",
"@flows/js": "0.0.50",
"@hookform/resolvers": "^3.3.4",
"@marsidev/react-turnstile": "^0.5.3",
"@monaco-editor/react": "^4.6.0",
Expand All @@ -33,7 +33,7 @@
"dayjs": "^1.11.10",
"icons": "workspace:*",
"monaco-editor": "^0.47.0",
"next": "14.2.0",
"next": "14.2.1",
"posthog-js": "^1.120.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -45,7 +45,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@next/eslint-plugin-next": "14.2.0",
"@next/eslint-plugin-next": "14.2.1",
"@pandacss/dev": "0.37.2",
"@types/node": "^20.11.29",
"@types/react": "^18.2.67",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { css } from "@flows/styled-system/css";
import { Flex } from "@flows/styled-system/jsx";
import { MenuItem } from "components/sidebar/menu-item";
import { LocalChip } from "components/ui/local-chip";
import { useSend } from "hooks/use-send";
import { KebabHorizontal16 } from "icons";
import { api, type FlowDetail } from "lib/api";
Expand All @@ -13,7 +12,7 @@ import { useRouter } from "next/navigation";
import type { FC } from "react";
import { routes } from "routes";
import { t } from "translations";
import { Button, Icon, Menu, Switch, Text, toast } from "ui";
import { Badge, Button, Icon, Menu, Switch, Text, toast } from "ui";

import { FlowPreviewDialog } from "./flow-preview-dialog";
import { FlowPublishChangesDialog } from "./flow-publish-changes-dialog";
Expand Down Expand Up @@ -71,7 +70,7 @@ export const FlowHeader: FC<Props> = ({ flow, params }) => {
<Flex justifyContent="space-between">
<Flex alignItems="center" gap="space8">
<Text variant="titleXl">{flow.name}</Text>
{!flowIsCloud && <LocalChip />}
{!flowIsCloud && <Badge>Local flow</Badge>}
</Flex>
{flowIsCloud ? (
<Flex alignItems="center" gap="space12">
Expand Down
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>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const FlowDeleteDialog: FC<Props> = ({ flow, organizationId, trigger }) =
});
if (res.error) return;
toast.success(t.toasts.deleteFlowSuccess);
router.refresh();
router.replace(routes.project({ projectId: flow.project_id, organizationId }));
router.refresh();
};

return (
Expand Down
Loading

0 comments on commit 6a8d28a

Please sign in to comment.