-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
307756b
commit 1c65c72
Showing
23 changed files
with
425 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 34 additions & 5 deletions
39
src/components/blocks/Reservation/Experiments/Experiment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/components/blocks/Reservation/Experiments/ExperimentData.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Pill from "../../../primitives/Pills/Pill.tsx"; | ||
import H4 from "../../../primitives/headings/H4.tsx"; | ||
|
||
const ExperimentData = () => { | ||
return ( | ||
<div className="rounded-lg border border-gray-300 p-6"> | ||
<H4>Data</H4> | ||
<div className="flex flex-row gap-2"><strong>Status:</strong> <Pill title="Synchronizing" variant="primary" /></div> | ||
<div><strong>Loaded:</strong> 24.5 GB (245 Files)</div> | ||
<div><strong>Transferred:</strong> 19.6 GB (200 Files)</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ExperimentData; |
42 changes: 42 additions & 0 deletions
42
src/components/blocks/Reservation/Experiments/ExperimentForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {FormProvider, SubmitHandler, useForm} from "react-hook-form"; | ||
import Button from "../../../primitives/buttons/Button.tsx"; | ||
import {zodResolver} from "@hookform/resolvers/zod"; | ||
import {z} from "zod"; | ||
import TextInput from "../../../primitives/form/TextInput.tsx"; | ||
import TextAreaInput from "../../../primitives/form/TextAreaInput.tsx"; | ||
import ExperimentData from "./ExperimentData.tsx"; | ||
|
||
const schema = z.object({ | ||
name: z.string(), | ||
start: z.date(), | ||
end: z.date(), | ||
note: z.string().optional() | ||
}) | ||
|
||
type ExperimentFormValues = z.infer<typeof schema>; | ||
|
||
const ExperimentForm = () => { | ||
const methods = useForm<ExperimentFormValues>({ | ||
resolver: zodResolver(schema), | ||
}) | ||
const onSubmit: SubmitHandler<ExperimentFormValues> = (data) => console.log(data) | ||
|
||
return ( | ||
<FormProvider {...methods}> | ||
<form onSubmit={methods.handleSubmit(onSubmit)}> | ||
<div className="flex flex-col gap-2"> | ||
<TextInput<ExperimentFormValues> fieldName="name" label="Name"/> | ||
<div className="flex flex-row gap-2"> | ||
<TextInput<ExperimentFormValues> fieldName="start" label="Start Time"/> | ||
<TextInput<ExperimentFormValues> fieldName="end" label="End Time"/> | ||
</div> | ||
<TextAreaInput<ExperimentFormValues> fieldName="note" rows={4} label="Note"/> | ||
<ExperimentData /> | ||
<Button type="submit" className="w-full">End Experiment</Button> | ||
</div> | ||
</form> | ||
</FormProvider> | ||
) | ||
} | ||
|
||
export default ExperimentForm; |
26 changes: 20 additions & 6 deletions
26
src/components/blocks/Reservation/Experiments/Experiments.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {ClockIcon} from "@heroicons/react/24/outline"; | ||
import {formatTime} from "../../../utils/format.ts"; | ||
|
||
interface TimeSpanProps { | ||
start: Date; | ||
end: Date; | ||
} | ||
|
||
const TimeSpan = ({start, end}: TimeSpanProps) => { | ||
return (<div className="flex flex-row items-center gap-2"> | ||
<ClockIcon className="h-6 w-6"/> | ||
<span className="font-bold">{start.getDate()}.{start.getDate()}. {formatTime(start, {showMinutes: true})} - {formatTime(end, {showMinutes: true})}</span> | ||
</div>) | ||
} | ||
|
||
export default TimeSpan; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {Dialog, DialogBackdrop, DialogPanel} from '@headlessui/react' | ||
import {useSetDialog} from "../../contexts/DialogContextProvider.tsx"; | ||
import {ReactNode} from "react"; | ||
|
||
export interface BaseDialogProps { | ||
title: string; | ||
content: ReactNode; | ||
buttons: ReactNode; | ||
} | ||
|
||
const BaseDialog = ({title, content, buttons}: BaseDialogProps) => { | ||
const setDialog = useSetDialog(); | ||
return ( | ||
<Dialog open={true} onClose={() => setDialog(null)} className="relative z-50"> | ||
<DialogBackdrop | ||
transition | ||
className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in" | ||
/> | ||
<div className="fixed inset-0 z-10 w-screen overflow-y-auto"> | ||
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> | ||
<DialogPanel | ||
transition | ||
className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in sm:my-8 sm:w-full sm:max-w-lg data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95" | ||
> | ||
<div className="bg-white p-4"> | ||
<h3 className="font-bold text-2xl">{title}</h3> | ||
<div> | ||
{content} | ||
</div> | ||
</div> | ||
<div className="bg-gray-50 p-4"> | ||
{buttons} | ||
</div> | ||
</DialogPanel> | ||
</div> | ||
</div> | ||
</Dialog> | ||
) | ||
} | ||
|
||
export default BaseDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import {useSetDialog} from "../../contexts/DialogContextProvider.tsx"; | ||
import Button from "../primitives/buttons/Button.tsx"; | ||
import {useNavigate} from "react-router-dom"; | ||
import {Event} from "../blocks/Agenda/AgendaEvent.tsx"; | ||
import TimeSpan from "../blocks/TimeSpan/TimeSpan.tsx"; | ||
import User from "../blocks/User/User.tsx"; | ||
import BaseDialog from "./BaseDialog.tsx"; | ||
|
||
const ConfirmIdentityDialog = ({reservation}: { reservation: Event }) => { | ||
const setDialog = useSetDialog(); | ||
const navigate = useNavigate(); | ||
|
||
const onConfirm = () => { | ||
setDialog(null); | ||
navigate("/agenda"); | ||
} | ||
|
||
return ( | ||
<BaseDialog | ||
title={`End ${reservation.title}`} | ||
content={ | ||
<div> | ||
<TimeSpan start={reservation.start} end={reservation.end}/> | ||
<User name={reservation.user}/> | ||
<div className="mt-4"> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mollis felis urna, a luctus ex | ||
egestas | ||
mollis. Mauris at purus tempus risus interdum euismod. Sed mauris turpis, molestie ut tristique | ||
sed, | ||
aliquet pulvinar est. Sed mauris lectus, imperdiet ut commodo vel, mattis in ex. Suspendisse | ||
eget | ||
purus | ||
sed nulla lacinia fringilla. Ut vestibulum odio nulla, in euismod sem tincidunt rutrum. Nunc | ||
iaculis | ||
risus at urna mollis, non vehicula risus sagittis. | ||
</div> | ||
</div>} | ||
buttons={ | ||
<Button type="button" onClick={onConfirm}> | ||
Confirm | ||
</Button> | ||
}/> | ||
) | ||
} | ||
|
||
export default ConfirmIdentityDialog; |
Oops, something went wrong.