@ynput/ayon-addon-dev 0.2.1 → 0.3.0
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.
- package/dist/shell/index.js +82 -5
- package/package.json +3 -3
package/dist/shell/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, createContext, useContext, useState, useMemo, useEffect, useSyncExternalStore, Component, StrictMode } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
import { provideHost, isKnownSlot, getRegistry, contributionTitle, getHost, registerManifest, setManifestsLoading } from "@ynput/ayon-addon/host";
|
|
5
|
-
import { useGetProjectFoldersQuery, useGetCurrentUserQuery, usersApi, useListProjectsQuery, useGetEntitiesDetailsPanelQuery, useGetProjectQuery, useGetUsersAssigneeQuery, createStandaloneStore } from "@ynput/ayon-frontend-shared/api";
|
|
6
|
-
import { AddonMoreMenu, AddonEntityPicker, SlicerHost, ProjectPageLayoutHost, JsonViewer, AddonButton, useAddonCustomizeSections, useAddonTableShortcuts, shortcutEntities, SettingsPanel, AddonDialog, useStudioPageSlotContext, useProjectPageSlotContext, SplitterStyles, LoginPage, AddonServices } from "@ynput/ayon-frontend-shared/components";
|
|
5
|
+
import { useGetProjectFoldersQuery, useGetCurrentUserQuery, usersApi, useListProjectsQuery, useGetEntitiesDetailsPanelQuery, useGetUsersQuery, useGetProjectQuery, useGetUsersAssigneeQuery, createStandaloneStore } from "@ynput/ayon-frontend-shared/api";
|
|
6
|
+
import { AddonMoreMenu, AddonEntityPicker, SlicerHost, ProjectPageLayoutHost, JsonViewer, AddonButton, useUserDetailsSlotContext, useAddonUserMenuItems, AddonUserDetailsSections, useAddonCustomizeSections, useAddonTableShortcuts, shortcutEntities, SettingsPanel, AddonDialog, useStudioPageSlotContext, useProjectPageSlotContext, SplitterStyles, LoginPage, AddonServices } from "@ynput/ayon-frontend-shared/components";
|
|
7
7
|
import { useGlobalContext, usePowerpack, useMenuContext, useSettingsPanel, useScopedDetailsPanel, EntityUpdatesProvider, GlobalProvider, PowerpackProvider, MenuProvider, URIProvider, DetailsPanelProvider, PiPProvider, DeleteEntitiesProvider, SettingsPanelProvider, ProjectContextProvider, ProjectFoldersContextProvider } from "@ynput/ayon-frontend-shared/context";
|
|
8
8
|
import { buildProjectsTableData, ProjectsTable, PROJECTS_LIST_MENU_ID, parseProjectFolderRowId } from "@ynput/ayon-frontend-shared/ProjectsTable";
|
|
9
9
|
import { getProjectDisplayName, clearAccessToken, storeAccessToken } from "@ynput/ayon-frontend-shared/util";
|
|
10
10
|
import { Button, Icon, Dropdown, Dialog, InputText } from "@ynput/ayon-react-components";
|
|
11
|
-
import { useContributions, prefetchPiece, runContribution, EntityPicker, ContributionView } from "@ynput/ayon-addon";
|
|
11
|
+
import { useContributions, prefetchPiece, runContribution, EntityPicker, ContributionView, useUser as useUser$1 } from "@ynput/ayon-addon";
|
|
12
12
|
import { useCreateContextMenu, ContextMenuProvider, GlobalContextMenu } from "@ynput/ayon-frontend-shared/ContextMenu";
|
|
13
13
|
import { useDispatch, Provider } from "react-redux";
|
|
14
14
|
import { BrowserRouter, useNavigate, useSearchParams, useParams, useLocation } from "react-router-dom";
|
|
@@ -405,6 +405,19 @@ const SLOT_AREAS = [
|
|
|
405
405
|
]
|
|
406
406
|
}
|
|
407
407
|
]
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
label: "Settings",
|
|
411
|
+
icon: "settings",
|
|
412
|
+
sections: [
|
|
413
|
+
{
|
|
414
|
+
label: "User details",
|
|
415
|
+
slots: [
|
|
416
|
+
{ slot: "userDetails.section", label: "Sections" },
|
|
417
|
+
{ slot: "userDetails.menuItem", label: "More menu" }
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
]
|
|
408
421
|
}
|
|
409
422
|
];
|
|
410
423
|
const slotPath = (slot) => {
|
|
@@ -417,7 +430,14 @@ const slotPath = (slot) => {
|
|
|
417
430
|
return ["Other", slot];
|
|
418
431
|
};
|
|
419
432
|
const slotIcon = (slot) => SLOT_AREAS.find((area) => area.sections.some((s) => s.slots.some((x) => x.slot === slot)))?.icon || "extension";
|
|
420
|
-
const NO_PROJECT = [
|
|
433
|
+
const NO_PROJECT = [
|
|
434
|
+
"studio.page",
|
|
435
|
+
"header.item",
|
|
436
|
+
"projectList.menuItem",
|
|
437
|
+
"app.service",
|
|
438
|
+
"userDetails.section",
|
|
439
|
+
"userDetails.menuItem"
|
|
440
|
+
];
|
|
421
441
|
const PROJECTS = ["studio.page", "projectList.menuItem"];
|
|
422
442
|
const ENTITIES = [
|
|
423
443
|
"detailsPanel.tab",
|
|
@@ -438,7 +458,8 @@ const RUN = [
|
|
|
438
458
|
"projectList.menuItem",
|
|
439
459
|
"slicer.menuItem",
|
|
440
460
|
"entityMenuItem",
|
|
441
|
-
"table.shortcut"
|
|
461
|
+
"table.shortcut",
|
|
462
|
+
"userDetails.menuItem"
|
|
442
463
|
];
|
|
443
464
|
const needsProject = (slot) => !!slot && !NO_PROJECT.includes(slot);
|
|
444
465
|
const needsProjects = (slot) => !!slot && PROJECTS.includes(slot);
|
|
@@ -1217,6 +1238,59 @@ const ServiceStage = ({ contribution, selection }) => {
|
|
|
1217
1238
|
useReport(contribution, context, true);
|
|
1218
1239
|
return /* @__PURE__ */ jsx(ServiceNote, {});
|
|
1219
1240
|
};
|
|
1241
|
+
const UserDetailsStage = ({ contribution }) => {
|
|
1242
|
+
const signedIn = useUser$1();
|
|
1243
|
+
const { data: users = [], isLoading } = useGetUsersQuery({ selfName: signedIn?.name });
|
|
1244
|
+
const [picked, setPicked] = useState();
|
|
1245
|
+
const fallback = useMemo(
|
|
1246
|
+
() => users.find((u) => u.name === signedIn?.name && !u.isService) ?? users.find((u) => !u.isService && u.active !== false),
|
|
1247
|
+
[users, signedIn?.name]
|
|
1248
|
+
);
|
|
1249
|
+
const target = users.find((u) => u.name === picked) ?? fallback;
|
|
1250
|
+
const selected = useMemo(() => target ? [target] : [], [target]);
|
|
1251
|
+
const context = useUserDetailsSlotContext(selected, false);
|
|
1252
|
+
const isMenuItem = contribution.slot === "userDetails.menuItem";
|
|
1253
|
+
useReport(contribution, context, !!target, isMenuItem);
|
|
1254
|
+
const { topItems, items } = useAddonUserMenuItems(context);
|
|
1255
|
+
if (isLoading) return /* @__PURE__ */ jsx(Hint, { children: "Loading users…" });
|
|
1256
|
+
if (!target) return /* @__PURE__ */ jsx(Hint, { children: "No users to show." });
|
|
1257
|
+
return /* @__PURE__ */ jsx("div", { className: "ayon-shell-body", style: { justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs(
|
|
1258
|
+
"div",
|
|
1259
|
+
{
|
|
1260
|
+
style: { width: "min(420px, 100%)", display: "flex", flexDirection: "column", gap: 4 },
|
|
1261
|
+
"data-shell-surface": "user-details",
|
|
1262
|
+
children: [
|
|
1263
|
+
/* @__PURE__ */ jsxs("div", { className: "ayon-shell-bar", children: [
|
|
1264
|
+
/* @__PURE__ */ jsx(
|
|
1265
|
+
Dropdown,
|
|
1266
|
+
{
|
|
1267
|
+
value: [target.name],
|
|
1268
|
+
options: users.map((u) => ({
|
|
1269
|
+
value: u.name,
|
|
1270
|
+
label: u.isService ? `${u.name} (service)` : u.attrib?.fullName || u.name
|
|
1271
|
+
})),
|
|
1272
|
+
search: true,
|
|
1273
|
+
onChange: (names) => setPicked(names[0]),
|
|
1274
|
+
style: { minWidth: 200 }
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ jsx("span", { className: "spacer" }),
|
|
1278
|
+
[...topItems, ...items].map((item) => /* @__PURE__ */ jsx(
|
|
1279
|
+
Button,
|
|
1280
|
+
{
|
|
1281
|
+
icon: item.icon,
|
|
1282
|
+
label: item.label,
|
|
1283
|
+
variant: "text",
|
|
1284
|
+
onClick: () => item.onClick?.()
|
|
1285
|
+
},
|
|
1286
|
+
item.id
|
|
1287
|
+
))
|
|
1288
|
+
] }),
|
|
1289
|
+
/* @__PURE__ */ jsx(AddonUserDetailsSections, { context })
|
|
1290
|
+
]
|
|
1291
|
+
}
|
|
1292
|
+
) });
|
|
1293
|
+
};
|
|
1220
1294
|
const HeaderStage = ({ contribution, selection }) => {
|
|
1221
1295
|
const { contributions } = useContributions("header.item");
|
|
1222
1296
|
const [context, setContext] = useState();
|
|
@@ -1470,6 +1544,9 @@ const Stage = ({
|
|
|
1470
1544
|
return /* @__PURE__ */ jsx(TableStage, { ...props });
|
|
1471
1545
|
case "app.service":
|
|
1472
1546
|
return /* @__PURE__ */ jsx(ServiceStage, { ...props });
|
|
1547
|
+
case "userDetails.section":
|
|
1548
|
+
case "userDetails.menuItem":
|
|
1549
|
+
return /* @__PURE__ */ jsx(UserDetailsStage, { ...props });
|
|
1473
1550
|
default:
|
|
1474
1551
|
return /* @__PURE__ */ jsxs(Hint, { children: [
|
|
1475
1552
|
"The shell has no stage for ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ynput/ayon-addon-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Dev tooling for AYON addon frontends: Vite plugin, dev server, CLI, lint preset",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@module-federation/vite": ">=1.14",
|
|
44
|
-
"@ynput/ayon-addon": "0.
|
|
44
|
+
"@ynput/ayon-addon": "0.4.0",
|
|
45
45
|
"vite": ">=6",
|
|
46
|
-
"@ynput/ayon-frontend-shared": ">=0.8.
|
|
46
|
+
"@ynput/ayon-frontend-shared": ">=0.8.1",
|
|
47
47
|
"@ynput/ayon-react-components": "^1.25.1",
|
|
48
48
|
"primereact": ">=9",
|
|
49
49
|
"react": ">=18",
|