reorganized directories + removed old files
This commit is contained in:
@@ -20,11 +20,11 @@ import { TextInput, MultilineTextInput } from "@components/TextInput";
|
|||||||
import { Divider } from "@components/Divider";
|
import { Divider } from "@components/Divider";
|
||||||
import { ImageInput } from "@components/ImageInput";
|
import { ImageInput } from "@components/ImageInput";
|
||||||
import { api } from "@utils/api";
|
import { api } from "@utils/api";
|
||||||
import { getRootContainer } from "@constants/htmlTools";
|
import { getRootContainer } from "@utils/constants/htmlTools";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { proposalSchema } from "@constants/schema/project";
|
import { proposalSchema } from "@utils/constants/schema/project";
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import type { SubmitHandler } from "react-hook-form";
|
import type { SubmitHandler } from "react-hook-form";
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
export const palette = {
|
|
||||||
fg: "#A3A395",
|
|
||||||
bg: "#303030",
|
|
||||||
primary: "#DEB887",
|
|
||||||
secondary: "#AF7E7F",
|
|
||||||
tertiary: "#B35443",
|
|
||||||
quaternary: "#483E41",
|
|
||||||
success: "#ACD161",
|
|
||||||
error: "#E24536",
|
|
||||||
warning: "#EDC25E",
|
|
||||||
};
|
|
||||||
@@ -5,8 +5,8 @@ import { SSRProvider } from "react-aria";
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { RootLayout } from "@components/layouts";
|
import { RootLayout } from "@components/layouts";
|
||||||
import { api } from "@utils/api";
|
import { api } from "@utils/api";
|
||||||
import "@styles/globals.css";
|
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
|
import "@utils/styles/globals.css";
|
||||||
|
|
||||||
const ParallelApp: AppType<{ session: Session | null }> = ({
|
const ParallelApp: AppType<{ session: Session | null }> = ({
|
||||||
Component,
|
Component,
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { InfoLayout } from "@components/layouts";
|
|
||||||
import { type NextPage } from "next";
|
|
||||||
|
|
||||||
const Error: NextPage = () => {
|
|
||||||
return <InfoLayout>Error</InfoLayout>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Error;
|
|
||||||
@@ -101,7 +101,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
|||||||
if (isNewUser) {
|
if (isNewUser) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/auth/sign-up",
|
destination: "/auth/user-info",
|
||||||
permanent: false,
|
permanent: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
import { Button } from "@components/Button";
|
|
||||||
import { TextInput } from "@components/TextInput";
|
|
||||||
import type {
|
|
||||||
GetServerSidePropsContext,
|
|
||||||
InferGetServerSidePropsType,
|
|
||||||
} from "next";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { InfoLayout } from "@components/layouts";
|
|
||||||
import { SignUpFields } from "@constants/authInputFields";
|
|
||||||
import { toast } from "react-hot-toast";
|
|
||||||
import type { z } from "zod";
|
|
||||||
import { editAccountDetailsSchema } from "@constants/schema/profile";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
import { getServerAuthSession } from "@server/auth";
|
|
||||||
import { appRouter } from "@server/api/root";
|
|
||||||
import { prisma } from "@server/db";
|
|
||||||
import superjson from "superjson";
|
|
||||||
import { createProxySSGHelpers } from "@trpc/react-query/ssg";
|
|
||||||
import { api } from "@utils/api";
|
|
||||||
|
|
||||||
export type EditAccountDetailsSchema = z.infer<typeof editAccountDetailsSchema>;
|
|
||||||
type ValidName = keyof typeof editAccountDetailsSchema.shape;
|
|
||||||
|
|
||||||
const SignUp = ({}: InferGetServerSidePropsType<typeof getServerSideProps>) => {
|
|
||||||
const { mutateAsync } = api.account.disableNewUserStatus.useMutation({
|
|
||||||
onSuccess() {
|
|
||||||
toast("Success");
|
|
||||||
},
|
|
||||||
onError() {
|
|
||||||
toast("Fail");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { asPath, query } = router;
|
|
||||||
|
|
||||||
const { register, formState, handleSubmit } =
|
|
||||||
useForm<EditAccountDetailsSchema>({
|
|
||||||
resolver: zodResolver(editAccountDetailsSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
// const onSubmit = useCallback((data) => {}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<InfoLayout>
|
|
||||||
<h1 className="text-r-3xl my-6 mx-10 text-center font-bold text-primary">
|
|
||||||
Sign up. Get Connected.
|
|
||||||
</h1>
|
|
||||||
<form
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
||||||
// onSubmit={handleSubmit(onSubmit)}
|
|
||||||
className="flex w-full max-w-lg flex-col items-center justify-center gap-y-2.5 px-4"
|
|
||||||
>
|
|
||||||
<input name="csrfToken" type="hidden" />
|
|
||||||
{SignUpFields.map(({ name, ...fieldProps }) => {
|
|
||||||
const isValidName = (name: string | undefined): name is ValidName =>
|
|
||||||
name !== undefined;
|
|
||||||
|
|
||||||
if (isValidName(name))
|
|
||||||
return (
|
|
||||||
<TextInput
|
|
||||||
key={name}
|
|
||||||
error={formState.errors[name]?.message}
|
|
||||||
{...fieldProps}
|
|
||||||
{...register(name)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
<Button type="submit" className="mt-12">
|
|
||||||
Sign Up
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
</InfoLayout>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SignUp;
|
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|
||||||
const session = await getServerAuthSession(ctx);
|
|
||||||
|
|
||||||
// Sign in if not authed
|
|
||||||
if (!session) {
|
|
||||||
return {
|
|
||||||
redirect: {
|
|
||||||
destination: "/auth/sign-in",
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// If authed but not a new user,
|
|
||||||
// go to projects or to callback url if one was specified
|
|
||||||
const ssg = createProxySSGHelpers({
|
|
||||||
router: appRouter,
|
|
||||||
ctx: { prisma, session },
|
|
||||||
transformer: superjson,
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await ssg.account.getNewUserStatus.fetch();
|
|
||||||
|
|
||||||
if (!data?.isNewUser) {
|
|
||||||
return {
|
|
||||||
redirect: {
|
|
||||||
destination: ctx.query.callbackUrl ?? "/projects",
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return { props: {} };
|
|
||||||
};
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { InfoLayout } from "@components/layouts";
|
|
||||||
import { type NextPage } from "next";
|
|
||||||
|
|
||||||
const VerifyRequest: NextPage = () => {
|
|
||||||
return <InfoLayout>Verify Request</InfoLayout>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default VerifyRequest;
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { proposalSchema } from "@constants/schema/project";
|
import { proposalSchema } from "@utils/constants/schema/project";
|
||||||
import { ProjectLifecycle } from "@prisma/client";
|
import { ProjectLifecycle } from "@prisma/client";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,21 @@ export const SignInFields: TextInputProps[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const SignUpFields: TextInputProps[] = [
|
export const UserInfoFields: TextInputProps[] = [
|
||||||
{
|
{
|
||||||
name: "username",
|
name: "username",
|
||||||
|
required: true,
|
||||||
label: "Username",
|
label: "Username",
|
||||||
placeholder: "Enter your username",
|
placeholder: "Enter your username",
|
||||||
},
|
},
|
||||||
...SignInFields,
|
{
|
||||||
|
name: "name",
|
||||||
|
label: "Name",
|
||||||
|
placeholder: "Enter your name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bio",
|
||||||
|
label: "Bio",
|
||||||
|
placeholder: "Enter your bio",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
@@ -6,6 +6,8 @@ export interface TextInputProps
|
|||||||
extends React.InputHTMLAttributes<HTMLInputElement> {
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
||||||
label?: string;
|
label?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
required?: boolean;
|
||||||
|
optional?: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
prefixIcon?: React.ReactNode;
|
prefixIcon?: React.ReactNode;
|
||||||
suffixIcon?: React.ReactNode;
|
suffixIcon?: React.ReactNode;
|
||||||
@@ -14,6 +16,8 @@ export interface TextInputProps
|
|||||||
export interface MultilineInputProps
|
export interface MultilineInputProps
|
||||||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||||
label?: string;
|
label?: string;
|
||||||
|
required?: boolean;
|
||||||
|
optional?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
hasAdaptiveHeight?: boolean;
|
hasAdaptiveHeight?: boolean;
|
||||||
|
|||||||
@@ -19,10 +19,8 @@
|
|||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@components/*": ["components/*"],
|
"@components/*": ["components/*"],
|
||||||
"@constants/*": ["constants/*"],
|
|
||||||
"@pages/*": ["pages/*"],
|
"@pages/*": ["pages/*"],
|
||||||
"@server/*": ["server/*"],
|
"@server/*": ["server/*"],
|
||||||
"@styles/*": ["styles/*"],
|
|
||||||
"@utils/*": ["utils/*"]
|
"@utils/*": ["utils/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user