Giter Club home page Giter Club logo

rent-near-me's Introduction

Hello there, I'm Andrew ๐Ÿ‘‹

I'm a Front-end developer from Sร i Gรฒn, Vietnam, currently living in Toronto, Canada.

Contacts

๐Ÿ’– Checkout my personal website: https://andrewnt.dev

๐Ÿ“ง Contact me: [email protected]

๐Ÿ‘” Let's connect: https://www.linkedin.com/in/andrewnt219/

Overview

Stats

Andrew's github stats

Top programming languages

Top Langs

My Stacks

Extremely comfortable

Next.js React Router HTML Git JavaScript Firebase Node.js Tailwindcss React.js TypeScript CSS Redux styled-components SASS

Know well

Jest MongoDB Material-UI Framer Motion

rent-near-me's People

Contributors

andrewnt219 avatar vitokhangnguyen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

vitokhangnguyen

rent-near-me's Issues

Refactor `LayoutProvider`

Background

The LayoutProvider right now seems to be there to support only the Modals. It wraps inside the DefaultLayout which I don't remember why I made such decision.

Proposal

  • Make LayoutProvider becomes ModalProvider and wrap it under AuthProvider (and also under SnackbarProvider when #98 is marged)\
  • Rename useLayoutModals to simply useModals
  • Any future Modal should be put inside ModalProvider so that no 2 modals can be shown at the same time (supported by useModalGroup)

Footer

image

  • Links
  • Footer text
  • Switch language button

Refactor: Apply feedbacks from code reviews

From #63:

  • Create a protected route / page guard mechanism (may become a seperated issue) #71
  • Change the type of error parameter in getErrorMessage() in src/utils/api-responses.ts to unknwon
  • Fix typo in ModeLType

From #70:

  • Refactor modals - making show and onDismiss mandataory props
  • Refactor useModalGroup - making return ModalControl non-optional type
  • Move logic of onCreateAccountClick and onAlreadyHaveAccountClick inside the componenets

Cannot reopen login modal after closing

Reproduce

Branch: dev

  • From homepage, open Menu > Login & Security
  • Close sign in modal
  • open Menu > Login & Security

What happened

Cannot open the login modal

Expect

Login modal should open

Login modal is closed on wrong credentials

Reproduce

Branch: dev

  • From homepage, open Menu > Login
  • Enter the wrong username and password
  • Press login

What happened

The modal is closed

Expect

Login should open and show an error message


I suspect this is because react-hook-form doesn't properly handle errors thrown in handleSubmit. I might have done it wrong, but their docs is not accurate. This does not handle the throw (even though their docs says so)

const onSubmit = () => {
  throw new Error('Something is wrong')
}

handleSubmit(onSubmit).catch((e) => {
  // you will need to catch that error
})

In the other project, I handle this with mutation from react-query. SWR seems to has the same concept for mutation, but I'm not sure.

Remove mandatory `id` from input fields

Background

Right now, almost every form field (TextField, PasswordField, DatePicker, SelectField) requires a id prop so it can use it for a11y purpose (for the aria-describedby attribute).

Proposal

After #95 is merged which includes the useUid hook, we should make the id prop optional. If an id is not passed into the components above, we should generate a random id and use it instead

Create unauthenticated, email unverified and error pages

  • User unauthenticated page
    • Prompt the user to login/register
    • Buttons to show the login/register modals
  • User's email unverified page
    • Prompt the user to go to their mailbox and click on the verification link
    • Button to resend the verification link
    • Links to popular mailboxes
      • Gmail, Outlook, Yahoo
      • Collapsible for more email services (if you happen to don't have any thing better to do)
  • Custom error page
    • 404 page
    • 500 page

Refactor: Create reuseable component `ActionField` and use it for the `PasswordActionField`

  • Refactor PasswordActionField to be more reuseable by creatinng a ActionField componenet with the following props:
    • label: string
    • mainContent: ReactNode, default to empty Node
    • alternativeContent: ReactNode, default to empty Node
    • mainButtonText: string, default to "Update"
    • alternativeButtonText: stringg, default to "Cancel"
    • showActionButton: boolean, default to true
    • Also, create a context wrapping the children and a hook to access that context (i.e.: useActionCollapsible()) which exposes properties and functions such as isOpen, open(), close() and toggle() so that any child componenet within the ActionCollapsible can control it (example use case: A form can close the collapsible when it successfully submitted)

Account Menu: Personal Info

Add the User Profile page allowing:

  • View user profile
  • Edit user profile

image

Profile
---------------
id: User ID from Supabase Auth
fname
lname
gender
dob?
bio?
phone?
created_on
last_signin_on
_______________

Refactor: Use `react-form-hook`'s `<FormProvider>` instead of passing `control` to individual fields

Background

Currently, we have this long-winded code for every form to pass the name and, more importantly, the control of the form to the useController hook of each field in the form.

  const controllers: Controllers<RegisterFormModel> = {
    firstName: {
      control,
      name: 'firstName',
    },
    lastName: {
      control,
      name: 'lastName',
    },
    gender: {
      control,
      name: 'gender',
    },
    dob: {
      control,
      name: 'dob',
    },
    email: {
      control,
      name: 'email',
    },
    password: {
      control,
      name: 'password',
    },
  };

Proposal

We can avoid passing the control of the form to individual fields by wrapping the form around a <FormProvider> exported from react-form-hook (See the description of the control property in the docs).

By doing this, we can eleminate the controllers altogether and pass only the name directly to the fields.

Official example for the use of <FormProvider> can be found here.

๐Ÿงจ Refactor: Replace custom form model classes with `yup.InferType<T>`

@vitokhangnguyen I have tried zod on two other projects, and honestly, I feel that the code is much more concise than using a class and yup, especially the duplication in the current constructor, and another duplicate in yup.object(). Here's an example using zod

import { z } from 'zod';

export const addCourseReviewSchema = z.object({
  courseId: z.string().min(1, 'Have to select a course ID'),
  difficulty: z
    .string()
    .transform((val) => +val)
    .refine((val) => val <= 5, { message: 'Maximum value is 5' })
    .refine((val) => val >= 1, { message: 'Minimum value is 1' }),
  professorIdList: z
    .string()
    .array()
    .min(1, { message: 'Minimum one related professor' }),
  title: z.string().min(1, { message: 'Review must have a title' }),
});

export type AddCourseReviewFormValues = z.infer<typeof addCourseReviewSchema>;

Validation

import { HasMessage, TResult, TResultSuccess, ValidateQuery } from '@common';
import { withApiHandler } from '@lib/api/withApiHandler';
import { signupFormSchema, SignupFormValues } from '@modules/auth';
import { AuthService } from '@modules/auth/server-index';
import {
  getErrorMessage,
  ResultError,
  ResultOk,
  ResultSuccess,
} from '@utils/api-utils';
import { errorsToString } from '@utils/parse-utils';
import { NextApiHandler } from 'next';

type PostData = HasMessage;
export type Auth_SignupByPassword_PostData = TResultSuccess<PostData>;
export type Auth_SignupByPassword_PostBody = SignupFormValues;

const post: NextApiHandler<TResult<PostData>> = async (req, res) => {
  const bodyResult = validateBody(req.body);

  if (bodyResult.type === 'error') return res.status(422).json(bodyResult);

  try {
    await AuthService.signUpByPassword(bodyResult.data);
  } catch (error) {
    return res
      .status(500)
      .json(ResultError(`Fail to sign up: ${getErrorMessage(error)}`));
  }

  return res.status(201).json(ResultOk());
};

const validateBody: ValidateQuery<Auth_SignupByPassword_PostBody> = (body) => {
  const result = signupFormSchema.safeParse(body);

  if (!result.success) {
    return ResultError(errorsToString(result.error.errors));
  }

  return ResultSuccess(body);
};

export default withApiHandler({ post });

Misc UI bugs

  • Search bar missing focus styling
  • ButtonSimple should have opacity instead of gray-shade on hover
  • TextField should have a lighter gray shade (or even better, opacity) on hover

Premium: Metadata (charts, better yet map)

Better ask users for anonymous data collection

Metadata

  • Rent rates
  • Type (main floor, basement)
  • Bedroom's type (master bedroom, shared bedroom, single bedroom)
  • Share kitchen/washroom with X housemate

Filters

  • By region
  • By combining the above metadata

User-House and User-User matching preferences

Allow tenants to share their preferences abouit their dream houses and housemates, as well as, their personalities.

This information will be shared with the owner when the tenant expresses their interests.

Feature: Reset Password with a verification email

  • Reset password modal for unauthenticated user
    • Add a modal with a TextField with type="email" and a submit button which will send an email containing the reset password link. Firebase SDK supports this feature and we can customize the email content on Firebase console. After submitting, close the modal and show a succes snackbar, show a snackbar error if and only if a network issue occurs.
  • Reset password modal for unauthenticated user
    • Same as the modal for unauthenticated user and...
    • Fill the TextField with the current user's email
  • Change the "Need a new password?" text below to "Forget password?"

Screenshot_20211109-193001_Chrome.jpg

Login user

  • By username/password
  • By Facebook
  • By Google
  • By Apple

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.