Add Loader in Product Delete button and tweak Weekly Summary UI

Add Loader in Product Delete button and tweak Weekly Summary UI
This commit is contained in:
Johannes
2023-08-14 10:33:56 +02:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
@@ -125,6 +125,7 @@ export function DeleteProduct({ environmentId }) {
const router = useRouter();
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const [deletingProduct, setDeletingProduct] = useState(false);
const { profile } = useProfile();
const { team } = useMembers(environmentId);
@@ -149,7 +150,9 @@ export function DeleteProduct({ environmentId }) {
setIsDeleteDialogOpen(false);
return;
}
setDeletingProduct(true);
const deleteProductRes = await deleteProduct(environmentId);
setDeletingProduct(false);
if (deleteProductRes?.id?.length > 0) {
toast.success("Product deleted successfully.");
@@ -191,6 +194,7 @@ export function DeleteProduct({ environmentId }) {
deleteWhat="Product"
open={isDeleteDialogOpen}
setOpen={setIsDeleteDialogOpen}
isDeleting={deletingProduct}
onDelete={handleDeleteProduct}
text={`Are you sure you want to delete "${truncate(
product?.name,
@@ -144,7 +144,7 @@ const createSurveyFields = (surveryResponses: SurveyResponse[]) => {
surveyFields += `
<div style="margin-top:1em;">
<p style="margin:0px;">${headline}</p>
<p style="font-weight: 500; margin:0px;">${answer}</p>
<p style="font-weight: bold; margin:0px;">${answer}</p>
</div>
`;
}