web: ui improvements for report edit mode

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-12-12 09:49:06 +01:00
parent 0db81832bf
commit c175707be4
11 changed files with 74 additions and 14 deletions

View File

@@ -1,6 +1,5 @@
import { Button } from '@/components/ui/button';
import { toast } from '@/components/ui/use-toast';
import { useOrganizationParams } from '@/hooks/useOrganizationParams';
import { pushModal } from '@/modals';
import { useSelector } from '@/redux';
import { api, handleError } from '@/utils/api';
@@ -9,7 +8,6 @@ import { SaveIcon } from 'lucide-react';
import { useReportId } from './hooks/useReportId';
export function ReportSaveButton() {
const params = useOrganizationParams();
const { reportId } = useReportId();
const update = api.report.update.useMutation({
onSuccess() {
@@ -25,6 +23,7 @@ export function ReportSaveButton() {
if (reportId) {
return (
<Button
disabled={!report.dirty}
loading={update.isLoading}
onClick={() => {
update.mutate({
@@ -40,6 +39,7 @@ export function ReportSaveButton() {
} else {
return (
<Button
disabled={!report.dirty}
onClick={() => {
pushModal('SaveReport', {
report,