π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
fix(calendar): make the post delete icon and confirmation red, swap Delete and Preview
Gilad Resisi169c66aaeb45
diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsxindex 3c57031b5..d150545ab 100644--- a/apps/frontend/src/components/launches/calendar.tsx+++ b/apps/frontend/src/components/launches/calendar.tsx@@ -201,7 +201,11 @@ const usePostActions = (onMutate?: () => void) => {t('are_you_sure_you_want_to_delete_post','Are you sure you want to delete post?'- )+ ),+ undefined,+ undefined,+ undefined,+ true))) {return;@@ -1141,12 +1145,12 @@ const CalendarItem: FC<{</div><divclassName={clsx(- 'hidden group-hover:block hover:underline cursor-pointer',+ 'hidden group-hover:block hover:underline cursor-pointer text-red-500',post?.tags?.[0]?.tag?.color && 'text-shadow-tags')}- onClick={preview}+ onClick={deletePost}>- <Preview />+ <DeletePost /></div>{' '}{(state === 'PUBLISHED' || state === 'ERROR') &&!post.intervalInDays &&@@ -1191,9 +1195,9 @@ const CalendarItem: FC<{'hidden group-hover:block hover:underline cursor-pointer',post?.tags?.[0]?.tag?.color && 'text-shadow-tags')}- onClick={deletePost}+ onClick={preview}>- <DeletePost />+ <Preview /></div></div><divdiff --git a/apps/frontend/src/components/layout/new-modal.tsx b/apps/frontend/src/components/layout/new-modal.tsxindex 53a210f3a..4100f4a43 100644--- a/apps/frontend/src/components/layout/new-modal.tsx+++ b/apps/frontend/src/components/layout/new-modal.tsx@@ -24,6 +24,7 @@ interface OpenModalInterface {top?: string | number;closeOnEscape?: boolean;withCloseButton?: boolean;+ destructive?: boolean;askClose?: boolean;onClose?: () => void;children: ReactNode | ((close: () => void) => ReactNode);@@ -206,6 +207,7 @@ export const Component: FC<{!modal.removeLayout &&'gap-[40px] p-[32px] mobile:gap-[24px] mobile:p-[16px]','bg-newBgColorInner mx-auto flex flex-col w-fit rounded-[24px] mobile:rounded-[16px] relative mobile:!max-w-full',+ modal.destructive && 'border-2 border-red-700',modal.size ? '' : 'min-w-[600px] mobile:min-w-0 mobile:w-full',modal.fullScreen && 'h-full')}@@ -344,14 +346,23 @@ export const DecisionModal: FC<{approveLabel: string;cancelLabel: string;onlyApprove: boolean;+ destructive?: boolean;resolution: (value: boolean) => void;-}> = ({ description, cancelLabel, approveLabel, resolution, onlyApprove }) => {+}> = ({+ description,+ cancelLabel,+ approveLabel,+ resolution,+ onlyApprove,+ destructive,+}) => {const { closeCurrent } = useModals();return (<div className="flex flex-col"><div className="max-w-[600px]">{description}</div><div className="flex gap-[12px] mt-[16px]"><Button+ className={destructive ? '!bg-red-800' : undefined}onClick={() => {resolution(true);closeCurrent();@@ -381,6 +392,7 @@ export const areYouSure = ({description = 'Are you sure you want to close this modal?' as any,approveLabel = 'Yes',cancelLabel = 'No',+ destructive = false,} = {}): Promise<boolean> => {return new Promise<boolean>((newRes) => {decisionModalEmitter.emit('open', {@@ -388,6 +400,7 @@ export const areYouSure = ({description,approveLabel,cancelLabel,+ destructive,newRes,});});@@ -410,16 +423,19 @@ export const useDecisionModal = () => {onlyApprove = false,approveLabel = 'Yes',cancelLabel = 'No',+ destructive = false,newRes = undefined as any,} = {}) => {return new Promise<boolean>((res) => {modals.openModal({title,askClose: false,+ destructive,onClose: () => res(false),children: (<DecisionModalonlyApprove={onlyApprove}+ destructive={destructive}resolution={(value) => (newRes ? newRes(value) : res(value))}description={description}approveLabel={approveLabel}diff --git a/libraries/react-shared-libraries/src/helpers/delete.dialog.tsx b/libraries/react-shared-libraries/src/helpers/delete.dialog.tsxindex 81071b7cd..bd4af3fdb 100644--- a/libraries/react-shared-libraries/src/helpers/delete.dialog.tsx+++ b/libraries/react-shared-libraries/src/helpers/delete.dialog.tsx@@ -5,7 +5,8 @@ export const deleteDialog = async (message: string,confirmButton?: string,title?: string,- cancelButton?: string+ cancelButton?: string,+ destructive?: boolean) => {return areYouSure({title: title || i18next.t('are_you_sure', 'Are you sure?'),@@ -13,5 +14,6 @@ export const deleteDialog = async (approveLabel:confirmButton || i18next.t('yes_delete_it', 'Yes, delete it!'),cancelLabel: cancelButton || i18next.t('no_cancel', 'No, cancel!'),+ destructive,});};