Skip to content
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

fix(dashboard): Fix double separator on step template sheet #7247

Merged
merged 1 commit into from
Dec 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { buildDefaultValuesOfDataSchema, buildDynamicZodSchema } from '@/utils/s
import { buildDefaultValues } from '@/utils/schema';
import merge from 'lodash.merge';
import { DelayControlValues } from '@/components/workflow-editor/steps/delay/delay-control-values';
import { ConfigureStepTemplateCta } from '@/components/workflow-editor/steps/configure-step-template-cta';
import { ConfigureStepTemplateIssueCta } from '@/components/workflow-editor/steps/configure-step-template-issue-cta';
import { ConfigureInAppStepPreview } from '@/components/workflow-editor/steps/in-app/configure-in-app-step-preview';
import { ConfigureEmailStepPreview } from '@/components/workflow-editor/steps/email/configure-email-step-preview';
import { useFeatureFlag } from '@/hooks/use-feature-flag';
Expand All @@ -58,16 +58,16 @@ const STEP_TYPE_TO_INLINE_CONTROL_VALUES: Record<StepTypeEnum, () => React.JSX.E
[StepTypeEnum.DIGEST]: () => null,
};

const STEP_TYPE_TO_PREVIEW: Record<StepTypeEnum, (props: HTMLAttributes<HTMLDivElement>) => ReactNode> = {
const STEP_TYPE_TO_PREVIEW: Record<StepTypeEnum, ((props: HTMLAttributes<HTMLDivElement>) => ReactNode) | null> = {
[StepTypeEnum.IN_APP]: ConfigureInAppStepPreview,
[StepTypeEnum.EMAIL]: ConfigureEmailStepPreview,
[StepTypeEnum.SMS]: () => null,
[StepTypeEnum.CHAT]: () => null,
[StepTypeEnum.PUSH]: () => null,
[StepTypeEnum.CUSTOM]: () => null,
[StepTypeEnum.TRIGGER]: () => null,
[StepTypeEnum.DIGEST]: () => null,
[StepTypeEnum.DELAY]: () => null,
[StepTypeEnum.SMS]: null,
[StepTypeEnum.CHAT]: null,
[StepTypeEnum.PUSH]: null,
[StepTypeEnum.CUSTOM]: null,
[StepTypeEnum.TRIGGER]: null,
[StepTypeEnum.DIGEST]: null,
[StepTypeEnum.DELAY]: null,
};

const calculateDefaultControlsValues = (step: StepDataDto) => {
Expand Down Expand Up @@ -286,9 +286,22 @@ export const ConfigureStepForm = (props: ConfigureStepFormProps) => {
</Link>
</SidebarContent>
<Separator />
<ConfigureStepTemplateCta step={step} issue={firstError}>
<Preview />
</ConfigureStepTemplateCta>

{firstError ? (
<>
<ConfigureStepTemplateIssueCta step={step} issue={firstError} />
<Separator />
</>
) : (
Preview && (
<>
<SidebarContent>
<Preview />
</SidebarContent>
<Separator />
</>
)
)}
</>
)}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Button } from '@/components/primitives/button';
import { SidebarContent } from '@/components/side-navigation/sidebar';
import TruncatedText from '@/components/truncated-text';
import { StepDataDto } from '@novu/shared';
import { RiArrowRightUpLine } from 'react-icons/ri';
import { Link } from 'react-router-dom';

type ConfigureStepTemplateIssueCtaProps = {
step: StepDataDto;
issue: string;
};
export const ConfigureStepTemplateIssueCta = (props: ConfigureStepTemplateIssueCtaProps) => {
const { step, issue } = props;

return (
<SidebarContent>
<div className="flex items-center justify-between">
<span className="text-xs font-medium">Action required</span>
<Link
to="https://docs.novu.co/sdks/framework/typescript/steps/inApp"
reloadDocument
className="text-xs"
target="_blank"
rel="noopener noreferrer"
>
<span>Help?</span>
</Link>
</div>
<Link to={'./edit'} relative="path" state={{ stepType: step.type }}>
<Button variant="outline" className="flex w-full justify-start gap-1.5 text-xs font-medium" type="button">
<span className="bg-destructive h-4 min-w-1 rounded-full" />
<TruncatedText>{issue}</TruncatedText>
<RiArrowRightUpLine className="text-destructive ml-auto h-4 w-4" />
</Button>
</Link>
</SidebarContent>
);
};
Loading