LibreChat/client/src/components/Bookmarks/DeleteBookmarkButton.tsx

59 lines
1.8 KiB
TypeScript
Raw Normal View History

import { useCallback } from 'react';
import type { FC } from 'react';
import { useDeleteConversationTagMutation } from '~/data-provider';
import TooltipIcon from '~/components/ui/TooltipIcon';
import { NotificationSeverity } from '~/common';
import { useToastContext } from '~/Providers';
import { TrashIcon } from '~/components/svg';
import { Label } from '~/components/ui';
import { useLocalize } from '~/hooks';
const DeleteBookmarkButton: FC<{
bookmark: string;
tabIndex?: number;
onFocus?: () => void;
onBlur?: () => void;
}> = ({ bookmark, tabIndex = 0, onFocus, onBlur }) => {
const localize = useLocalize();
const { showToast } = useToastContext();
const deleteBookmarkMutation = useDeleteConversationTagMutation({
onSuccess: () => {
showToast({
message: localize('com_ui_bookmarks_delete_success'),
});
},
onError: () => {
showToast({
message: localize('com_ui_bookmarks_delete_error'),
severity: NotificationSeverity.ERROR,
});
},
});
const confirmDelete = useCallback(async () => {
await deleteBookmarkMutation.mutateAsync(bookmark);
}, [bookmark, deleteBookmarkMutation]);
return (
<TooltipIcon
disabled={false}
appendLabel={false}
title="Delete Bookmark"
confirmMessage={
<Label htmlFor="bookmark" className="text-left text-sm font-medium">
{localize('com_ui_bookmark_delete_confirm')} {bookmark}
</Label>
}
confirm={confirmDelete}
💬 feat: assistant conversation starter (#3699) * feat: initial UI convoStart * fix: ConvoStarter UI * fix: convoStarters bug * feat: Add input field focus on conversation starters * style: conversation starter UI update * feat: apply fixes for starters * style: update conversationStarters UI and fixed typo * general UI update * feat: Add onClick functionality to ConvoStarter component * fix: quick fix test * fix(AssistantSelect): remove object check * fix: updateAssistant `conversation_starters` var * chore: remove starter autofocus * fix: no empty conversation starters, always show input, use Constants value for max count * style: Update defaultTextPropsLabel styles, for a11y placeholder * refactor: Update ConvoStarter component styles and class names for a11y and theme * refactor: convostarter, move plus button to within persistent element * fix: types * chore: Update landing page assistant description styling with theming * chore: assistant types * refactor: documents routes * refactor: optimize conversation starter mutations/queries * refactor: Update listAllAssistants return type to Promise<Array<Assistant>> * feat: edit existing starters * feat(convo-starters): enhance ConvoStarter component and add animations - Update ConvoStarter component styling for better visual appeal - Implement fade-in animation for smoother appearance - Add hover effect with background color change - Improve text overflow handling with line-clamp and text-balance - Ensure responsive design for various screen sizes * feat(assistant): add conversation starters to assistant builder - Add localization strings for conversation starters - Update mobile.css with shake animation for max starters reached - Enhance user experience with tooltips and dynamic input handling * refactor: select specific fields for assistant documents fetch * refactor: remove endpoint query key, fetch all assistant docs for now, add conversation_starters to v1 methods * refactor: add document filters based on endpoint config * fix: starters not applied during creation * refactor: update AssistantSelect component to handle undefined lastSelectedModels --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-08-31 13:42:20 -04:00
className="transition-colors flex size-7 items-center justify-center rounded-lg duration-200 hover:bg-surface-hover"
icon={<TrashIcon className="size-4" />}
tabIndex={tabIndex}
onFocus={onFocus}
onBlur={onBlur}
/>
);
};
export default DeleteBookmarkButton;