Fix toast hide action button

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-25 15:11:17 +01:00
parent e1b18a67b5
commit f93ee928a8
3 changed files with 38 additions and 101 deletions

View File

@@ -638,14 +638,6 @@ function ControlViewContent({
},
},
onCompleted: () => {
toast({
title: "Task updated",
description: `Task has been ${
newState === "DONE" ? "completed" : "reopened"
}.`,
});
// Update the selected task state if it's the current task
if (selectedTask && selectedTask.id === taskId) {
setSelectedTask({
...selectedTask,
@@ -797,11 +789,6 @@ function ControlViewContent({
"input.file": file,
},
onCompleted: () => {
toast({
title: "Document added",
description: "Document evidence has been added successfully.",
variant: "default",
});
setTaskForEvidence(null);
// Reset the file input
if (hiddenFileInputRef.current) {
@@ -843,13 +830,6 @@ function ControlViewContent({
// Description is now optional for link evidence
// Remove the validation check for empty description
// Show toast for add started
toast({
title: "Adding link evidence",
description: `Adding ${linkEvidenceName}...`,
variant: "default",
});
// Get the evidence connection ID for this task
const evidenceConnectionId = getEvidenceConnectionId(taskForEvidence.id);
@@ -870,11 +850,6 @@ function ControlViewContent({
connections: evidenceConnectionId ? [evidenceConnectionId] : [],
},
onCompleted: () => {
toast({
title: "Link evidence added",
description: "Link evidence has been added successfully.",
variant: "default",
});
setTaskForEvidence(null);
setEvidenceDialogOpen(false);
// Reset form fields
@@ -1070,10 +1045,6 @@ function ControlViewContent({
connections: evidenceConnectionId ? [evidenceConnectionId] : [],
},
onCompleted: () => {
toast({
title: "Evidence deleted",
description: "Evidence has been deleted successfully.",
});
setIsDeleteEvidenceOpen(false);
setEvidenceToDelete(null);
},
@@ -1097,11 +1068,6 @@ function ControlViewContent({
},
},
onCompleted: () => {
toast({
title: "Task assigned",
description: "Task has been assigned successfully.",
});
// Close the popover
setPeoplePopoverOpen((prev) => ({ ...prev, [taskId]: false }));
},
onError: (error) => {
@@ -1122,12 +1088,6 @@ function ControlViewContent({
taskId,
},
},
onCompleted: () => {
toast({
title: "Task unassigned",
description: "Task has been unassigned successfully.",
});
},
onError: (error) => {
toast({
title: "Error unassigning task",
@@ -1250,10 +1210,6 @@ function ControlViewContent({
},
},
onCompleted: () => {
toast({
title: "Task updated",
description: "Time estimate has been updated successfully.",
});
setIsEditingDuration(false);
// Update the selected task state if it's the current task

View File

@@ -16,9 +16,15 @@ import {
import { Suspense, useEffect, useState, useCallback } from "react";
import type { PeopleViewQuery as PeopleViewQueryType } from "./__generated__/PeopleViewQuery.graphql";
import { useParams } from "react-router";
import { cn } from "@/lib/utils";
import { PageTemplate } from "@/components/PageTemplate";
import { PeopleViewSkeleton } from "./PeoplePage";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
const peopleViewQuery = graphql`
query PeopleViewQuery($peopleId: ID!) {
@@ -237,63 +243,40 @@ function PeopleViewContent({
<HelpCircle className="h-4 w-4 text-gray-400" />
<Label className="text-sm">Kind</Label>
</div>
<div className="flex gap-2">
<button
onClick={() => handleFieldChange("kind", "EMPLOYEE")}
className={cn(
"rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "EMPLOYEE"
? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Employee
</button>
<button
onClick={() => handleFieldChange("kind", "CONTRACTOR")}
className={cn(
"rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "CONTRACTOR"
? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Contractor
</button>
<button
onClick={() =>
handleFieldChange("kind", "SERVICE_ACCOUNT")
}
className={cn(
"rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "SERVICE_ACCOUNT"
? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Service Account
</button>
</div>
<Select
value={formData.kind}
onValueChange={(value) => handleFieldChange("kind", value)}
>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select kind" />
</SelectTrigger>
<SelectContent>
<SelectItem value="EMPLOYEE">Employee</SelectItem>
<SelectItem value="CONTRACTOR">Contractor</SelectItem>
<SelectItem value="SERVICE_ACCOUNT">
Service Account
</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</div>
</Card>
<div className="mt-6 flex justify-end gap-2">
<Button variant="outline" onClick={handleCancel}>
Cancel
</Button>
<Button
onClick={handleSave}
className="bg-primary text-primary-foreground hover:bg-primary/90"
disabled={!hasChanges}
>
Save Changes
</Button>
</div>
</div>
</div>
{hasChanges && (
<div className="fixed bottom-6 right-6 flex gap-2">
<Button variant="outline" onClick={handleCancel}>
Cancel
</Button>
<Button
onClick={handleSave}
className="bg-primary text-primary-foreground hover:bg-primary/90"
>
Save Changes
</Button>
</div>
)}
</PageTemplate>
);
}

View File

@@ -373,21 +373,19 @@ function VendorViewContent({
</div>
</div>
</Card>
</div>
{hasChanges && (
<div className="fixed bottom-6 right-6 flex gap-2">
<div className="mt-6 flex justify-end gap-2">
<Button variant="outline" onClick={handleCancel}>
Cancel
</Button>
<Button
onClick={handleSave}
className="bg-primary text-primary-foreground hover:bg-primary/90"
disabled={!hasChanges}
>
Save Changes
</Button>
</div>
)}
</div>
</PageTemplate>
);
}