feat: fix duplicate modals
This commit is contained in:
parent
9c5785b5cb
commit
700f3c5ccb
|
|
@ -53,7 +53,6 @@ import { AddEditModal } from '@gitroom/frontend/components/new-launch/add.edit.m
|
|||
import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';
|
||||
import { useVariables } from '@gitroom/react/helpers/variable.context';
|
||||
import { stripHtmlValidation } from '@gitroom/helpers/utils/strip.html.validation';
|
||||
import { ModalWrapperComponent } from '../new-launch/modal.wrapper.component';
|
||||
import { newDayjs } from '@gitroom/frontend/components/layout/set.timezone';
|
||||
|
||||
// Extend dayjs with necessary plugins
|
||||
|
|
@ -464,6 +463,7 @@ export const CalendarColumn: FC<{
|
|||
? ExistingDataContextProvider
|
||||
: Fragment;
|
||||
modal.openModal({
|
||||
id: 'add-edit-modal',
|
||||
closeOnClickOutside: false,
|
||||
removeLayout: true,
|
||||
closeOnEscape: false,
|
||||
|
|
@ -553,6 +553,7 @@ export const CalendarColumn: FC<{
|
|||
classNames: {
|
||||
modal: 'w-[100%] max-w-[1400px] text-textColor',
|
||||
},
|
||||
id: 'add-edit-modal',
|
||||
children: (
|
||||
<AddEditModal
|
||||
allIntegrations={integrations.map((p) => ({
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ const FirstStep: FC = (props) => {
|
|||
classNames: {
|
||||
modal: 'w-[100%] max-w-[1400px] bg-transparent text-textColor',
|
||||
},
|
||||
id: 'add-edit-modal',
|
||||
children: (
|
||||
<AddEditModal
|
||||
allIntegrations={integrations.map((p) => ({
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ export const Menu: FC<{
|
|||
classNames: {
|
||||
modal: 'w-[100%] max-w-[1400px] bg-transparent text-textColor',
|
||||
},
|
||||
id: 'add-edit-modal',
|
||||
children: (
|
||||
<AddEditModal
|
||||
allIntegrations={integrations.map((p) => ({
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ export const NewPost = () => {
|
|||
classNames: {
|
||||
modal: 'w-[100%] max-w-[1400px] bg-transparent text-textColor',
|
||||
},
|
||||
id: 'add-edit-modal',
|
||||
children: (
|
||||
<AddEditModal
|
||||
allIntegrations={integrations.map((p) => ({
|
||||
|
|
|
|||
|
|
@ -45,13 +45,17 @@ interface State extends ModalManagerStoreInterface {
|
|||
|
||||
const useModalStore = create<State>((set) => ({
|
||||
modalManager: [],
|
||||
openModal: (params) =>
|
||||
openModal: (params) => {
|
||||
const newId = params.id || makeId(20);
|
||||
set((state) => ({
|
||||
modalManager: [
|
||||
...state.modalManager,
|
||||
{ id: params.id || makeId(20), ...params },
|
||||
...(!state.modalManager.some((p) => p.id === newId)
|
||||
? [{ id: newId, ...params }]
|
||||
: []),
|
||||
],
|
||||
})),
|
||||
}));
|
||||
},
|
||||
closeById: (id) =>
|
||||
set((state) => ({
|
||||
modalManager: state.modalManager.filter((modal) => modal.id !== id),
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ export const Sets: FC = () => {
|
|||
withCloseButton: false,
|
||||
removeLayout: true,
|
||||
askClose: true,
|
||||
id: 'add-edit-modal',
|
||||
children: (
|
||||
<AddEditModal
|
||||
allIntegrations={integrations.map((p: any) => ({
|
||||
|
|
|
|||
Loading…
Reference in New Issue