better-supabase 0.30.0 → 0.31.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/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/{app-tables-yyVncXEt.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
- package/dist/astro/index.js +2 -2
- package/dist/{authorization-CDU9tYA_.d.ts → authorization-DfEkyFt_.d.ts} +10 -3
- package/dist/{bind-p7asfI6H.d.ts → bind-DAx0bMSi.d.ts} +2 -2
- package/dist/{block-env-B8wG3xeh.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
- package/dist/blocks/ai-chat/index.d.ts +3 -3
- package/dist/blocks/announcements/index.d.ts +3 -3
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/attachments/index.d.ts +1 -1
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/automations/index.d.ts +1 -1
- package/dist/blocks/billing/index.d.ts +1 -1
- package/dist/blocks/bookings/index.d.ts +1 -1
- package/dist/blocks/calendar/index.d.ts +7 -3
- package/dist/blocks/calendar/index.js +5 -1
- package/dist/blocks/comments/index.d.ts +4 -4
- package/dist/blocks/employees/index.js +1 -4
- package/dist/blocks/entitlements/index.d.ts +2 -2
- package/dist/blocks/forms/index.d.ts +1 -1
- package/dist/blocks/inbox/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/messaging/index.d.ts +4 -4
- package/dist/blocks/mfa/index.d.ts +1 -1
- package/dist/blocks/notifications/index.d.ts +3 -3
- package/dist/blocks/notifications/index.js +5 -43
- package/dist/blocks/onboarding/index.d.ts +1 -1
- package/dist/blocks/organizations/index.d.ts +34 -21
- package/dist/blocks/organizations/index.js +5 -1
- package/dist/blocks/permissions/index.d.ts +32 -3
- package/dist/blocks/permissions/index.js +23 -2
- package/dist/blocks/push/index.d.ts +10 -2
- package/dist/blocks/push/index.js +23 -7
- package/dist/blocks/reactions/index.d.ts +3 -3
- package/dist/blocks/saved-views/index.d.ts +1 -1
- package/dist/blocks/search/index.d.ts +2 -2
- package/dist/blocks/sessions/index.d.ts +1 -1
- package/dist/blocks/settings/index.d.ts +1 -1
- package/dist/blocks/subjects/index.d.ts +1 -1
- package/dist/blocks/tags/index.d.ts +1 -1
- package/dist/blocks/tasks/index.js +1 -1
- package/dist/blocks/teams/index.d.ts +7 -1
- package/dist/blocks/teams/index.js +8 -7
- package/dist/blocks/undo/index.d.ts +1 -1
- package/dist/blocks/usage/index.d.ts +1 -1
- package/dist/blocks/workflow-editor/index.d.ts +3 -3
- package/dist/blocks/workflows/index.d.ts +3 -3
- package/dist/cli/{add-Dggyehsy.js → add-B9wP0YGU.js} +2 -2
- package/dist/cli/{add-D4w-Axib.js → add-DjZXKd7X.js} +10 -10
- package/dist/cli/add-ZcEOEK23.js +1 -0
- package/dist/cli/{app-table-files-CiGuwLkO.js → app-table-files-mtvjHa48.js} +2 -2
- package/dist/cli/{backfill-DjVjXW_P.js → backfill-Coshdvh_.js} +2 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-jRL9K1R8.js → blocks-BWCuA0nq.js} +2 -2
- package/dist/cli/{blocks-Bbmb6W_F.js → blocks-hiSazThw.js} +1 -1
- package/dist/cli/{cache-BuoIFlUJ.js → cache-x2wWAy0h.js} +1 -1
- package/dist/cli/{codemod-DRavXBCb.js → codemod-BnjV7BpC.js} +210 -11
- package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
- package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
- package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
- package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
- package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
- package/dist/cli/{content-mapper-BCtyfKXl.js → content-mapper-DvOSOdTE.js} +2 -2
- package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
- package/dist/cli/{doctor-Di2ZekfN.js → doctor-Ywy8oJEU.js} +41 -16
- package/dist/cli/env-CNjT_uOV.js +1 -0
- package/dist/cli/{env-B2CbnbzD.js → env-XMiKvhtV.js} +1 -1
- package/dist/cli/{gen-STKC9vkK.js → gen-B-FbQmG1.js} +14 -14
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-DW6_nIwj.js → init-fb9e1BKX.js} +9 -9
- package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
- package/dist/cli/{live-0G4Plw3K.js → live-DIt7TP-N.js} +2 -2
- package/dist/cli/{mcp-flKS8iU5.js → mcp-CVWwraga.js} +3 -3
- package/dist/cli/{metadata-VARUbXEe.js → metadata-CannIjel.js} +3 -3
- package/dist/cli/{migrate-Bkq07XcT.js → migrate-Ht2TzIQF.js} +2 -2
- package/dist/cli/{migration-safety-BfVeza5j.js → migration-safety-nNyB05I-.js} +1 -1
- package/dist/cli/{migrations-BCq7Zs2E.js → migrations-bAd7dpk1.js} +2 -2
- package/dist/cli/{module-migration-lbeUrsYv.js → module-migration-CkNux8dr.js} +2 -2
- package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
- package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
- package/dist/cli/{powersync-B15CfH5Y.js → powersync-B2v0tDwp.js} +100 -7
- package/dist/cli/powersync-D3mAQ6QE.js +1 -0
- package/dist/cli/{print-DjxpBRnv.js → print-CxQ0rBKT.js} +2 -2
- package/dist/cli/{providers-dyxcHQY3.js → providers-DtI90lSw.js} +1 -1
- package/dist/cli/{remove-BLq5gbal.js → remove-DYtE4IZ4.js} +6 -6
- package/dist/cli/{render-CizUf3RW.js → render-QGWfEoiB.js} +3 -3
- package/dist/cli/{run-ChEjR7yw.js → run-B5aMwErM.js} +2 -2
- package/dist/cli/{run-MwM__teL.js → run-BNoJKf5I.js} +40 -39
- package/dist/cli/{run-ChOY6s4o.js → run-DiYX1XEa.js} +8 -8
- package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
- package/dist/cli/seed-Cm-c0BDd.js +1 -0
- package/dist/cli/{shared-DV5wIv-7.js → shared-D_CFi5di.js} +1 -1
- package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
- package/dist/cli/{snapshot-B5LXkVMC.js → snapshot-BlQ4DDcJ.js} +9 -4
- package/dist/cli/{source-BoLNG_2A.js → source-CelMBQMj.js} +1 -1
- package/dist/cli/{spec-D6QeE2Zx.js → spec-BxcoGE0h.js} +1 -1
- package/dist/cli/{spec-Dz-PGCaM.js → spec-iBx1LcYO.js} +3 -3
- package/dist/cli/{sql-layout-zo02f3Dm.js → sql-layout-Dp4Rottt.js} +2 -2
- package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
- package/dist/cli/{sync-m-oZ_SyI.js → sync-BnORI43S.js} +4 -4
- package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
- package/dist/cli/{upgrade-C9sgVZ5z.js → upgrade-CR6-WmIc.js} +5 -5
- package/dist/cli/{upgrade-WwEJaX3i.js → upgrade-fz92aCnh.js} +3 -3
- package/dist/cli/{version-D2BQuqta.js → version-Dz8ZlOuh.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +4 -4
- package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
- package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
- package/dist/{context-nbYYjv7U.d.ts → context-DWWoP1wK.d.ts} +1 -1
- package/dist/{controller-TRocodqG.d.ts → controller-Br9dGKGe.d.ts} +1 -1
- package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +3 -3
- package/dist/create/lite/index.js +3 -3
- package/dist/delivery-events-DbL8IHIY.js +53 -0
- package/dist/edge/index.js +3 -3
- package/dist/{entitlements-B1i1-wfe.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
- package/dist/eve/index.js +1 -1
- package/dist/expo/index.js +3 -2
- package/dist/{field-errors-tJvehEFc.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
- package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/{index-BkzXwuIN.d.ts → index-Clyd2Goi.d.ts} +1 -1
- package/dist/{index-zsgNmE8m.d.ts → index-D98bQs8a.d.ts} +7 -7
- package/dist/{index-BKrxynq9.d.ts → index-DIdPoQtO.d.ts} +2 -2
- package/dist/{index-CWAQRWY8.d.ts → index-I8YLxKq8.d.ts} +2 -2
- package/dist/{index-8US7qlvW.d.ts → index-eRBuKtMt.d.ts} +2 -2
- package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
- package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/next/index.d.ts +73 -6
- package/dist/next/index.js +88 -35
- package/dist/{operations-CB9atU2e.d.ts → operations-hm1Isvvs.d.ts} +1 -1
- package/dist/{options-BKBy5wM_.js → options-CF6EVF_G.js} +2 -1
- package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
- package/dist/orpc/index.js +2 -1
- package/dist/otel/index.js +4 -4
- package/dist/{ports-hpbyMySO.d.ts → ports-DOrPTJzl.d.ts} +1 -1
- package/dist/powersync/index.d.ts +204 -4
- package/dist/powersync/index.js +361 -4
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
- package/dist/{project-B32wb5J6.js → project-DJ9Uo0sT.js} +5 -5
- package/dist/{push-token-DQ1ycFPU.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
- package/dist/react-router/index.js +2 -2
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
- package/dist/records/index.d.ts +5 -5
- package/dist/records/index.js +3 -3
- package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
- package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
- package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -4
- package/dist/{sign-in-Cyj3ZlFX.js → sign-in-CuZ1Ag7O.js} +17 -2
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.js +1 -1
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +3 -3
- package/dist/{sql-CyeDg3Yh.js → sql-DHp0L7zK.js} +404 -165
- package/dist/ssr/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-C9YE_kqK.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
- package/dist/testing/index.d.ts +13 -4
- package/dist/testing/index.js +17 -15
- package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
- package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
- package/dist/{topic-breZqx_4.d.ts → topic-BaUElNw2.d.ts} +1 -1
- package/dist/{types-C3I7S51U.d.ts → types-CMN0h_Ix.d.ts} +2 -2
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-ItO3dz8m.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
- package/dist/workflow-sdk/world/index.js +2 -2
- package/dist/{workflow-sdk-BWPsdzVK.js → workflow-sdk-DJJkP0dT.js} +12 -1
- package/dist/yjs/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +9 -1
- package/schemas/doctor-report-v1.json +1 -0
- package/skills/better-supabase/references/ui-recipes.md +524 -295
- package/skills/better-supabase-api/references/powersync.md +16 -0
- package/skills/better-supabase-auth/SKILL.md +4 -1
- package/dist/cli/add-BdhGOwkB.js +0 -1
- package/dist/cli/env-CynGCICL.js +0 -1
- package/dist/cli/powersync-DnBsDchT.js +0 -1
- package/dist/cli/seed-BOun22-k.js +0 -1
|
@@ -368,7 +368,7 @@ import {
|
|
|
368
368
|
} from "@/components/ui/dialog";
|
|
369
369
|
import { Input } from "@/components/ui/input";
|
|
370
370
|
import { useCommandSearch } from "@/hooks/use-search";
|
|
371
|
-
import { Link } from "@/i18n/navigation";
|
|
371
|
+
import { Link, toAppHref } from "@/i18n/navigation";
|
|
372
372
|
import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
373
373
|
|
|
374
374
|
/** The API schema `gen` wrote for the search block. */
|
|
@@ -449,7 +449,7 @@ export function CommandSearch() {
|
|
|
449
449
|
{group.items.map((item) => (
|
|
450
450
|
<li key={`${item.subjectType}:${item.subjectId}`}>
|
|
451
451
|
<Link
|
|
452
|
-
href={item.url
|
|
452
|
+
href={toAppHref(item.url)}
|
|
453
453
|
onClick={() => void search.select(item)}
|
|
454
454
|
className="block rounded-md px-2 py-1.5 outline-none hover:bg-muted focus-visible:bg-muted"
|
|
455
455
|
>
|
|
@@ -616,7 +616,7 @@ import { Progress } from "@/components/ui/progress";
|
|
|
616
616
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
617
617
|
import { gettingStarted } from "@/features/onboarding/checklist";
|
|
618
618
|
import { useOnboarding } from "@/hooks/use-onboarding";
|
|
619
|
-
import { Link } from "@/i18n/navigation";
|
|
619
|
+
import { Link, toAppHref } from "@/i18n/navigation";
|
|
620
620
|
import { useAuth } from "@/lib/hooks";
|
|
621
621
|
import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
622
622
|
|
|
@@ -684,7 +684,7 @@ export function OnboardingCard() {
|
|
|
684
684
|
</span>
|
|
685
685
|
{step.completed ? null : (
|
|
686
686
|
<Link
|
|
687
|
-
href={step.href
|
|
687
|
+
href={toAppHref(step.href)}
|
|
688
688
|
className={buttonVariants({ variant: "outline", size: "sm" })}
|
|
689
689
|
>
|
|
690
690
|
{t("Start")}
|
|
@@ -1158,18 +1158,31 @@ npx shadcn add @better-supabase/use-organizations
|
|
|
1158
1158
|
```
|
|
1159
1159
|
|
|
1160
1160
|
```tsx title="apps/examples/expo-powersync/src/components/organization-switcher.tsx"
|
|
1161
|
+
import type { OrganizationMembership } from "better-supabase/blocks/organizations";
|
|
1162
|
+
|
|
1161
1163
|
import { ActivityIndicator, Pressable, Text, View } from "react-native";
|
|
1162
1164
|
|
|
1165
|
+
import type { OrganizationSource } from "../hooks/use-organizations";
|
|
1166
|
+
|
|
1163
1167
|
import { useOrganizations } from "../hooks/use-organizations";
|
|
1164
1168
|
import { API_SCHEMA } from "../lib/blocks";
|
|
1165
1169
|
|
|
1166
1170
|
/**
|
|
1167
1171
|
* The caller's organizations. Pressing one switches to it, refreshes the
|
|
1168
|
-
* session so the token carries the new tenant, and loads the list again.
|
|
1172
|
+
* session so the token carries the new tenant, and loads the list again. `load`
|
|
1173
|
+
* reads them elsewhere, such as from the PowerSync database.
|
|
1169
1174
|
*/
|
|
1170
|
-
export function OrganizationSwitcher(
|
|
1175
|
+
export function OrganizationSwitcher({
|
|
1176
|
+
load,
|
|
1177
|
+
}: {
|
|
1178
|
+
readonly load?: OrganizationSource<OrganizationMembership>;
|
|
1179
|
+
}) {
|
|
1171
1180
|
const { organizations, activeId, switching, error, switchTo } =
|
|
1172
|
-
useOrganizations(
|
|
1181
|
+
useOrganizations(
|
|
1182
|
+
load === undefined
|
|
1183
|
+
? { schema: API_SCHEMA }
|
|
1184
|
+
: { schema: API_SCHEMA, load },
|
|
1185
|
+
);
|
|
1173
1186
|
|
|
1174
1187
|
if (organizations === undefined) {
|
|
1175
1188
|
return <ActivityIndicator />;
|
|
@@ -2163,24 +2176,47 @@ An organization's members with their roles, where a role change shows at once an
|
|
|
2163
2176
|
Web, with shadcn components:
|
|
2164
2177
|
|
|
2165
2178
|
```bash
|
|
2166
|
-
npx shadcn add avatar button select
|
|
2179
|
+
npx shadcn add avatar badge button empty input select
|
|
2167
2180
|
```
|
|
2168
2181
|
|
|
2169
2182
|
```bash
|
|
2170
2183
|
npx shadcn add @better-supabase/use-organizations
|
|
2171
2184
|
```
|
|
2172
2185
|
|
|
2173
|
-
```tsx title="apps/examples/nextjs/src/features/
|
|
2186
|
+
```tsx title="apps/examples/nextjs/src/features/members/components/member-table.tsx"
|
|
2174
2187
|
"use client";
|
|
2175
2188
|
|
|
2189
|
+
import type { CellContext, ColumnDef } from "@tanstack/react-table";
|
|
2190
|
+
|
|
2191
|
+
import { useTable } from "@tanstack/react-table";
|
|
2176
2192
|
import { DbException } from "better-supabase";
|
|
2177
2193
|
import { UserMinusIcon } from "lucide-react";
|
|
2178
2194
|
import { useExtracted, useFormatter } from "next-intl";
|
|
2195
|
+
import { createContext, use, useCallback, useMemo, useState } from "react";
|
|
2179
2196
|
import { toast } from "sonner";
|
|
2180
2197
|
import * as v from "valibot";
|
|
2181
2198
|
|
|
2199
|
+
import type { DataGridFeatures } from "@/components/reui/data-grid/data-grid";
|
|
2200
|
+
import type { Member } from "@/features/organization/organization-queries";
|
|
2201
|
+
|
|
2202
|
+
import {
|
|
2203
|
+
DataGrid,
|
|
2204
|
+
DataGridContainer,
|
|
2205
|
+
dataGridFeatures,
|
|
2206
|
+
} from "@/components/reui/data-grid/data-grid";
|
|
2207
|
+
import { DataGridScrollArea } from "@/components/reui/data-grid/data-grid-scroll-area";
|
|
2208
|
+
import { DataGridTable } from "@/components/reui/data-grid/data-grid-table";
|
|
2182
2209
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
2210
|
+
import { Badge } from "@/components/ui/badge";
|
|
2183
2211
|
import { Button } from "@/components/ui/button";
|
|
2212
|
+
import {
|
|
2213
|
+
Empty,
|
|
2214
|
+
EmptyContent,
|
|
2215
|
+
EmptyDescription,
|
|
2216
|
+
EmptyHeader,
|
|
2217
|
+
EmptyTitle,
|
|
2218
|
+
} from "@/components/ui/empty";
|
|
2219
|
+
import { Input } from "@/components/ui/input";
|
|
2184
2220
|
import {
|
|
2185
2221
|
Select,
|
|
2186
2222
|
SelectContent,
|
|
@@ -2189,26 +2225,18 @@ import {
|
|
|
2189
2225
|
SelectValue,
|
|
2190
2226
|
} from "@/components/ui/select";
|
|
2191
2227
|
import {
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
TableHeader,
|
|
2197
|
-
TableRow,
|
|
2198
|
-
} from "@/components/ui/table";
|
|
2228
|
+
loadMembers,
|
|
2229
|
+
memberChanged,
|
|
2230
|
+
} from "@/features/organization/organization-actions";
|
|
2231
|
+
import { useRoleLabel } from "@/features/organization/use-role-label";
|
|
2199
2232
|
import { RoleBadge } from "@/features/user/components/role-badge";
|
|
2200
|
-
import { assignableRoles } from "@/features/user/user-permissions";
|
|
2201
2233
|
import { useMembers } from "@/hooks/use-organizations";
|
|
2234
|
+
import { Link } from "@/i18n/navigation";
|
|
2202
2235
|
import { Role } from "@/lib/claims";
|
|
2203
2236
|
import { initials } from "@/lib/initials";
|
|
2204
2237
|
import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
2205
2238
|
import { useErrorMessage } from "@/lib/use-error-message";
|
|
2206
2239
|
|
|
2207
|
-
import type { Member } from "../organization-queries";
|
|
2208
|
-
|
|
2209
|
-
import { loadMembers, memberChanged } from "../organization-actions";
|
|
2210
|
-
import { useRoleLabel } from "../use-role-label";
|
|
2211
|
-
|
|
2212
2240
|
async function loadOrganizationMembers(): Promise<readonly Member[]> {
|
|
2213
2241
|
const result = await loadMembers({});
|
|
2214
2242
|
|
|
@@ -2219,29 +2247,203 @@ async function loadOrganizationMembers(): Promise<readonly Member[]> {
|
|
|
2219
2247
|
return result.data;
|
|
2220
2248
|
}
|
|
2221
2249
|
|
|
2250
|
+
/** A team as the members table shows it: its name and who is on it. */
|
|
2251
|
+
export interface MemberTeam {
|
|
2252
|
+
readonly id: string;
|
|
2253
|
+
readonly name: string;
|
|
2254
|
+
readonly memberIds: readonly string[];
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
type MemberRow = Member & {
|
|
2258
|
+
readonly teams: readonly MemberTeam[];
|
|
2259
|
+
readonly you: boolean;
|
|
2260
|
+
/** The roles the caller may pick here, empty when the role is fixed. */
|
|
2261
|
+
readonly roleChoices: readonly Role[];
|
|
2262
|
+
readonly removable: boolean;
|
|
2263
|
+
readonly busy: boolean;
|
|
2264
|
+
};
|
|
2265
|
+
|
|
2266
|
+
type MemberCell = CellContext<DataGridFeatures, MemberRow>;
|
|
2267
|
+
|
|
2268
|
+
const ALL_ROLES = "all";
|
|
2269
|
+
|
|
2270
|
+
function MemberCellView({ row }: MemberCell) {
|
|
2271
|
+
const t = useExtracted("members");
|
|
2272
|
+
const member = row.original;
|
|
2273
|
+
|
|
2274
|
+
return (
|
|
2275
|
+
<div className="flex items-center gap-3">
|
|
2276
|
+
<Avatar className="size-8">
|
|
2277
|
+
{member.avatarUrl ? (
|
|
2278
|
+
<AvatarImage src={member.avatarUrl} alt="" />
|
|
2279
|
+
) : null}
|
|
2280
|
+
<AvatarFallback>{initials(member.name, member.email)}</AvatarFallback>
|
|
2281
|
+
</Avatar>
|
|
2282
|
+
<div className="grid min-w-0 leading-tight">
|
|
2283
|
+
<Link
|
|
2284
|
+
href={`/settings/members/${member.userId}`}
|
|
2285
|
+
className="truncate font-medium hover:underline"
|
|
2286
|
+
>
|
|
2287
|
+
{member.name ?? member.email}
|
|
2288
|
+
{member.you ? (
|
|
2289
|
+
<span className="font-normal text-muted-foreground">
|
|
2290
|
+
{" "}
|
|
2291
|
+
({t("you")})
|
|
2292
|
+
</span>
|
|
2293
|
+
) : null}
|
|
2294
|
+
</Link>
|
|
2295
|
+
<span className="truncate text-xs text-muted-foreground">
|
|
2296
|
+
{member.email}
|
|
2297
|
+
</span>
|
|
2298
|
+
</div>
|
|
2299
|
+
</div>
|
|
2300
|
+
);
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
function TeamsCell({ row }: MemberCell) {
|
|
2304
|
+
const { teams } = row.original;
|
|
2305
|
+
|
|
2306
|
+
if (teams.length === 0) {
|
|
2307
|
+
return <span className="text-muted-foreground">–</span>;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
return (
|
|
2311
|
+
<div className="flex flex-wrap gap-1">
|
|
2312
|
+
{teams.map((team) => (
|
|
2313
|
+
<Badge key={team.id} variant="outline">
|
|
2314
|
+
{team.name}
|
|
2315
|
+
</Badge>
|
|
2316
|
+
))}
|
|
2317
|
+
</div>
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
function JoinedCell({ row }: MemberCell) {
|
|
2322
|
+
const format = useFormatter();
|
|
2323
|
+
const { joinedAt } = row.original;
|
|
2324
|
+
|
|
2325
|
+
return (
|
|
2326
|
+
<span className="text-muted-foreground tabular-nums">
|
|
2327
|
+
{joinedAt
|
|
2328
|
+
? format.dateTime(new Date(joinedAt), { dateStyle: "medium" })
|
|
2329
|
+
: "–"}
|
|
2330
|
+
</span>
|
|
2331
|
+
);
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
interface MemberActions {
|
|
2335
|
+
readonly changeRole: (member: Member, role: Role) => Promise<void>;
|
|
2336
|
+
readonly removeMember: (member: Member) => Promise<void>;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
const MemberActionsContext = createContext<MemberActions | null>(null);
|
|
2340
|
+
|
|
2341
|
+
function useMemberActions(): MemberActions {
|
|
2342
|
+
const actions = use(MemberActionsContext);
|
|
2343
|
+
|
|
2344
|
+
if (actions === null) {
|
|
2345
|
+
throw new Error("Render member cells inside <MemberTable>.");
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
return actions;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
function RoleCell({ row }: MemberCell) {
|
|
2352
|
+
const t = useExtracted("members");
|
|
2353
|
+
const roleLabel = useRoleLabel();
|
|
2354
|
+
const { changeRole } = useMemberActions();
|
|
2355
|
+
const member = row.original;
|
|
2356
|
+
|
|
2357
|
+
if (member.roleChoices.length === 0) {
|
|
2358
|
+
return <RoleBadge role={member.role} />;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
const items = member.roleChoices.map((role) => ({
|
|
2362
|
+
value: role,
|
|
2363
|
+
label: roleLabel(role),
|
|
2364
|
+
}));
|
|
2365
|
+
|
|
2366
|
+
return (
|
|
2367
|
+
<Select
|
|
2368
|
+
value={member.role}
|
|
2369
|
+
items={items}
|
|
2370
|
+
disabled={member.busy}
|
|
2371
|
+
onValueChange={(value) => {
|
|
2372
|
+
if (v.is(Role, value)) {
|
|
2373
|
+
void changeRole(member, value);
|
|
2374
|
+
}
|
|
2375
|
+
}}
|
|
2376
|
+
>
|
|
2377
|
+
<SelectTrigger size="sm" className="w-32" aria-label={t("Role")}>
|
|
2378
|
+
<SelectValue />
|
|
2379
|
+
</SelectTrigger>
|
|
2380
|
+
<SelectContent>
|
|
2381
|
+
{items.map((item) => (
|
|
2382
|
+
<SelectItem key={item.value} value={item.value}>
|
|
2383
|
+
{item.label}
|
|
2384
|
+
</SelectItem>
|
|
2385
|
+
))}
|
|
2386
|
+
</SelectContent>
|
|
2387
|
+
</Select>
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
function ActionsCell({ row }: MemberCell) {
|
|
2392
|
+
const t = useExtracted("members");
|
|
2393
|
+
const { removeMember } = useMemberActions();
|
|
2394
|
+
const member = row.original;
|
|
2395
|
+
|
|
2396
|
+
if (!member.removable) {
|
|
2397
|
+
return null;
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
return (
|
|
2401
|
+
<Button
|
|
2402
|
+
variant="ghost"
|
|
2403
|
+
size="icon-sm"
|
|
2404
|
+
disabled={member.busy}
|
|
2405
|
+
aria-label={t("Remove {name}", {
|
|
2406
|
+
name: member.name ?? member.email ?? "",
|
|
2407
|
+
})}
|
|
2408
|
+
onClick={() => {
|
|
2409
|
+
void removeMember(member);
|
|
2410
|
+
}}
|
|
2411
|
+
>
|
|
2412
|
+
<UserMinusIcon />
|
|
2413
|
+
</Button>
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2222
2417
|
/**
|
|
2223
|
-
* The organization's members
|
|
2224
|
-
*
|
|
2418
|
+
* The organization's members in a ReUI data grid, with a search and a role
|
|
2419
|
+
* filter. The server renders the rows; a role change shows at once and goes
|
|
2420
|
+
* through `update_member_role` in the browser.
|
|
2225
2421
|
*/
|
|
2226
2422
|
export function MemberTable({
|
|
2227
2423
|
organizationId,
|
|
2228
2424
|
initial,
|
|
2425
|
+
teams,
|
|
2229
2426
|
currentUserId,
|
|
2230
|
-
|
|
2427
|
+
assignable,
|
|
2231
2428
|
canUpdateRole,
|
|
2232
2429
|
canRemove,
|
|
2233
2430
|
}: {
|
|
2234
2431
|
organizationId: string;
|
|
2235
2432
|
initial: readonly Member[];
|
|
2433
|
+
teams: readonly MemberTeam[];
|
|
2236
2434
|
currentUserId: string;
|
|
2237
|
-
|
|
2435
|
+
assignable: readonly Role[];
|
|
2238
2436
|
canUpdateRole: boolean;
|
|
2239
2437
|
canRemove: boolean;
|
|
2240
2438
|
}) {
|
|
2241
|
-
const t = useExtracted("
|
|
2439
|
+
const t = useExtracted("members");
|
|
2242
2440
|
const roleLabel = useRoleLabel();
|
|
2243
2441
|
const errorMessage = useErrorMessage();
|
|
2244
|
-
const
|
|
2442
|
+
const [search, setSearch] = useState("");
|
|
2443
|
+
|
|
2444
|
+
const [roleFilter, setRoleFilter] = useState<Role | typeof ALL_ROLES>(
|
|
2445
|
+
ALL_ROLES,
|
|
2446
|
+
);
|
|
2245
2447
|
|
|
2246
2448
|
const { members, pending, setRole, remove } = useMembers({
|
|
2247
2449
|
organizationId,
|
|
@@ -2253,12 +2455,10 @@ export function MemberTable({
|
|
|
2253
2455
|
},
|
|
2254
2456
|
});
|
|
2255
2457
|
|
|
2256
|
-
const
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
label: roleLabel(role),
|
|
2261
|
-
}));
|
|
2458
|
+
const filterItems = [
|
|
2459
|
+
{ value: ALL_ROLES, label: t("All roles") },
|
|
2460
|
+
...Role.options.map((role) => ({ value: role, label: roleLabel(role) })),
|
|
2461
|
+
];
|
|
2262
2462
|
|
|
2263
2463
|
// Nobody changes their own role or an owner's here; ownership moves by transfer.
|
|
2264
2464
|
const editable = (member: Member) =>
|
|
@@ -2266,130 +2466,146 @@ export function MemberTable({
|
|
|
2266
2466
|
member.role !== "owner" &&
|
|
2267
2467
|
assignable.includes(member.role);
|
|
2268
2468
|
|
|
2269
|
-
const
|
|
2469
|
+
const changeRole = useCallback(
|
|
2470
|
+
async (member: Member, role: Role) => {
|
|
2471
|
+
const result = await setRole(member.userId, role);
|
|
2270
2472
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2473
|
+
if (result.ok) {
|
|
2474
|
+
toast.success(t("Role updated"));
|
|
2475
|
+
} else {
|
|
2476
|
+
toast.error(errorMessage(result.error));
|
|
2477
|
+
}
|
|
2478
|
+
},
|
|
2479
|
+
[setRole, t, errorMessage],
|
|
2480
|
+
);
|
|
2273
2481
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
toast.error(errorMessage(result.error));
|
|
2278
|
-
}
|
|
2279
|
-
};
|
|
2482
|
+
const removeMember = useCallback(
|
|
2483
|
+
async (member: Member) => {
|
|
2484
|
+
const result = await remove(member.userId);
|
|
2280
2485
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2486
|
+
if (result.ok) {
|
|
2487
|
+
toast.success(t("Member removed"));
|
|
2488
|
+
} else {
|
|
2489
|
+
toast.error(errorMessage(result.error));
|
|
2490
|
+
}
|
|
2491
|
+
},
|
|
2492
|
+
[remove, t, errorMessage],
|
|
2493
|
+
);
|
|
2283
2494
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2495
|
+
const actions = useMemo(
|
|
2496
|
+
() => ({ changeRole, removeMember }),
|
|
2497
|
+
[changeRole, removeMember],
|
|
2498
|
+
);
|
|
2499
|
+
|
|
2500
|
+
const columns: ColumnDef<DataGridFeatures, MemberRow>[] = [
|
|
2501
|
+
{ id: "member", header: t("Member"), cell: MemberCellView, size: 280 },
|
|
2502
|
+
{ accessorKey: "role", header: t("Role"), cell: RoleCell, size: 150 },
|
|
2503
|
+
{ id: "teams", header: t("Teams"), cell: TeamsCell, size: 200 },
|
|
2504
|
+
{
|
|
2505
|
+
accessorKey: "joinedAt",
|
|
2506
|
+
header: t("Joined"),
|
|
2507
|
+
cell: JoinedCell,
|
|
2508
|
+
size: 140,
|
|
2509
|
+
},
|
|
2510
|
+
{ id: "actions", header: "", cell: ActionsCell, size: 56 },
|
|
2511
|
+
];
|
|
2512
|
+
|
|
2513
|
+
const needle = search.trim().toLowerCase();
|
|
2514
|
+
const all = members ?? initial;
|
|
2515
|
+
|
|
2516
|
+
const data: MemberRow[] = all
|
|
2517
|
+
.filter(
|
|
2518
|
+
(member) =>
|
|
2519
|
+
(roleFilter === ALL_ROLES || member.role === roleFilter) &&
|
|
2520
|
+
(needle === "" ||
|
|
2521
|
+
[member.name, member.email].some((text) =>
|
|
2522
|
+
text?.toLowerCase().includes(needle),
|
|
2523
|
+
)),
|
|
2524
|
+
)
|
|
2525
|
+
.map((member) => ({
|
|
2526
|
+
...member,
|
|
2527
|
+
teams: teams.filter((team) => team.memberIds.includes(member.userId)),
|
|
2528
|
+
you: member.userId === currentUserId,
|
|
2529
|
+
roleChoices: canUpdateRole && editable(member) ? assignable : [],
|
|
2530
|
+
removable: canRemove && editable(member),
|
|
2531
|
+
busy: pending.includes(member.userId),
|
|
2532
|
+
}));
|
|
2533
|
+
|
|
2534
|
+
const table = useTable({
|
|
2535
|
+
features: dataGridFeatures,
|
|
2536
|
+
columns,
|
|
2537
|
+
data,
|
|
2538
|
+
getRowId: (row) => row.userId,
|
|
2539
|
+
});
|
|
2540
|
+
|
|
2541
|
+
const clearFilters = () => {
|
|
2542
|
+
setSearch("");
|
|
2543
|
+
setRoleFilter(ALL_ROLES);
|
|
2289
2544
|
};
|
|
2290
2545
|
|
|
2291
2546
|
return (
|
|
2292
|
-
<
|
|
2293
|
-
<
|
|
2294
|
-
<
|
|
2295
|
-
<
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2547
|
+
<MemberActionsContext value={actions}>
|
|
2548
|
+
<div className="flex flex-col gap-3">
|
|
2549
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
2550
|
+
<Input
|
|
2551
|
+
type="search"
|
|
2552
|
+
className="w-56"
|
|
2553
|
+
value={search}
|
|
2554
|
+
placeholder={t("Search members")}
|
|
2555
|
+
aria-label={t("Search members")}
|
|
2556
|
+
onChange={(event) => {
|
|
2557
|
+
setSearch(event.target.value);
|
|
2558
|
+
}}
|
|
2559
|
+
/>
|
|
2560
|
+
<Select
|
|
2561
|
+
value={roleFilter}
|
|
2562
|
+
items={filterItems}
|
|
2563
|
+
onValueChange={(value) => {
|
|
2564
|
+
setRoleFilter(v.is(Role, value) ? value : ALL_ROLES);
|
|
2565
|
+
}}
|
|
2307
2566
|
>
|
|
2308
|
-
<
|
|
2309
|
-
<
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
<
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
>
|
|
2351
|
-
<SelectValue />
|
|
2352
|
-
</SelectTrigger>
|
|
2353
|
-
<SelectContent>
|
|
2354
|
-
{roleItems.map((item) => (
|
|
2355
|
-
<SelectItem key={item.value} value={item.value}>
|
|
2356
|
-
{item.label}
|
|
2357
|
-
</SelectItem>
|
|
2358
|
-
))}
|
|
2359
|
-
</SelectContent>
|
|
2360
|
-
</Select>
|
|
2361
|
-
) : (
|
|
2362
|
-
<RoleBadge role={member.role} />
|
|
2363
|
-
)}
|
|
2364
|
-
</TableCell>
|
|
2365
|
-
<TableCell className="hidden text-muted-foreground sm:table-cell">
|
|
2366
|
-
{member.joinedAt
|
|
2367
|
-
? format.dateTime(new Date(member.joinedAt), {
|
|
2368
|
-
dateStyle: "medium",
|
|
2369
|
-
})
|
|
2370
|
-
: "–"}
|
|
2371
|
-
</TableCell>
|
|
2372
|
-
<TableCell>
|
|
2373
|
-
{canRemove && editable(member) ? (
|
|
2374
|
-
<Button
|
|
2375
|
-
variant="ghost"
|
|
2376
|
-
size="icon-sm"
|
|
2377
|
-
disabled={busy(member)}
|
|
2378
|
-
aria-label={t("Remove {name}", {
|
|
2379
|
-
name: member.name ?? member.email ?? "",
|
|
2380
|
-
})}
|
|
2381
|
-
onClick={() => {
|
|
2382
|
-
void removeMember(member);
|
|
2383
|
-
}}
|
|
2384
|
-
>
|
|
2385
|
-
<UserMinusIcon />
|
|
2386
|
-
</Button>
|
|
2387
|
-
) : null}
|
|
2388
|
-
</TableCell>
|
|
2389
|
-
</TableRow>
|
|
2390
|
-
))}
|
|
2391
|
-
</TableBody>
|
|
2392
|
-
</Table>
|
|
2567
|
+
<SelectTrigger size="sm" className="w-36" aria-label={t("Role")}>
|
|
2568
|
+
<SelectValue />
|
|
2569
|
+
</SelectTrigger>
|
|
2570
|
+
<SelectContent>
|
|
2571
|
+
{filterItems.map((item) => (
|
|
2572
|
+
<SelectItem key={item.value} value={item.value}>
|
|
2573
|
+
{item.label}
|
|
2574
|
+
</SelectItem>
|
|
2575
|
+
))}
|
|
2576
|
+
</SelectContent>
|
|
2577
|
+
</Select>
|
|
2578
|
+
</div>
|
|
2579
|
+
<div data-testid="members">
|
|
2580
|
+
<DataGrid
|
|
2581
|
+
table={table}
|
|
2582
|
+
recordCount={data.length}
|
|
2583
|
+
tableLayout={{ dense: true }}
|
|
2584
|
+
emptyMessage={
|
|
2585
|
+
<Empty>
|
|
2586
|
+
<EmptyHeader>
|
|
2587
|
+
<EmptyTitle>{t("No members match")}</EmptyTitle>
|
|
2588
|
+
<EmptyDescription>
|
|
2589
|
+
{t("Try another name or role.")}
|
|
2590
|
+
</EmptyDescription>
|
|
2591
|
+
</EmptyHeader>
|
|
2592
|
+
<EmptyContent>
|
|
2593
|
+
<Button size="sm" variant="outline" onClick={clearFilters}>
|
|
2594
|
+
{t("Clear filters")}
|
|
2595
|
+
</Button>
|
|
2596
|
+
</EmptyContent>
|
|
2597
|
+
</Empty>
|
|
2598
|
+
}
|
|
2599
|
+
>
|
|
2600
|
+
<DataGridContainer>
|
|
2601
|
+
<DataGridScrollArea>
|
|
2602
|
+
<DataGridTable />
|
|
2603
|
+
</DataGridScrollArea>
|
|
2604
|
+
</DataGridContainer>
|
|
2605
|
+
</DataGrid>
|
|
2606
|
+
</div>
|
|
2607
|
+
</div>
|
|
2608
|
+
</MemberActionsContext>
|
|
2393
2609
|
);
|
|
2394
2610
|
}
|
|
2395
2611
|
```
|
|
@@ -2492,7 +2708,7 @@ npx shadcn add button dialog field input select
|
|
|
2492
2708
|
npx shadcn add @better-supabase/use-organizations
|
|
2493
2709
|
```
|
|
2494
2710
|
|
|
2495
|
-
```tsx title="apps/examples/nextjs/src/features/
|
|
2711
|
+
```tsx title="apps/examples/nextjs/src/features/members/components/invite-member-dialog.tsx"
|
|
2496
2712
|
"use client";
|
|
2497
2713
|
|
|
2498
2714
|
import type { SubmitEvent } from "react";
|
|
@@ -2528,26 +2744,24 @@ import {
|
|
|
2528
2744
|
SelectTrigger,
|
|
2529
2745
|
SelectValue,
|
|
2530
2746
|
} from "@/components/ui/select";
|
|
2531
|
-
import {
|
|
2747
|
+
import { invitationSent } from "@/features/organization/organization-actions";
|
|
2748
|
+
import { useInviteLink } from "@/features/organization/use-invite-link";
|
|
2749
|
+
import { useRoleLabel } from "@/features/organization/use-role-label";
|
|
2532
2750
|
import { useInvitations } from "@/hooks/use-organizations";
|
|
2533
2751
|
import { Role } from "@/lib/claims";
|
|
2534
2752
|
import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
2535
2753
|
import { useErrorMessage } from "@/lib/use-error-message";
|
|
2536
2754
|
|
|
2537
|
-
import { invitationSent } from "../organization-actions";
|
|
2538
|
-
import { useInviteLink } from "../use-invite-link";
|
|
2539
|
-
import { useRoleLabel } from "../use-role-label";
|
|
2540
|
-
|
|
2541
2755
|
/**
|
|
2542
2756
|
* Invites a teammate through `invite_member` in the browser, then shows the
|
|
2543
2757
|
* accept link: the example has no mailer.
|
|
2544
2758
|
*/
|
|
2545
2759
|
export function InviteMemberDialog({
|
|
2546
2760
|
organizationId,
|
|
2547
|
-
|
|
2761
|
+
assignable,
|
|
2548
2762
|
}: {
|
|
2549
2763
|
organizationId: string;
|
|
2550
|
-
|
|
2764
|
+
assignable: readonly Role[];
|
|
2551
2765
|
}) {
|
|
2552
2766
|
const t = useExtracted("organization");
|
|
2553
2767
|
const fieldId = useId();
|
|
@@ -2558,7 +2772,7 @@ export function InviteMemberDialog({
|
|
|
2558
2772
|
const [email, setEmail] = useState("");
|
|
2559
2773
|
const [role, setRole] = useState<Role>("member");
|
|
2560
2774
|
|
|
2561
|
-
const roles =
|
|
2775
|
+
const roles = assignable.map((each) => ({
|
|
2562
2776
|
value: each,
|
|
2563
2777
|
label: roleLabel(each),
|
|
2564
2778
|
}));
|
|
@@ -7405,6 +7619,7 @@ import {
|
|
|
7405
7619
|
EmptyTitle,
|
|
7406
7620
|
} from "@/components/ui/empty";
|
|
7407
7621
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
7622
|
+
import { env } from "@/env";
|
|
7408
7623
|
import { useSupabase } from "@/lib/hooks";
|
|
7409
7624
|
import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
7410
7625
|
|
|
@@ -7415,7 +7630,7 @@ import { blockConfig } from "@/lib/supabase/blocks.generated";
|
|
|
7415
7630
|
const WORKER_URL = "/push-sw.js";
|
|
7416
7631
|
const PUSH_GUIDE = "https://bettersupabase.com/docs/blocks/push";
|
|
7417
7632
|
|
|
7418
|
-
const VAPID_PUBLIC_KEY =
|
|
7633
|
+
const VAPID_PUBLIC_KEY = env.NEXT_PUBLIC_VAPID_PUBLIC_KEY;
|
|
7419
7634
|
|
|
7420
7635
|
type PushState =
|
|
7421
7636
|
| { readonly kind: "checking" }
|
|
@@ -9160,7 +9375,7 @@ import { useExtracted } from "next-intl";
|
|
|
9160
9375
|
import { Button } from "@/components/ui/button";
|
|
9161
9376
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
9162
9377
|
import { useSubject } from "@/hooks/use-subjects";
|
|
9163
|
-
import { Link } from "@/i18n/navigation";
|
|
9378
|
+
import { Link, toAppHref } from "@/i18n/navigation";
|
|
9164
9379
|
|
|
9165
9380
|
/**
|
|
9166
9381
|
* A link to any subject in `config.subjects`, titled and routed by
|
|
@@ -9207,7 +9422,7 @@ export function SubjectLink({ subject }: { subject: RecordRef }) {
|
|
|
9207
9422
|
<span className="truncate text-sm font-medium">{title}</span>
|
|
9208
9423
|
) : (
|
|
9209
9424
|
<Link
|
|
9210
|
-
href={resolved.url}
|
|
9425
|
+
href={toAppHref(resolved.url)}
|
|
9211
9426
|
className="truncate text-sm font-medium underline-offset-4 transition-colors hover:underline"
|
|
9212
9427
|
>
|
|
9213
9428
|
{title}
|
|
@@ -9240,7 +9455,7 @@ import { useExtracted } from "next-intl";
|
|
|
9240
9455
|
import { Badge } from "@/components/reui/badge";
|
|
9241
9456
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
9242
9457
|
import { useSubject } from "@/hooks/use-subjects";
|
|
9243
|
-
import { Link } from "@/i18n/navigation";
|
|
9458
|
+
import { Link, toAppHref } from "@/i18n/navigation";
|
|
9244
9459
|
|
|
9245
9460
|
/**
|
|
9246
9461
|
* A compact badge for a subject: its type and title, linking to its page. Rows
|
|
@@ -9269,7 +9484,7 @@ export function SubjectChip({ subject }: { subject: RecordRef }) {
|
|
|
9269
9484
|
<Badge
|
|
9270
9485
|
variant="outline"
|
|
9271
9486
|
className="transition-colors hover:bg-accent"
|
|
9272
|
-
render={<Link href={resolved.url} />}
|
|
9487
|
+
render={<Link href={toAppHref(resolved.url)} />}
|
|
9273
9488
|
>
|
|
9274
9489
|
{content}
|
|
9275
9490
|
</Badge>
|
|
@@ -9556,7 +9771,7 @@ npx shadcn add alert badge button card empty skeleton
|
|
|
9556
9771
|
* with and whether they must sign in with SSO.
|
|
9557
9772
|
*/
|
|
9558
9773
|
export async function SsoSettings() {
|
|
9559
|
-
if (!can(await
|
|
9774
|
+
if (!can(await getPermissions(), "sso.manage")) {
|
|
9560
9775
|
forbidden();
|
|
9561
9776
|
}
|
|
9562
9777
|
|
|
@@ -9761,7 +9976,7 @@ npx shadcn add alert badge button card empty skeleton table
|
|
|
9761
9976
|
* back to the previous one when the duration runs out.
|
|
9762
9977
|
*/
|
|
9763
9978
|
export async function AccessRequestsInbox() {
|
|
9764
|
-
if (!can(await
|
|
9979
|
+
if (!can(await getPermissions(), "access_requests.create")) {
|
|
9765
9980
|
forbidden();
|
|
9766
9981
|
}
|
|
9767
9982
|
|
|
@@ -11339,13 +11554,13 @@ export async function ContactDetail({
|
|
|
11339
11554
|
}: {
|
|
11340
11555
|
params: Promise<{ id: string }>;
|
|
11341
11556
|
}) {
|
|
11342
|
-
const [{ id },
|
|
11557
|
+
const [{ id }, t, permissions] = await Promise.all([
|
|
11343
11558
|
params,
|
|
11344
|
-
getSession(),
|
|
11345
11559
|
getExtracted("crm"),
|
|
11560
|
+
getPermissions(),
|
|
11346
11561
|
]);
|
|
11347
11562
|
|
|
11348
|
-
if (!can(
|
|
11563
|
+
if (!can(permissions, "parties.read")) {
|
|
11349
11564
|
forbidden();
|
|
11350
11565
|
}
|
|
11351
11566
|
|
|
@@ -11476,7 +11691,7 @@ export async function ContactDetail({
|
|
|
11476
11691
|
))}
|
|
11477
11692
|
</ul>
|
|
11478
11693
|
)}
|
|
11479
|
-
{can(
|
|
11694
|
+
{can(permissions, "parties.write") ? (
|
|
11480
11695
|
<LinkPersonForm
|
|
11481
11696
|
companyId={contact.id}
|
|
11482
11697
|
people={contact.candidates.map((person) => ({
|
|
@@ -11527,9 +11742,12 @@ npx shadcn add card empty skeleton
|
|
|
11527
11742
|
* pipeline. Dragging a deal saves its new stage through `moveDeal`.
|
|
11528
11743
|
*/
|
|
11529
11744
|
export async function DealBoard() {
|
|
11530
|
-
const [
|
|
11745
|
+
const [t, permissions] = await Promise.all([
|
|
11746
|
+
getExtracted("crm"),
|
|
11747
|
+
getPermissions(),
|
|
11748
|
+
]);
|
|
11531
11749
|
|
|
11532
|
-
if (!can(
|
|
11750
|
+
if (!can(permissions, "deals.read")) {
|
|
11533
11751
|
forbidden();
|
|
11534
11752
|
}
|
|
11535
11753
|
|
|
@@ -11555,7 +11773,7 @@ export async function DealBoard() {
|
|
|
11555
11773
|
<CardDescription>
|
|
11556
11774
|
{t("Drag a deal to another stage to move it.")}
|
|
11557
11775
|
</CardDescription>
|
|
11558
|
-
{pipeline && can(
|
|
11776
|
+
{pipeline && can(permissions, "deals.write") ? (
|
|
11559
11777
|
<CardAction>
|
|
11560
11778
|
<CreateDealDialog pipelineId={pipeline.id} stages={openStages} />
|
|
11561
11779
|
</CardAction>
|
|
@@ -11572,14 +11790,14 @@ export async function DealBoard() {
|
|
|
11572
11790
|
</EmptyMedia>
|
|
11573
11791
|
<EmptyTitle>{t("No pipeline yet")}</EmptyTitle>
|
|
11574
11792
|
<EmptyDescription>
|
|
11575
|
-
{can(
|
|
11793
|
+
{can(permissions, "pipelines.manage")
|
|
11576
11794
|
? t(
|
|
11577
11795
|
"Start with six stages, from qualified to closed won or lost.",
|
|
11578
11796
|
)
|
|
11579
11797
|
: t("Ask an admin to create the sales pipeline.")}
|
|
11580
11798
|
</EmptyDescription>
|
|
11581
11799
|
</EmptyHeader>
|
|
11582
|
-
{can(
|
|
11800
|
+
{can(permissions, "pipelines.manage") ? (
|
|
11583
11801
|
<EmptyContent>
|
|
11584
11802
|
<CreatePipelineButton />
|
|
11585
11803
|
</EmptyContent>
|
|
@@ -11592,7 +11810,7 @@ export async function DealBoard() {
|
|
|
11592
11810
|
.join(",")}
|
|
11593
11811
|
stages={board.data.stages}
|
|
11594
11812
|
deals={board.data.deals}
|
|
11595
|
-
canMove={can(
|
|
11813
|
+
canMove={can(permissions, "deals.write")}
|
|
11596
11814
|
/>
|
|
11597
11815
|
)}
|
|
11598
11816
|
</CardContent>
|
|
@@ -11627,10 +11845,10 @@ const stepIcons = {
|
|
|
11627
11845
|
|
|
11628
11846
|
/** Render inside `<Suspense>`: the organization's sequences and their steps. */
|
|
11629
11847
|
export async function SequenceBuilder() {
|
|
11630
|
-
const [view,
|
|
11848
|
+
const [view, t, permissions] = await Promise.all([
|
|
11631
11849
|
getSequences(),
|
|
11632
|
-
getSession(),
|
|
11633
11850
|
getExtracted("sequences"),
|
|
11851
|
+
getPermissions(),
|
|
11634
11852
|
]);
|
|
11635
11853
|
|
|
11636
11854
|
if (view.kind === "no-organization") {
|
|
@@ -11654,7 +11872,7 @@ export async function SequenceBuilder() {
|
|
|
11654
11872
|
);
|
|
11655
11873
|
}
|
|
11656
11874
|
|
|
11657
|
-
const manage = can(
|
|
11875
|
+
const manage = can(permissions, "sequences.manage");
|
|
11658
11876
|
|
|
11659
11877
|
if (view.data.length === 0) {
|
|
11660
11878
|
return (
|
|
@@ -11810,13 +12028,13 @@ export async function ActivityTimeline({
|
|
|
11810
12028
|
}: {
|
|
11811
12029
|
subject: { type: ContactKind; id: string };
|
|
11812
12030
|
}) {
|
|
11813
|
-
const [
|
|
11814
|
-
getSession(),
|
|
12031
|
+
const [t, format, permissions] = await Promise.all([
|
|
11815
12032
|
getExtracted("crm"),
|
|
11816
12033
|
getFormatter(),
|
|
12034
|
+
getPermissions(),
|
|
11817
12035
|
]);
|
|
11818
12036
|
|
|
11819
|
-
if (!can(
|
|
12037
|
+
if (!can(permissions, "engagements.read")) {
|
|
11820
12038
|
return null;
|
|
11821
12039
|
}
|
|
11822
12040
|
|
|
@@ -11826,7 +12044,7 @@ export async function ActivityTimeline({
|
|
|
11826
12044
|
return null;
|
|
11827
12045
|
}
|
|
11828
12046
|
|
|
11829
|
-
const canLog = can(
|
|
12047
|
+
const canLog = can(permissions, "engagements.write");
|
|
11830
12048
|
|
|
11831
12049
|
const types = new Map([
|
|
11832
12050
|
["call", t("Call")],
|
|
@@ -11941,14 +12159,14 @@ export async function QuoteBuilder({
|
|
|
11941
12159
|
}: {
|
|
11942
12160
|
params: Promise<{ id: string }>;
|
|
11943
12161
|
}) {
|
|
11944
|
-
const [{ id },
|
|
12162
|
+
const [{ id }, t, locale, permissions] = await Promise.all([
|
|
11945
12163
|
params,
|
|
11946
|
-
getSession(),
|
|
11947
12164
|
getExtracted("crm"),
|
|
11948
12165
|
getLocale(),
|
|
12166
|
+
getPermissions(),
|
|
11949
12167
|
]);
|
|
11950
12168
|
|
|
11951
|
-
if (!can(
|
|
12169
|
+
if (!can(permissions, "quotes.read")) {
|
|
11952
12170
|
forbidden();
|
|
11953
12171
|
}
|
|
11954
12172
|
|
|
@@ -11968,7 +12186,7 @@ export async function QuoteBuilder({
|
|
|
11968
12186
|
notFound();
|
|
11969
12187
|
}
|
|
11970
12188
|
|
|
11971
|
-
const canWrite = can(
|
|
12189
|
+
const canWrite = can(permissions, "quotes.write");
|
|
11972
12190
|
|
|
11973
12191
|
const editable =
|
|
11974
12192
|
canWrite &&
|
|
@@ -12103,14 +12321,14 @@ npx shadcn add badge card empty progress skeleton
|
|
|
12103
12321
|
* are.
|
|
12104
12322
|
*/
|
|
12105
12323
|
export async function TargetsProgress() {
|
|
12106
|
-
const [
|
|
12107
|
-
getSession(),
|
|
12324
|
+
const [t, format, locale, permissions] = await Promise.all([
|
|
12108
12325
|
getExtracted("crm"),
|
|
12109
12326
|
getFormatter(),
|
|
12110
12327
|
getLocale(),
|
|
12328
|
+
getPermissions(),
|
|
12111
12329
|
]);
|
|
12112
12330
|
|
|
12113
|
-
if (!can(
|
|
12331
|
+
if (!can(permissions, "targets.read")) {
|
|
12114
12332
|
return null;
|
|
12115
12333
|
}
|
|
12116
12334
|
|
|
@@ -12120,7 +12338,7 @@ export async function TargetsProgress() {
|
|
|
12120
12338
|
return null;
|
|
12121
12339
|
}
|
|
12122
12340
|
|
|
12123
|
-
const canManage = can(
|
|
12341
|
+
const canManage = can(permissions, "targets.manage");
|
|
12124
12342
|
|
|
12125
12343
|
const amountOf = (target: TargetRow, value: bigint) =>
|
|
12126
12344
|
target.currency === null
|
|
@@ -12711,7 +12929,7 @@ export function WorkItemGrid({
|
|
|
12711
12929
|
|
|
12712
12930
|
const go = (next: WorkGridQuery) => {
|
|
12713
12931
|
startTransition(() => {
|
|
12714
|
-
router.replace(
|
|
12932
|
+
router.replace(withSearch(pathname, workGridSearch(next)));
|
|
12715
12933
|
});
|
|
12716
12934
|
};
|
|
12717
12935
|
|
|
@@ -13049,13 +13267,13 @@ npx shadcn add alert badge button card empty skeleton table
|
|
|
13049
13267
|
* caller is an approver of the current step.
|
|
13050
13268
|
*/
|
|
13051
13269
|
export async function ApprovalsQueue() {
|
|
13052
|
-
const [
|
|
13053
|
-
getSession(),
|
|
13270
|
+
const [t, format, permissions] = await Promise.all([
|
|
13054
13271
|
getExtracted("approvals"),
|
|
13055
13272
|
getFormatter(),
|
|
13273
|
+
getPermissions(),
|
|
13056
13274
|
]);
|
|
13057
13275
|
|
|
13058
|
-
if (!can(
|
|
13276
|
+
if (!can(permissions, "approvals.read")) {
|
|
13059
13277
|
forbidden();
|
|
13060
13278
|
}
|
|
13061
13279
|
|
|
@@ -13065,8 +13283,8 @@ export async function ApprovalsQueue() {
|
|
|
13065
13283
|
return null;
|
|
13066
13284
|
}
|
|
13067
13285
|
|
|
13068
|
-
const canRequest = can(
|
|
13069
|
-
const canDecide = can(
|
|
13286
|
+
const canRequest = can(permissions, "approvals.request");
|
|
13287
|
+
const canDecide = can(permissions, "approvals.manage");
|
|
13070
13288
|
const customers = queue.kind === "ok" ? queue.data.customers : [];
|
|
13071
13289
|
|
|
13072
13290
|
const actionLabel = (action: string) =>
|
|
@@ -13300,7 +13518,7 @@ export async function MyWorkList() {
|
|
|
13300
13518
|
<span className="truncate">{row.title}</span>
|
|
13301
13519
|
) : (
|
|
13302
13520
|
<Link
|
|
13303
|
-
href={row.url}
|
|
13521
|
+
href={toAppHref(row.url)}
|
|
13304
13522
|
className="truncate font-medium underline-offset-4 transition-colors hover:underline"
|
|
13305
13523
|
>
|
|
13306
13524
|
{row.title}
|
|
@@ -13619,13 +13837,13 @@ export async function CustomFieldsEditor({
|
|
|
13619
13837
|
}: {
|
|
13620
13838
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
13621
13839
|
}) {
|
|
13622
|
-
const [
|
|
13623
|
-
getSession(),
|
|
13840
|
+
const [t, params, permissions] = await Promise.all([
|
|
13624
13841
|
getExtracted("custom-fields"),
|
|
13625
13842
|
searchParams,
|
|
13843
|
+
getPermissions(),
|
|
13626
13844
|
]);
|
|
13627
13845
|
|
|
13628
|
-
if (!can(
|
|
13846
|
+
if (!can(permissions, "custom_fields.read")) {
|
|
13629
13847
|
forbidden();
|
|
13630
13848
|
}
|
|
13631
13849
|
|
|
@@ -13637,7 +13855,7 @@ export async function CustomFieldsEditor({
|
|
|
13637
13855
|
return null;
|
|
13638
13856
|
}
|
|
13639
13857
|
|
|
13640
|
-
const canManage = can(
|
|
13858
|
+
const canManage = can(permissions, "custom_fields.manage");
|
|
13641
13859
|
|
|
13642
13860
|
return (
|
|
13643
13861
|
<Card data-recipe="custom-fields-editor">
|
|
@@ -14285,12 +14503,12 @@ npx shadcn add card empty skeleton
|
|
|
14285
14503
|
* with `employees.view_sensitive`.
|
|
14286
14504
|
*/
|
|
14287
14505
|
export async function EmployeeDirectory() {
|
|
14288
|
-
const [
|
|
14289
|
-
getSession(),
|
|
14506
|
+
const [t, permissions] = await Promise.all([
|
|
14290
14507
|
getExtracted("people"),
|
|
14508
|
+
getPermissions(),
|
|
14291
14509
|
]);
|
|
14292
14510
|
|
|
14293
|
-
if (!can(
|
|
14511
|
+
if (!can(permissions, "employees.read")) {
|
|
14294
14512
|
forbidden();
|
|
14295
14513
|
}
|
|
14296
14514
|
|
|
@@ -14300,8 +14518,8 @@ export async function EmployeeDirectory() {
|
|
|
14300
14518
|
return null;
|
|
14301
14519
|
}
|
|
14302
14520
|
|
|
14303
|
-
const canWrite = can(
|
|
14304
|
-
const canViewSensitive = can(
|
|
14521
|
+
const canWrite = can(permissions, "employees.write");
|
|
14522
|
+
const canViewSensitive = can(permissions, "employees.view_sensitive");
|
|
14305
14523
|
|
|
14306
14524
|
const managers =
|
|
14307
14525
|
directory.kind === "ok"
|
|
@@ -14380,13 +14598,13 @@ export async function HiringBoard({
|
|
|
14380
14598
|
}: {
|
|
14381
14599
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
14382
14600
|
}) {
|
|
14383
|
-
const [
|
|
14384
|
-
getSession(),
|
|
14601
|
+
const [t, query, permissions] = await Promise.all([
|
|
14385
14602
|
getExtracted("people"),
|
|
14386
14603
|
searchParams,
|
|
14604
|
+
getPermissions(),
|
|
14387
14605
|
]);
|
|
14388
14606
|
|
|
14389
|
-
if (!can(
|
|
14607
|
+
if (!can(permissions, "hiring.read")) {
|
|
14390
14608
|
forbidden();
|
|
14391
14609
|
}
|
|
14392
14610
|
|
|
@@ -14396,8 +14614,8 @@ export async function HiringBoard({
|
|
|
14396
14614
|
return null;
|
|
14397
14615
|
}
|
|
14398
14616
|
|
|
14399
|
-
const canManage = can(
|
|
14400
|
-
const canWrite = can(
|
|
14617
|
+
const canManage = can(permissions, "hiring.manage");
|
|
14618
|
+
const canWrite = can(permissions, "hiring.write");
|
|
14401
14619
|
const jobs = board.kind === "ok" ? board.data.jobs : [];
|
|
14402
14620
|
const job = jobs.find((item) => item.id === query["job"]) ?? jobs[0];
|
|
14403
14621
|
|
|
@@ -14533,15 +14751,15 @@ export async function Timesheet({
|
|
|
14533
14751
|
}: {
|
|
14534
14752
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
14535
14753
|
}) {
|
|
14536
|
-
const [
|
|
14537
|
-
getSession(),
|
|
14754
|
+
const [t, format, query, permissions] = await Promise.all([
|
|
14538
14755
|
getExtracted("people"),
|
|
14539
14756
|
getFormatter(),
|
|
14540
14757
|
searchParams,
|
|
14758
|
+
getPermissions(),
|
|
14541
14759
|
connection(),
|
|
14542
14760
|
]);
|
|
14543
14761
|
|
|
14544
|
-
if (!can(
|
|
14762
|
+
if (!can(permissions, "time_tracking.track")) {
|
|
14545
14763
|
forbidden();
|
|
14546
14764
|
}
|
|
14547
14765
|
|
|
@@ -14746,19 +14964,19 @@ export async function DispatchBoard({
|
|
|
14746
14964
|
}: {
|
|
14747
14965
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
14748
14966
|
}) {
|
|
14749
|
-
const [
|
|
14750
|
-
getSession(),
|
|
14967
|
+
const [t, format, query, permissions] = await Promise.all([
|
|
14751
14968
|
getExtracted("field"),
|
|
14752
14969
|
getFormatter(),
|
|
14753
14970
|
searchParams,
|
|
14971
|
+
getPermissions(),
|
|
14754
14972
|
connection(),
|
|
14755
14973
|
]);
|
|
14756
14974
|
|
|
14757
|
-
if (!can(
|
|
14975
|
+
if (!can(permissions, "dispatch.read")) {
|
|
14758
14976
|
forbidden();
|
|
14759
14977
|
}
|
|
14760
14978
|
|
|
14761
|
-
const manage = can(
|
|
14979
|
+
const manage = can(permissions, "dispatch.manage");
|
|
14762
14980
|
const monday = mondayOf(query["week"]);
|
|
14763
14981
|
const board = await settle(() => loadDispatchWeek(monday.toString()));
|
|
14764
14982
|
|
|
@@ -14963,15 +15181,15 @@ export async function TechnicianDay({
|
|
|
14963
15181
|
}: {
|
|
14964
15182
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
14965
15183
|
}) {
|
|
14966
|
-
const [
|
|
14967
|
-
getSession(),
|
|
15184
|
+
const [t, format, query, permissions] = await Promise.all([
|
|
14968
15185
|
getExtracted("field"),
|
|
14969
15186
|
getFormatter(),
|
|
14970
15187
|
searchParams,
|
|
15188
|
+
getPermissions(),
|
|
14971
15189
|
connection(),
|
|
14972
15190
|
]);
|
|
14973
15191
|
|
|
14974
|
-
if (!can(
|
|
15192
|
+
if (!can(permissions, "dispatch.work")) {
|
|
14975
15193
|
forbidden();
|
|
14976
15194
|
}
|
|
14977
15195
|
|
|
@@ -15103,15 +15321,15 @@ export async function ShipmentTracking({
|
|
|
15103
15321
|
}: {
|
|
15104
15322
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
15105
15323
|
}) {
|
|
15106
|
-
const [
|
|
15107
|
-
getSession(),
|
|
15324
|
+
const [t, format, query, permissions] = await Promise.all([
|
|
15108
15325
|
getExtracted("field"),
|
|
15109
15326
|
getFormatter(),
|
|
15110
15327
|
searchParams,
|
|
15328
|
+
getPermissions(),
|
|
15111
15329
|
connection(),
|
|
15112
15330
|
]);
|
|
15113
15331
|
|
|
15114
|
-
if (!can(
|
|
15332
|
+
if (!can(permissions, "shipments.read")) {
|
|
15115
15333
|
forbidden();
|
|
15116
15334
|
}
|
|
15117
15335
|
|
|
@@ -15125,7 +15343,7 @@ export async function ShipmentTracking({
|
|
|
15125
15343
|
return null;
|
|
15126
15344
|
}
|
|
15127
15345
|
|
|
15128
|
-
const newShipment = can(
|
|
15346
|
+
const newShipment = can(permissions, "shipments.manage") ? (
|
|
15129
15347
|
<NewShipmentDialog />
|
|
15130
15348
|
) : null;
|
|
15131
15349
|
|
|
@@ -15302,24 +15520,25 @@ async function retry() {
|
|
|
15302
15520
|
* billing page still shows the plan.
|
|
15303
15521
|
*/
|
|
15304
15522
|
export async function InvoicesTable() {
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
}
|
|
15310
|
-
|
|
15311
|
-
const [list, t, format, locale] = await Promise.all([
|
|
15523
|
+
// One round trip: the invoices read starts with the permission read, and RLS
|
|
15524
|
+
// limits it to what the caller may see either way.
|
|
15525
|
+
const [permissions, list, t, format, locale] = await Promise.all([
|
|
15526
|
+
getPermissions(),
|
|
15312
15527
|
getInvoices(),
|
|
15313
15528
|
getExtracted("billing"),
|
|
15314
15529
|
getFormatter(),
|
|
15315
15530
|
getLocale(),
|
|
15316
15531
|
]);
|
|
15317
15532
|
|
|
15533
|
+
if (!can(permissions, "invoices.read")) {
|
|
15534
|
+
return null;
|
|
15535
|
+
}
|
|
15536
|
+
|
|
15318
15537
|
if (list.kind === "no-organization") {
|
|
15319
15538
|
return null;
|
|
15320
15539
|
}
|
|
15321
15540
|
|
|
15322
|
-
const canWrite = can(
|
|
15541
|
+
const canWrite = can(permissions, "invoices.write");
|
|
15323
15542
|
|
|
15324
15543
|
const status = (value: InvoiceStatus, overdue: boolean) => {
|
|
15325
15544
|
if (overdue) {
|
|
@@ -15486,9 +15705,9 @@ async function retry() {
|
|
|
15486
15705
|
|
|
15487
15706
|
/** Render inside `<Suspense>`: the organization's products as cards. */
|
|
15488
15707
|
export async function ProductCatalogGrid() {
|
|
15489
|
-
const
|
|
15708
|
+
const permissions = await getPermissions();
|
|
15490
15709
|
|
|
15491
|
-
if (!can(
|
|
15710
|
+
if (!can(permissions, "catalog.read")) {
|
|
15492
15711
|
forbidden();
|
|
15493
15712
|
}
|
|
15494
15713
|
|
|
@@ -15502,7 +15721,7 @@ export async function ProductCatalogGrid() {
|
|
|
15502
15721
|
return null;
|
|
15503
15722
|
}
|
|
15504
15723
|
|
|
15505
|
-
const canManage = can(
|
|
15724
|
+
const canManage = can(permissions, "catalog.manage");
|
|
15506
15725
|
|
|
15507
15726
|
const status = (product: Product) => {
|
|
15508
15727
|
switch (product.status) {
|
|
@@ -15567,7 +15786,7 @@ export async function ProductCatalogGrid() {
|
|
|
15567
15786
|
})}
|
|
15568
15787
|
</p>
|
|
15569
15788
|
<div className="flex items-center gap-2">
|
|
15570
|
-
{can(
|
|
15789
|
+
{can(permissions, "promotions.manage") ? (
|
|
15571
15790
|
<CreatePromotionCodeDialog />
|
|
15572
15791
|
) : null}
|
|
15573
15792
|
{canManage ? <CreateProductDialog variant="outline" /> : null}
|
|
@@ -15628,9 +15847,9 @@ async function retry() {
|
|
|
15628
15847
|
|
|
15629
15848
|
/** Render inside `<Suspense>`: stock per tracked variant and active location. */
|
|
15630
15849
|
export async function InventoryTable() {
|
|
15631
|
-
const
|
|
15850
|
+
const permissions = await getPermissions();
|
|
15632
15851
|
|
|
15633
|
-
if (!can(
|
|
15852
|
+
if (!can(permissions, "inventory.read")) {
|
|
15634
15853
|
forbidden();
|
|
15635
15854
|
}
|
|
15636
15855
|
|
|
@@ -15643,7 +15862,7 @@ export async function InventoryTable() {
|
|
|
15643
15862
|
return null;
|
|
15644
15863
|
}
|
|
15645
15864
|
|
|
15646
|
-
const canManage = can(
|
|
15865
|
+
const canManage = can(permissions, "inventory.manage");
|
|
15647
15866
|
|
|
15648
15867
|
const locationName = new Map(
|
|
15649
15868
|
stock.kind === "ok"
|
|
@@ -15811,9 +16030,9 @@ export async function OrderDetail({
|
|
|
15811
16030
|
}: {
|
|
15812
16031
|
params: Promise<{ id: string }>;
|
|
15813
16032
|
}) {
|
|
15814
|
-
const [{ id },
|
|
16033
|
+
const [{ id }, permissions] = await Promise.all([params, getPermissions()]);
|
|
15815
16034
|
|
|
15816
|
-
if (!can(
|
|
16035
|
+
if (!can(permissions, "orders.read")) {
|
|
15817
16036
|
forbidden();
|
|
15818
16037
|
}
|
|
15819
16038
|
|
|
@@ -15846,7 +16065,7 @@ export async function OrderDetail({
|
|
|
15846
16065
|
}
|
|
15847
16066
|
|
|
15848
16067
|
const view = detail.data;
|
|
15849
|
-
const canManage = can(
|
|
16068
|
+
const canManage = can(permissions, "orders.manage");
|
|
15850
16069
|
const amount = (value: Money) => formatMoney(value, locale);
|
|
15851
16070
|
|
|
15852
16071
|
const problemLabel = (problem: string) => {
|
|
@@ -16084,7 +16303,7 @@ export async function OrderDetail({
|
|
|
16084
16303
|
]
|
|
16085
16304
|
: [],
|
|
16086
16305
|
)}
|
|
16087
|
-
canCreate={can(
|
|
16306
|
+
canCreate={can(permissions, "promotions.manage")}
|
|
16088
16307
|
/>
|
|
16089
16308
|
) : view.promotions.length === 0 ? (
|
|
16090
16309
|
<p className="text-sm text-muted-foreground">
|
|
@@ -16143,14 +16362,17 @@ export async function KitchenDisplay({
|
|
|
16143
16362
|
}: {
|
|
16144
16363
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
16145
16364
|
}) {
|
|
16146
|
-
const [
|
|
16365
|
+
const [params, permissions] = await Promise.all([
|
|
16366
|
+
searchParams,
|
|
16367
|
+
getPermissions(),
|
|
16368
|
+
]);
|
|
16147
16369
|
|
|
16148
|
-
if (!can(
|
|
16370
|
+
if (!can(permissions, "orders.read") && !can(permissions, "orders.prepare")) {
|
|
16149
16371
|
forbidden();
|
|
16150
16372
|
}
|
|
16151
16373
|
|
|
16152
16374
|
const canPrepare =
|
|
16153
|
-
can(
|
|
16375
|
+
can(permissions, "orders.prepare") || can(permissions, "orders.manage");
|
|
16154
16376
|
|
|
16155
16377
|
const [kitchen, t] = await Promise.all([
|
|
16156
16378
|
getKitchen(
|
|
@@ -16595,9 +16817,9 @@ export async function CalendarView({
|
|
|
16595
16817
|
}: {
|
|
16596
16818
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
16597
16819
|
}) {
|
|
16598
|
-
const
|
|
16820
|
+
const permissions = await getPermissions();
|
|
16599
16821
|
|
|
16600
|
-
if (!can(
|
|
16822
|
+
if (!can(permissions, "calendar.read")) {
|
|
16601
16823
|
forbidden();
|
|
16602
16824
|
}
|
|
16603
16825
|
|
|
@@ -16608,8 +16830,8 @@ export async function CalendarView({
|
|
|
16608
16830
|
connection(),
|
|
16609
16831
|
]);
|
|
16610
16832
|
|
|
16611
|
-
const canWrite = can(
|
|
16612
|
-
const canManage = can(
|
|
16833
|
+
const canWrite = can(permissions, "calendar.write");
|
|
16834
|
+
const canManage = can(permissions, "calendar.manage");
|
|
16613
16835
|
const first = firstOfMonth(query["month"], "UTC");
|
|
16614
16836
|
const weeks = weeksOf(first);
|
|
16615
16837
|
const from = weeks[0]?.[0] ?? first;
|
|
@@ -16918,9 +17140,9 @@ npx shadcn add badge card empty skeleton
|
|
|
16918
17140
|
|
|
16919
17141
|
```tsx title="apps/examples/nextjs/src/features/bookings/components/availability-editor.tsx"
|
|
16920
17142
|
export async function AvailabilityEditor() {
|
|
16921
|
-
const
|
|
17143
|
+
const permissions = await getPermissions();
|
|
16922
17144
|
|
|
16923
|
-
if (!can(
|
|
17145
|
+
if (!can(permissions, "bookings.manage")) {
|
|
16924
17146
|
forbidden();
|
|
16925
17147
|
}
|
|
16926
17148
|
|
|
@@ -16951,7 +17173,9 @@ export async function AvailabilityEditor() {
|
|
|
16951
17173
|
{ count: page.liveLinks },
|
|
16952
17174
|
)}
|
|
16953
17175
|
</Badge>
|
|
16954
|
-
{can(
|
|
17176
|
+
{can(permissions, "share_links.create") ? (
|
|
17177
|
+
<BookingLinkButton />
|
|
17178
|
+
) : null}
|
|
16955
17179
|
</CardAction>
|
|
16956
17180
|
) : null}
|
|
16957
17181
|
</CardHeader>
|
|
@@ -17004,9 +17228,9 @@ npx shadcn add card empty skeleton
|
|
|
17004
17228
|
* offset before every occurrence of the event, once per occurrence.
|
|
17005
17229
|
*/
|
|
17006
17230
|
export async function RemindersList() {
|
|
17007
|
-
const
|
|
17231
|
+
const permissions = await getPermissions();
|
|
17008
17232
|
|
|
17009
|
-
if (!can(
|
|
17233
|
+
if (!can(permissions, "reminders.manage")) {
|
|
17010
17234
|
return null;
|
|
17011
17235
|
}
|
|
17012
17236
|
|
|
@@ -17049,7 +17273,7 @@ export async function RemindersList() {
|
|
|
17049
17273
|
{t("Add an event, then set a reminder for it here.")}
|
|
17050
17274
|
</EmptyDescription>
|
|
17051
17275
|
</EmptyHeader>
|
|
17052
|
-
{calendars.length > 0 && can(
|
|
17276
|
+
{calendars.length > 0 && can(permissions, "calendar.write") ? (
|
|
17053
17277
|
<EmptyContent>
|
|
17054
17278
|
<CreateEventDialog
|
|
17055
17279
|
calendars={calendars}
|
|
@@ -17739,8 +17963,8 @@ import {
|
|
|
17739
17963
|
TableHeader,
|
|
17740
17964
|
TableRow,
|
|
17741
17965
|
} from "@/components/ui/table";
|
|
17966
|
+
import { getPermissions } from "@/features/user/permission-snapshot";
|
|
17742
17967
|
import { can } from "@/features/user/user-permissions";
|
|
17743
|
-
import { getSession } from "@/features/user/user-queries";
|
|
17744
17968
|
import { Link } from "@/i18n/navigation";
|
|
17745
17969
|
|
|
17746
17970
|
import { getTrash } from "../trash-queries";
|
|
@@ -17757,11 +17981,11 @@ async function retry() {
|
|
|
17757
17981
|
* forever.
|
|
17758
17982
|
*/
|
|
17759
17983
|
export async function TrashBin() {
|
|
17760
|
-
const [view,
|
|
17984
|
+
const [view, t, format, permissions] = await Promise.all([
|
|
17761
17985
|
getTrash(),
|
|
17762
|
-
getSession(),
|
|
17763
17986
|
getExtracted("trash"),
|
|
17764
17987
|
getFormatter(),
|
|
17988
|
+
getPermissions(),
|
|
17765
17989
|
]);
|
|
17766
17990
|
|
|
17767
17991
|
if (view.kind === "no-organization") {
|
|
@@ -17773,7 +17997,7 @@ export async function TrashBin() {
|
|
|
17773
17997
|
["drive_node", t("Drive item")],
|
|
17774
17998
|
]);
|
|
17775
17999
|
|
|
17776
|
-
const canPurge = can(
|
|
18000
|
+
const canPurge = can(permissions, "trash.manage");
|
|
17777
18001
|
|
|
17778
18002
|
return (
|
|
17779
18003
|
<Card data-recipe="trash-bin">
|
|
@@ -18151,10 +18375,10 @@ const moderationVariants = {
|
|
|
18151
18375
|
|
|
18152
18376
|
/** Render inside `<Suspense>`: the board's posts, top voted first. */
|
|
18153
18377
|
export async function PostBoard() {
|
|
18154
|
-
const [view,
|
|
18378
|
+
const [view, t, permissions] = await Promise.all([
|
|
18155
18379
|
getBoard(),
|
|
18156
|
-
getSession(),
|
|
18157
18380
|
getExtracted("community"),
|
|
18381
|
+
getPermissions(),
|
|
18158
18382
|
]);
|
|
18159
18383
|
|
|
18160
18384
|
if (view.kind === "no-organization") {
|
|
@@ -18181,7 +18405,7 @@ export async function PostBoard() {
|
|
|
18181
18405
|
const board = view.data;
|
|
18182
18406
|
|
|
18183
18407
|
if (board === null) {
|
|
18184
|
-
const manage = can(
|
|
18408
|
+
const manage = can(permissions, "posts.manage");
|
|
18185
18409
|
|
|
18186
18410
|
return (
|
|
18187
18411
|
<Empty className="border">
|
|
@@ -18209,7 +18433,7 @@ export async function PostBoard() {
|
|
|
18209
18433
|
);
|
|
18210
18434
|
}
|
|
18211
18435
|
|
|
18212
|
-
const write = can(
|
|
18436
|
+
const write = can(permissions, "posts.write");
|
|
18213
18437
|
|
|
18214
18438
|
const statusLabels: Record<PostStatus, string> = {
|
|
18215
18439
|
open: t("Open"),
|
|
@@ -19475,8 +19699,8 @@ import {
|
|
|
19475
19699
|
EmptyTitle,
|
|
19476
19700
|
} from "@/components/ui/empty";
|
|
19477
19701
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
19702
|
+
import { getPermissions } from "@/features/user/permission-snapshot";
|
|
19478
19703
|
import { can } from "@/features/user/user-permissions";
|
|
19479
|
-
import { getSession } from "@/features/user/user-queries";
|
|
19480
19704
|
|
|
19481
19705
|
import { getTemplates } from "../templates-queries";
|
|
19482
19706
|
import { CreateTemplateDialog } from "./create-template-dialog";
|
|
@@ -19490,18 +19714,18 @@ async function retry() {
|
|
|
19490
19714
|
|
|
19491
19715
|
/** The New template button, for members who may manage templates. */
|
|
19492
19716
|
export async function TemplateManagerActions() {
|
|
19493
|
-
const
|
|
19717
|
+
const permissions = await getPermissions();
|
|
19494
19718
|
|
|
19495
|
-
return can(
|
|
19719
|
+
return can(permissions, "templates.manage") ? <CreateTemplateDialog /> : null;
|
|
19496
19720
|
}
|
|
19497
19721
|
|
|
19498
19722
|
/** Render inside `<Suspense>`: the customer templates, each with Use template. */
|
|
19499
19723
|
export async function TemplatesGallery() {
|
|
19500
|
-
const [view,
|
|
19724
|
+
const [view, t, format, permissions] = await Promise.all([
|
|
19501
19725
|
getTemplates(),
|
|
19502
|
-
getSession(),
|
|
19503
19726
|
getExtracted("templates"),
|
|
19504
19727
|
getFormatter(),
|
|
19728
|
+
getPermissions(),
|
|
19505
19729
|
]);
|
|
19506
19730
|
|
|
19507
19731
|
if (view.kind === "no-organization") {
|
|
@@ -19509,7 +19733,7 @@ export async function TemplatesGallery() {
|
|
|
19509
19733
|
}
|
|
19510
19734
|
|
|
19511
19735
|
const canApply =
|
|
19512
|
-
can(
|
|
19736
|
+
can(permissions, "templates.apply") && can(permissions, "customers.write");
|
|
19513
19737
|
|
|
19514
19738
|
if (view.kind === "error") {
|
|
19515
19739
|
return (
|
|
@@ -19542,7 +19766,7 @@ export async function TemplatesGallery() {
|
|
|
19542
19766
|
)}
|
|
19543
19767
|
</EmptyDescription>
|
|
19544
19768
|
</EmptyHeader>
|
|
19545
|
-
{can(
|
|
19769
|
+
{can(permissions, "templates.manage") ? (
|
|
19546
19770
|
<EmptyContent>
|
|
19547
19771
|
<CreateTemplateDialog />
|
|
19548
19772
|
</EmptyContent>
|
|
@@ -20295,14 +20519,14 @@ function EndpointStatusBadge({
|
|
|
20295
20519
|
* delete endpoints, and retry finished deliveries.
|
|
20296
20520
|
*/
|
|
20297
20521
|
export async function WebhookEndpoints() {
|
|
20298
|
-
const [
|
|
20299
|
-
getSession(),
|
|
20522
|
+
const [state, t, format, permissions] = await Promise.all([
|
|
20300
20523
|
loadWebhooksState(),
|
|
20301
20524
|
getExtracted("webhooks"),
|
|
20302
20525
|
getFormatter(),
|
|
20526
|
+
getPermissions(),
|
|
20303
20527
|
]);
|
|
20304
20528
|
|
|
20305
|
-
if (!can(
|
|
20529
|
+
if (!can(permissions, "webhooks.read")) {
|
|
20306
20530
|
forbidden();
|
|
20307
20531
|
}
|
|
20308
20532
|
|
|
@@ -20310,7 +20534,7 @@ export async function WebhookEndpoints() {
|
|
|
20310
20534
|
return null;
|
|
20311
20535
|
}
|
|
20312
20536
|
|
|
20313
|
-
const manage = can(
|
|
20537
|
+
const manage = can(permissions, "webhooks.manage");
|
|
20314
20538
|
|
|
20315
20539
|
const firstEnabled =
|
|
20316
20540
|
state.kind === "ok"
|
|
@@ -20578,13 +20802,13 @@ async function retry() {
|
|
|
20578
20802
|
* them. Members without `service_principals.read` see nothing.
|
|
20579
20803
|
*/
|
|
20580
20804
|
export async function ServicePrincipalsTable() {
|
|
20581
|
-
const [
|
|
20582
|
-
getSession(),
|
|
20805
|
+
const [t, format, permissions] = await Promise.all([
|
|
20583
20806
|
getExtracted("servicePrincipals"),
|
|
20584
20807
|
getFormatter(),
|
|
20808
|
+
getPermissions(),
|
|
20585
20809
|
]);
|
|
20586
20810
|
|
|
20587
|
-
if (!can(
|
|
20811
|
+
if (!can(permissions, "service_principals.read")) {
|
|
20588
20812
|
return null;
|
|
20589
20813
|
}
|
|
20590
20814
|
|
|
@@ -20594,7 +20818,7 @@ export async function ServicePrincipalsTable() {
|
|
|
20594
20818
|
return null;
|
|
20595
20819
|
}
|
|
20596
20820
|
|
|
20597
|
-
const manage = can(
|
|
20821
|
+
const manage = can(permissions, "service_principals.manage");
|
|
20598
20822
|
|
|
20599
20823
|
const roles = new Map([
|
|
20600
20824
|
["owner", t("Owner")],
|
|
@@ -20756,12 +20980,12 @@ async function retry() {
|
|
|
20756
20980
|
* only, so this checks `organization.update` before it reads.
|
|
20757
20981
|
*/
|
|
20758
20982
|
export async function SigningKeysRotation() {
|
|
20759
|
-
const [
|
|
20760
|
-
getSession(),
|
|
20983
|
+
const [t, permissions] = await Promise.all([
|
|
20761
20984
|
getExtracted("signingKeys"),
|
|
20985
|
+
getPermissions(),
|
|
20762
20986
|
]);
|
|
20763
20987
|
|
|
20764
|
-
if (!can(
|
|
20988
|
+
if (!can(permissions, SIGNING_KEYS_PERMISSION)) {
|
|
20765
20989
|
forbidden();
|
|
20766
20990
|
}
|
|
20767
20991
|
|
|
@@ -21145,13 +21369,13 @@ function JobStatusBadge({ status, t }: { status: JobRunStatus; t: Translate }) {
|
|
|
21145
21369
|
* it reads with the database owner.
|
|
21146
21370
|
*/
|
|
21147
21371
|
export async function JobRunsTable() {
|
|
21148
|
-
const [
|
|
21149
|
-
getSession(),
|
|
21372
|
+
const [t, format, permissions] = await Promise.all([
|
|
21150
21373
|
getExtracted("jobs"),
|
|
21151
21374
|
getFormatter(),
|
|
21375
|
+
getPermissions(),
|
|
21152
21376
|
]);
|
|
21153
21377
|
|
|
21154
|
-
if (!can(
|
|
21378
|
+
if (!can(permissions, JOBS_PERMISSION)) {
|
|
21155
21379
|
forbidden();
|
|
21156
21380
|
}
|
|
21157
21381
|
|
|
@@ -22145,7 +22369,7 @@ export function TaskToolbar({
|
|
|
22145
22369
|
|
|
22146
22370
|
const go = (next: TaskQuery) => {
|
|
22147
22371
|
startTransition(() => {
|
|
22148
|
-
router.replace(
|
|
22372
|
+
router.replace(withSearch(pathname, taskSearch(next)));
|
|
22149
22373
|
});
|
|
22150
22374
|
};
|
|
22151
22375
|
|
|
@@ -22891,7 +23115,12 @@ export async function ProjectPage({
|
|
|
22891
23115
|
}: {
|
|
22892
23116
|
params: Promise<{ id: string }>;
|
|
22893
23117
|
}) {
|
|
22894
|
-
const [{ id }, session] = await Promise.all([
|
|
23118
|
+
const [{ id }, session, permissions] = await Promise.all([
|
|
23119
|
+
params,
|
|
23120
|
+
getSession(),
|
|
23121
|
+
getPermissions(),
|
|
23122
|
+
]);
|
|
23123
|
+
|
|
22895
23124
|
const organizationId = tenantOf(session);
|
|
22896
23125
|
|
|
22897
23126
|
if (!organizationId) {
|
|
@@ -23006,7 +23235,7 @@ export async function ProjectPage({
|
|
|
23006
23235
|
authors={Object.fromEntries(
|
|
23007
23236
|
members.data.map((member) => [member.userId, member.name]),
|
|
23008
23237
|
)}
|
|
23009
|
-
canComment={can(
|
|
23238
|
+
canComment={can(permissions, "messages.send")}
|
|
23010
23239
|
/>
|
|
23011
23240
|
</CardContent>
|
|
23012
23241
|
</Card>
|
|
@@ -23041,8 +23270,8 @@ export async function ProjectPage({
|
|
|
23041
23270
|
<ProjectHistory
|
|
23042
23271
|
projectId={record.id}
|
|
23043
23272
|
versions={history.data}
|
|
23044
|
-
canSave={can(
|
|
23045
|
-
canRestore={can(
|
|
23273
|
+
canSave={can(permissions, "versions.create")}
|
|
23274
|
+
canRestore={can(permissions, "versions.restore")}
|
|
23046
23275
|
/>
|
|
23047
23276
|
) : (
|
|
23048
23277
|
<ProjectLoadError title={t("The history didn't load")} />
|
|
@@ -23255,7 +23484,7 @@ export async function TaskCalendar({
|
|
|
23255
23484
|
rows: readonly TaskRow[];
|
|
23256
23485
|
first: Temporal.PlainDate;
|
|
23257
23486
|
today: Temporal.PlainDate;
|
|
23258
|
-
monthHref: (month: string) =>
|
|
23487
|
+
monthHref: (month: string) => AppHref;
|
|
23259
23488
|
}) {
|
|
23260
23489
|
const [t, format] = await Promise.all([
|
|
23261
23490
|
getExtracted("projects"),
|
|
@@ -23427,7 +23656,7 @@ export async function TaskTimeline({
|
|
|
23427
23656
|
members: readonly MemberOption[];
|
|
23428
23657
|
from: Temporal.PlainDate;
|
|
23429
23658
|
today: Temporal.PlainDate;
|
|
23430
|
-
windowHref: (from: string) =>
|
|
23659
|
+
windowHref: (from: string) => AppHref;
|
|
23431
23660
|
}) {
|
|
23432
23661
|
const t = await getExtracted("projects");
|
|
23433
23662
|
const lanes = new Map<string, TaskRow[]>();
|
|
@@ -23549,7 +23778,7 @@ export async function TaskGantt({
|
|
|
23549
23778
|
projects: readonly ProjectOption[];
|
|
23550
23779
|
from: Temporal.PlainDate;
|
|
23551
23780
|
today: Temporal.PlainDate;
|
|
23552
|
-
windowHref: (from: string) =>
|
|
23781
|
+
windowHref: (from: string) => AppHref;
|
|
23553
23782
|
}) {
|
|
23554
23783
|
const t = await getExtracted("projects");
|
|
23555
23784
|
|