@fungi.computer/tourtois 0.20.12 → 0.20.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
3
3
  import { memberAvatarSchema, defaultMemberAvatar, } from "@fungi.computer/sprite-zdog/avatar";
4
+ import { toast } from "@fungi.computer/caps/components/toaster";
5
+ import { WORKBENCH_NOTICES } from "./app-toast.js";
4
6
  import { AvatarPreview } from "./AvatarPreview.js";
5
7
  import { AvatarPicker } from "./AvatarPicker.js";
6
8
  import { skipToken, useMutation, useQuery, useQueryClient, } from "@tanstack/react-query";
@@ -60,6 +62,9 @@ function useSaveMemberAvatar(save) {
60
62
  },
61
63
  mutationFn: save,
62
64
  onError: (_cause, _next, snapshot) => {
65
+ toast.error("Your avatar could not be saved. Try again.", {
66
+ toasterId: WORKBENCH_NOTICES,
67
+ });
63
68
  if (snapshot &&
64
69
  client.getQueryData(accountAvatarQuery) === snapshot.optimistic) {
65
70
  client.setQueryData(accountAvatarQuery, snapshot.previous ?? null);
@@ -82,7 +87,7 @@ export function OwnSprite(props) {
82
87
  export function AvatarSettings({ save: write }) {
83
88
  const saved = useMemberAvatar();
84
89
  const save = useSaveMemberAvatar(write);
85
- return (_jsxs("section", { className: "tourtois-avatar-settings", "aria-labelledby": "tourtois-avatar-heading", children: [_jsx(SectionHeading, { id: "tourtois-avatar-heading", children: "Avatar" }), _jsx("p", { className: "tourtois-settings-lede", children: "Choose your character, colours and drawing style. Changes save automatically." }), save.isError ? (_jsx("p", { role: "alert", children: "Your account did not save this avatar. Your previous avatar was restored. Choose it again to retry." })) : null, _jsx(AvatarPicker, { value: saved, disabled: save.isPending, onChange: (next) => {
90
+ return (_jsxs("section", { className: "tourtois-avatar-settings", "aria-labelledby": "tourtois-avatar-heading", children: [_jsx(SectionHeading, { id: "tourtois-avatar-heading", children: "Avatar" }), _jsx("p", { className: "tourtois-settings-lede", children: "Choose your character, colours and drawing style. Changes save automatically." }), _jsx(AvatarPicker, { value: saved, disabled: save.isPending, onChange: (next) => {
86
91
  save.mutate(next);
87
92
  } })] }));
88
93
  }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // Standalone Oyster Settings chrome, loaded from the chosen shell Release.
3
3
  // App Permissions frame Oyster's own grants page, never its implementation.
4
4
  // Connections, Keys and Computers retain their existing host-backed ports.
@@ -8,6 +8,7 @@ import "./shell.css";
8
8
  import { AppError } from "@fungi.computer/agar";
9
9
  import { createQueryClient } from "@fungi.computer/agar/query";
10
10
  import { workbenchDirectorySchema } from "@fungi.computer/nacre/workbench-directory";
11
+ import { toast } from "@fungi.computer/caps/components/toaster";
11
12
  import { QueryClientProvider } from "@tanstack/react-query";
12
13
  import * as S from "effect/Schema";
13
14
  import { z } from "zod";
@@ -16,6 +17,7 @@ import { createRoot } from "react-dom/client";
16
17
  import { connectionAddedSchema, connectionsViewSchema, connectionToolsSchema, createPlatformControls, PlatformControlsView, } from "./platform-controls.js";
17
18
  import { createOysterSetupPort, oysterSetupSchema } from "./oyster-setup.js";
18
19
  import { modelKeysViewSchema } from "./ModelKeys.js";
20
+ import { WORKBENCH_NOTICES } from "./app-toast.js";
19
21
  import { settingsLocationSchema } from "./settings-routes.js";
20
22
  import { OysterComputers, createOysterComputersPort, } from "./OysterComputers.js";
21
23
  import { DiscordChannels, createOysterDiscordChannelsPort, } from "./DiscordChannels.js";
@@ -217,7 +219,6 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
217
219
  const sizeObserver = useRef(null);
218
220
  const [height, setHeight] = useState(0);
219
221
  const leave = useRef("clean");
220
- const [refreshFailed, setRefreshFailed] = useState(false);
221
222
  useSettingsLeaveGuard(() => leave.current);
222
223
  useEffect(() => () => {
223
224
  sizeObserver.current?.disconnect();
@@ -234,10 +235,11 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
234
235
  return;
235
236
  leave.current = parsed.data.state;
236
237
  if (parsed.data.event === "accepted") {
237
- setRefreshFailed(false);
238
238
  void onAccepted().catch((cause) => {
239
239
  console.error("App permissions Settings refresh failed", cause);
240
- setRefreshFailed(true);
240
+ toast.error("Settings could not be refreshed. Reopen Settings to try again.", {
241
+ toasterId: WORKBENCH_NOTICES,
242
+ });
241
243
  });
242
244
  }
243
245
  };
@@ -246,20 +248,20 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
246
248
  window.removeEventListener("message", receive);
247
249
  };
248
250
  }, [onAccepted]);
249
- return (_jsxs(_Fragment, { children: [refreshFailed ? (_jsx("p", { role: "alert", children: "Permissions saved. Settings could not refresh. Close and reopen Settings to retry." })) : null, _jsx("iframe", { ref: frame, title: "App permissions", src: `/api/installations/${encodeURIComponent(installationId)}/grants`, className: "w-full shrink-0 border-0", style: { height }, onLoad: () => {
250
- sizeObserver.current?.disconnect();
251
- const body = frame.current?.contentDocument?.body;
252
- if (!body)
253
- return;
254
- // The same-origin host page owns its markup. Observe its body rather
255
- // than its editor internals; Settings remains the only scroll owner.
256
- const resize = () => {
257
- setHeight(Math.ceil(body.getBoundingClientRect().height));
258
- };
259
- sizeObserver.current = new ResizeObserver(resize);
260
- sizeObserver.current.observe(body);
261
- resize();
262
- } })] }));
251
+ return (_jsx(_Fragment, { children: _jsx("iframe", { ref: frame, title: "App permissions", src: `/api/installations/${encodeURIComponent(installationId)}/grants`, className: "w-full shrink-0 border-0", style: { height }, onLoad: () => {
252
+ sizeObserver.current?.disconnect();
253
+ const body = frame.current?.contentDocument?.body;
254
+ if (!body)
255
+ return;
256
+ // The same-origin host page owns its markup. Observe its body rather
257
+ // than its editor internals; Settings remains the only scroll owner.
258
+ const resize = () => {
259
+ setHeight(Math.ceil(body.getBoundingClientRect().height));
260
+ };
261
+ sizeObserver.current = new ResizeObserver(resize);
262
+ sizeObserver.current.observe(body);
263
+ resize();
264
+ } }) }));
263
265
  }
264
266
  function OysterAppPermissions({ selectedKey, onAccepted, }) {
265
267
  if (!selectedKey?.startsWith("installation:"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.20.12",
3
+ "version": "0.20.13",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Tourtois: the trusted desktop shell for Oyster and Fungi, with host-supplied Settings sections",
6
6
  "type": "module",
@@ -106,7 +106,7 @@
106
106
  "react": "^18.3.1 || ^19.2.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@fungi.computer/oyster": "0.31.1",
109
+ "@fungi.computer/oyster": "0.31.2",
110
110
  "@cloudflare/workers-types": "5.20260828.1",
111
111
  "@fungi.computer/forage": "0.3.9",
112
112
  "@fungi.computer/mycelium": "0.4.0",