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

chore(dashboard): a few more fixes #6985

Merged
merged 1 commit into from
Nov 13, 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 @@ -11,6 +11,7 @@ import { ConfigureInAppPreview } from './configure-in-app-preview';
import { SdkBanner } from './sdk-banner';
import { useStep } from './use-step';
import { getFirstControlsErrorMessage, getFirstBodyErrorMessage } from '../step-utils';
import { EXCLUDED_EDITOR_TYPES } from '@/utils/constants';

export const ConfigureStepContent = () => {
const { step } = useStep();
Expand Down Expand Up @@ -65,15 +66,19 @@ export const ConfigureStepContent = () => {
<CommonFields />
</SidebarContent>
<Separator />
<SidebarContent>
<Link to={'./edit'} relative="path">
<Button variant="outline" className="flex w-full justify-start gap-1.5 text-xs font-medium" type="button">
<RiPencilRuler2Fill className="h-4 w-4 text-neutral-600" />
Configure {step?.type} template <RiArrowRightSLine className="ml-auto h-4 w-4 text-neutral-600" />
</Button>
</Link>
</SidebarContent>
<Separator />
{!EXCLUDED_EDITOR_TYPES.includes(step?.type ?? '') && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not show the Configure {channel} template button for the step types: digest, delay, custom, trigger

<>
<SidebarContent>
<Link to={'./edit'} relative="path">
<Button variant="outline" className="flex w-full justify-start gap-1.5 text-xs font-medium" type="button">
<RiPencilRuler2Fill className="h-4 w-4 text-neutral-600" />
Configure {step?.type} template <RiArrowRightSLine className="ml-auto h-4 w-4 text-neutral-600" />
</Button>
</Link>
</SidebarContent>
<Separator />
</>
)}
<SidebarContent>
<SdkBanner />
</SidebarContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from 'react';
import { useEffect, useMemo } from 'react';
import { motion } from 'framer-motion';
import { useNavigate, useParams } from 'react-router-dom';

Expand All @@ -16,6 +16,7 @@ import { useFetchStep } from '@/hooks/use-fetch-step';
import { VisuallyHidden } from '@/components/primitives/visually-hidden';
import { PageMeta } from '@/components/page-meta';
import { getStepBase62Id } from '@/utils/step';
import { EXCLUDED_EDITOR_TYPES } from '@/utils/constants';

const transitionSetting = { ease: [0.29, 0.83, 0.57, 0.99], duration: 0.4 };

Expand All @@ -34,9 +35,21 @@ export const EditStepSidebar = () => {
);

const handleCloseSidebar = () => {
navigate('../', { relative: 'path' });
navigate('..', { relative: 'path' });
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed / at the end of the URL


const isNotSupportedEditorType = EXCLUDED_EDITOR_TYPES.includes(stepType ?? '');

useEffect(() => {
if (isNotSupportedEditorType) {
navigate('..', { relative: 'path' });
}
}, [isNotSupportedEditorType, navigate]);

if (isNotSupportedEditorType) {
return null;
}

Comment on lines +43 to +51
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if step type is not supported, we should not allow opening the editor

return (
<>
<PageMeta title={`Edit ${step?.name}`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
AlertDialogTitle,
} from '@/components/primitives/alert-dialog';

const tabsContentClassName = 'h-full w-full px-3 py-3.5';
const tabsContentClassName = 'h-full w-full px-3 py-3.5 overflow-y-auto';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scrollbar for the In-App Editor drawer content when there is not enough space


export const InAppTabs = ({ workflow, step }: { workflow: WorkflowResponseDto; step: StepDataDto }) => {
const { stepSlug = '', workflowSlug = '' } = useParams<{ workflowSlug: string; stepSlug: string }>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useUpdateWorkflow } from '@/hooks/use-update-workflow';
import { buildDefaultValues, buildDynamicZodSchema } from '@/utils/schema';
import { CustomStepControls } from './controls/custom-step-controls';

const tabsContentClassName = 'h-full w-full px-3 py-3.5';
const tabsContentClassName = 'h-full w-full px-3 py-3.5 overflow-y-auto';

export const OtherStepTabs = ({ workflow, step }: { workflow: WorkflowResponseDto; step: StepDataDto }) => {
const { stepSlug = '' } = useParams<{ workflowSlug: string; stepSlug: string }>();
Expand Down
9 changes: 9 additions & 0 deletions apps/dashboard/src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { StepTypeEnum } from '@novu/shared';

export const AUTOCOMPLETE_PASSWORD_MANAGERS_OFF = {
autoComplete: 'off',
'data-1p-ignore': true,
'data-form-type': 'other',
};

export const EXCLUDED_EDITOR_TYPES: string[] = [
StepTypeEnum.DIGEST,
StepTypeEnum.DELAY,
StepTypeEnum.TRIGGER,
StepTypeEnum.CUSTOM,
];
Loading