From 5aca33138ba54da57cc4b5a03317764dbf113f07 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Tue, 23 Apr 2024 04:14:33 +0100 Subject: [PATCH] feat: agreement improvements --- .../src/routes/_authenticated/signin/agreements/$id.tsx | 9 ++++++--- .../routes/_authenticated/signin/agreements/index.tsx | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/forge/src/routes/_authenticated/signin/agreements/$id.tsx b/apps/forge/src/routes/_authenticated/signin/agreements/$id.tsx index fbef596..bddc773 100644 --- a/apps/forge/src/routes/_authenticated/signin/agreements/$id.tsx +++ b/apps/forge/src/routes/_authenticated/signin/agreements/$id.tsx @@ -3,19 +3,21 @@ import Title from "@/components/title"; import { extractError, useUser } from "@/lib/utils"; import { getAgreement } from "@/services/root/getAgreement"; import { useQuery } from "@tanstack/react-query"; -import { createFileRoute } from "@tanstack/react-router"; +import { createFileRoute, useNavigate } from "@tanstack/react-router"; import { Button } from "@ui/components/ui/button"; import { Checkbox } from "@ui/components/ui/checkbox"; import { Label } from "@ui/components/ui/label"; import { Separator } from "@ui/components/ui/separator"; import { useState } from "react"; import Markdown from "react-markdown"; +import { toast } from "sonner"; export default function Component() { const { id } = Route.useParams(); const [isChecked, setIsChecked] = useState(false); const user = useUser()!; + const navigator = useNavigate(); const { data: agreement, @@ -71,11 +73,12 @@ export default function Component() { onClick={async () => { if (isChecked) { await axiosInstance.post(`/agreements/${id}`, { user }); - user.agreements_signed.push({ id }); + toast.success("Successfully signed agreement"); + return navigator({ to: "/signin/agreements" }); } }} > - Continue + Confirm diff --git a/apps/forge/src/routes/_authenticated/signin/agreements/index.tsx b/apps/forge/src/routes/_authenticated/signin/agreements/index.tsx index 5b39606..a4d92f1 100644 --- a/apps/forge/src/routes/_authenticated/signin/agreements/index.tsx +++ b/apps/forge/src/routes/_authenticated/signin/agreements/index.tsx @@ -45,8 +45,8 @@ export default function Component() {

The signable agreements in the iForge.

- - +
+ Reasons Status @@ -64,7 +64,9 @@ export default function Component() { {agreement.reasons.map((reason) => reason.name).join(", ")}
- {getAgreementStatus(agreement)} + + {getAgreementStatus(agreement)} +
{agreement.version}