Merge pull request #50 from AlexisNP/bugfix/fix-leftover-hardcoded-logic
Bugfix/fix leftover hardcoded logic
This commit is contained in:
@@ -1,72 +1,66 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { type RPGDate } from "@/models/Date"
|
const { currentDate } = useCalendar()
|
||||||
|
|
||||||
import { PhArrowLineLeft, PhArrowLineRight } from "@phosphor-icons/vue"
|
// const { toast } = useToast()
|
||||||
import { useToast } from "../ui/toast";
|
// const { t } = useI18n()
|
||||||
|
|
||||||
const { currentDate, currentConfig, jumpToDate, getRelativeEventFromDate } = useCalendar()
|
// function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
||||||
|
// let fromDate: RPGDate
|
||||||
|
|
||||||
const { toast } = useToast()
|
// // To modify, obviously
|
||||||
const { t } = useI18n()
|
// const daysPerMonth = 32
|
||||||
|
|
||||||
function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
// const toDay = position === "next" ? daysPerMonth : 1
|
||||||
let fromDate: RPGDate
|
// const toMonth = position === "next" ? monthsPerYear : 0
|
||||||
|
|
||||||
// To modify, obviously
|
// switch (currentConfig.viewType) {
|
||||||
const daysPerMonth = 32
|
// case "month":
|
||||||
const monthsPerYear = 10
|
// fromDate = {
|
||||||
|
// day: toDay,
|
||||||
|
// month: currentDate.currentMonth,
|
||||||
|
// year: currentDate.currentYear
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
|
||||||
const toDay = position === "next" ? daysPerMonth : 1
|
// case "year":
|
||||||
const toMonth = position === "next" ? monthsPerYear : 0
|
// fromDate = {
|
||||||
|
// day: toDay,
|
||||||
|
// month: toMonth,
|
||||||
|
// year: currentDate.currentYear
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
|
||||||
switch (currentConfig.viewType) {
|
// case "decade":
|
||||||
case "month":
|
// fromDate = {
|
||||||
fromDate = {
|
// day: toDay,
|
||||||
day: toDay,
|
// month: currentDate.currentMonth,
|
||||||
month: currentDate.currentMonth,
|
// year: currentDate.currentYear
|
||||||
year: currentDate.currentYear
|
// }
|
||||||
}
|
// break
|
||||||
break
|
|
||||||
|
|
||||||
case "year":
|
// case "century":
|
||||||
fromDate = {
|
// default:
|
||||||
day: toDay,
|
// fromDate = {
|
||||||
month: toMonth,
|
// day: toDay,
|
||||||
year: currentDate.currentYear
|
// month: currentDate.currentMonth,
|
||||||
}
|
// year: currentDate.currentYear
|
||||||
break
|
// }
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
|
||||||
case "decade":
|
// try {
|
||||||
fromDate = {
|
// const { targetDate } = getRelativeEventFromDate(fromDate, position)
|
||||||
day: toDay,
|
|
||||||
month: currentDate.currentMonth,
|
|
||||||
year: currentDate.currentYear
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
case "century":
|
// jumpToDate(targetDate)
|
||||||
default:
|
// } catch (err) {
|
||||||
fromDate = {
|
// toast({
|
||||||
day: toDay,
|
// title: t("entity.calendar.event.outOfBoundsTitle"),
|
||||||
month: currentDate.currentMonth,
|
// variant: "default",
|
||||||
year: currentDate.currentYear
|
// description: t("entity.calendar.event.outOfBoundsMessage"),
|
||||||
}
|
// duration: 4000,
|
||||||
break
|
// })
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
try {
|
|
||||||
const { targetDate } = getRelativeEventFromDate(fromDate, position)
|
|
||||||
|
|
||||||
jumpToDate(targetDate)
|
|
||||||
} catch (err) {
|
|
||||||
toast({
|
|
||||||
title: t("entity.calendar.event.outOfBoundsTitle"),
|
|
||||||
variant: "default",
|
|
||||||
description: t("entity.calendar.event.outOfBoundsMessage"),
|
|
||||||
duration: 4000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -82,7 +76,7 @@ function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
|||||||
</template>
|
</template>
|
||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<!-- <div>
|
||||||
<UiTooltipProvider :delay-duration="250">
|
<UiTooltipProvider :delay-duration="250">
|
||||||
<UiTooltip>
|
<UiTooltip>
|
||||||
<UiTooltipTrigger as-child>
|
<UiTooltipTrigger as-child>
|
||||||
@@ -123,6 +117,6 @@ function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
|||||||
</UiTooltipContent>
|
</UiTooltipContent>
|
||||||
</UiTooltip>
|
</UiTooltip>
|
||||||
</UiTooltipProvider>
|
</UiTooltipProvider>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user