Add favorites and recently visited pages
Pages can be starred from their header; favorites show in the sidebar above the spaces, and Home lists the pages visited last. Both are per user and per workspace, and are filtered by the caller's current rights, so pages that moved out of reach or into the trash drop out. Visits are trimmed to the newest 50 per workspace. The icon set gains the glyphs the rest of Phase 1 needs, and DwIcon can draw a filled variant for on/off states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34660c6b46
commit
b0e36fcfaf
19 files changed
+804
-13
No files matched your search
@@ -34,6 +34,7 @@ export type InstanceSettings = Schemas["InstanceSettings"];
|
||||
export type InstanceSettingsUpdate = Schemas["InstanceSettingsUpdate"];
|
||||
export type Invite = Schemas["Invite"];
|
||||
export type Group = Schemas["Group"];
|
||||
export type PageItem = Schemas["PageItem"];
|
||||
export type GroupRequest = Schemas["GroupRequest"];
|
||||
export type SpaceGroup = Schemas["SpaceGroup"];
|
||||
export type MemberUser = Schemas["MemberUser"];
|
||||
@@ -180,6 +181,9 @@ export function createClient(opts: ClientOptions) {
|
||||
createSpace: (id: string, input: CreateSpaceRequest) =>
|
||||
post<Space>(`/api/v1/workspaces/${encodeURIComponent(id)}/spaces`, input),
|
||||
groups: (id: string) => request<Group[]>("GET", `/api/v1/workspaces/${encodeURIComponent(id)}/groups`),
|
||||
favorites: (id: string) => request<PageItem[]>("GET", `/api/v1/workspaces/${encodeURIComponent(id)}/favorites`),
|
||||
recent: (id: string, limit?: number) =>
|
||||
request<PageItem[]>("GET", `/api/v1/workspaces/${encodeURIComponent(id)}/recent${query({ limit })}`),
|
||||
createGroup: (id: string, input: GroupRequest) =>
|
||||
post<Group>(`/api/v1/workspaces/${encodeURIComponent(id)}/groups`, input),
|
||||
},
|
||||
@@ -237,6 +241,10 @@ export function createClient(opts: ClientOptions) {
|
||||
post<Page>(`/api/v1/pages/${encodeURIComponent(id)}/move`, { parent, index }),
|
||||
trash: (id: string) => request<void>("DELETE", `/api/v1/pages/${encodeURIComponent(id)}`),
|
||||
restore: (id: string) => post<Page>(`/api/v1/pages/${encodeURIComponent(id)}/restore`),
|
||||
setFavorite: (id: string, on: boolean) =>
|
||||
request<void>(on ? "PUT" : "DELETE", `/api/v1/pages/${encodeURIComponent(id)}/favorite`),
|
||||
/** Records that the user opened the page, for their recent list. */
|
||||
visit: (id: string) => post(`/api/v1/pages/${encodeURIComponent(id)}/visit`),
|
||||
purge: (id: string) => request<void>("DELETE", `/api/v1/pages/${encodeURIComponent(id)}?permanent=true`),
|
||||
},
|
||||
};
|
||||
|
||||
Vendored
+199
@@ -966,6 +966,83 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/workspaces/{id}/favorites": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
/** The caller's favorite pages in the workspace, newest first */
|
||||
get: operations["listFavorites"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/workspaces/{id}/recent": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
/** Pages the caller visited last in the workspace */
|
||||
get: operations["listRecentPages"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/pages/{id}/favorite": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
/** Add the page to the caller's favorites */
|
||||
put: operations["addFavorite"];
|
||||
post?: never;
|
||||
/** Remove the page from the caller's favorites */
|
||||
delete: operations["removeFavorite"];
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/pages/{id}/visit": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/** Note that the caller opened the page (for the recent list) */
|
||||
post: operations["recordPageVisit"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
}
|
||||
export type webhooks = Record<string, never>;
|
||||
export interface components {
|
||||
@@ -1115,6 +1192,8 @@ export interface components {
|
||||
/** @description Root first */
|
||||
ancestors: components["schemas"]["PageRef"][];
|
||||
role: components["schemas"]["SpaceRole"];
|
||||
/** @description In the caller's favorites */
|
||||
favorite: boolean;
|
||||
};
|
||||
PageContent: {
|
||||
/** @description Tiptap JSON with type "doc"; null for a page that was never edited */
|
||||
@@ -1307,6 +1386,15 @@ export interface components {
|
||||
};
|
||||
role: components["schemas"]["SpaceRole"];
|
||||
};
|
||||
PageItem: {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: string;
|
||||
space: string;
|
||||
spaceName: string;
|
||||
/** @description When it was favorited */
|
||||
at: string;
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Signed in */
|
||||
@@ -3118,4 +3206,115 @@ export interface operations {
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
listFavorites: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["PageItem"][];
|
||||
};
|
||||
};
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
listRecentPages: {
|
||||
parameters: {
|
||||
query?: {
|
||||
limit?: number;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["PageItem"][];
|
||||
};
|
||||
};
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
addFavorite: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description Added */
|
||||
204: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
removeFavorite: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description Removed */
|
||||
204: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
recordPageVisit: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description Recorded */
|
||||
204: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
404: components["responses"]["Error"];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user