Wip: アンテナ編集画面周辺
This commit is contained in:
parent
041b05b15f
commit
946f5bce3e
51 changed files with 1006 additions and 3665 deletions
|
@ -0,0 +1,58 @@
|
|||
import { useCallback } from 'react';
|
||||
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
import { deleteAntenna } from 'mastodon/actions/antennas';
|
||||
import { removeColumn } from 'mastodon/actions/columns';
|
||||
import { useAppDispatch } from 'mastodon/store';
|
||||
|
||||
import type { BaseConfirmationModalProps } from './confirmation_modal';
|
||||
import { ConfirmationModal } from './confirmation_modal';
|
||||
|
||||
const messages = defineMessages({
|
||||
deleteAntennaTitle: {
|
||||
id: 'confirmations.delete_antenna.title',
|
||||
defaultMessage: 'Delete antenna?',
|
||||
},
|
||||
deleteAntennaMessage: {
|
||||
id: 'confirmations.delete_antenna.message',
|
||||
defaultMessage: 'Are you sure you want to permanently delete this antenna?',
|
||||
},
|
||||
deleteAntennaConfirm: {
|
||||
id: 'confirmations.delete_antenna.confirm',
|
||||
defaultMessage: 'Delete',
|
||||
},
|
||||
});
|
||||
|
||||
export const ConfirmDeleteAntennaModal: React.FC<
|
||||
{
|
||||
antennaId: string;
|
||||
columnId: string;
|
||||
} & BaseConfirmationModalProps
|
||||
> = ({ antennaId, columnId, onClose }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
const history = useHistory();
|
||||
|
||||
const onConfirm = useCallback(() => {
|
||||
dispatch(deleteAntenna(antennaId));
|
||||
|
||||
if (columnId) {
|
||||
dispatch(removeColumn(columnId));
|
||||
} else {
|
||||
history.push('/antennas');
|
||||
}
|
||||
}, [dispatch, history, columnId, antennaId]);
|
||||
|
||||
return (
|
||||
<ConfirmationModal
|
||||
title={intl.formatMessage(messages.deleteAntennaTitle)}
|
||||
message={intl.formatMessage(messages.deleteAntennaMessage)}
|
||||
confirm={intl.formatMessage(messages.deleteAntennaConfirm)}
|
||||
onConfirm={onConfirm}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,59 @@
|
|||
import { useCallback } from 'react';
|
||||
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
import { deleteBookmarkCategory } from 'mastodon/actions/bookmark_categories';
|
||||
import { removeColumn } from 'mastodon/actions/columns';
|
||||
import { useAppDispatch } from 'mastodon/store';
|
||||
|
||||
import type { BaseConfirmationModalProps } from './confirmation_modal';
|
||||
import { ConfirmationModal } from './confirmation_modal';
|
||||
|
||||
const messages = defineMessages({
|
||||
deleteBookmarkCategoryTitle: {
|
||||
id: 'confirmations.delete_bookmark_category.title',
|
||||
defaultMessage: 'Delete category?',
|
||||
},
|
||||
deleteBookmarkCategoryMessage: {
|
||||
id: 'confirmations.delete_bookmark_category.message',
|
||||
defaultMessage:
|
||||
'Are you sure you want to permanently delete this category?',
|
||||
},
|
||||
deleteBookmarkCategoryConfirm: {
|
||||
id: 'confirmations.delete_bookmark_category.confirm',
|
||||
defaultMessage: 'Delete',
|
||||
},
|
||||
});
|
||||
|
||||
export const ConfirmDeleteBookmarkCategoryModal: React.FC<
|
||||
{
|
||||
bookmark_categoryId: string;
|
||||
columnId: string;
|
||||
} & BaseConfirmationModalProps
|
||||
> = ({ bookmark_categoryId, columnId, onClose }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
const history = useHistory();
|
||||
|
||||
const onConfirm = useCallback(() => {
|
||||
dispatch(deleteBookmarkCategory(bookmark_categoryId));
|
||||
|
||||
if (columnId) {
|
||||
dispatch(removeColumn(columnId));
|
||||
} else {
|
||||
history.push('/bookmark_categorys');
|
||||
}
|
||||
}, [dispatch, history, columnId, bookmark_categoryId]);
|
||||
|
||||
return (
|
||||
<ConfirmationModal
|
||||
title={intl.formatMessage(messages.deleteBookmarkCategoryTitle)}
|
||||
message={intl.formatMessage(messages.deleteBookmarkCategoryMessage)}
|
||||
confirm={intl.formatMessage(messages.deleteBookmarkCategoryConfirm)}
|
||||
onConfirm={onConfirm}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,58 @@
|
|||
import { useCallback } from 'react';
|
||||
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
import { deleteCircle } from 'mastodon/actions/circles';
|
||||
import { removeColumn } from 'mastodon/actions/columns';
|
||||
import { useAppDispatch } from 'mastodon/store';
|
||||
|
||||
import type { BaseConfirmationModalProps } from './confirmation_modal';
|
||||
import { ConfirmationModal } from './confirmation_modal';
|
||||
|
||||
const messages = defineMessages({
|
||||
deleteCircleTitle: {
|
||||
id: 'confirmations.delete_circle.title',
|
||||
defaultMessage: 'Delete circle?',
|
||||
},
|
||||
deleteCircleMessage: {
|
||||
id: 'confirmations.delete_circle.message',
|
||||
defaultMessage: 'Are you sure you want to permanently delete this circle?',
|
||||
},
|
||||
deleteCircleConfirm: {
|
||||
id: 'confirmations.delete_circle.confirm',
|
||||
defaultMessage: 'Delete',
|
||||
},
|
||||
});
|
||||
|
||||
export const ConfirmDeleteCircleModal: React.FC<
|
||||
{
|
||||
circleId: string;
|
||||
columnId: string;
|
||||
} & BaseConfirmationModalProps
|
||||
> = ({ circleId, columnId, onClose }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
const history = useHistory();
|
||||
|
||||
const onConfirm = useCallback(() => {
|
||||
dispatch(deleteCircle(circleId));
|
||||
|
||||
if (columnId) {
|
||||
dispatch(removeColumn(columnId));
|
||||
} else {
|
||||
history.push('/circles');
|
||||
}
|
||||
}, [dispatch, history, columnId, circleId]);
|
||||
|
||||
return (
|
||||
<ConfirmationModal
|
||||
title={intl.formatMessage(messages.deleteCircleTitle)}
|
||||
message={intl.formatMessage(messages.deleteCircleMessage)}
|
||||
confirm={intl.formatMessage(messages.deleteCircleConfirm)}
|
||||
onConfirm={onConfirm}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
};
|
|
@ -1,6 +1,9 @@
|
|||
export { ConfirmationModal } from './confirmation_modal';
|
||||
export { ConfirmDeleteStatusModal } from './delete_status';
|
||||
export { ConfirmDeleteListModal } from './delete_list';
|
||||
export { ConfirmDeleteAntennaModal } from './delete_antenna';
|
||||
export { ConfirmDeleteCircleModal } from './delete_circle';
|
||||
export { ConfirmDeleteBookmarkCategoryModal } from './delete_bookmark_category';
|
||||
export { ConfirmReplyModal } from './reply';
|
||||
export { ConfirmEditStatusModal } from './edit_status';
|
||||
export { ConfirmUnfollowModal } from './unfollow';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue