refactor(web): two panels on the left, the work on the right
Four panels became three, and the arrangement carries the change: everything that organises or configures is stacked in one narrow column, and the whole of the rest is one surface for looking at images. Collections is a LIST, not a grid of covers — it sits in a narrow column beside the gallery, where two cards per row meant four collections visible. A row is a name, a count, and rename/delete on hover. Create is a dialog rather than an always-present input, and a filter field replaces it in that space, since finding one is the frequent act and making one is not. Selecting a collection now shows it in the GALLERY. It used to replace the list inside its own panel, which meant the selector disappeared the moment it was used, and both panels kept their own copy of one collection's images and disagreed after any edit. `?collection=` is read by the gallery now; the collections hook stopped fetching detail entirely. Deleting asks the question that cannot be undone: keep the images, or delete them too. That needed a server route — DELETE /collections/:id?images=delete — which reads the members BEFORE the collection goes, since deleting it takes the memberships with it. Unchecked by default: the recoverable answer is the one you get by pressing Enter without reading. Providers stopped being a panel. It was a card per provider, each with a key field and three buttons, filling a quarter of the screen for something set once — it is a dropdown at the top of Generate now, listing "adapter · model" with a delete on each, and adding one opens a dialog. The form and the dropdown share one provider list (useProviders); they were two fetches, so adding a provider left the form showing the old models until a reload.
This commit is contained in:
+19
-1
@@ -113,11 +113,29 @@ export function useAtelierClient() {
|
||||
/** Long-polls up to `waitSeconds` server-side, so the panel does not run its own retry loop. */
|
||||
awaitGeneration: (id: string, waitSeconds = 30) => client.get<JobResponse>(`images/generations/${id}?wait=${waitSeconds}`),
|
||||
|
||||
/** A provider row is adapter + model; the key is set separately, and never comes back. */
|
||||
createProvider: (adapter: string, model: string) =>
|
||||
client.post<{ data: ProviderStatus[] }>('providers', { adapter, model }).then((r) => r.data),
|
||||
updateProvider: (id: string, values: Record<string, unknown>) =>
|
||||
client.patch<{ data: ProviderStatus[] }>(`providers/${id}`, values).then((r) => r.data),
|
||||
deleteProvider: (id: string) => client.delete<{ data: ProviderStatus[] }>(`providers/${id}`).then((r) => r.data),
|
||||
|
||||
listCollections: () => client.get<{ data: CollectionSummary[] }>('collections').then((r) => r.data),
|
||||
getCollection: (id: string) => client.get<{ data: CollectionDetail }>(`collections/${id}`).then((r) => r.data),
|
||||
createCollection: (name: string) =>
|
||||
client.post<{ data: Collection }>('collections', { name }).then((r) => r.data),
|
||||
deleteCollection: (id: string) => client.delete<{ data: unknown }>(`collections/${id}`),
|
||||
renameCollection: (id: string, name: string) =>
|
||||
client.patch<{ data: Collection }>(`collections/${id}`, { name }).then((r) => r.data),
|
||||
/**
|
||||
* `deleteImages` is the difference between filing something wrongly and regretting the whole
|
||||
* afternoon — the server keeps the images unless it is asked, by name, not to.
|
||||
*/
|
||||
deleteCollection: (id: string, deleteImages = false) =>
|
||||
client
|
||||
.delete<{ data: { id: string; deleted: boolean; deletedImages: number } }>(
|
||||
`collections/${id}${deleteImages ? '?images=delete' : ''}`,
|
||||
)
|
||||
.then((r) => r.data),
|
||||
addToCollection: (id: string, generationIds: string[]) =>
|
||||
client
|
||||
.post<{ data: { added: number; images: GenerationRow[] } }>(`collections/${id}/items`, { generationIds })
|
||||
|
||||
Reference in New Issue
Block a user