Skip to content

Commit

Permalink
fix: resolved merge conflict in notification page
Browse files Browse the repository at this point in the history
  • Loading branch information
kinxlo committed Aug 1, 2024
2 parents 0e9e310 + 2c2c928 commit d7471e4
Show file tree
Hide file tree
Showing 67 changed files with 2,400 additions and 746 deletions.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions public/images/WaitList/BACKGROUND.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/WaitList/Vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/images/WaitList/activity 2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added public/images/WaitList/database.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/images/WaitList/database.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/images/WaitList/dollar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/emailManagement.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
6 changes: 6 additions & 0 deletions public/images/WaitList/lock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/images/WaitList/message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/payment.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/payment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/phone.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/phone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/WaitList/pie-chart2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/safety.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/WaitList/safety.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/images/WaitList/success.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/cancel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/app/(auth-routes)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useToast } from "~/components/ui/use-toast";
import { cn } from "~/lib/utils";
import { LoginSchema } from "~/schemas";
import { getApiUrl } from "~/utils/getApiUrl";
import { loginUser } from "~/utils/login";
import { loginAuth } from "~/utils/loginAuth";

const Login = () => {
const router = useRouter();
Expand Down Expand Up @@ -66,7 +66,7 @@ const Login = () => {

const onSubmit = async (values: z.infer<typeof LoginSchema>) => {
startTransition(async () => {
await loginUser(values).then(async (data) => {
await loginAuth(values).then(async (data) => {
const { email, password } = values;

if (data.status === 200) {
Expand Down
101 changes: 60 additions & 41 deletions src/app/(auth-routes)/register/organisation/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"use client";

import { zodResolver } from "@hookform/resolvers/zod";
import { useSession } from "next-auth/react";
import { useRouter } from "next-nprogress-bar";
import Link from "next/link";
import { useTransition } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";

import LoadingSpinner from "~/components/miscellaneous/loading-spinner";
import { Button } from "~/components/ui/button";
import {
Form,
Expand All @@ -22,47 +26,53 @@ import {
SelectTrigger,
SelectValue,
} from "~/components/ui/select";
import { useToast } from "~/components/ui/use-toast";
import { organizationSchema } from "~/schemas";
import { createOrg } from "~/utils/createOrg";

const formSchema = z.object({
fullname: z.string().min(2, {
message: "Fullname must be at least 2 characters.",
}),
email: z.string().email({
message: "Email must be a valid email address.",
}),
password: z.string().min(2, {
message: "Password must be at least 2 characters.",
}),
companyName: z.string().min(2, {
message: "Company name must be at least 2 characters.",
}),
companyEmail: z.string().email({
message: "Company email must be a valid email address.",
}),
industry: z.string().min(1, {
message: "Please select an industry.",
}),
organizationType: z.string().min(1, {
message: "Please select an organization type.",
}),
country: z.string().min(1, {
message: "Please select a country.",
}),
state: z.string().min(1, {
message: "Please select a state.",
}),
address: z.string().min(1, {
message: "Please enter company address.",
}),
});
function Organisation() {
const router = useRouter();
const { toast } = useToast();
const { status } = useSession();
const [isLoading, startTransition] = useTransition();

type FormData = z.infer<typeof formSchema>;
if (status === "authenticated") {
router.push("/dashboard");
}

function Organisation() {
const form = useForm<FormData>({
resolver: zodResolver(formSchema),
const form = useForm<z.infer<typeof organizationSchema>>({
resolver: zodResolver(organizationSchema),
defaultValues: {
name: "",
description: "Company Description",
email: "",
industry: "",
type: "",
country: "",
state: "",
address: "",
},
});

const onSubmit = async (values: z.infer<typeof organizationSchema>) => {
const token = sessionStorage.getItem("temp_token");
startTransition(async () => {
await createOrg(values, token || "").then(async (data) => {
if (data.status === 201) {
router.push("/login");
}

toast({
title:
data.status === 201
? "Organization created successfully"
: "an error occurred",
description: data.status === 201 ? "Continue to login" : data.error,
});
});
});
};

return (
<>
<div>
Expand All @@ -77,10 +87,10 @@ function Organisation() {

<div className="mx-auto md:w-2/4">
<Form {...form}>
<form className="space-y-6">
<form className="space-y-6" onSubmit={form.handleSubmit(onSubmit)}>
<FormField
control={form.control}
name="companyName"
name="name"
render={({ field }) => (
<FormItem className="flex flex-col gap-2">
<div>
Expand All @@ -98,7 +108,7 @@ function Organisation() {
/>
<FormField
control={form.control}
name="companyEmail"
name="email"
render={({ field }) => (
<FormItem className="flex flex-col gap-2">
<div>
Expand Down Expand Up @@ -144,7 +154,7 @@ function Organisation() {
/>
<FormField
control={form.control}
name="organizationType"
name="type"
render={({ field }) => (
<FormItem className="flex w-full flex-col gap-2">
<div className="w-full">
Expand Down Expand Up @@ -240,7 +250,16 @@ function Organisation() {
)}
/>
<Button type="submit" className="w-full">
Create Account
{isLoading ? (
<span className="flex items-center gap-x-2">
<span className="animate-pulse">
Creating Organization...
</span>{" "}
<LoadingSpinner className="size-4 animate-spin sm:size-5" />
</span>
) : (
<span>Create Organization</span>
)}
</Button>
<div className="flex justify-center gap-2">
<p className="text-sm">Already Have An Account?</p>
Expand Down
1 change: 1 addition & 0 deletions src/app/(auth-routes)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const Register = () => {
startTransition(async () => {
await registerUser(values).then(async (data) => {
if (data.status === 201) {
sessionStorage.setItem("temp_token", data.access_token);
router.push("/register/organisation");
}

Expand Down
Loading

0 comments on commit d7471e4

Please sign in to comment.