diff --git a/package.json b/package.json
index ab47367..bbcbd73 100644
--- a/package.json
+++ b/package.json
@@ -79,6 +79,7 @@
"papaparse": "^5.4.1",
"postcss": "8.4.23",
"react": "^18.2.0",
+ "react-canvas-confetti": "^2.0.7",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.50.1",
diff --git a/src/components/Form.tsx b/src/components/Form.tsx
index 298c911..3810275 100644
--- a/src/components/Form.tsx
+++ b/src/components/Form.tsx
@@ -6,7 +6,7 @@ import { useMutation } from "@tanstack/react-query"
import axios from "axios"
import { useRouter } from "next/navigation"
import { toast } from "@/hooks/use-toast"
-import { useEffect } from "react"
+import { useEffect, useState } from "react"
import { Button } from "@/components/ui/Button"
import {
Form,
@@ -23,6 +23,7 @@ import { Checkbox } from "@/components/ui/checkbox"
import { ApuntsPostCreationRequest } from "@/lib/validators/post"
import { uploadFiles } from "@/lib/uploadthing"
import { GCED_START } from "@/config"
+import Fireworks from "react-canvas-confetti/dist/presets/fireworks"
const formSchema = z.object({
pdf: z.any(),
@@ -56,6 +57,7 @@ export function ProfileForm({
semester?: number
}) {
const router = useRouter()
+ const [isVisible, setIsVisible] = useState(false)
const { mutate: createApuntsPost } = useMutation({
mutationFn: async ({
@@ -99,6 +101,7 @@ export function ProfileForm({
}
},
onSuccess: (subjectAcronym) => {
+ setIsVisible(true)
router.push(`/${subjectAcronym}`)
router.refresh()
@@ -446,6 +449,7 @@ export function ProfileForm({
+ {isVisible && }
)
diff --git a/yarn.lock b/yarn.lock
index ef89138..368e1b6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1109,6 +1109,11 @@
"@tanstack/query-core" "4.29.11"
use-sync-external-store "^1.2.0"
+"@types/canvas-confetti@^1.6.4":
+ version "1.6.4"
+ resolved "https://registry.yarnpkg.com/@types/canvas-confetti/-/canvas-confetti-1.6.4.tgz#620fd8d78b335d6a4046c0f73236d6988b37552a"
+ integrity sha512-fNyZ/Fdw/Y92X0vv7B+BD6ysHL4xVU5dJcgzgxLdGbn8O3PezZNIJpml44lKM0nsGur+o/6+NZbZeNTt00U1uA==
+
"@types/editorjs__header@^2.6.0":
version "2.6.0"
resolved "https://registry.npmjs.org/@types/editorjs__header/-/editorjs__header-2.6.0.tgz"
@@ -1656,6 +1661,11 @@ caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001489, caniuse-lite@^1.0.300015
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001585.tgz"
integrity sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q==
+canvas-confetti@^1.9.2:
+ version "1.9.2"
+ resolved "https://registry.yarnpkg.com/canvas-confetti/-/canvas-confetti-1.9.2.tgz#c9f74098c7fdf66dd9d1aab5d381061cf74e48f0"
+ integrity sha512-6Xi7aHHzKwxZsem4mCKoqP6YwUG3HamaHHAlz1hTNQPCqXhARFpSXnkC9TWlahHY5CG6hSL5XexNjxK8irVErg==
+
canvas@^2.11.2:
version "2.11.2"
resolved "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz"
@@ -4183,6 +4193,14 @@ rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
+react-canvas-confetti@^2.0.7:
+ version "2.0.7"
+ resolved "https://registry.yarnpkg.com/react-canvas-confetti/-/react-canvas-confetti-2.0.7.tgz#0499e7815b50f6a7731fd01729e07c30faa300f3"
+ integrity sha512-DIj44O35TPAwJkUSIZqWdVsgAMHtVf8h7YNmnr3jF3bn5mG+d7Rh9gEcRmdJfYgRzh6K+MAGujwUoIqQyLnMJw==
+ dependencies:
+ "@types/canvas-confetti" "^1.6.4"
+ canvas-confetti "^1.9.2"
+
react-dom@^18.2.0:
version "18.2.0"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz"