mirror of https://github.com/buster-so/buster.git
pass save events differently
This commit is contained in:
parent
d9bc8d4741
commit
f516d3b611
|
@ -35,9 +35,7 @@ const SplitterContent: React.FC<{
|
|||
<PopupSplitter />
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button variant={'default'} onClick={onReset}>
|
||||
Reset
|
||||
</Button>
|
||||
<Button onClick={onReset}>Reset</Button>
|
||||
<Button
|
||||
className="flex items-center"
|
||||
variant="black"
|
||||
|
@ -58,14 +56,8 @@ const SplitterContent: React.FC<{
|
|||
title="Unsaved changes"
|
||||
isDirty={open}
|
||||
description="Are you sure you want to leave this page?"
|
||||
onOk={() => {
|
||||
onSave();
|
||||
return Promise.resolve();
|
||||
}}
|
||||
onCancel={() => {
|
||||
onReset();
|
||||
return Promise.resolve();
|
||||
}}
|
||||
onOk={onSave}
|
||||
onCancel={onReset}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ const sizeVariants = {
|
|||
};
|
||||
|
||||
export const buttonVariants = cva(
|
||||
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
||||
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
||||
{
|
||||
variants: {
|
||||
variant: buttonTypeClasses,
|
||||
|
|
|
@ -12,9 +12,9 @@ type PreventNavigationProps = {
|
|||
description: string;
|
||||
cancelText?: string;
|
||||
okText?: string;
|
||||
onOk: () => Promise<void>;
|
||||
onCancel: () => Promise<void>;
|
||||
onClose?: () => void;
|
||||
onOk: (() => Promise<void>) | (() => void);
|
||||
onCancel: (() => Promise<void>) | (() => void);
|
||||
onClose?: (() => Promise<void>) | (() => void);
|
||||
doNotLeavePageOnOkay?: boolean;
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ export const PreventNavigation: React.FC<PreventNavigationProps> = React.memo(
|
|||
document.querySelectorAll('a').forEach((link) => {
|
||||
link.addEventListener('click', handleClick);
|
||||
});
|
||||
}, 0);
|
||||
}, 5);
|
||||
};
|
||||
|
||||
setLeavingPage(true);
|
||||
|
|
|
@ -251,29 +251,27 @@ function SegmentedTriggerComponent<T extends string = string>(props: SegmentedTr
|
|||
|
||||
return (
|
||||
<Tooltip title={tooltip || ''} sideOffset={10} delayDuration={150}>
|
||||
<LinkDiv href={link || ''} onClick={handleClick}>
|
||||
<Tabs.Trigger
|
||||
key={value}
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
asChild
|
||||
ref={(el) => {
|
||||
if (el) tabRefs.current.set(value, el);
|
||||
}}
|
||||
className={cn(
|
||||
triggerVariants({
|
||||
size,
|
||||
block,
|
||||
disabled,
|
||||
selected: selectedValue === value
|
||||
})
|
||||
)}>
|
||||
<div className="">
|
||||
{icon && <span className={cn('flex items-center text-sm')}>{icon}</span>}
|
||||
{label && <span className={cn('text-sm')}>{label}</span>}
|
||||
</div>
|
||||
</Tabs.Trigger>
|
||||
</LinkDiv>
|
||||
<Tabs.Trigger
|
||||
key={value}
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
asChild
|
||||
ref={(el) => {
|
||||
if (el) tabRefs.current.set(value, el);
|
||||
}}
|
||||
className={cn(
|
||||
triggerVariants({
|
||||
size,
|
||||
block,
|
||||
disabled,
|
||||
selected: selectedValue === value
|
||||
})
|
||||
)}>
|
||||
<LinkDiv href={link || ''} onClick={handleClick}>
|
||||
{icon && <span className={cn('flex items-center text-sm')}>{icon}</span>}
|
||||
{label && <span className={cn('text-sm')}>{label}</span>}
|
||||
</LinkDiv>
|
||||
</Tabs.Trigger>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue