Add image display to flight logs

This commit is contained in:
april
2024-01-15 11:52:29 -06:00
parent 4b80593aa3
commit 2395bb10bf
8 changed files with 107 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import {
Container,
Fieldset,
Group,
Loader,
Modal,
NumberInput,
ScrollArea,
@@ -34,6 +35,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useApi } from "@/util/api";
import { useAircraft } from "@/util/hooks";
import { useEffect, useState } from "react";
import ImageUpload from "./image-upload";
export default function FlightForm({
onSubmit,
@@ -101,6 +103,8 @@ export default function FlightForm({
crew: [],
comments: "",
images: [],
},
});
@@ -492,20 +496,22 @@ export default function FlightForm({
minRows={4}
{...form.getInputProps("comments")}
/>
<ImageUpload
form={form}
field="images"
label="Images"
placeholder="Upload Images"
/>
</Fieldset>
</Container>
</ScrollArea.Autosize>
<Group justify="flex-end" mt="md">
{isPending ? (
<Text c="yellow" fw={700}>
Loading...
</Text>
<Loader />
) : isError ? (
<Text c="red" fw={700}>
{error instanceof AxiosError
? error.response?.data.detail
: error?.message}
{error?.message}
</Text>
) : null}
{withCancelButton ? (