From 1f7cabf3a10b2a048a43b9f2436673d3e52238a7 Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Fri, 11 Oct 2024 14:18:39 +0200 Subject: [PATCH 01/10] :sparkles: Implement episode order saving --- components/webtoons/episodes/EpisodeList.vue | 17 +++++++++++------ utils/storage.ts | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 utils/storage.ts diff --git a/components/webtoons/episodes/EpisodeList.vue b/components/webtoons/episodes/EpisodeList.vue index 3c4118c..52d883e 100644 --- a/components/webtoons/episodes/EpisodeList.vue +++ b/components/webtoons/episodes/EpisodeList.vue @@ -5,18 +5,20 @@ import EpisodeItem from "~/components/webtoons/episodes/EpisodeItem.vue"; import {Skeleton} from "~/components/ui/skeleton"; import EpisodeSkeleton from "~/components/webtoons/episodes/EpisodeSkeleton.vue"; import VisibilityObserver from "~/components/utils/VisibilityObserver.vue"; +import {saveOrder} from "~/utils/storage"; useSeoMeta({ title: "OWR", description: "Episodes page", }); +const id = useRoute().params.id as any as number; + const title = ref(""); const episodes = ref([]); const maxIndex = ref(30); -const newFirst = ref(true); +const order = ref(getOrder(id)); -const id = useRoute().params.id as any as number; function loadEpisodes(){ const webtoonState: any = useState(`webtoon-${id}`); @@ -45,11 +47,12 @@ function increaseMaxIndex(){ } function toggleOrder(){ - newFirst.value = !newFirst.value; + order.value = !order.value; + saveOrder(id, order.value); } const orderedEpisodes = computed(() => { - return newFirst.value ? episodes.value : [...episodes.value].reverse(); + return order.value ? episodes.value : [...episodes.value].reverse(); }); onMounted(() => { @@ -62,8 +65,10 @@ onMounted(() => {
- - + { width="800" height="1280" /> + + +