diff --git a/apps/landing/src/app/(auth)/_components/animated-background.tsx b/apps/landing/src/app/(auth)/_components/animated-background.tsx
deleted file mode 100644
index 15fd401..0000000
--- a/apps/landing/src/app/(auth)/_components/animated-background.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-'use client';
-
-import { motion } from 'framer-motion';
-import { useEffect, useMemo, useState } from 'react';
-import {
- SiCplusplus,
- SiCss,
- SiGo,
- SiHtml5,
- SiJavascript,
- SiPhp,
- SiPython,
- SiRuby,
- SiRust,
- SiSwift,
- SiTypescript,
-} from 'react-icons/si';
-
-export function AnimatedBackground() {
- const [isClient, setIsClient] = useState(false);
-
- useEffect(() => {
- setIsClient(true);
- }, []);
-
- const iconColorMap = useMemo(
- () => [
- { Icon: SiJavascript, color: '#F7DF1E' },
- { Icon: SiTypescript, color: '#3178C6' },
- { Icon: SiPython, color: '#3776AB' },
- { Icon: SiCplusplus, color: '#00599C' },
- { Icon: SiRuby, color: '#CC342D' },
- { Icon: SiSwift, color: '#F05138' },
- { Icon: SiRust, color: '#000000' },
- { Icon: SiGo, color: '#00ADD8' },
- { Icon: SiPhp, color: '#777BB4' },
- { Icon: SiHtml5, color: '#E34F26' },
- { Icon: SiCss, color: '#1572B6' },
- ],
- []
- );
-
- const getRandom = (min: number, max: number) =>
- Math.random() * (max - min) + min;
-
- const floatingIcons = useMemo(() => {
- if (!isClient) return [];
-
- return Array.from({ length: 40 }).map((_, i) => {
- const { Icon, color } = iconColorMap[i % iconColorMap.length];
- return (
-
-
-
- );
- });
- }, [isClient, iconColorMap]);
-
- if (!isClient) return null;
-
- return (
-
{floatingIcons}
- );
-}
diff --git a/apps/landing/src/app/(auth)/_http/fetch-post-verify-turnstile.ts b/apps/landing/src/app/(auth)/_http/fetch-post-verify-turnstile.ts
deleted file mode 100644
index aefeb2d..0000000
--- a/apps/landing/src/app/(auth)/_http/fetch-post-verify-turnstile.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-export async function fetchPostverifyTurnstile(
- token: string,
- remoteIp?: string
-): Promise {
- const url = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
- const params = new URLSearchParams({
- secret: String(process.env.TURNSTILE_SECRET_KEY),
- response: token,
- });
- if (remoteIp) {
- params.append('remoteip', remoteIp);
- }
-
- const res = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: params.toString(),
- });
-
- if (!res.ok) {
- console.error('Turnstile verify HTTP error', res.status);
- return false;
- }
-
- const data = (await res.json()) as TurnstileVerifyResponse;
- if (!data.success) {
- console.warn('Turnstile failure', data['error-codes']);
- return false;
- }
-
- return true;
-}
-
-interface TurnstileVerifyResponse {
- success: boolean;
- challenge_ts: string;
- hostname: string;
- 'error-codes'?: string[];
-}
diff --git a/apps/landing/src/app/(auth)/forgot-password/_actions/forgot-password-action.ts b/apps/landing/src/app/(auth)/forgot-password/_actions/forgot-password-action.ts
deleted file mode 100644
index 200d4db..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/_actions/forgot-password-action.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-'use server';
-
-import { fetcher } from '@/lib/fetcher';
-import { getRemoteIp } from '@/lib/headers';
-import { fetchPostverifyTurnstile } from '../../_http/fetch-post-verify-turnstile';
-import {
- forgotPasswordValidationSchema,
- ForgotPasswordValidationType,
-} from '../_validation/forgot-password-validation';
-
-export async function ForgotPasswordAction(
- request: ForgotPasswordValidationType
-) {
- const validRequest = forgotPasswordValidationSchema.parse(request);
- const remoteIp = await getRemoteIp();
-
- const isCapchaValid = await fetchPostverifyTurnstile(
- validRequest.token,
- remoteIp
- );
-
- if (!isCapchaValid) throw new Error('Failed to verify captcha');
-
- const { data, error } = await fetcher.POST('/v1/auth/forgot', {
- body: {
- email: validRequest.email,
- },
- });
-
- if (error) throw new Error(error.message);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/forgot-password/_components/forgot-password-form.tsx b/apps/landing/src/app/(auth)/forgot-password/_components/forgot-password-form.tsx
deleted file mode 100644
index 5ead8e0..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/_components/forgot-password-form.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile';
-import { useRef, useState } from 'react';
-import { LuLoader } from 'react-icons/lu';
-import { useFormForgotPassword } from '../_hooks/use-form-forgot-password';
-import { usePostForgotPassowrd } from '../_hooks/use-post-forgot-password';
-import { ForgotPasswordValidationType } from '../_validation/forgot-password-validation';
-
-export function ForgotPasswordForm() {
- const ref = useRef(null);
-
- const [step, setStep] = useState(1);
- const [emailValue, setEmailValue] = useState('');
-
- const form = useFormForgotPassword();
- const { mutate, isPending, error } = usePostForgotPassowrd(form);
-
- const handleFirstStep = (values: ForgotPasswordValidationType) => {
- setEmailValue(values.email);
- setStep(2);
- };
-
- const handleSecondStep = () => {
- mutate({ email: emailValue, token: form.getValues('token') });
- };
-
- return (
-
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/forgot-password/_hooks/use-form-forgot-password.ts b/apps/landing/src/app/(auth)/forgot-password/_hooks/use-form-forgot-password.ts
deleted file mode 100644
index ebf9172..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/_hooks/use-form-forgot-password.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useForm } from 'react-hook-form';
-import {
- forgotPasswordValidationSchema,
- type ForgotPasswordValidationType,
-} from '../_validation/forgot-password-validation';
-
-export function useFormForgotPassword() {
- return useForm({
- resolver: zodResolver(forgotPasswordValidationSchema),
- defaultValues: {
- email: '',
- token: '',
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/forgot-password/_hooks/use-post-forgot-password.ts b/apps/landing/src/app/(auth)/forgot-password/_hooks/use-post-forgot-password.ts
deleted file mode 100644
index a06a05f..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/_hooks/use-post-forgot-password.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { ForgotPasswordAction } from '../_actions/forgot-password-action';
-import { useFormForgotPassword } from './use-form-forgot-password';
-
-export function usePostForgotPassowrd(
- form: ReturnType
-) {
- return useMutation({
- mutationFn: ForgotPasswordAction,
- onSuccess: ({ message }) => {
- form.reset();
- toast.success(message);
- },
- onError: ({ message }) => {
- form.reset();
- toast.error(message);
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/forgot-password/_http/fetch-post-forgot-password.ts b/apps/landing/src/app/(auth)/forgot-password/_http/fetch-post-forgot-password.ts
deleted file mode 100644
index e69de29..0000000
diff --git a/apps/landing/src/app/(auth)/forgot-password/_validation/forgot-password-validation.ts b/apps/landing/src/app/(auth)/forgot-password/_validation/forgot-password-validation.ts
deleted file mode 100644
index d99d3a1..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/_validation/forgot-password-validation.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { z } from 'zod';
-
-export const forgotPasswordValidationSchema = z.object({
- email: z.string().email({ message: 'Format email tidak valid' }),
- token: z.string(),
-});
-export type ForgotPasswordValidationType = z.infer<
- typeof forgotPasswordValidationSchema
->;
diff --git a/apps/landing/src/app/(auth)/forgot-password/page.tsx b/apps/landing/src/app/(auth)/forgot-password/page.tsx
deleted file mode 100644
index 36cccf8..0000000
--- a/apps/landing/src/app/(auth)/forgot-password/page.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { LogoSimple } from '@/app/_components/logo';
-import { Metadata } from 'next';
-import { ForgotPasswordForm } from './_components/forgot-password-form';
-
-export const metadata: Metadata = {
- title: 'IMPHNEN - Signin',
-};
-
-export default function Page() {
- return (
- <>
-
-
-
-
- Reset password akunmu
-
-
-
-
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/layout.tsx b/apps/landing/src/app/(auth)/layout.tsx
deleted file mode 100644
index bfcbcb5..0000000
--- a/apps/landing/src/app/(auth)/layout.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { baiJamjureeFont } from '@/lib/fonts';
-import { Card } from '@components';
-import { cn } from '@utils';
-import { ReactNode } from 'react';
-import { AnimatedBackground } from './_components/animated-background';
-
-export default function Layout({ children }: { children: ReactNode }) {
- return (
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/reset-password/_actions/reset-password-actions.ts b/apps/landing/src/app/(auth)/reset-password/_actions/reset-password-actions.ts
deleted file mode 100644
index b4a8a1a..0000000
--- a/apps/landing/src/app/(auth)/reset-password/_actions/reset-password-actions.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-'use server';
-
-import { fetcher } from '@/lib/fetcher';
-import {
- resetPasswordValidationSchema,
- ResetPasswordValidationSchema,
-} from '../_validation/reset-password-validation';
-
-export async function resetPasswordAction(
- request: ResetPasswordValidationSchema
-) {
- const validRequest = resetPasswordValidationSchema.parse(request);
-
- if (validRequest.confirm_password !== validRequest.confirm_password) {
- throw new Error('Password missmatch');
- }
-
- const { data, error } = await fetcher.POST('/v1/auth/new-password', {
- body: {
- password: validRequest.password,
- token: validRequest.token,
- },
- });
-
- if (error) throw new Error(error.message);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/reset-password/_components/reset-password-form.tsx b/apps/landing/src/app/(auth)/reset-password/_components/reset-password-form.tsx
deleted file mode 100644
index c4289b3..0000000
--- a/apps/landing/src/app/(auth)/reset-password/_components/reset-password-form.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import { LuLoaderCircle } from 'react-icons/lu';
-import { usePostResetPassword } from '../_hooks/use-post-reset-password';
-import { useResetPasswordForm } from '../_hooks/use-reset-password-form';
-import { ResetPasswordValidationSchema } from '../_validation/reset-password-validation';
-
-export function ResetPasswordForm() {
- const form = useResetPasswordForm();
- const { mutate, error, isPending } = usePostResetPassword(form);
-
- const onSubmit = (values: ResetPasswordValidationSchema) => {
- mutate(values);
- };
-
- return (
-
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/reset-password/_hooks/use-post-reset-password.ts b/apps/landing/src/app/(auth)/reset-password/_hooks/use-post-reset-password.ts
deleted file mode 100644
index 80f89ec..0000000
--- a/apps/landing/src/app/(auth)/reset-password/_hooks/use-post-reset-password.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-import { useRouter } from 'next/navigation';
-import { toast } from 'sonner';
-import { resetPasswordAction } from '../_actions/reset-password-actions';
-import { useResetPasswordForm } from './use-reset-password-form';
-
-export function usePostResetPassword(
- form: ReturnType
-) {
- const router = useRouter();
-
- return useMutation({
- mutationFn: resetPasswordAction,
- onSuccess: ({ message }) => {
- form.reset();
- router.replace('/signin');
- toast.success(message);
- },
- onError: ({ message }) => {
- form.reset();
- toast.error(message);
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/reset-password/_hooks/use-reset-password-form.ts b/apps/landing/src/app/(auth)/reset-password/_hooks/use-reset-password-form.ts
deleted file mode 100644
index 4cdbb1c..0000000
--- a/apps/landing/src/app/(auth)/reset-password/_hooks/use-reset-password-form.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useSearchParams } from 'next/navigation';
-import { useForm } from 'react-hook-form';
-
-import {
- resetPasswordValidationSchema,
- ResetPasswordValidationSchema,
-} from '../_validation/reset-password-validation';
-
-export function useResetPasswordForm() {
- const searchParams = useSearchParams();
- const tokenFromQuery = searchParams.get('token') ?? '';
-
- return useForm({
- resolver: zodResolver(resetPasswordValidationSchema),
- defaultValues: {
- password: '',
- confirm_password: '',
- token: tokenFromQuery,
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/reset-password/_validation/reset-password-validation.ts b/apps/landing/src/app/(auth)/reset-password/_validation/reset-password-validation.ts
deleted file mode 100644
index 1261ca8..0000000
--- a/apps/landing/src/app/(auth)/reset-password/_validation/reset-password-validation.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { z } from 'zod';
-
-export const resetPasswordValidationSchema = z
- .object({
- password: z
- .string({
- required_error: 'Password tidak boleh kosong',
- invalid_type_error: 'Password harus berupa string',
- })
- .min(8, 'Password harus minimal 8 karakter')
- .max(50, 'Password tidak boleh lebih dari 50 karakter')
- .regex(
- /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*\W).+$/,
- 'Password harus mengandung setidaknya satu huruf kapital, satu huruf kecil, satu angka, dan satu karakter spesial'
- ),
- confirm_password: z
- .string({
- required_error: 'Konfirmasi password tidak boleh kosong',
- })
- .min(8, 'Konfirmasi password harus minimal 8 karakter')
- .max(50, 'Konfirmasi password tidak boleh lebih dari 50 karakter'),
- token: z.string(),
- })
- .refine((data) => data.password === data.confirm_password, {
- message: 'Password dan Konfirmasi Password harus sama',
- path: ['confirm_password'],
- });
-
-export type ResetPasswordValidationSchema = z.infer<
- typeof resetPasswordValidationSchema
->;
diff --git a/apps/landing/src/app/(auth)/reset-password/page.tsx b/apps/landing/src/app/(auth)/reset-password/page.tsx
deleted file mode 100644
index 6378290..0000000
--- a/apps/landing/src/app/(auth)/reset-password/page.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { LogoSimple } from '@/app/_components/logo';
-import { redirect } from 'next/navigation';
-import { use } from 'react';
-import { ResetPasswordForm } from './_components/reset-password-form';
-
-export const dynamic = 'force-dynamic';
-
-export default function Page({
- searchParams,
-}: {
- searchParams: Promise<{ token?: string }>;
-}) {
- const { token } = use(searchParams);
-
- if (!token) redirect('/signin');
-
- return (
- <>
-
-
-
-
- Ubah passwordmu
-
-
-
-
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/signin/_actions/signin-action.ts b/apps/landing/src/app/(auth)/signin/_actions/signin-action.ts
deleted file mode 100644
index 0397189..0000000
--- a/apps/landing/src/app/(auth)/signin/_actions/signin-action.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-'use server';
-
-import { setAccessToken, setRefreshToken } from '@/lib/cookies';
-import { fetchPostSignin } from '../_http/fetch-post-signin';
-import {
- type SignInValidationType,
- signInValidationSchema,
-} from '../_validation/signin-validation';
-
-export async function SigninAction(request: SignInValidationType) {
- const validRequest = signInValidationSchema.parse(request);
-
- const { data } = await fetchPostSignin(validRequest);
-
- const accessToken = data.token.access_token;
- const refreshToken = data.token.refresh_token;
-
- await setAccessToken(accessToken);
- await setRefreshToken(refreshToken);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/signin/_components/signin-form.tsx b/apps/landing/src/app/(auth)/signin/_components/signin-form.tsx
deleted file mode 100644
index 490627b..0000000
--- a/apps/landing/src/app/(auth)/signin/_components/signin-form.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import Link from 'next/link';
-import { LuLoader } from 'react-icons/lu';
-import { useFormSignin } from '../_hooks/use-form-signin';
-import { usePostSignin } from '../_hooks/use-post-signin';
-import { type SignInValidationType } from '../_validation/signin-validation';
-
-export function SigninForm() {
- const form = useFormSignin();
- const { mutate, isPending, error } = usePostSignin(form);
-
- const onSubmit = (values: SignInValidationType) => {
- mutate(values);
- };
-
- return (
-
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/signin/_hooks/use-form-signin.ts b/apps/landing/src/app/(auth)/signin/_hooks/use-form-signin.ts
deleted file mode 100644
index 76af058..0000000
--- a/apps/landing/src/app/(auth)/signin/_hooks/use-form-signin.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useForm } from 'react-hook-form';
-import {
- signInValidationSchema,
- type SignInValidationType,
-} from '../_validation/signin-validation';
-
-export function useFormSignin() {
- return useForm({
- resolver: zodResolver(signInValidationSchema),
- defaultValues: {
- email: '',
- password: '',
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/signin/_hooks/use-post-signin.ts b/apps/landing/src/app/(auth)/signin/_hooks/use-post-signin.ts
deleted file mode 100644
index 2d4ee62..0000000
--- a/apps/landing/src/app/(auth)/signin/_hooks/use-post-signin.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-import { useRouter } from 'next/navigation';
-import { toast } from 'sonner';
-import { SigninAction } from '../_actions/signin-action';
-import { useFormSignin } from './use-form-signin';
-
-export function usePostSignin(form: ReturnType) {
- const router = useRouter();
-
- return useMutation({
- mutationFn: SigninAction,
-
- onSuccess: () => {
- router.push('/');
- },
- onError: (error, variables) => {
- form.resetField('password');
-
- if (error.message.includes('not active')) {
- setTimeout(() => {
- router.push(`/verification?ref=${variables.email}`);
- }, 750);
- }
-
- toast.error(error.message);
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/signin/_http/fetch-post-signin.ts b/apps/landing/src/app/(auth)/signin/_http/fetch-post-signin.ts
deleted file mode 100644
index 52fbab2..0000000
--- a/apps/landing/src/app/(auth)/signin/_http/fetch-post-signin.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { fetcher } from '@/lib/fetcher';
-import { SignInValidationType } from '../_validation/signin-validation';
-
-export async function fetchPostSignin({
- email,
- password,
-}: SignInValidationType) {
- const { data, error, response } = await fetcher.POST('/v1/auth/login', {
- body: {
- email,
- password,
- },
- });
-
- if (error) {
- throw new Error(error.message);
- }
-
- if (!response.ok) {
- throw new Error('Someting went wrong, please try again later');
- }
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/signin/_validation/signin-validation.ts b/apps/landing/src/app/(auth)/signin/_validation/signin-validation.ts
deleted file mode 100644
index 0bb050b..0000000
--- a/apps/landing/src/app/(auth)/signin/_validation/signin-validation.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { z } from 'zod';
-
-export const signInValidationSchema = z.object({
- email: z
- .string({
- required_error: 'Email tidak boleh kosong',
- invalid_type_error: 'Email harus berupa string',
- })
- .min(1, 'Email tidak boleh kosong')
- .email('Email harus valid'),
- password: z
- .string({
- required_error: 'Password tidak boleh kosong',
- invalid_type_error: 'Password harus berupa string',
- })
- .min(1, 'Password tidak boleh kosong'),
-});
-export type SignInValidationType = z.infer;
diff --git a/apps/landing/src/app/(auth)/signin/page.tsx b/apps/landing/src/app/(auth)/signin/page.tsx
deleted file mode 100644
index 2eb58e1..0000000
--- a/apps/landing/src/app/(auth)/signin/page.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { LogoSimple } from '@/app/_components/logo';
-import { Metadata } from 'next';
-import Link from 'next/link';
-import { SigninForm } from './_components/signin-form';
-
-export const metadata: Metadata = {
- title: 'IMPHNEN - Signin',
-};
-
-export default function Page() {
- return (
- <>
-
-
-
-
- Masuk untuk mengakses akunmu
-
-
-
-
-
-
-
- Belum punya akun?{' '}
-
- Daftar
-
-
-
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/signup/_actions/signup-action.ts b/apps/landing/src/app/(auth)/signup/_actions/signup-action.ts
deleted file mode 100644
index a36fbc0..0000000
--- a/apps/landing/src/app/(auth)/signup/_actions/signup-action.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-'use server';
-
-import { getRemoteIp } from '@/lib/headers';
-import { z } from 'zod';
-import { fetchPostverifyTurnstile } from '../../_http/fetch-post-verify-turnstile';
-import { fetchPostSignin } from '../_http/fetch-post-signup';
-import { signupValidationSchema } from '../_validation/signup-validation';
-
-export async function SignupAction(
- request: z.infer
-) {
- const validRequest = signupValidationSchema.parse(request);
- const remoteIp = await getRemoteIp();
-
- const isCapchaValid = await fetchPostverifyTurnstile(
- validRequest.token,
- remoteIp
- );
-
- if (!isCapchaValid) throw new Error('Failed to verify captcha');
-
- const data = await fetchPostSignin(validRequest);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/signup/_components/signup-form.tsx b/apps/landing/src/app/(auth)/signup/_components/signup-form.tsx
deleted file mode 100644
index 40fe83f..0000000
--- a/apps/landing/src/app/(auth)/signup/_components/signup-form.tsx
+++ /dev/null
@@ -1,223 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import { zodResolver } from '@hookform/resolvers/zod';
-import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile';
-import { useMutation } from '@tanstack/react-query';
-import { useRouter } from 'next/navigation';
-import { useRef, useState } from 'react';
-import { useForm } from 'react-hook-form';
-import { LuLoader } from 'react-icons/lu';
-import { z } from 'zod';
-import { SignupAction } from '../_actions/signup-action';
-import {
- signupValidationSchema,
- stepOneSignupValidationSchema,
- stepTwoSignupValidationSchema,
-} from '../_validation/signup-validation';
-
-export function SignupForm() {
- const router = useRouter();
- const ref = useRef(null);
-
- const [step, setStep] = useState(1);
- const [stepOneData, setStepOneData] = useState | null>(null);
-
- const firstForm = useForm>({
- resolver: zodResolver(stepOneSignupValidationSchema),
- defaultValues: {
- email: '',
- phone_number: '',
- fullname: '',
- password: '',
- confirm_password: '',
- },
- });
-
- const secondForm = useForm>({
- resolver: zodResolver(stepTwoSignupValidationSchema),
- defaultValues: {
- token: '',
- },
- });
-
- const { mutate, isPending, error } = useMutation({
- mutationFn: async (data: z.infer) => {
- const result = await SignupAction(data);
-
- return {
- ...result,
- email: data.email,
- };
- },
- onSuccess: ({ email }) => {
- router.push(`/verification?ref=${email}`);
- },
- onError: () => {
- ref.current?.reset();
- secondForm.resetField('token');
- },
- });
-
- const handleFirstSubmit = (
- values: z.infer
- ) => {
- setStepOneData(values);
- setStep(2);
- };
-
- const handleSecondSubmit = (
- values: z.infer
- ) => {
- if (stepOneData) {
- mutate({ ...stepOneData, ...values });
- }
- };
-
- return (
- <>
- {step === 1 && (
-
-
- )}
-
- {step === 2 && (
-
-
- )}
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/signup/_http/fetch-post-signup.ts b/apps/landing/src/app/(auth)/signup/_http/fetch-post-signup.ts
deleted file mode 100644
index 16e6c16..0000000
--- a/apps/landing/src/app/(auth)/signup/_http/fetch-post-signup.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { fetcher } from '@/lib/fetcher';
-import { SignupValidationSchema } from '../_validation/signup-validation';
-
-export async function fetchPostSignin({
- email,
- password,
- fullname,
- phone_number,
-}: SignupValidationSchema) {
- const { data, error, response } = await fetcher.POST('/v1/auth/register', {
- body: {
- email,
- password,
- fullname,
- phone_number,
- },
- });
-
- if (error) {
- throw new Error(error.message);
- }
-
- if (!response.ok) {
- throw new Error('Someting went wrong, please try again later');
- }
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/signup/_validation/signup-validation.ts b/apps/landing/src/app/(auth)/signup/_validation/signup-validation.ts
deleted file mode 100644
index dd994a4..0000000
--- a/apps/landing/src/app/(auth)/signup/_validation/signup-validation.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { z } from 'zod';
-
-export const stepOneSignupValidationSchema = z
- .object({
- email: z
- .string({
- required_error: 'Email tidak boleh kosong',
- invalid_type_error: 'Email harus berupa string',
- })
- .min(1, 'Email tidak boleh kosong')
- .email('Email harus valid'),
- fullname: z
- .string({
- required_error: 'Nama tidak boleh kosong',
- invalid_type_error: 'Nama harus berupa string',
- })
- .min(1, 'Nama tidak boleh kosong')
- .max(50, 'Nama tidak boleh lebih dari 50 karakter'),
- password: z
- .string({
- required_error: 'Password tidak boleh kosong',
- invalid_type_error: 'Password harus berupa string',
- })
- .min(8, 'Password harus minimal 8 karakter')
- .max(50, 'Password tidak boleh lebih dari 50 karakter')
- .regex(
- /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*\W).+$/,
- 'Password harus mengandung setidaknya satu huruf kapital, satu huruf kecil, satu angka, dan satu karakter spesial'
- ),
- confirm_password: z
- .string({
- required_error: 'Konfirmasi password tidak boleh kosong',
- })
- .min(8, 'Konfirmasi password harus minimal 8 karakter')
- .max(50, 'Konfirmasi password tidak boleh lebih dari 50 karakter'),
- phone_number: z
- .string({
- required_error: 'Nomor telepon tidak boleh kosong',
- invalid_type_error: 'Nomor telepon harus berupa string',
- })
- .min(10, 'Nomor telepon tidak boleh kurang dari 10 karakter')
- .max(15, 'Nomor telepon tidak boleh lebih dari 15 karakter')
- .regex(/^\d+$/, 'Nomor telepon hanya boleh berisi angka'),
- })
- .refine((data) => data.password === data.confirm_password, {
- message: 'Password dan Konfirmasi Password harus sama',
- path: ['confirm_password'],
- });
-
-export const stepTwoSignupValidationSchema = z.object({
- token: z.string(),
-});
-
-export const signupValidationSchema = stepOneSignupValidationSchema.and(
- stepTwoSignupValidationSchema
-);
-export type SignupValidationSchema = z.infer;
diff --git a/apps/landing/src/app/(auth)/signup/page.tsx b/apps/landing/src/app/(auth)/signup/page.tsx
deleted file mode 100644
index 444d145..0000000
--- a/apps/landing/src/app/(auth)/signup/page.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { LogoSimple } from '@/app/_components/logo';
-import { Metadata } from 'next';
-import Link from 'next/link';
-import { SignupForm } from './_components/signup-form';
-
-export const metadata: Metadata = {
- title: 'IMPHNEN - Signup',
-};
-
-export default function Page() {
- return (
- <>
-
-
-
-
- Buat akunmu sekarang
-
-
-
-
-
-
-
- Sudah punya akun?{' '}
-
- Masuk
-
-
-
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/verification/_actions/resend-otp-action.ts b/apps/landing/src/app/(auth)/verification/_actions/resend-otp-action.ts
deleted file mode 100644
index 48f733e..0000000
--- a/apps/landing/src/app/(auth)/verification/_actions/resend-otp-action.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-'use server';
-
-import { fetcher } from '@/lib/fetcher';
-import { getRemoteIp } from '@/lib/headers';
-import { fetchPostverifyTurnstile } from '../../_http/fetch-post-verify-turnstile';
-import {
- resendOTPValidationSchema,
- type ResendOTPValidationType,
-} from '../_validation/resend-otp-validation';
-
-export async function resendOTPAction(request: ResendOTPValidationType) {
- const validRequest = resendOTPValidationSchema.parse(request);
- const remoteIp = await getRemoteIp();
-
- const isCapchaValid = await fetchPostverifyTurnstile(
- validRequest.token,
- remoteIp
- );
-
- if (!isCapchaValid) throw new Error('Failed to verify captcha');
-
- const { data, error } = await fetcher.POST('/v1/auth/send-otp', {
- body: {
- email: validRequest.email,
- },
- });
-
- if (error) throw new Error(error.message);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/verification/_actions/verify-email-action.ts b/apps/landing/src/app/(auth)/verification/_actions/verify-email-action.ts
deleted file mode 100644
index 8e18021..0000000
--- a/apps/landing/src/app/(auth)/verification/_actions/verify-email-action.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-'use server';
-
-import { fetchPostVerifyEmail } from '../_http/fetch-post-verify-email';
-import {
- type VerifyEmailValidationType,
- verifyEmailValidationSchema,
-} from '../_validation/verify-email-validation';
-
-export async function verifyEmailAction(request: VerifyEmailValidationType) {
- const validRequest = verifyEmailValidationSchema.parse(request);
-
- const data = await fetchPostVerifyEmail(validRequest);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/verification/_components/resend-otp-form.tsx b/apps/landing/src/app/(auth)/verification/_components/resend-otp-form.tsx
deleted file mode 100644
index 7731608..0000000
--- a/apps/landing/src/app/(auth)/verification/_components/resend-otp-form.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile';
-import { useRef } from 'react';
-import { useFormResendOTP } from '../_hooks/use-form-resend-otp';
-import { usePostResendOTP } from '../_hooks/use-post-resend-otp';
-import { ResendOTPValidationType } from '../_validation/resend-otp-validation';
-
-export function ResendOTPForm() {
- const ref = useRef(null);
-
- const form = useFormResendOTP();
-
- const { mutate, isPending, error } = usePostResendOTP(form);
-
- const onSubmit = (values: ResendOTPValidationType) => {
- mutate(values);
- };
-
- return (
-
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/verification/_components/verification-tabs.tsx b/apps/landing/src/app/(auth)/verification/_components/verification-tabs.tsx
deleted file mode 100644
index 319505c..0000000
--- a/apps/landing/src/app/(auth)/verification/_components/verification-tabs.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-'use client';
-
-import { cn } from '@utils';
-import { useState } from 'react';
-import { ResendOTPForm } from './resend-otp-form';
-import { VerifyEmailForm } from './verify-email-form';
-
-export function VerificationTabs() {
- const [activeTab, setActiveTab] = useState<'form' | 'resend'>('form');
-
- return (
- <>
-
-
-
-
-
- {activeTab === 'form' ? : }
- >
- );
-}
diff --git a/apps/landing/src/app/(auth)/verification/_components/verify-email-form.tsx b/apps/landing/src/app/(auth)/verification/_components/verify-email-form.tsx
deleted file mode 100644
index 895bb10..0000000
--- a/apps/landing/src/app/(auth)/verification/_components/verify-email-form.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-'use client';
-
-import {
- Button,
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- Input,
-} from '@components';
-import { LuLoader } from 'react-icons/lu';
-import { useFormVerifyEmail } from '../_hooks/use-form-verify-email';
-import { usePostVerifyEmail } from '../_hooks/use-post-verify-email';
-import { type VerifyEmailValidationType } from '../_validation/verify-email-validation';
-
-export function VerifyEmailForm() {
- const form = useFormVerifyEmail();
- const { mutate, isPending, error } = usePostVerifyEmail(form);
-
- const onSubmit = (values: VerifyEmailValidationType) => {
- mutate(values);
- };
-
- return (
-
-
- );
-}
diff --git a/apps/landing/src/app/(auth)/verification/_hooks/use-form-resend-otp.ts b/apps/landing/src/app/(auth)/verification/_hooks/use-form-resend-otp.ts
deleted file mode 100644
index 8578cda..0000000
--- a/apps/landing/src/app/(auth)/verification/_hooks/use-form-resend-otp.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useSearchParams } from 'next/navigation';
-import { useForm } from 'react-hook-form';
-import {
- resendOTPValidationSchema,
- type ResendOTPValidationType,
-} from '../_validation/resend-otp-validation';
-
-export function useFormResendOTP() {
- const searchParams = useSearchParams();
- const email = searchParams.get('ref');
-
- return useForm({
- resolver: zodResolver(resendOTPValidationSchema),
- defaultValues: {
- email: email ?? '',
- token: '',
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/verification/_hooks/use-form-verify-email.ts b/apps/landing/src/app/(auth)/verification/_hooks/use-form-verify-email.ts
deleted file mode 100644
index 859a6a8..0000000
--- a/apps/landing/src/app/(auth)/verification/_hooks/use-form-verify-email.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useSearchParams } from 'next/navigation';
-import { useForm } from 'react-hook-form';
-import {
- verifyEmailValidationSchema,
- type VerifyEmailValidationType,
-} from '../_validation/verify-email-validation';
-
-export function useFormVerifyEmail() {
- const searchParams = useSearchParams();
- const email = searchParams.get('ref');
-
- return useForm({
- resolver: zodResolver(verifyEmailValidationSchema),
- defaultValues: {
- email: email ?? '',
- otp: '',
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/verification/_hooks/use-post-resend-otp.ts b/apps/landing/src/app/(auth)/verification/_hooks/use-post-resend-otp.ts
deleted file mode 100644
index 401d6eb..0000000
--- a/apps/landing/src/app/(auth)/verification/_hooks/use-post-resend-otp.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { resendOTPAction } from '../_actions/resend-otp-action';
-import { useFormResendOTP } from './use-form-resend-otp';
-
-export function usePostResendOTP(form: ReturnType) {
- return useMutation({
- mutationFn: resendOTPAction,
- onSuccess: ({ message }) => {
- form.reset();
- toast.success(message);
- },
- onError: ({ message }) => {
- form.reset();
- toast.error(message);
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/verification/_hooks/use-post-verify-email.ts b/apps/landing/src/app/(auth)/verification/_hooks/use-post-verify-email.ts
deleted file mode 100644
index e7da35d..0000000
--- a/apps/landing/src/app/(auth)/verification/_hooks/use-post-verify-email.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-import { useRouter } from 'next/navigation';
-import { verifyEmailAction } from '../_actions/verify-email-action';
-import { useFormVerifyEmail } from './use-form-verify-email';
-
-export function usePostVerifyEmail(
- form: ReturnType
-) {
- const router = useRouter();
-
- return useMutation({
- mutationFn: verifyEmailAction,
- onSuccess: () => {
- router.push('/');
- },
- onError: () => {
- form.resetField('otp');
- },
- });
-}
diff --git a/apps/landing/src/app/(auth)/verification/_http/fetch-post-verify-email.ts b/apps/landing/src/app/(auth)/verification/_http/fetch-post-verify-email.ts
deleted file mode 100644
index e0a57c8..0000000
--- a/apps/landing/src/app/(auth)/verification/_http/fetch-post-verify-email.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { fetcher } from '@/lib/fetcher';
-import { VerifyEmailValidationType } from '../_validation/verify-email-validation';
-
-export async function fetchPostVerifyEmail({
- email,
- otp,
-}: VerifyEmailValidationType) {
- const formattedOTP = parseInt(otp);
-
- const { data, error, response } = await fetcher.POST(
- '/v1/auth/verify-email',
- {
- body: {
- email,
- otp: formattedOTP,
- },
- }
- );
-
- if (error) {
- throw new Error(error.message);
- }
-
- if (!response.ok) {
- throw new Error('Something went wrong, please try again later');
- }
-
- console.log(data);
-
- return data;
-}
diff --git a/apps/landing/src/app/(auth)/verification/_validation/resend-otp-validation.ts b/apps/landing/src/app/(auth)/verification/_validation/resend-otp-validation.ts
deleted file mode 100644
index 2b4bc20..0000000
--- a/apps/landing/src/app/(auth)/verification/_validation/resend-otp-validation.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { z } from 'zod';
-
-export const resendOTPValidationSchema = z.object({
- email: z.string().email({ message: 'Format email tidak valid' }),
- token: z.string().min(1, { message: 'OTP harus terdiri dari 1 digit' }),
-});
-export type ResendOTPValidationType = z.infer;
diff --git a/apps/landing/src/app/(auth)/verification/_validation/verify-email-validation.ts b/apps/landing/src/app/(auth)/verification/_validation/verify-email-validation.ts
deleted file mode 100644
index 7ace2c8..0000000
--- a/apps/landing/src/app/(auth)/verification/_validation/verify-email-validation.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { z } from 'zod';
-
-export const verifyEmailValidationSchema = z.object({
- email: z.string().email({ message: 'Format email tidak valid' }),
- otp: z
- .string()
- .min(6, { message: 'OTP harus terdiri dari 6 digit' })
- .max(6, { message: 'OTP harus terdiri dari 6 digit' }),
-});
-export type VerifyEmailValidationType = z.infer<
- typeof verifyEmailValidationSchema
->;
diff --git a/apps/landing/src/app/(auth)/verification/page.tsx b/apps/landing/src/app/(auth)/verification/page.tsx
deleted file mode 100644
index 21658ed..0000000
--- a/apps/landing/src/app/(auth)/verification/page.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Suspense } from 'react';
-import { LogoSimple } from '../../_components/logo';
-import { VerificationTabs } from './_components/verification-tabs';
-
-export default function Page() {
- return (
- <>
-
-
-
-
- Verifikasi akun mu sekarang
-
-
-
-
-
-
- >
- );
-}
diff --git a/apps/landing/src/app/(public)/_components/header.tsx b/apps/landing/src/app/(public)/_components/header.tsx
index 63aae9a..e73ecc5 100644
--- a/apps/landing/src/app/(public)/_components/header.tsx
+++ b/apps/landing/src/app/(public)/_components/header.tsx
@@ -2,16 +2,14 @@
import { LogoSimple } from '@/app/_components/logo';
import NAVIGATIONS from '@/data/navigations.json';
-import { Button } from '@components';
import { cn } from '@utils';
import { AnimatePresence, motion } from 'framer-motion';
import Link from 'next/link';
-import { usePathname, useRouter } from 'next/navigation';
+import { usePathname } from 'next/navigation';
import { useEffect, useState } from 'react';
import { LuMenu, LuX } from 'react-icons/lu';
export function Header() {
- const router = useRouter();
const pathname = usePathname();
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
@@ -61,22 +59,6 @@ export function Header() {
))}
-
-
-
-
-