Skip to content

feat: create experimental template embed page for dynamic params #17999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@radix-ui/react-radio-group": "1.2.3",
"@radix-ui/react-scroll-area": "1.2.3",
"@radix-ui/react-select": "2.1.4",
"@radix-ui/react-separator": "1.1.7",
"@radix-ui/react-slider": "1.2.2",
"@radix-ui/react-slot": "1.1.1",
"@radix-ui/react-switch": "1.1.1",
Expand Down
78 changes: 78 additions & 0 deletions site/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions site/src/components/Separator/Separator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as SeparatorPrimitive from "@radix-ui/react-separator";
/**
* Copied from shadc/ui on 06/20/2025
* @see {@link https://ui.shadcn.com/docs/components/separator}
*/
import type * as React from "react";

import { cn } from "utils/cn";

function Separator({
className,
orientation = "horizontal",
decorative = true,
...props
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
return (
<SeparatorPrimitive.Root
data-slot="separator"
decorative={decorative}
orientation={orientation}
className={cn(
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
className,
)}
{...props}
/>
);
}

export { Separator };
17 changes: 17 additions & 0 deletions site/src/components/Skeleton/Skeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copied from shadc/ui on 06/20/2025
* @see {@link https://ui.shadcn.com/docs/components/skeleton}
*/
import { cn } from "utils/cn";

function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="skeleton"
className={cn("bg-surface-tertiary animate-pulse rounded-md", className)}
{...props}
/>
);
}

export { Skeleton };
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface DynamicParameterProps {
onChange: (value: string) => void;
disabled?: boolean;
isPreset?: boolean;
autofill: boolean;
autofill?: boolean;
}

export const DynamicParameter: FC<DynamicParameterProps> = ({
Expand Down Expand Up @@ -873,7 +873,6 @@ interface DiagnosticsProps {
diagnostics: PreviewParameter["diagnostics"];
}

// Displays a diagnostic with a border, icon and background color
export const Diagnostics: FC<DiagnosticsProps> = ({ diagnostics }) => {
return (
<div className="flex flex-col gap-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { type FormikContextType, useFormik } from "formik";
import type { ExternalAuthPollingState } from "hooks/useExternalAuth";
import { ArrowLeft, CircleHelp } from "lucide-react";
import { useSyncFormParameters } from "modules/hooks/useSyncFormParameters";
import { Diagnostics } from "modules/workspaces/DynamicParameter/DynamicParameter";
import {
Diagnostics,
DynamicParameter,
getInitialParameterValues,
useValidationSchemaForDynamicParameters,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { templateByName } from "api/queries/templates";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Loader } from "components/Loader/Loader";
import type { FC } from "react";
import { useQuery } from "react-query";
import { useParams } from "react-router-dom";
import TemplateEmbedPage from "./TemplateEmbedPage";
import TemplateEmbedPageExperimental from "./TemplateEmbedPageExperimental";

const TemplateEmbedExperimentRouter: FC = () => {
const { organization: organizationName = "default", template: templateName } =
useParams() as { organization?: string; template: string };
const templateQuery = useQuery(
templateByName(organizationName, templateName),
);

if (templateQuery.isError) {
return <ErrorAlert error={templateQuery.error} />;
}
if (!templateQuery.data) {
return <Loader />;
}

return (
<>
{templateQuery.data?.use_classic_parameter_flow ? (
<TemplateEmbedPage />
) : (
<TemplateEmbedPageExperimental />
)}
</>
);
};

export default TemplateEmbedExperimentRouter;
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export const TemplateEmbedPageView: FC<TemplateEmbedPageViewProps> = ({
{!buttonValues || !templateParameters ? (
<Loader />
) : (
<div css={{ display: "flex", alignItems: "flex-start", gap: 48 }}>
<div css={{ flex: 1, maxWidth: 400 }}>
<div className="flex items-start gap-12">
<div className="max-w-3xl">
<VerticalForm>
<FormSection
title="Creation mode"
Expand Down
Loading
Loading