feat(frontend): Toast-Bestaetigungen fuer Schnellerfassung
Sonner-Toaster global eingebunden. Erfolgs-Toast auf allen sechs Schnellerfassungs-Formularen (Durchsicht, Varroa, Behandlung, Fuetterung, Aufgabe, Ernte) - ohne Toast blieb nach dem Speichern und Wegnavigieren keine sichtbare Bestaetigung, dass die Eingabe gespeichert wurde. Wichtig fuer klares Feedback bei zeitkritischer Erfassung am Bienenstand.
This commit is contained in:
1 parent
ecb3afe1f5
commit
8080a7f5ec
7 files changed
+14
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { fetchColonies } from "@/lib/colonies/api";
|
||||
import { createFeeding } from "@/lib/feedings/api";
|
||||
import { FeedType } from "@/lib/feedings/types";
|
||||
@@ -60,6 +61,7 @@ export default function NewFeedingPage() {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["colonies", feeding.colonyId, "feedings", "summary"],
|
||||
});
|
||||
toast.success("Fütterung gespeichert");
|
||||
router.push(`/colonies/${feeding.colonyId}`);
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { fetchApiaries } from "@/lib/apiaries/api";
|
||||
import { fetchColonies } from "@/lib/colonies/api";
|
||||
import { createHarvest } from "@/lib/harvests/api";
|
||||
@@ -47,6 +48,7 @@ export default function NewHarvestPage() {
|
||||
mutationFn: createHarvest,
|
||||
onSuccess: (harvest) => {
|
||||
void queryClient.invalidateQueries({ queryKey: ["harvests"] });
|
||||
toast.success("Ernte gespeichert");
|
||||
router.push(`/harvests/${harvest.id}`);
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { fetchColonies } from "@/lib/colonies/api";
|
||||
import { createInspection } from "@/lib/inspections/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -51,6 +52,7 @@ export default function NewInspectionPage() {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["colonies", inspection.colonyId, "inspections"],
|
||||
});
|
||||
toast.success("Durchsicht gespeichert");
|
||||
router.push(`/colonies/${inspection.colonyId}`);
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { createTask } from "@/lib/tasks/api";
|
||||
import { TaskPriority } from "@/lib/tasks/types";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -33,6 +34,7 @@ export default function NewTaskPage() {
|
||||
mutationFn: createTask,
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: ["tasks"] });
|
||||
toast.success("Aufgabe angelegt");
|
||||
router.push("/tasks");
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { fetchColonies } from "@/lib/colonies/api";
|
||||
import { createTreatment } from "@/lib/treatments/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -48,6 +49,7 @@ export default function NewTreatmentPage() {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["colonies", treatment.colonyId, "treatments"],
|
||||
});
|
||||
toast.success("Behandlung gespeichert");
|
||||
router.push(`/colonies/${treatment.colonyId}`);
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import { fetchColonies } from "@/lib/colonies/api";
|
||||
import { createVarroaMeasurement } from "@/lib/varroa/api";
|
||||
import { VarroaMethod } from "@/lib/varroa/types";
|
||||
@@ -56,6 +57,7 @@ export default function NewVarroaMeasurementPage() {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["colonies", measurement.colonyId, "varroa-measurements"],
|
||||
});
|
||||
toast.success("Varroamessung gespeichert");
|
||||
router.push(`/colonies/${measurement.colonyId}`);
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import { Space_Grotesk, Inter, IBM_Plex_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { Providers } from "./providers";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
|
||||
const spaceGrotesk = Space_Grotesk({
|
||||
variable: "--font-heading",
|
||||
@@ -33,6 +34,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
||||
>
|
||||
<body className="min-h-full flex flex-col">
|
||||
<Providers>{children}</Providers>
|
||||
<Toaster position="top-right" richColors />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user