mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-04-28 13:00:30 +00:00
(fix:prompts) show delete only when possible
This commit is contained in:
@@ -53,7 +53,7 @@ function Dropdown({
|
|||||||
darkBorderColor?: string;
|
darkBorderColor?: string;
|
||||||
showEdit?: boolean;
|
showEdit?: boolean;
|
||||||
onEdit?: (value: { name: string; id: string; type: string }) => void;
|
onEdit?: (value: { name: string; id: string; type: string }) => void;
|
||||||
showDelete?: boolean;
|
showDelete?: boolean | ((option: any) => boolean);
|
||||||
onDelete?: (value: string) => void;
|
onDelete?: (value: string) => void;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
placeholderTextColor?: string;
|
placeholderTextColor?: string;
|
||||||
@@ -173,8 +173,15 @@ function Dropdown({
|
|||||||
)}
|
)}
|
||||||
{showDelete && onDelete && (
|
{showDelete && onDelete && (
|
||||||
<button
|
<button
|
||||||
onClick={() => onDelete(option.id)}
|
onClick={(e) => {
|
||||||
disabled={option.type === 'public'}
|
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
|
<img
|
||||||
src={Trash}
|
src={Trash}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export default function Prompts({
|
|||||||
rounded="3xl"
|
rounded="3xl"
|
||||||
border="border"
|
border="border"
|
||||||
showEdit
|
showEdit
|
||||||
showDelete
|
showDelete={(prompt) => prompt.type !== 'public'}
|
||||||
onEdit={({
|
onEdit={({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Reference in New Issue
Block a user