mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-16 17:36:07 +00:00
fix: double close button
This commit is contained in:
+11
-9
@@ -405,7 +405,7 @@ export default function PluginInstallProgressDialog() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={(o) => !o && handleClose()}>
|
<Dialog open={open} onOpenChange={(o) => !o && handleClose()}>
|
||||||
<DialogContent className="w-[460px] max-h-[80vh] p-6 bg-white dark:bg-[#1a1a1e] overflow-y-auto">
|
<DialogContent className="w-[460px] max-h-[80vh] p-6 bg-white dark:bg-[#1a1a1e] overflow-y-auto" hideCloseButton>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle className="flex items-center gap-3">
|
<DialogTitle className="flex items-center gap-3">
|
||||||
<Download className="size-5" />
|
<Download className="size-5" />
|
||||||
@@ -422,14 +422,16 @@ export default function PluginInstallProgressDialog() {
|
|||||||
{selectedTask && <TaskProgressContent task={selectedTask} />}
|
{selectedTask && <TaskProgressContent task={selectedTask} />}
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 mt-2">
|
<div className="flex justify-end gap-2 mt-2">
|
||||||
{selectedTask &&
|
<Button
|
||||||
(selectedTask.stage === InstallStage.DONE ||
|
variant="default"
|
||||||
selectedTask.stage === InstallStage.ERROR) && (
|
size="sm"
|
||||||
<Button variant="outline" size="sm" onClick={handleDismiss}>
|
onClick={
|
||||||
{t('plugins.installProgress.dismiss')}
|
selectedTask?.stage === InstallStage.DONE ||
|
||||||
</Button>
|
selectedTask?.stage === InstallStage.ERROR
|
||||||
)}
|
? handleDismiss
|
||||||
<Button variant="default" size="sm" onClick={handleClose}>
|
: handleClose
|
||||||
|
}
|
||||||
|
>
|
||||||
{selectedTask?.stage === InstallStage.DONE ||
|
{selectedTask?.stage === InstallStage.DONE ||
|
||||||
selectedTask?.stage === InstallStage.ERROR
|
selectedTask?.stage === InstallStage.ERROR
|
||||||
? t('common.close')
|
? t('common.close')
|
||||||
|
|||||||
@@ -109,8 +109,11 @@ function DialogOverlay({
|
|||||||
function DialogContent({
|
function DialogContent({
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
|
hideCloseButton = false,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
||||||
|
hideCloseButton?: boolean;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<DialogPortal data-slot="dialog-portal">
|
<DialogPortal data-slot="dialog-portal">
|
||||||
<DialogOverlay />
|
<DialogOverlay />
|
||||||
@@ -123,10 +126,12 @@ function DialogContent({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
{!hideCloseButton && (
|
||||||
<XIcon />
|
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
||||||
<span className="sr-only">Close</span>
|
<XIcon />
|
||||||
</DialogPrimitive.Close>
|
<span className="sr-only">Close</span>
|
||||||
|
</DialogPrimitive.Close>
|
||||||
|
)}
|
||||||
</DialogPrimitive.Content>
|
</DialogPrimitive.Content>
|
||||||
</DialogPortal>
|
</DialogPortal>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user