Skip to content

Commit

Permalink
feat: reverse courses list for easier access to newer courses (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
laporchen committed Mar 17, 2024
1 parent 24daa30 commit 88ea886
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pages/courses/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { computed } from "vue";
import { useTitle } from "@vueuse/core";
import { useAxios } from "@vueuse/integrations/useAxios";
import { fetcher } from "@/models/api";
Expand All @@ -11,6 +12,8 @@ const { isDesktop } = useInteractions();
useTitle("Courses | Normal OJ");
const { data: courses, error, isLoading } = useAxios<CourseList>("/course", fetcher);
const displayedCourses = computed(() => [...(courses.value ?? [])].reverse());
const session = useSession();
const rolesCanCreateCourse = [UserRole.Admin, UserRole.Teacher];
</script>
Expand Down Expand Up @@ -44,7 +47,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 displayedCourses" :key="course" class="hover">
<td
:class="{
'min-w-[10rem] max-w-[12rem] whitespace-pre-wrap': !isDesktop,
Expand Down

0 comments on commit 88ea886

Please sign in to comment.