0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-04 02:01:58 -05:00

Added toast notification for successful reply

ref https://linear.app/tryghost/issue/AP-395
This commit is contained in:
Fabien O'Carroll 2024-09-19 10:43:11 +07:00 committed by Fabien 'egg' O'Carroll
parent 5ff7dce5a2
commit e8e44a0312

View file

@ -4,7 +4,7 @@ import * as FormPrimitive from '@radix-ui/react-form';
import APAvatar from './APAvatar'; import APAvatar from './APAvatar';
import clsx from 'clsx'; import clsx from 'clsx';
import getUsername from '../../utils/get-username'; import getUsername from '../../utils/get-username';
import {Button} from '@tryghost/admin-x-design-system'; import {Button, showToast} from '@tryghost/admin-x-design-system';
import {ObjectProperties} from '@tryghost/admin-x-framework/api/activitypub'; import {ObjectProperties} from '@tryghost/admin-x-framework/api/activitypub';
import {useReplyMutationForUser} from '../../hooks/useActivityPubQueries'; import {useReplyMutationForUser} from '../../hooks/useActivityPubQueries';
// import {useFocusContext} from '@tryghost/admin-x-design-system/types/providers/DesignSystemProvider'; // import {useFocusContext} from '@tryghost/admin-x-design-system/types/providers/DesignSystemProvider';
@ -53,6 +53,10 @@ const APReplyBox: React.FC<APTextAreaProps> = ({
await replyMutation.mutate({id: object.id, content: textValue}, { await replyMutation.mutate({id: object.id, content: textValue}, {
onSuccess() { onSuccess() {
setTextValue(''); setTextValue('');
showToast({
message: 'Reply sent',
type: 'success'
});
} }
}); });
} }
@ -89,7 +93,7 @@ const APReplyBox: React.FC<APTextAreaProps> = ({
</div> </div>
</FormPrimitive.Root> </FormPrimitive.Root>
<div className='absolute bottom-[6px] right-[9px] flex space-x-4 transition-[opacity] duration-150'> <div className='absolute bottom-[6px] right-[9px] flex space-x-4 transition-[opacity] duration-150'>
<Button disabled={replyMutation.isLoading} loading={replyMutation.isLoading} color='black' id='post' label='Post' size='sm' onClick={handleClick} /> <Button color='black' disabled={replyMutation.isLoading} id='post' label='Post' loading={replyMutation.isLoading} size='sm' onClick={handleClick} />
</div> </div>
</div> </div>
</div> </div>