@protobase/ui 0.44.3 → 0.44.5

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.
@@ -78,7 +78,8 @@ const text = defineMessages({
78
78
  newOrganization: "New organization",
79
79
  newOrganizationDescription: "You become its owner, with every role, and work in it once it is made.",
80
80
  invitationsForYou: "Invitations for you",
81
- invitationsForYouDescription: "Open the link in the invitation email to accept one.",
81
+ invitationsForYouDescription: "Accept one to become a member and work there.",
82
+ accept: "Accept",
82
83
  anOrganization: "An organization",
83
84
  noAppRoles: "no app roles",
84
85
  until: (date) => `Until ${date}`,
@@ -165,7 +166,8 @@ const text = defineMessages({
165
166
  newOrganization: "Nieuwe organisatie",
166
167
  newOrganizationDescription: "Je wordt de eigenaar, met elke rol, en werkt erin zodra die is gemaakt.",
167
168
  invitationsForYou: "Uitnodigingen voor jou",
168
- invitationsForYouDescription: "Open de link in de uitnodigingsmail om er een te accepteren.",
169
+ invitationsForYouDescription: "Accepteer er een om lid te worden en daar te werken.",
170
+ accept: "Accepteren",
169
171
  anOrganization: "Een organisatie",
170
172
  noAppRoles: "geen app-rollen",
171
173
  until: (date) => `Tot ${date}`,
@@ -63,35 +63,50 @@ const NewOrganization = ({ basePath }) => {
63
63
  })]
64
64
  });
65
65
  };
66
- const YourInvitations = () => {
66
+ /** The invitations for the person's own address, each to accept, which opens the app in its organization. */
67
+ const YourInvitations = ({ basePath }) => {
67
68
  const { session, organizations } = useAuth();
68
69
  const [invitations, setInvitations] = useState([]);
70
+ const { busy, error, run } = useAction();
69
71
  useEffect(() => {
70
72
  session.organizations.myInvitations().then(setInvitations, () => setInvitations([]));
71
73
  }, [session]);
72
74
  if (invitations.length === 0) return null;
73
75
  const roles = organizations?.roles ?? [];
74
- return /* @__PURE__ */ jsx(AccountSection, {
76
+ const accept = (invitationId) => run(async () => {
77
+ await session.organizations.acceptMine(invitationId);
78
+ reopenIn(basePath);
79
+ });
80
+ return /* @__PURE__ */ jsxs(AccountSection, {
75
81
  title: text("invitationsForYou"),
76
82
  description: text("invitationsForYouDescription"),
77
- children: /* @__PURE__ */ jsx("ul", {
83
+ children: [/* @__PURE__ */ jsx(SectionError, { message: error }), /* @__PURE__ */ jsx("ul", {
78
84
  className: "divide-y rounded-md border",
79
85
  children: invitations.map((invitation) => /* @__PURE__ */ jsxs("li", {
80
- className: "px-3 py-2.5",
81
- children: [
82
- /* @__PURE__ */ jsx("span", {
83
- className: "font-medium",
84
- children: invitation.organizationName ?? text("anOrganization")
85
- }),
86
- ": ",
87
- invitation.appRoles.map((name) => roleLabel(roles, name)).join(", ") || text("noAppRoles"),
88
- /* @__PURE__ */ jsx("span", {
89
- className: "block text-xs text-muted-foreground",
90
- children: text("until", new Date(invitation.expiresAt).toLocaleDateString(formatTag()))
91
- })
92
- ]
86
+ className: "flex items-center gap-3 px-3 py-2.5",
87
+ children: [/* @__PURE__ */ jsxs("span", {
88
+ className: "min-w-0 flex-1",
89
+ children: [
90
+ /* @__PURE__ */ jsx("span", {
91
+ className: "font-medium",
92
+ children: invitation.organizationName ?? text("anOrganization")
93
+ }),
94
+ ": ",
95
+ invitation.appRoles.map((name) => roleLabel(roles, name)).join(", ") || text("noAppRoles"),
96
+ /* @__PURE__ */ jsx("span", {
97
+ className: "block text-xs text-muted-foreground",
98
+ children: text("until", new Date(invitation.expiresAt).toLocaleDateString(formatTag()))
99
+ })
100
+ ]
101
+ }), /* @__PURE__ */ jsx(Button, {
102
+ size: "sm",
103
+ variant: "primary",
104
+ loading: busy,
105
+ onClick: () => void accept(invitation.id),
106
+ children: text("accept")
107
+ })]
93
108
  }, invitation.id))
94
- })
109
+ })]
95
110
  });
96
111
  };
97
112
  /**
@@ -127,7 +142,7 @@ const OrganizationsPage = ({ state, basePath }) => {
127
142
  }, organization.id))
128
143
  })]
129
144
  }),
130
- /* @__PURE__ */ jsx(YourInvitations, {}),
145
+ /* @__PURE__ */ jsx(YourInvitations, { basePath }),
131
146
  mayCreate && /* @__PURE__ */ jsx(NewOrganization, { basePath }),
132
147
  (state.current?.globalRoles.length ?? 0) > 0 && /* @__PURE__ */ jsx(AllOrganizations, {
133
148
  basePath,
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.44.3";
2
+ var version = "0.44.5";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };