Refactor file upload path and add loading animation to ApplyProject component

This commit is contained in:
THIS ONE IS A LITTLE BIT TRICKY KRUB 2024-10-27 21:29:16 +07:00
parent a0030e39c0
commit 82bfbe95a9
3 changed files with 5 additions and 2233 deletions

View File

@ -11,7 +11,7 @@ import { uploadFile } from "@/app/api/generalApi";
import { Loader } from "@/components/loading/loader"; import { Loader } from "@/components/loading/loader";
type businessSchema = z.infer<typeof businessFormSchema>; type businessSchema = z.infer<typeof businessFormSchema>;
const BUCKET_PITCH_NAME = "business-pitches"; const BUCKET_PITCH_NAME = "business-application";
let supabase = createSupabaseClient(); let supabase = createSupabaseClient();
export default function ApplyBusiness() { export default function ApplyBusiness() {
@ -35,7 +35,7 @@ export default function ApplyBusiness() {
recvData["businessPitchDeck"], recvData["businessPitchDeck"],
BUCKET_PITCH_NAME, BUCKET_PITCH_NAME,
// file structure: userId/fileName // file structure: userId/fileName
`${user?.id}/${recvData["businessPitchDeck"].name}` `${user?.id}/pitch-file/pitch.md`
); );
if (!uploadSuccess) { if (!uploadSuccess) {
@ -79,7 +79,7 @@ export default function ApplyBusiness() {
if (result.isConfirmed && applyProject) { if (result.isConfirmed && applyProject) {
window.location.href = "/project/apply"; window.location.href = "/project/apply";
} else { } else {
window.location.href = "/"; // window.location.href = "/";
} }
}); });
}; };
@ -151,8 +151,8 @@ export default function ApplyBusiness() {
console.error("Error fetching user ID:", error); console.error("Error fetching user ID:", error);
} }
}; };
setSucess(true);
fetchUserData(); // fetchUserData();
}, []); }, []);
return ( return (

View File

@ -1,6 +1,5 @@
import Lottie from "react-lottie"; import Lottie from "react-lottie";
import * as loadingData from "./loading.json"; import * as loadingData from "./loading.json";
import * as successData from "./success.json";
const loadingOption = { const loadingOption = {
loop: true, loop: true,
@ -10,14 +9,6 @@ const loadingOption = {
preserveAspectRatio: "xMidYMid slice", preserveAspectRatio: "xMidYMid slice",
}, },
}; };
// const successOption = {
// loop: false,
// autoplay: true,
// animationData: successData,
// rendererSettings: {
// preserveAspectRatio: "xMidYMid slice",
// },
// };
interface LoaderProps { interface LoaderProps {
isSuccess: boolean; isSuccess: boolean;
@ -31,11 +22,6 @@ export function Loader(props: LoaderProps) {
<Lottie options={loadingOption} height={200} width={200} /> <Lottie options={loadingOption} height={200} width={200} />
</div> </div>
)} )}
{/* {!props.isSuccess ? (
<Lottie options={loadingOption} height={200} width={200} />
) : (
<Lottie options={successOption} height={200} width={200} />
)} */}
</> </>
); );
} }

File diff suppressed because it is too large Load Diff