create-bw-app 0.18.2 → 0.18.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/package.json +1 -1
- package/src/constants.mjs +9 -8
- package/src/generator.mjs +0 -1
- package/template/base/app/(shell)/shell-layout-client.tsx +46 -3
- package/template/modules/admin/app/api/admin/users/invitations/[invitationId]/route.ts +9 -0
- package/template/modules/admin/app/api/admin/users/invitations/route.ts +11 -0
- package/template/base/app/(auth)/signup/page.tsx +0 -1
package/package.json
CHANGED
package/src/constants.mjs
CHANGED
|
@@ -61,6 +61,8 @@ export const MODULE_STARTER_FILES = {
|
|
|
61
61
|
admin: [
|
|
62
62
|
"app/api/admin/users/route.ts",
|
|
63
63
|
"app/api/admin/users/roles/route.ts",
|
|
64
|
+
"app/api/admin/users/invitations/route.ts",
|
|
65
|
+
"app/api/admin/users/invitations/[invitationId]/route.ts",
|
|
64
66
|
"app/(shell)/admin/users/page.tsx",
|
|
65
67
|
],
|
|
66
68
|
crm: [
|
|
@@ -136,7 +138,6 @@ export const PLATFORM_STARTER_FILES = [
|
|
|
136
138
|
"app/(auth)/auth-provider.tsx",
|
|
137
139
|
"app/(auth)/layout.tsx",
|
|
138
140
|
"app/(auth)/login/page.tsx",
|
|
139
|
-
"app/(auth)/signup/page.tsx",
|
|
140
141
|
"app/(auth)/forgot-password/page.tsx",
|
|
141
142
|
"app/(auth)/reset-password/page.tsx",
|
|
142
143
|
"app/(auth)/auth/post-login/page.tsx",
|
|
@@ -166,14 +167,14 @@ export const PLATFORM_STARTER_FILES = [
|
|
|
166
167
|
];
|
|
167
168
|
|
|
168
169
|
export const APP_DEPENDENCY_DEFAULTS = {
|
|
169
|
-
"@brightweblabs/app-shell": "^0.7.
|
|
170
|
-
"@brightweblabs/core-auth": "^0.7.
|
|
170
|
+
"@brightweblabs/app-shell": "^0.7.3",
|
|
171
|
+
"@brightweblabs/core-auth": "^0.7.2",
|
|
171
172
|
"@brightweblabs/infra": "^0.4.0",
|
|
172
|
-
"@brightweblabs/module-admin": "^0.5.
|
|
173
|
-
"@brightweblabs/module-crm": "^0.9.
|
|
174
|
-
"@brightweblabs/module-marketing": "^0.2.
|
|
175
|
-
"@brightweblabs/module-orgs": "^0.3.
|
|
176
|
-
"@brightweblabs/module-projects": "^0.8.
|
|
173
|
+
"@brightweblabs/module-admin": "^0.5.9",
|
|
174
|
+
"@brightweblabs/module-crm": "^0.9.4",
|
|
175
|
+
"@brightweblabs/module-marketing": "^0.2.8",
|
|
176
|
+
"@brightweblabs/module-orgs": "^0.3.9",
|
|
177
|
+
"@brightweblabs/module-projects": "^0.8.2",
|
|
177
178
|
"@brightweblabs/theme": "^0.5.0",
|
|
178
179
|
"@brightweblabs/ui": "^1.1.1",
|
|
179
180
|
"geist": "1.7.2",
|
package/src/generator.mjs
CHANGED
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
DesktopSidebar,
|
|
9
9
|
MobileNav,
|
|
10
10
|
computeInitials,
|
|
11
|
+
isShellNavItemActive,
|
|
11
12
|
useShellNavState,
|
|
13
|
+
type ShellContextualAction,
|
|
12
14
|
type ShellNavStateGroup,
|
|
13
15
|
} from "@brightweblabs/app-shell";
|
|
14
16
|
import { createAuthUiClient } from "@brightweblabs/core-auth/ui";
|
|
@@ -25,6 +27,11 @@ export type ShellViewer = {
|
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
const authClient = createAuthUiClient();
|
|
30
|
+
const toolbarWindowEventByAction: Record<string, string> = {
|
|
31
|
+
"projects-refresh": "projects:refresh",
|
|
32
|
+
"projects-new-menu": "projects:open-new-project",
|
|
33
|
+
"crm-create-menu": "brightweb:crm:create-contact",
|
|
34
|
+
};
|
|
28
35
|
|
|
29
36
|
export function ShellLayoutClient({
|
|
30
37
|
children,
|
|
@@ -46,12 +53,43 @@ export function ShellLayoutClient({
|
|
|
46
53
|
const { isSidebarCollapsed, isGroupOpen, toggleGroup, toggleSidebar } =
|
|
47
54
|
useShellNavState({ pathname, groups: shellGroups });
|
|
48
55
|
const isAdminSurface = pathname === "/admin" || pathname.startsWith("/admin/");
|
|
49
|
-
const
|
|
50
|
-
|
|
56
|
+
const shellNavItems = [
|
|
57
|
+
...config.primaryNav,
|
|
58
|
+
...(config.adminNavItem ? [config.adminNavItem] : []),
|
|
59
|
+
...config.toolsSection.items,
|
|
60
|
+
...config.moduleGroups.flatMap((group) => group.children),
|
|
61
|
+
];
|
|
62
|
+
const activeNavItem = shellNavItems.reduce<(typeof shellNavItems)[number] | undefined>(
|
|
63
|
+
(active, item) => isShellNavItemActive(pathname, item)
|
|
64
|
+
&& (!active || item.href.length > active.href.length)
|
|
65
|
+
? item
|
|
66
|
+
: active,
|
|
67
|
+
undefined,
|
|
68
|
+
);
|
|
69
|
+
const isActive = (href: string) => activeNavItem?.href === href;
|
|
51
70
|
const displayName =
|
|
52
71
|
[viewer.firstName, viewer.lastName].filter(Boolean).join(" ") ||
|
|
53
72
|
viewer.email ||
|
|
54
73
|
"Conta";
|
|
74
|
+
const projectsBaseHref = pathname.startsWith("/projects") ? "/projects" : "/projetos";
|
|
75
|
+
|
|
76
|
+
const handleToolbarAction = (item: ShellContextualAction) => {
|
|
77
|
+
if (item.action === "projects-back-to-portfolio") {
|
|
78
|
+
router.push(projectsBaseHref);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (item.action === "projects-open-board") {
|
|
82
|
+
const projectId = pathname.split("/")[2];
|
|
83
|
+
if (projectId) {
|
|
84
|
+
router.push(`${projectsBaseHref}/${projectId}/${projectsBaseHref === "/projects" ? "tasks" : "tarefas"}`);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (item.action) {
|
|
90
|
+
window.dispatchEvent(new Event(toolbarWindowEventByAction[item.action] ?? item.action));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
55
93
|
|
|
56
94
|
return (
|
|
57
95
|
<AppShellFrame
|
|
@@ -100,15 +138,20 @@ export function ShellLayoutClient({
|
|
|
100
138
|
}
|
|
101
139
|
header={
|
|
102
140
|
<AppHeader
|
|
141
|
+
title={activeNavItem?.label}
|
|
103
142
|
pathname={pathname}
|
|
104
143
|
toolbarRoutes={toolbarRoutes}
|
|
105
144
|
toolbarActions={toolbarActions}
|
|
106
|
-
|
|
145
|
+
onToolbarAction={handleToolbarAction}
|
|
146
|
+
>
|
|
147
|
+
{null}
|
|
148
|
+
</AppHeader>
|
|
107
149
|
}
|
|
108
150
|
mobileNav={
|
|
109
151
|
<MobileNav
|
|
110
152
|
toolsExpanded={isGroupOpen(config.toolsSection.key)}
|
|
111
153
|
visiblePrimaryNav={config.primaryNav}
|
|
154
|
+
adminNavItem={viewer.isAdmin ? config.adminNavItem : null}
|
|
112
155
|
visibleToolNav={config.toolsSection.items}
|
|
113
156
|
navGroups={config.moduleGroups}
|
|
114
157
|
isNavItemActive={isActive}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export async function DELETE(
|
|
2
|
+
request: Request,
|
|
3
|
+
context: { params: Promise<{ invitationId: string }> },
|
|
4
|
+
) {
|
|
5
|
+
const { handleAdminUserInvitationDeleteRequest } = await import("@brightweblabs/module-admin");
|
|
6
|
+
return handleAdminUserInvitationDeleteRequest(request, context);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const dynamic = "force-dynamic";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export async function GET() {
|
|
2
|
+
const { handleAdminUserInvitationsGetRequest } = await import("@brightweblabs/module-admin");
|
|
3
|
+
return handleAdminUserInvitationsGetRequest();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export async function POST(request: Request) {
|
|
7
|
+
const { handleAdminUserInvitationsPostRequest } = await import("@brightweblabs/module-admin");
|
|
8
|
+
return handleAdminUserInvitationsPostRequest(request);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const dynamic = "force-dynamic";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SignupPage as default } from "@brightweblabs/core-auth/ui";
|