Skip to content

Commit

Permalink
rework UI
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidOpDeBeeck committed Oct 31, 2023
1 parent df5bce0 commit 81c9eb4
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 80 deletions.
2 changes: 1 addition & 1 deletion rcaas-ui/src/action-bar/ActionBar.tsx
Expand Up @@ -8,7 +8,7 @@ import YearMonthSelector from "./YearMonthSelector.tsx";
export default function ActionBar() {
return (
<div
className="flex flex-none justify-between rounded-t-lg border border-gray-200 bg-white p-2 shadow dark:border-slate-800 dark:bg-slate-700">
className="flex flex-none justify-between border-b-2 border-gray-200 bg-white p-2 shadow dark:border-slate-800 dark:bg-slate-700">
<YearMonthTitle/>
<div className="flex space-x-2">
<TodayButton/>
Expand Down
2 changes: 1 addition & 1 deletion rcaas-ui/src/calendar/Calendar.tsx
Expand Up @@ -6,7 +6,7 @@ export default function Calendar() {

return (
<div
className="grid flex-1 grid-rows-6 gap-1 rounded-b-lg border border-gray-200 bg-white p-1 shadow dark:border-slate-800 dark:bg-slate-600">
className="grid flex-1 grid-rows-6 gap-1 bg-white p-1 shadow dark:bg-slate-600">
{
(calendar?.weeks || []).map((week, weekIndex) => (
<Week key={weekIndex}
Expand Down
20 changes: 8 additions & 12 deletions rcaas-ui/src/modal/Modal.tsx
Expand Up @@ -38,18 +38,14 @@ export default function Modal({title, submitLabel, closeLabel, open, onSubmit, o
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
<Dialog.Panel
className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-xl">
<div className="bg-white px-4 pt-5 pb-4 dark:bg-slate-700 sm:p-6 sm:pb-4">
<div className="mt-0 text-left">
<Dialog.Title as="h3"
className="border-b border-gray-200 pb-3 text-2xl font-bold leading-6 text-gray-800 dark:border-slate-600 dark:text-gray-200">
{title}
</Dialog.Title>
<div className="mt-4">
<form>
{children}
</form>
</div>
</div>
<div className="bg-white px-6 pt-6 pb-2 dark:bg-slate-700">
<Dialog.Title as="h3"
className="border-b border-gray-200 pb-3 text-2xl font-bold leading-6 text-gray-800 dark:border-slate-600 dark:text-gray-200">
{title}
</Dialog.Title>
<form className="py-4">
{children}
</form>
</div>
<div className="flex-row-reverse bg-gray-50 px-6 py-3 space-x-reverse space-x-1 dark:bg-slate-800 sm:flex">
{submitLabel && <Button
Expand Down
2 changes: 1 addition & 1 deletion rcaas-ui/src/pages/ProjectPage.tsx
Expand Up @@ -11,7 +11,7 @@ export default function ProjectPage() {
}, [project]);

return (
<div className="flex min-h-screen w-full flex-col bg-gray-100 p-2 dark:bg-slate-800">
<div className="flex min-h-screen w-full flex-col">
<ActionBar/>
<Calendar/>
</div>
Expand Down
71 changes: 6 additions & 65 deletions rcaas-ui/src/settings/SettingsModal.tsx
@@ -1,9 +1,7 @@
import NewReleaseButton from "./NewReleaseButton.tsx";
import {useProject} from "../queries/project/useProject.ts";
import NewReschedulingButton from "./NewReschedulingButton.tsx";
import DeleteProjectButton from "./DeleteProjectButton.tsx";
import DeleteReschedulingButton from "./DeleteReschedulingButton.tsx";
import Modal from "../modal/Modal.tsx";
import SpecificationDetail from "./SpecificationDetail.tsx";

type Props = {
showModal: boolean;
Expand All @@ -18,69 +16,12 @@ export default function SettingsModal({showModal, closeModal}: Props) {
closeLabel={"Close"}
open={showModal}
onClose={() => closeModal()}>
<div className="flex flex-col py-2 space-y-2">
<div className="flex flex-col space-y-2">
{project?.specifications.map((specification, specificationIndex) => (
<div key={specificationIndex}
className="rounded-md border-2 border-gray-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-600">
<div className="flex items-center justify-between">
<h1 className="text-lg font-semibold text-gray-800 dark:text-gray-200">{specification.sprintBased.version.environment}</h1>
<div className="flex space-x-1">
<NewReschedulingButton specificationIndex={specificationIndex}/>
<DeleteProjectButton specificationIndex={specificationIndex}/>
</div>
</div>
<h2 className="mt-2 py-2 font-medium dark:text-gray-200">Configuration</h2>
<div className="grid grid-cols-2 gap-x-3 gap-y-1 px-2">
<div className="flex justify-between text-sm space-x-2 dark:text-gray-200">
<span>Version</span>
<span>{specification.sprintBased.version.value}</span>
</div>
<div className="flex justify-between text-sm space-x-1 dark:text-gray-200">
<span>Start Date</span>
<span>{specification.sprintBased.startDate}</span>
</div>
<div className="flex justify-between text-sm space-x-1 dark:text-gray-200">
<span>Sprint Length</span>
<span>{specification.sprintBased.sprintLength}</span>
</div>
<div className="flex items-center justify-between text-sm space-x-1 dark:text-gray-200">
<span>Color</span>
<div
className={`w-4 h-4 rounded-full bg-${specification.sprintBased.version.color}-400 border-2 border-${specification.sprintBased.version.color}-500`}></div>
</div>
</div>
<h2 className="mt-2 py-2 font-medium dark:text-gray-200">Reschedulings</h2>
<div className="px-2">
<table className="w-full table-fixed">
<thead>
<tr className="border-b border-gray-200 text-left text-sm dark:border-gray-800 dark:text-gray-200">
<th className="w-2/5 py-2 font-medium">From Date</th>
<th className="w-2/5 py-2 font-medium">To Date</th>
<th className="w-1/5 py-2 font-medium"></th>
</tr>
</thead>
<tbody className="text-left text-sm">
{specification?.sprintBased.reschedulings.map((rescheduling, reschedulingIndex) => (
<tr key={reschedulingIndex}
className="border-b border-gray-200 dark:border-gray-800 dark:text-gray-200">
<td className="py-2">{rescheduling.from}</td>
<td className="py-2">{rescheduling.to}</td>
<td className="py-1">
<DeleteReschedulingButton
specificationIndex={specificationIndex}
reschedulingIndex={reschedulingIndex}/>
</td>
</tr>
))}
{specification?.sprintBased.reschedulings.length === 0 && (<tr>
<td colSpan={5} className="py-2 text-xs italic dark:text-gray-200">No reschedulings
available
</td>
</tr>)}
</tbody>
</table>
</div>
</div>
<SpecificationDetail
key={specificationIndex}
specification={specification}
specificationIndex={specificationIndex}/>
))}
{project?.specifications.length === 0 && (<div>
<span className="text-xs italic dark:text-gray-200">No releases available</span>
Expand Down
98 changes: 98 additions & 0 deletions rcaas-ui/src/settings/SpecificationDetail.tsx
@@ -0,0 +1,98 @@
import {ChevronDownIcon, ChevronRightIcon} from "@heroicons/react/24/outline";
import NewReschedulingButton from "./NewReschedulingButton.tsx";
import DeleteProjectButton from "./DeleteProjectButton.tsx";
import {ReleaseSpecificationTO} from "../domain/ReleaseTO.ts";
import {Fragment, useState} from "react";
import DeleteReschedulingButton from "./DeleteReschedulingButton.tsx";
import {Transition} from "@headlessui/react";

type Props = {
specification: ReleaseSpecificationTO;
specificationIndex: number;
}

export default function SpecificationDetail({specification, specificationIndex}: Props) {
const [collapsed, setCollapsed] = useState(true);

return <div key={specificationIndex}
className="rounded-md border-2 border-gray-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-600">
<div className="flex items-center justify-between">
<div className="flex items-center text-gray-800 space-x-2 dark:text-gray-200">
{collapsed
? <ChevronRightIcon onClick={() => setCollapsed(prev => !prev)}
className="h-4 w-4 cursor-pointer [&>path]:stroke-[3]"/>
: <ChevronDownIcon onClick={() => setCollapsed(prev => !prev)}
className="h-4 w-4 cursor-pointer [&>path]:stroke-[3]"/>}
<h1 className="text-lg font-semibold">{specification.sprintBased.version.environment}</h1>
</div>
<div className="flex space-x-1">
<NewReschedulingButton specificationIndex={specificationIndex}/>
<DeleteProjectButton specificationIndex={specificationIndex}/>
</div>
</div>
<Transition.Root show={!collapsed} as={Fragment}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0">
<div>
<h2 className="py-2 font-medium uppercase dark:text-gray-200">Configuration</h2>
<div className="grid grid-cols-2 gap-x-3 gap-y-1 px-2">
<div className="flex justify-between text-sm space-x-2 dark:text-gray-200">
<span>Version</span>
<span>{specification.sprintBased.version.value}</span>
</div>
<div className="flex justify-between text-sm space-x-1 dark:text-gray-200">
<span>Start Date</span>
<span>{specification.sprintBased.startDate}</span>
</div>
<div className="flex justify-between text-sm space-x-1 dark:text-gray-200">
<span>Sprint Length</span>
<span>{specification.sprintBased.sprintLength}</span>
</div>
<div className="flex items-center justify-between text-sm space-x-1 dark:text-gray-200">
<span>Color</span>
<div
className={`w-4 h-4 rounded-full bg-${specification.sprintBased.version.color}-400 border-2 border-${specification.sprintBased.version.color}-500`}></div>
</div>
</div>
<h2 className="mt-2 py-2 font-medium uppercase dark:text-gray-200">Reschedulings</h2>
<div className="px-2">
<table className="w-full table-fixed">
<thead>
<tr className="border-b border-gray-200 text-left text-sm dark:border-gray-800 dark:text-gray-200">
<th className="w-2/5 py-2 font-medium">From Date</th>
<th className="w-2/5 py-2 font-medium">To Date</th>
<th className="w-1/5 py-2 font-medium"></th>
</tr>
</thead>
<tbody className="text-left text-sm">
{specification?.sprintBased.reschedulings.map((rescheduling, reschedulingIndex) => (
<tr key={reschedulingIndex}
className="border-b border-gray-200 dark:border-gray-800 dark:text-gray-200">
<td className="py-2">{rescheduling.from}</td>
<td className="py-2">{rescheduling.to}</td>
<td className="py-1">
<DeleteReschedulingButton
specificationIndex={specificationIndex}
reschedulingIndex={reschedulingIndex}/>
</td>
</tr>
))}
{specification?.sprintBased.reschedulings.length === 0 && (<tr>
<td colSpan={5} className="py-2 text-xs italic dark:text-gray-200">No reschedulings
available
</td>
</tr>)}
</tbody>
</table>
</div>
</div>
</Transition.Child>
</Transition.Root>
</div>;
}

0 comments on commit 81c9eb4

Please sign in to comment.