2024-08-28 04:41:08 -07:00
|
|
|
import type { ICryptoAddress } from 'pl-fe/features/crypto-donate/components/crypto-address';
|
|
|
|
import type { ModalType } from 'pl-fe/features/ui/components/modal-root';
|
2024-09-09 03:52:24 -07:00
|
|
|
import type { AccountModerationModalProps } from 'pl-fe/features/ui/components/modals/account-moderation-modal';
|
2024-08-28 04:41:08 -07:00
|
|
|
import type { BoostModalProps } from 'pl-fe/features/ui/components/modals/boost-modal';
|
|
|
|
import type { CompareHistoryModalProps } from 'pl-fe/features/ui/components/modals/compare-history-modal';
|
|
|
|
import type { ComponentModalProps } from 'pl-fe/features/ui/components/modals/component-modal';
|
|
|
|
import type { ComposeModalProps } from 'pl-fe/features/ui/components/modals/compose-modal';
|
|
|
|
import type { ConfirmationModalProps } from 'pl-fe/features/ui/components/modals/confirmation-modal';
|
|
|
|
import type { DislikesModalProps } from 'pl-fe/features/ui/components/modals/dislikes-modal';
|
2024-09-10 13:57:45 -07:00
|
|
|
import type { DropdownMenuModalProps } from 'pl-fe/features/ui/components/modals/dropdown-menu-modal';
|
2024-08-28 04:41:08 -07:00
|
|
|
import type { EditAnnouncementModalProps } from 'pl-fe/features/ui/components/modals/edit-announcement-modal';
|
|
|
|
import type { EditBookmarkFolderModalProps } from 'pl-fe/features/ui/components/modals/edit-bookmark-folder-modal';
|
|
|
|
import type { EditDomainModalProps } from 'pl-fe/features/ui/components/modals/edit-domain-modal';
|
|
|
|
import type { EditFederationModalProps } from 'pl-fe/features/ui/components/modals/edit-federation-modal';
|
|
|
|
import type { EditRuleModalProps } from 'pl-fe/features/ui/components/modals/edit-rule-modal';
|
|
|
|
import type { EmbedModalProps } from 'pl-fe/features/ui/components/modals/embed-modal';
|
|
|
|
import type { EventMapModalProps } from 'pl-fe/features/ui/components/modals/event-map-modal';
|
|
|
|
import type { EventParticipantsModalProps } from 'pl-fe/features/ui/components/modals/event-participants-modal';
|
|
|
|
import type { FamiliarFollowersModalProps } from 'pl-fe/features/ui/components/modals/familiar-followers-modal';
|
|
|
|
import type { FavouritesModalProps } from 'pl-fe/features/ui/components/modals/favourites-modal';
|
|
|
|
import type { JoinEventModalProps } from 'pl-fe/features/ui/components/modals/join-event-modal';
|
|
|
|
import type { ListAdderModalProps } from 'pl-fe/features/ui/components/modals/list-adder-modal';
|
|
|
|
import type { ListEditorModalProps } from 'pl-fe/features/ui/components/modals/list-editor-modal';
|
|
|
|
import type { MediaModalProps } from 'pl-fe/features/ui/components/modals/media-modal';
|
|
|
|
import type { MentionsModalProps } from 'pl-fe/features/ui/components/modals/mentions-modal';
|
|
|
|
import type { MissingDescriptionModalProps } from 'pl-fe/features/ui/components/modals/missing-description-modal';
|
|
|
|
import type { ReactionsModalProps } from 'pl-fe/features/ui/components/modals/reactions-modal';
|
|
|
|
import type { ReblogsModalProps } from 'pl-fe/features/ui/components/modals/reblogs-modal';
|
|
|
|
import type { ReplyMentionsModalProps } from 'pl-fe/features/ui/components/modals/reply-mentions-modal';
|
|
|
|
import type { SelectBookmarkFolderModalProps } from 'pl-fe/features/ui/components/modals/select-bookmark-folder-modal';
|
|
|
|
import type { TextFieldModalProps } from 'pl-fe/features/ui/components/modals/text-field-modal';
|
|
|
|
import type { UnauthorizedModalProps } from 'pl-fe/features/ui/components/modals/unauthorized-modal';
|
|
|
|
import type { VideoModalProps } from 'pl-fe/features/ui/components/modals/video-modal';
|
2022-11-12 06:18:24 -08:00
|
|
|
|
2024-08-22 07:46:46 -07:00
|
|
|
const MODAL_OPEN = 'MODAL_OPEN' as const;
|
|
|
|
const MODAL_CLOSE = 'MODAL_CLOSE' as const;
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2024-08-18 08:50:56 -07:00
|
|
|
type OpenModalProps =
|
2024-08-22 07:46:46 -07:00
|
|
|
| [type: 'ACCOUNT_MODERATION', props: AccountModerationModalProps]
|
|
|
|
| [type: 'BIRTHDAYS' | 'COMPOSE_EVENT' | 'CREATE_GROUP' | 'HOTKEYS' | 'REPORT']
|
|
|
|
| [type: 'BOOST', props: BoostModalProps]
|
|
|
|
| [type: 'COMPARE_HISTORY', props: CompareHistoryModalProps]
|
|
|
|
| [type: 'COMPONENT', props: ComponentModalProps]
|
|
|
|
| [type: 'COMPOSE', props?: ComposeModalProps]
|
|
|
|
| [type: 'CONFIRM', props: ConfirmationModalProps]
|
|
|
|
| [type: 'CRYPTO_DONATE', props: ICryptoAddress]
|
|
|
|
| [type: 'DISLIKES', props: DislikesModalProps]
|
2024-09-10 13:57:45 -07:00
|
|
|
| [type: 'DROPDOWN_MENU', props: DropdownMenuModalProps]
|
2024-08-22 07:46:46 -07:00
|
|
|
| [type: 'EDIT_ANNOUNCEMENT', props?: EditAnnouncementModalProps]
|
|
|
|
| [type: 'EDIT_BOOKMARK_FOLDER', props: EditBookmarkFolderModalProps]
|
|
|
|
| [type: 'EDIT_DOMAIN', props?: EditDomainModalProps]
|
|
|
|
| [type: 'EDIT_FEDERATION', props: EditFederationModalProps]
|
|
|
|
| [type: 'EDIT_RULE', props?: EditRuleModalProps]
|
|
|
|
| [type: 'EMBED', props: EmbedModalProps]
|
|
|
|
| [type: 'EVENT_MAP', props: EventMapModalProps]
|
|
|
|
| [type: 'EVENT_PARTICIPANTS', props: EventParticipantsModalProps]
|
|
|
|
| [type: 'FAMILIAR_FOLLOWERS', props: FamiliarFollowersModalProps]
|
|
|
|
| [type: 'FAVOURITES', props: FavouritesModalProps]
|
|
|
|
| [type: 'JOIN_EVENT', props: JoinEventModalProps]
|
|
|
|
| [type: 'LIST_ADDER', props: ListAdderModalProps]
|
|
|
|
| [type: 'LIST_EDITOR', props: ListEditorModalProps]
|
|
|
|
| [type: 'MEDIA', props: MediaModalProps]
|
|
|
|
| [type: 'MENTIONS', props: MentionsModalProps]
|
|
|
|
| [type: 'MISSING_DESCRIPTION', props: MissingDescriptionModalProps]
|
|
|
|
| [type: 'MUTE']
|
|
|
|
| [type: 'REACTIONS', props: ReactionsModalProps]
|
|
|
|
| [type: 'REBLOGS', props: ReblogsModalProps]
|
|
|
|
| [type: 'REPLY_MENTIONS', props: ReplyMentionsModalProps]
|
|
|
|
| [type: 'SELECT_BOOKMARK_FOLDER', props: SelectBookmarkFolderModalProps]
|
|
|
|
| [type: 'TEXT_FIELD', props: TextFieldModalProps]
|
|
|
|
| [type: 'UNAUTHORIZED', props?: UnauthorizedModalProps]
|
|
|
|
| [type: 'VIDEO', props: VideoModalProps];
|
2024-08-18 08:50:56 -07:00
|
|
|
|
2022-04-10 18:31:24 -07:00
|
|
|
/** Open a modal of the given type */
|
2024-09-10 13:57:45 -07:00
|
|
|
const openModal = (...[type, props]: OpenModalProps) => ({
|
2023-05-30 06:04:50 -07:00
|
|
|
type: MODAL_OPEN,
|
|
|
|
modalType: type,
|
|
|
|
modalProps: props,
|
|
|
|
});
|
|
|
|
|
2022-04-10 18:31:24 -07:00
|
|
|
/** Close the modal */
|
2024-05-12 16:18:04 -07:00
|
|
|
const closeModal = (type?: ModalType) => ({
|
|
|
|
type: MODAL_CLOSE,
|
|
|
|
modalType: type,
|
|
|
|
});
|
|
|
|
|
2024-08-16 15:26:29 -07:00
|
|
|
type ModalsAction =
|
2024-09-10 13:57:45 -07:00
|
|
|
ReturnType<typeof openModal>
|
2024-08-16 15:26:29 -07:00
|
|
|
| ReturnType<typeof closeModal>;
|
|
|
|
|
2024-05-12 16:18:04 -07:00
|
|
|
export {
|
|
|
|
MODAL_OPEN,
|
|
|
|
MODAL_CLOSE,
|
|
|
|
openModal,
|
|
|
|
closeModal,
|
2024-08-16 15:26:29 -07:00
|
|
|
type ModalsAction,
|
2024-05-12 16:18:04 -07:00
|
|
|
};
|