Added toast when navigating out of bounds of event pages
This commit is contained in:
@@ -2,9 +2,13 @@
|
|||||||
import { type RPGDate } from "@/models/Date"
|
import { type RPGDate } from "@/models/Date"
|
||||||
|
|
||||||
import { PhArrowLineLeft, PhArrowLineRight } from "@phosphor-icons/vue"
|
import { PhArrowLineLeft, PhArrowLineRight } from "@phosphor-icons/vue"
|
||||||
|
import { useToast } from "../ui/toast";
|
||||||
|
|
||||||
const { currentDate, currentConfig, jumpToDate, getRelativeEventFromDate } = useCalendar()
|
const { currentDate, currentConfig, jumpToDate, getRelativeEventFromDate } = useCalendar()
|
||||||
|
|
||||||
|
const { toast } = useToast()
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
||||||
let fromDate: RPGDate
|
let fromDate: RPGDate
|
||||||
|
|
||||||
@@ -55,7 +59,12 @@ function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
|
|||||||
|
|
||||||
jumpToDate(targetDate)
|
jumpToDate(targetDate)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
toast({
|
||||||
|
title: t("entity.calendar.event.outOfBoundsTitle"),
|
||||||
|
variant: "default",
|
||||||
|
description: t("entity.calendar.event.outOfBoundsMessage"),
|
||||||
|
duration: 4000,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ export default defineI18nConfig(() => ({
|
|||||||
addLocation: "Add a place",
|
addLocation: "Add a place",
|
||||||
prevPage: "Previous page with events",
|
prevPage: "Previous page with events",
|
||||||
nextPage: "Next page with events",
|
nextPage: "Next page with events",
|
||||||
|
outOfBoundsTitle: "No next or previous events were found",
|
||||||
|
outOfBoundsMessage: "Maybe the event is the first or last one ?",
|
||||||
patterns: {
|
patterns: {
|
||||||
title: "Between 3 and 120 caracters.",
|
title: "Between 3 and 120 caracters.",
|
||||||
description: "1200 caracters max.",
|
description: "1200 caracters max.",
|
||||||
@@ -355,6 +357,8 @@ export default defineI18nConfig(() => ({
|
|||||||
addLocation: "Ajouter un endroit",
|
addLocation: "Ajouter un endroit",
|
||||||
prevPage: "Précédente page à évènements",
|
prevPage: "Précédente page à évènements",
|
||||||
nextPage: "Prochaine page à évènements",
|
nextPage: "Prochaine page à évènements",
|
||||||
|
outOfBoundsTitle: "Aucun évènement suivant ou précédent trouvé",
|
||||||
|
outOfBoundsMessage: "Peut-être l'évènement se situe au début ou à la fin du calendrier ?",
|
||||||
patterns: {
|
patterns: {
|
||||||
title: "Entre 3 et 120 charactères.",
|
title: "Entre 3 et 120 charactères.",
|
||||||
description: "Maximum 1200 charactères.",
|
description: "Maximum 1200 charactères.",
|
||||||
|
|||||||
Reference in New Issue
Block a user