feat(art): #3 add edit button

This commit is contained in:
2026-03-09 00:12:50 +07:00 Unverified
parent 3e3ef549d4
commit d91f36fc52
15 changed files with 218 additions and 85 deletions
+20
View File
@@ -16,6 +16,7 @@ type SharedStates = Partial<{
updated: boolean;
"rubgram.services": string[];
"tl.deleteMode": boolean;
inspect: Record<string, string>;
_raw: Record<string, unknown>;
}>;
@@ -165,4 +166,23 @@ export const shared = {
raw() {
return [shared.state("_raw")[0]];
},
inspect(k: string, v: Parameters<typeof console.log>[0]) {
const comms = use(IccContext);
// unmount handler
useEffect(
() => () => {
const { [k]: removed, ...rest } = comms.get("inspect") || {};
comms.set("inspect", rest);
},
[],
);
// value updater
useEffect(() => {
const obj = comms.get("inspect") || {};
comms.set("inspect", {
...obj,
[k]: typeof v === "string" ? v : JSON.stringify(v),
});
}, [v]);
},
};