Projects CRUD (todo: project images)

This commit is contained in:
Ahmed Al-Taiar
2024-09-08 23:36:30 -04:00
parent 1c5a8d026a
commit e080e6b222
17 changed files with 386 additions and 251 deletions

View File

@ -45,7 +45,6 @@ const UPDATE_PROJECT_MUTATION: TypedDocumentNode<
`
export const Loading = () => <CellLoading />
export const Failure = ({ error }: CellFailureProps) => (
<CellFailure error={error} />
)
@ -58,33 +57,37 @@ export const Success = ({ project }: CellSuccessProps<EditProjectById>) => {
toast.success('Project updated')
navigate(routes.projects())
},
onError: (error) => {
toast.error(error.message)
},
onError: (error) => toast.error(error.message),
}
)
const onSave = (
input: UpdateProjectInput,
id: EditProjectById['project']['id']
) => {
updateProject({ variables: { id, input } })
}
) => updateProject({ variables: { id, input } })
return (
<div className="rw-segment">
<header className="rw-segment-header">
<h2 className="rw-heading rw-heading-secondary">
Edit Project {project?.id}
</h2>
</header>
<div className="rw-segment-main">
<ProjectForm
project={project}
onSave={onSave}
error={error}
loading={loading}
/>
<div className="flex w-full justify-center">
<div className="overflow-hidden overflow-x-auto rounded-xl bg-base-100">
<table className="table w-80">
<thead className="bg-base-200 font-syne">
<tr>
<th className="w-0">Edit Project {project.id}</th>
</tr>
</thead>
<tbody>
<tr>
<th>
<ProjectForm
project={project}
onSave={onSave}
error={error}
loading={loading}
/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
)