From a0b00de6157badd6535c638b62eb90d3550ac780 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Wed, 31 Jul 2024 12:40:35 -0400 Subject: [PATCH] finished started, completed, status and notes and made responsive --- frontend/src/ChangeDataDialogue.svelte | 147 +++++++++++++++++-------- 1 file changed, 102 insertions(+), 45 deletions(-) diff --git a/frontend/src/ChangeDataDialogue.svelte b/frontend/src/ChangeDataDialogue.svelte index 923e3ff..43704d3 100644 --- a/frontend/src/ChangeDataDialogue.svelte +++ b/frontend/src/ChangeDataDialogue.svelte @@ -2,6 +2,7 @@ import {anime} from "./GetAniListSingleItemAndOpenModal.svelte"; import {Button} from "flowbite-svelte"; import StarRatting from "@ernane/svelte-star-rating" + import moment from 'moment' const ratingInWords = { 0: "Not Reviewed", @@ -61,6 +62,8 @@ score: anime.data.MediaList.score, notes: anime.data.MediaList.notes } + let startedAtDate: string + let completedAtDate: string const changeRating = (e) => { config.score = e.target.valueAsNumber @@ -79,7 +82,11 @@ count++ } - let startedAtDate = `${values.startedAt.year}-${values.startedAt.month}-${values.startedAt.day}` + if (values.startedAt.year > 0) { + let startedAtISODate = new Date(values.startedAt.year, values.startedAt.month - 1, values.startedAt.day) + let startedAtMoment = moment(startedAtISODate) + startedAtDate = startedAtMoment.format('YYYY-MM-DD') + } const transformStartedAtDate = (e) => { const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/ @@ -89,31 +96,42 @@ values.startedAt.day = Number(date[3]) } - console.log(startedAtDate) + if (values.completedAt.year > 0) { + let completedAtISODate = new Date(values.completedAt.year, values.completedAt.month - 1, values.completedAt.day) + let completedAtMoment = moment(completedAtISODate) + completedAtDate = completedAtMoment.format('YYYY-MM-DD') + } + + const transformCompletedAtDate = (e) => { + const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/ + const date = re.exec(e.target.value) + values.completedAt.year = Number(date[1]) + values.completedAt.month = Number(date[2]) + values.completedAt.day = Number(date[3]) + }
-
-
+
+
{title} Cover Image

Rating: {config.score * 2}

{ratingInWords[config.score * 2]}

-
-
- - -
- +
+
+
+ @@ -121,13 +139,13 @@
- +
-
+
-
-
- -
- - - - - - - - - - - - - - - - Date + Started +
+
+ +
+ + value={startedAtDate} + placeholder="Date Started" + on:change={transformStartedAtDate} + > +
+
+ +
+
+ +
+ +
+
+
+ + +
+
+
+
+ + +
-