Skip to content

Commit

Permalink
reviewer editions
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Oct 2, 2024
1 parent 4434845 commit 645d46b
Show file tree
Hide file tree
Showing 32 changed files with 3,886 additions and 2,876 deletions.
18 changes: 18 additions & 0 deletions client/src/containers/collaborators/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ export default function CollaboratorForm() {
disconnect: [],
},
}),
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
},
});
Expand All @@ -263,6 +269,12 @@ export default function CollaboratorForm() {
}),
...values,
image: imageId,
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
data?.apiToken,
)
Expand All @@ -281,6 +293,12 @@ export default function CollaboratorForm() {
connect: [+id],
disconnect: [],
},
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
},
});
Expand Down
9 changes: 7 additions & 2 deletions client/src/containers/datasets/changes-to-approve/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ export default function FormToApprove() {
} as Data;
}, [datasetData, datasetValuesData, previousDataSource?.data?.attributes?.value_type]);


const PENDING_TO_APPROVE_DATA = useMemo(() => {
datasetDataPendingToApprove?.data?.attributes || ({} as DatasetEditSuggestion);

Expand Down Expand Up @@ -278,7 +277,6 @@ export default function FormToApprove() {

const [formValues, setFormValues] = useState<Data>(PENDING_TO_APPROVE_DATA);


const formSchema = z.object({
message: z.string().min(1, { message: "Please provide a reason for the rejection" }),
});
Expand Down Expand Up @@ -370,8 +368,15 @@ export default function FormToApprove() {
dataset_edit_suggestion_ids: parsedData?.dataset_edit_suggestions?.data.map(
(d: { id: number }) => d?.id,
),
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
session?.apiToken,

// to do review data + change sug status
)
.then((data) => {
Expand Down
9 changes: 9 additions & 0 deletions client/src/containers/datasets/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ export default function EditDatasetForm() {
}),
...parsedData,
category_ids: [data.settings.category],
reviewed_by: {
connect: [ME_DATA?.id],
disconnect: [],
},
},
session?.apiToken,
// to do review data + change sug status
Expand All @@ -277,6 +281,11 @@ export default function EditDatasetForm() {
data: {
...data.data,
},
// @ts-expect-error TO-DO - fix types
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
},
},
});
Expand Down
13 changes: 12 additions & 1 deletion client/src/containers/datasets/new/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ export default function NewDatasetForm() {
if (ME_DATA?.role?.type === "admin") {
const { value_type } = data.settings;
const parsedData = getDataParsed(value_type, data);
updateOrCreateDataset(parsedData, session?.apiToken as string)
updateOrCreateDataset(
{
...parsedData,
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
session?.apiToken as string,
)
.then(() => {
console.info("Success creating dataset:", data);
toast.success("Success creating dataset");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export default function ApprovedContributorsRow(data: ApprovedProps) {
{data.review_status}
</span>
</TableCell>
<div
className="flex w-full whitespace-nowrap"
title={data?.reviewed_by?.data?.attributes?.email}
>
{data?.reviewed_by?.data?.attributes?.username
? data?.reviewed_by?.data?.attributes?.username
: "-"}
</div>
<TableCell>
<div className="flex w-full whitespace-nowrap">
{data.updatedAt && data.createdAt && formatDate(data.updatedAt)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default function PendingChangesAdmin() {
<TableHead className="w-[100px]">name</TableHead>
<TableHead>Author</TableHead>
<TableHead>State</TableHead>
<TableHead>Reviewer</TableHead>
<TableHead>Date</TableHead>
</TableRow>
</TableHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type PendingChangesCell =
| extendedProjectData;

export default function PendingDeclinedChangesContributorRow(data: PendingChangesCell) {
console.log(data);
return (
<TableRow key={data.createdAt}>
<TableCell className="whitespace-nowrap font-medium">
Expand Down Expand Up @@ -49,6 +50,15 @@ export default function PendingDeclinedChangesContributorRow(data: PendingChange
</span>
</Link>
</TableCell>
<TableCell>
<Link
href={`/dashboard/${data.route}/${data.id}`}
className="flex w-full whitespace-nowrap"
title={data?.reviewed_by?.data?.attributes?.email}
>
{data.review_status === "pending" ? "-" : data?.reviewed_by?.data?.attributes?.username}
</Link>
</TableCell>
<TableCell>
<Link
href={`/dashboard/${data.route}/${data.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ export default function ApprovedContributorsRow(data: ApprovedProps) {
{data.review_status}
</span>
</TableCell>
<TableCell>
<div
className="flex w-full whitespace-nowrap"
title={data?.reviewed_by?.data?.attributes?.email}
>
{data.review_status === "pending" ? "-" : data?.reviewed_by?.data?.attributes?.username}
</div>
</TableCell>
<TableCell>
<div className="flex w-full whitespace-nowrap">
{data.updatedAt && data.createdAt && formatDate(data.updatedAt)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default function PendingChangesContributor() {
<TableHead className="w-[100px] whitespace-nowrap">Change type</TableHead>
<TableHead>Name</TableHead>
<TableHead>State</TableHead>
<TableHead>Reviewer</TableHead>
<TableHead>Date</TableHead>
</TableRow>
</TableHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type PendingChangesCell =
| extendedProjectData;

export default function PendingDeclinedChangesContributorRow(data: PendingChangesCell) {
console.log(data);
return (
<TableRow key={data.createdAt}>
<TableCell className="whitespace-nowrap font-medium">
Expand All @@ -44,6 +45,24 @@ export default function PendingDeclinedChangesContributorRow(data: PendingChange
</span>
</Link>
</TableCell>
<TableCell>
<Link
href={`/dashboard/${data.route}/${data.id}`}
className="flex w-full whitespace-nowrap"
title={data?.reviewed_by?.data?.attributes?.email}
>
{data.review_status === "pending" ? "-" : data?.reviewed_by?.data?.attributes?.username}
</Link>
</TableCell>
<TableCell>
<Link
href={`/dashboard/${data.route}/${data.id}`}
className="flex w-full whitespace-nowrap"
title={data?.reviewed_by?.data?.attributes?.email}
>
{data.review_status === "pending" ? "-" : data?.reviewed_by?.data?.attributes?.username}
</Link>
</TableCell>
<TableCell>
<Link
href={`/dashboard/${data.route}/${data.id}`}
Expand Down
10 changes: 10 additions & 0 deletions client/src/containers/other-tools/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export default function ToolForm() {
}),
...values,
other_tools_category: values.category,
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
},
data?.apiToken,
)
Expand Down Expand Up @@ -297,6 +301,12 @@ export default function ToolForm() {
connect: [+id],
},
}),
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
},
});
Expand Down
12 changes: 12 additions & 0 deletions client/src/containers/projects/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,12 @@ export default function ProjectForm() {
id: 366,
}),
...values,
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
data?.apiToken,
// to do review data + change sug status
Expand Down Expand Up @@ -453,6 +459,12 @@ export default function ProjectForm() {
},
}),
review_status: "approved",
...(ME_DATA.id && {
reviewed_by: {
connect: [ME_DATA.id],
disconnect: [],
},
}),
},
},
});
Expand Down
1 change: 0 additions & 1 deletion client/src/containers/welcome-message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { useGetWelcomeMessage } from "@/types/generated/welcome-message";

import { Button } from "@/components/ui/button";
import { Dialog, DialogContent } from "@/components/ui/dialog";
import isEmpty from "lodash-es/isEmpty";

export default function WelcomeMessage() {
const videoRef = useRef<ReactPlayer>(null);
Expand Down
Loading

0 comments on commit 645d46b

Please sign in to comment.