mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
(fix:prompts) show delete only when possible
This commit is contained in:
@@ -53,7 +53,7 @@ function Dropdown({
|
||||
darkBorderColor?: string;
|
||||
showEdit?: boolean;
|
||||
onEdit?: (value: { name: string; id: string; type: string }) => void;
|
||||
showDelete?: boolean;
|
||||
showDelete?: boolean | ((option: any) => boolean);
|
||||
onDelete?: (value: string) => void;
|
||||
placeholder?: string;
|
||||
placeholderTextColor?: string;
|
||||
@@ -173,8 +173,15 @@ function Dropdown({
|
||||
)}
|
||||
{showDelete && onDelete && (
|
||||
<button
|
||||
onClick={() => onDelete(option.id)}
|
||||
disabled={option.type === 'public'}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete?.(typeof option === 'string' ? option : option.id);
|
||||
}}
|
||||
className={`${
|
||||
typeof showDelete === 'function' && !showDelete(option)
|
||||
? 'hidden'
|
||||
: ''
|
||||
} mr-2 h-4 w-4 cursor-pointer hover:opacity-50`}
|
||||
>
|
||||
<img
|
||||
src={Trash}
|
||||
|
||||
@@ -177,7 +177,7 @@ export default function Prompts({
|
||||
rounded="3xl"
|
||||
border="border"
|
||||
showEdit
|
||||
showDelete
|
||||
showDelete={(prompt) => prompt.type !== 'public'}
|
||||
onEdit={({
|
||||
id,
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user