Skip to content
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

feat: reverse courses list for easier access to newer courses #158

Merged
merged 2 commits into from
Mar 17, 2024

Conversation

laporchen
Copy link
Contributor

This is just a personal preference. Since most users would only use the newest courses (probably)

@uier
Copy link
Member

uier commented Mar 14, 2024

Hi @laporchen, what you think about the review comment.

I can take over this issue if you're not available

@laporchen
Copy link
Contributor Author

Hi @laporchen, what you think about the review comment.

I can take over this issue if you're not available

Which review comment you are talking about here. I don't think I see one in this PR?

@@ -44,7 +44,7 @@ const rolesCanCreateCourse = [UserRole.Admin, UserRole.Teacher];
</tr>
</thead>
<tbody>
<tr v-for="{ course, teacher } in courses" :key="course" class="hover">
<tr v-for="{ course, teacher } in (courses ?? []).reverse()" :key="course" class="hover">
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should use Array.prototype.toReversed() to avoid mutating the list. How do you think?

Optionally, we can have a toggle to decide the order (new->old OR old->new), and store this preference in local storage, but overall I think reversing course list is great and will be appreciated by most of the users. So it's optional

Copy link
Member

Choose a reason for hiding this comment

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

@laporchen here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer keeping only one order method just for now for simplicity, and I'll change toReversed to prevent potential issue in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using a destructing array to prevent mutation to the original list, since we can't use es2023 stuff now.

Copy link

cloudflare-pages bot commented Mar 17, 2024

Deploying nfe with  Cloudflare Pages  Cloudflare Pages

Latest commit: e45491a
Status: ✅  Deploy successful!
Preview URL: https://c258728e.nfe.pages.dev
Branch Preview URL: https://feat-reverse-courses-list-or.nfe.pages.dev

View logs

@uier uier merged commit 88ea886 into main Mar 17, 2024
4 checks passed
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.

None yet

2 participants