diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-11 09:47:25 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-11 09:47:25 +0700 |
| commit | 92c2a229d9c9b510d71b928978872a8b107e9d5a (patch) | |
| tree | 8d8161a49a0bdc46d4c28d3f2682bb485314a41d /src/lib/auth/components | |
| parent | 62bebc1d33fd090d7666e18e7a0326ef7ef36897 (diff) | |
Documentation and refactor code
Diffstat (limited to 'src/lib/auth/components')
| -rw-r--r-- | src/lib/auth/components/Activate.jsx | 52 | ||||
| -rw-r--r-- | src/lib/auth/components/CompanyProfile.jsx | 37 | ||||
| -rw-r--r-- | src/lib/auth/components/Login.jsx | 4 | ||||
| -rw-r--r-- | src/lib/auth/components/PersonalProfile.jsx | 32 | ||||
| -rw-r--r-- | src/lib/auth/components/RegisterDesktop.jsx | 20 | ||||
| -rw-r--r-- | src/lib/auth/components/RegisterMobile.jsx | 2 |
6 files changed, 45 insertions, 102 deletions
diff --git a/src/lib/auth/components/Activate.jsx b/src/lib/auth/components/Activate.jsx index 717e178b..c81bcbbd 100644 --- a/src/lib/auth/components/Activate.jsx +++ b/src/lib/auth/components/Activate.jsx @@ -27,10 +27,7 @@ const Activate = () => { children: ( <> Selamat, akun anda berhasil diaktifkan,{' '} - <Link - className='text-gray_r-12' - href='/' - > + <Link className='text-gray_r-12' href='/'> kembali ke beranda </Link> . @@ -43,10 +40,7 @@ const Activate = () => { children: ( <> Mohon maaf token sudah tidak aktif, lakukan permintaan aktivasi akun kembali atau{' '} - <Link - className='text-gray_r-12' - href='/login' - > + <Link className='text-gray_r-12' href='/login'> masuk </Link>{' '} jika sudah memiliki akun. @@ -67,9 +61,12 @@ const Activate = () => { const activationRequest = async (e) => { e.preventDefault() setIsLoading(true) - let activationRequest = await axios.post(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/activation-request`, { - email - }) + let activationRequest = await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/activation-request`, + { + email + } + ) if (activationRequest.data.activationRequest) { setAlert({ children: <>Mohon cek email anda untuk aktivasi akun Indoteknik</>, @@ -82,10 +79,7 @@ const Activate = () => { children: ( <> Email tersebut belum terdaftar,{' '} - <Link - className='text-gray_r-12' - href='/register' - > + <Link className='text-gray_r-12' href='/register'> daftar sekarang </Link> . @@ -99,10 +93,7 @@ const Activate = () => { children: ( <> Email tersebut sudah terdaftar dan sudah aktif,{' '} - <Link - className='text-gray_r-12' - href='/login' - > + <Link className='text-gray_r-12' href='/login'> masuk sekarang </Link> . @@ -119,29 +110,18 @@ const Activate = () => { return ( <div className='p-6 pt-10 flex flex-col items-center min-h-screen'> <Link href='/'> - <Image - src={IndoteknikLogo} - alt='Logo Indoteknik' - width={150} - height={50} - /> + <Image src={IndoteknikLogo} alt='Logo Indoteknik' width={150} height={50} /> </Link> <h1 className='text-2xl mt-4 font-semibold text-center'>Aktivasi Akun Indoteknik</h1> {alert && ( - <Alert - className='text-center mt-4' - type={alert.type} - > + <Alert className='text-center mt-4' type={alert.type}> {alert.children} </Alert> )} - <form - onSubmit={activationRequest} - className='mt-6 w-full' - > + <form onSubmit={activationRequest} className='mt-6 w-full'> <input type='email' id='email' @@ -151,11 +131,7 @@ const Activate = () => { placeholder='Masukan alamat email' autoFocus /> - <button - type='submit' - disabled={!email} - className='btn-yellow font-semibold mt-4 w-full' - > + <button type='submit' disabled={!email} className='btn-yellow font-semibold mt-4 w-full'> {isLoading ? 'Loading...' : 'Aktivasi'} </button> </form> diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 1b25551e..854aa246 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -69,11 +69,7 @@ const CompanyProfile = () => { return ( <> - <button - type='button' - onClick={toggle} - className='p-4 flex items-center text-left' - > + <button type='button' onClick={toggle} className='p-4 flex items-center text-left'> <div> <div className='font-semibold mb-2'>Informasi Usaha</div> <div className='text-gray_r-11'> @@ -96,12 +92,7 @@ const CompanyProfile = () => { <Controller name='industry' control={control} - render={(props) => ( - <HookFormSelect - {...props} - options={industries} - /> - )} + render={(props) => <HookFormSelect {...props} options={industries} />} /> </div> <div className='flex flex-wrap'> @@ -110,12 +101,7 @@ const CompanyProfile = () => { <Controller name='companyType' control={control} - render={(props) => ( - <HookFormSelect - {...props} - options={companyTypes} - /> - )} + render={(props) => <HookFormSelect {...props} options={companyTypes} />} /> </div> <div className='w-9/12 pl-1'> @@ -129,24 +115,13 @@ const CompanyProfile = () => { </div> <div> <label>Nama Wajib Pajak</label> - <input - {...register('taxName')} - type='text' - className='form-input mt-3' - /> + <input {...register('taxName')} type='text' className='form-input mt-3' /> </div> <div> <label>Nomor NPWP</label> - <input - {...register('npwp')} - type='text' - className='form-input mt-3' - /> + <input {...register('npwp')} type='text' className='form-input mt-3' /> </div> - <button - type='submit' - className='btn-yellow w-full mt-2' - > + <button type='submit' className='btn-yellow w-full mt-2'> Simpan </button> </form> diff --git a/src/lib/auth/components/Login.jsx b/src/lib/auth/components/Login.jsx index 171ff4c8..cbcfd07b 100644 --- a/src/lib/auth/components/Login.jsx +++ b/src/lib/auth/components/Login.jsx @@ -1,5 +1,5 @@ -import LoginDesktop from "./LoginDesktop" -import LoginMobile from "./LoginMobile" +import LoginDesktop from './LoginDesktop' +import LoginMobile from './LoginMobile' const Login = () => { return ( diff --git a/src/lib/auth/components/PersonalProfile.jsx b/src/lib/auth/components/PersonalProfile.jsx index 4f606ed4..4a533ae9 100644 --- a/src/lib/auth/components/PersonalProfile.jsx +++ b/src/lib/auth/components/PersonalProfile.jsx @@ -34,7 +34,7 @@ const PersonalProfile = () => { let data = values if (!values.password) delete data.password const isUpdated = await editPersonalProfileApi({ data }) - + if (isUpdated?.user) { setAuth(isUpdated.user) setValue('password', '') @@ -47,11 +47,7 @@ const PersonalProfile = () => { return ( <> - <button - type='button' - onClick={toggle} - className='p-4 flex items-center text-left' - > + <button type='button' onClick={toggle} className='p-4 flex items-center text-left'> <div> <div className='font-semibold mb-2'>Informasi Akun</div> <div className='text-gray_r-11'> @@ -71,28 +67,15 @@ const PersonalProfile = () => { > <div> <label>Email</label> - <input - {...register('email')} - type='text' - disabled - className='form-input mt-3' - /> + <input {...register('email')} type='text' disabled className='form-input mt-3' /> </div> <div> <label>Nama Lengkap</label> - <input - {...register('name')} - type='text' - className='form-input mt-3' - /> + <input {...register('name')} type='text' className='form-input mt-3' /> </div> <div> <label>No. Handphone</label> - <input - {...register('mobile')} - type='tel' - className='form-input mt-3' - /> + <input {...register('mobile')} type='tel' className='form-input mt-3' /> </div> <div> <label>Kata Sandi</label> @@ -103,10 +86,7 @@ const PersonalProfile = () => { placeholder='Isi jika ingin mengubah kata sandi' /> </div> - <button - type='submit' - className='btn-yellow w-full mt-2' - > + <button type='submit' className='btn-yellow w-full mt-2'> Simpan </button> </form> diff --git a/src/lib/auth/components/RegisterDesktop.jsx b/src/lib/auth/components/RegisterDesktop.jsx index ac6ac960..482a9ce3 100644 --- a/src/lib/auth/components/RegisterDesktop.jsx +++ b/src/lib/auth/components/RegisterDesktop.jsx @@ -89,9 +89,19 @@ const RegisterDesktop = () => { placeholder='••••••••••••' /> </div> - <div class="flex items-center mt-4 "> - <input type="checkbox" id='sdk' className='form-input flex items-start w-fit mr-2' required /> - <label onClick={() => setTnd(true)} className='inline cursor-pointer text-danger-500'>Syarat dan Ketentuan</label> + <div class='flex items-center mt-4 '> + <input + type='checkbox' + id='sdk' + className='form-input flex items-start w-fit mr-2' + required + /> + <label + onClick={() => setTnd(true)} + className='inline cursor-pointer text-danger-500' + > + Syarat dan Ketentuan + </label> </div> <button type='submit' @@ -103,7 +113,9 @@ const RegisterDesktop = () => { </form> <div> - <BottomPopup active={tnd} close={() => setTnd(false)}><PageContent path='/register#tnd'></PageContent></BottomPopup> + <BottomPopup active={tnd} close={() => setTnd(false)}> + <PageContent path='/register#tnd'></PageContent> + </BottomPopup> </div> <div className='text-gray_r-11 mt-10'> diff --git a/src/lib/auth/components/RegisterMobile.jsx b/src/lib/auth/components/RegisterMobile.jsx index 214584f4..f5c818e7 100644 --- a/src/lib/auth/components/RegisterMobile.jsx +++ b/src/lib/auth/components/RegisterMobile.jsx @@ -114,7 +114,7 @@ const RegisterMobile = () => { <PageContent path='/register#tnd'></PageContent> </BottomPopup> </div> - + <div className='text-gray_r-11 mt-4'> Sudah punya akun Indoteknik?{' '} <Link href='/login' className='inline'> |
