@checkmate-monitor/queue-frontend 0.0.2 → 0.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @checkmate-monitor/queue-frontend
2
2
 
3
+ ## 0.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 32ea706: ### User Menu Loading State Fix
8
+
9
+ Fixed user menu items "popping in" one after another due to independent async permission checks.
10
+
11
+ **Changes:**
12
+
13
+ - Added `UserMenuItemsContext` interface with `permissions` and `hasCredentialAccount` to `@checkmate-monitor/frontend-api`
14
+ - `LoginNavbarAction` now pre-fetches all permissions and credential account info before rendering the menu
15
+ - All user menu item components now use the passed context for synchronous permission checks instead of async hooks
16
+ - Uses `qualifyPermissionId` helper for fully-qualified permission IDs
17
+
18
+ **Result:** All menu items appear simultaneously when the user menu opens.
19
+
20
+ - Updated dependencies [52231ef]
21
+ - Updated dependencies [b0124ef]
22
+ - Updated dependencies [54cc787]
23
+ - Updated dependencies [a65e002]
24
+ - Updated dependencies [ae33df2]
25
+ - Updated dependencies [32ea706]
26
+ - @checkmate-monitor/ui@0.1.2
27
+ - @checkmate-monitor/common@0.2.0
28
+ - @checkmate-monitor/frontend-api@0.1.0
29
+ - @checkmate-monitor/queue-common@0.0.3
30
+
31
+ ## 0.0.3
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [0f8cc7d]
36
+ - @checkmate-monitor/frontend-api@0.0.3
37
+ - @checkmate-monitor/ui@0.1.1
38
+
3
39
  ## 0.0.2
4
40
 
5
41
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkmate-monitor/queue-frontend",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,19 +1,25 @@
1
1
  import React from "react";
2
2
  import { Link } from "react-router-dom";
3
3
  import { ListOrdered } from "lucide-react";
4
- import { useApi, permissionApiRef } from "@checkmate-monitor/frontend-api";
4
+ import type { UserMenuItemsContext } from "@checkmate-monitor/frontend-api";
5
5
  import { DropdownMenuItem } from "@checkmate-monitor/ui";
6
- import { resolveRoute } from "@checkmate-monitor/common";
7
- import { queueRoutes } from "@checkmate-monitor/queue-common";
6
+ import { qualifyPermissionId, resolveRoute } from "@checkmate-monitor/common";
7
+ import {
8
+ queueRoutes,
9
+ permissions,
10
+ pluginMetadata,
11
+ } from "@checkmate-monitor/queue-common";
8
12
 
9
- export const QueueUserMenuItems = () => {
10
- const permissionApi = useApi(permissionApiRef);
11
- const { allowed: canRead, loading } = permissionApi.useResourcePermission(
12
- "queue",
13
- "read"
13
+ export const QueueUserMenuItems = ({
14
+ permissions: userPerms,
15
+ }: UserMenuItemsContext) => {
16
+ const qualifiedId = qualifyPermissionId(
17
+ pluginMetadata,
18
+ permissions.queueRead
14
19
  );
20
+ const canRead = userPerms.includes("*") || userPerms.includes(qualifiedId);
15
21
 
16
- if (loading || !canRead) {
22
+ if (!canRead) {
17
23
  return <React.Fragment />;
18
24
  }
19
25
 
package/src/index.tsx CHANGED
@@ -2,9 +2,10 @@ import {
2
2
  rpcApiRef,
3
3
  ApiRef,
4
4
  UserMenuItemsSlot,
5
+ createSlotExtension,
6
+ createFrontendPlugin,
5
7
  } from "@checkmate-monitor/frontend-api";
6
8
  import { queueApiRef, type QueueApiClient } from "./api";
7
- import { createFrontendPlugin } from "@checkmate-monitor/frontend-api";
8
9
  import { QueueConfigPage } from "./pages/QueueConfigPage";
9
10
  import { QueueUserMenuItems } from "./components/UserMenuItems";
10
11
  import {
@@ -33,11 +34,10 @@ export const queuePlugin = createFrontendPlugin({
33
34
  },
34
35
  ],
35
36
  extensions: [
36
- {
37
+ createSlotExtension(UserMenuItemsSlot, {
37
38
  id: "queue.user-menu.items",
38
- slot: UserMenuItemsSlot,
39
39
  component: QueueUserMenuItems,
40
- },
40
+ }),
41
41
  ],
42
42
  });
43
43