Merge pull request #48 from AlexisNP/features/nav-should-toast

Added toast when navigating out of bounds of event pages
This commit is contained in:
AlexisNP
2024-11-27 14:10:57 +01:00
committed by GitHub
2 changed files with 14 additions and 1 deletions

View File

@@ -2,9 +2,13 @@
import { type RPGDate } from "@/models/Date"
import { PhArrowLineLeft, PhArrowLineRight } from "@phosphor-icons/vue"
import { useToast } from "../ui/toast";
const { currentDate, currentConfig, jumpToDate, getRelativeEventFromDate } = useCalendar()
const { toast } = useToast()
const { t } = useI18n()
function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
let fromDate: RPGDate
@@ -55,7 +59,12 @@ function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
jumpToDate(targetDate)
} catch (err) {
console.log(err)
toast({
title: t("entity.calendar.event.outOfBoundsTitle"),
variant: "default",
description: t("entity.calendar.event.outOfBoundsMessage"),
duration: 4000,
})
}
}
</script>

View File

@@ -136,6 +136,8 @@ export default defineI18nConfig(() => ({
addLocation: "Add a place",
prevPage: "Previous 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: {
title: "Between 3 and 120 caracters.",
description: "1200 caracters max.",
@@ -355,6 +357,8 @@ export default defineI18nConfig(() => ({
addLocation: "Ajouter un endroit",
prevPage: "Précédente 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: {
title: "Entre 3 et 120 charactères.",
description: "Maximum 1200 charactères.",