Skip to content

Save review text #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 26, 2024
Merged

Save review text #78

merged 11 commits into from
May 26, 2024

Conversation

NayHtetKyaw
Copy link
Member

Create a temporary localstorage to save the review inputs even when the page got refresh, the inputs will still remain>

@NayHtetKyaw NayHtetKyaw requested a review from chinathaip May 19, 2024 17:18
Copy link
Contributor

@chinathaip chinathaip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks gucci. Just a few modifications

@chinathaip chinathaip linked an issue May 19, 2024 that may be closed by this pull request
6 tasks
NayHtetKyaw and others added 4 commits May 20, 2024 09:07
Co-authored-by: ChinathaiP <92321280+chinathaip@users.noreply.github.com>
Signed-off-by: Anascence <58430236+NayHtetKyaw@users.noreply.github.com>
Copy link
Contributor

@chinathaip chinathaip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of inaccuracy na. Don't forget to format the code. Also, I've seen the keys reviewFormXXXXX being referred a lot and there's actually one mismatch key. Consider defining them as a function that returns the key with dynamic course code. For example

// ofc rename it better lol
interface reviewFormKey {
   academicYearKey: string;
   ratingKey: string;
   descriptionKey: string;
}

const createReviewFormKey = (courseCode: string): reviewFormKey => {
   return {
        academicYearKey: `reviewFormAcademicYear_${courseCode}`,
        ratingKey: `reviewFormDescription_${courseCode}`,
        descriptionKey: `reviewFormDescription_${courseCode}`
   }
}

Now you can always use it like this so everything is consistent

const reviewKeys = createReviewFormKey(params.coursecode);
localStorage.removeItem(reviewKeys.academicYearKey);
localStorage.removeItem(reviewKeys.ratingKey);
localStorage.removeItem(reviewKeys.descriptionKey);

localStorage.getItem(reviewKeys.academicYearKey);
localStorage.getItem(reviewKeys.ratingKey);
localStorage.getItem(reviewKeys.descriptionKey);

or so.. Try this and see if it works or not. Maybe even create the reviewKeys with useMemo with the course code as dependency

@NayHtetKyaw NayHtetKyaw requested a review from chinathaip May 25, 2024 17:33
Copy link
Contributor

@chinathaip chinathaip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@NayHtetKyaw NayHtetKyaw merged commit dbb1dcc into main May 26, 2024
@chinathaip chinathaip deleted the ana/save-reviewtext branch May 26, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FRONTEND] UX/UI Improvement
2 participants