Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import { useState } from "react";
|
|
// ui
|
|
import { Button } from "@plane/propel/button";
|
|
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";
|
|
|
|
type Props = {
|
|
isOpen: boolean;
|
|
handleClose: () => void;
|
|
onDiscard: () => void;
|
|
onConfirm: () => Promise<void>;
|
|
};
|
|
|
|
export function ConfirmIssueDiscard(props: Props) {
|
|
const { isOpen, handleClose, onDiscard, onConfirm } = props;
|
|
|
|
const [isLoading, setIsLoading] = useState(false);
|
|
|
|
const onClose = () => {
|
|
handleClose();
|
|
setIsLoading(false);
|
|
};
|
|
|
|
const handleDeletion = async () => {
|
|
setIsLoading(true);
|
|
await onConfirm();
|
|
setIsLoading(false);
|
|
};
|
|
|
|
return (
|
|
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.TOP} width={EModalWidth.XXL}>
|
|
<div className="px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
<div className="sm:flex sm:items-start">
|
|
<div className="mt-3 text-center sm:mt-0 sm:text-left">
|
|
<h3 className="text-16 leading-6 font-medium text-primary">Save this draft?</h3>
|
|
<div className="mt-2">
|
|
<p className="text-13 text-secondary">
|
|
You can save this work item to Drafts so you can come back to it later.{" "}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="flex justify-between gap-2 p-4 sm:px-6">
|
|
<div>
|
|
<Button variant="secondary" onClick={onDiscard}>
|
|
Discard
|
|
</Button>
|
|
</div>
|
|
<div className="flex items-center gap-2">
|
|
<Button variant="secondary" onClick={onClose}>
|
|
Cancel
|
|
</Button>
|
|
<Button variant="primary" onClick={handleDeletion} loading={isLoading}>
|
|
{isLoading ? "Saving" : "Save to Drafts"}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</ModalCore>
|
|
);
|
|
}
|