@studiocubics/cms 0.0.1 → 0.0.2
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/clerk/actions/invitations.d.ts +6 -0
- package/dist/clerk/actions/invitations.js +59 -0
- package/dist/clerk/actions/invitations.js.map +1 -0
- package/dist/clerk/actions/systemUsers.d.ts +8 -0
- package/dist/clerk/actions/systemUsers.js +64 -0
- package/dist/clerk/actions/systemUsers.js.map +1 -0
- package/dist/clerk/auth.d.ts +8 -0
- package/dist/clerk/auth.js +21 -0
- package/dist/clerk/auth.js.map +1 -0
- package/dist/clerk/hasPermission.d.ts +33 -0
- package/dist/clerk/hasPermission.js +78 -0
- package/dist/clerk/hasPermission.js.map +1 -0
- package/dist/clerk/rbacConfig.d.ts +31 -0
- package/dist/clerk/rbacConfig.js +48 -0
- package/dist/clerk/rbacConfig.js.map +1 -0
- package/dist/clerk/schemas/invitation.d.ts +12 -0
- package/dist/clerk/schemas/invitation.js +20 -0
- package/dist/clerk/schemas/invitation.js.map +1 -0
- package/dist/clerk/schemas/systemUser.d.ts +6 -0
- package/dist/clerk/toClientSafeUser.d.ts +48 -0
- package/dist/clerk/toClientSafeUser.js +46 -0
- package/dist/clerk/toClientSafeUser.js.map +1 -0
- package/dist/constants/defaults.d.ts +6 -0
- package/dist/constants/defaults.js +56 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/pageLimits.d.ts +2 -0
- package/dist/constants/pageLimits.js +5 -0
- package/dist/constants/pageLimits.js.map +1 -0
- package/dist/index.css +215 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/CMSRootProviders.d.ts +4 -0
- package/dist/providers/CMSRootProviders.js +11 -0
- package/dist/providers/CMSRootProviders.js.map +1 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.d.ts +2 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js +13 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.js.map +1 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js +4 -0
- package/dist/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css.js.map +1 -0
- package/dist/ui/Layout/CMSSecurityLayout.d.ts +2 -0
- package/dist/ui/Layout/CMSSecurityLayout.js +18 -0
- package/dist/ui/Layout/CMSSecurityLayout.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.d.ts +6 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.js +15 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebar.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.d.ts +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js +18 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarBody.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.d.ts +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js +39 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.d.ts +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js +16 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.js.map +1 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js +4 -0
- package/dist/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css.js.map +1 -0
- package/dist/ui/Layout/_index.d.ts +2 -0
- package/dist/ui/System/Auth/SignIn/SignIn.d.ts +1 -0
- package/dist/ui/System/Auth/SignIn/SignIn.js +28 -0
- package/dist/ui/System/Auth/SignIn/SignIn.js.map +1 -0
- package/dist/ui/System/Auth/SignIn/SignIn.module.css.js +4 -0
- package/dist/ui/System/Auth/SignIn/SignIn.module.css.js.map +1 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.d.ts +14 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.js +46 -0
- package/dist/ui/System/Auth/SignIn/useSignInForm.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.d.ts +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.js +36 -0
- package/dist/ui/System/Auth/SignUp/SignUp.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/SignUp.module.css.js +4 -0
- package/dist/ui/System/Auth/SignUp/SignUp.module.css.js.map +1 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.d.ts +19 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.js +58 -0
- package/dist/ui/System/Auth/SignUp/useSignUpForm.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationList.d.ts +1 -0
- package/dist/ui/System/Invitations/InvitationList.js +11 -0
- package/dist/ui/System/Invitations/InvitationList.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListActions.d.ts +11 -0
- package/dist/ui/System/Invitations/InvitationListActions.js +39 -0
- package/dist/ui/System/Invitations/InvitationListActions.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListCard.d.ts +4 -0
- package/dist/ui/System/Invitations/InvitationListCard.js +16 -0
- package/dist/ui/System/Invitations/InvitationListCard.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListPage.d.ts +2 -0
- package/dist/ui/System/Invitations/InvitationListPage.js +22 -0
- package/dist/ui/System/Invitations/InvitationListPage.js.map +1 -0
- package/dist/ui/System/Invitations/InvitationListPagination.d.ts +4 -0
- package/dist/ui/System/Invitations/InvitationListPagination.js +11 -0
- package/dist/ui/System/Invitations/InvitationListPagination.js.map +1 -0
- package/dist/ui/System/Permissions/RoleListCard.d.ts +6 -0
- package/dist/ui/System/Permissions/RoleListCard.js +11 -0
- package/dist/ui/System/Permissions/RoleListCard.js.map +1 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.d.ts +4 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.js +14 -0
- package/dist/ui/System/Permissions/RolePermissionsPage.js.map +1 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.d.ts +2 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.js +28 -0
- package/dist/ui/System/Permissions/RolePermissionsTable.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.d.ts +5 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js +31 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js +4 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.d.ts +1 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.js +17 -0
- package/dist/ui/System/SystemUser/CurrentSystemUserPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserActions.d.ts +6 -0
- package/dist/ui/System/SystemUser/SystemUserActions.js +14 -0
- package/dist/ui/System/SystemUser/SystemUserActions.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.d.ts +12 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js +16 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.d.ts +11 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js +26 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserList.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserList.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserList.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserListActions.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.d.ts +11 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.js +34 -0
- package/dist/ui/System/SystemUser/SystemUserListCard.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.d.ts +2 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.js +24 -0
- package/dist/ui/System/SystemUser/SystemUserListPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.d.ts +4 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.js +11 -0
- package/dist/ui/System/SystemUser/SystemUserListPagination.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserPage.d.ts +1 -0
- package/dist/ui/System/SystemUser/SystemUserPage.js +17 -0
- package/dist/ui/System/SystemUser/SystemUserPage.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.d.ts +5 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.js +13 -0
- package/dist/ui/System/SystemUser/SystemUserPageContent.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.d.ts +6 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js +21 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js +4 -0
- package/dist/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.d.ts +9 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js +19 -0
- package/dist/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.js.map +1 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.d.ts +9 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.js +27 -0
- package/dist/ui/System/SystemUser/SystemUserTimestamps.js.map +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.d.ts +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.js +16 -0
- package/dist/ui/System/WelcomePage/WelcomePage.js.map +1 -0
- package/dist/ui/System/WelcomePage/WelcomePage.module.css.js +4 -0
- package/dist/ui/System/WelcomePage/WelcomePage.module.css.js.map +1 -0
- package/{src/ui/System/types.ts → dist/ui/System/types.d.ts} +3 -5
- package/dist/utils/proxyFunctions.d.ts +4 -0
- package/dist/utils/proxyFunctions.js +34 -0
- package/dist/utils/proxyFunctions.js.map +1 -0
- package/package.json +14 -14
- package/rollup.config.js +1 -1
- package/.turbo/turbo-build.log +0 -7
- package/CHANGELOG.md +0 -12
- package/eslint.config.js +0 -21
- package/src/clerk/actions/invitations.ts +0 -78
- package/src/clerk/actions/systemUsers.ts +0 -94
- package/src/clerk/auth.ts +0 -34
- package/src/clerk/clerk.d.ts +0 -105
- package/src/clerk/hasPermission.ts +0 -96
- package/src/clerk/rbacConfig.ts +0 -68
- package/src/clerk/schemas/invitation.ts +0 -17
- package/src/clerk/schemas/systemUser.ts +0 -16
- package/src/clerk/toClientSafeUser.ts +0 -77
- package/src/constants/defaults.tsx +0 -62
- package/src/constants/pageLimits.ts +0 -2
- package/src/declaration.d.ts +0 -5
- package/src/providers/CMSRootProviders.tsx +0 -13
- package/src/routes.d.ts +0 -96
- package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.module.css +0 -4
- package/src/ui/Inputs/ThemedMonacoEditor/ThemedMonacoEditor.tsx +0 -16
- package/src/ui/Layout/CMSSecurityLayout.tsx +0 -27
- package/src/ui/Layout/CMSSidebar/CMSSidebar.tsx +0 -39
- package/src/ui/Layout/CMSSidebar/CMSSidebarBody.tsx +0 -43
- package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.module.css +0 -7
- package/src/ui/Layout/CMSSidebar/CMSSidebarFooter/CMSSidebarFooter.tsx +0 -59
- package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.module.css +0 -44
- package/src/ui/Layout/CMSSidebar/CMSSidebarHeader/CMSSidebarHeader.tsx +0 -30
- package/src/ui/Layout/_index.ts +0 -2
- package/src/ui/System/Auth/SignIn/SignIn.module.css +0 -50
- package/src/ui/System/Auth/SignIn/SignIn.tsx +0 -79
- package/src/ui/System/Auth/SignIn/useSignInForm.tsx +0 -42
- package/src/ui/System/Auth/SignUp/SignUp.module.css +0 -48
- package/src/ui/System/Auth/SignUp/SignUp.tsx +0 -138
- package/src/ui/System/Auth/SignUp/useSignUpForm.tsx +0 -54
- package/src/ui/System/Invitations/InvitationList.tsx +0 -9
- package/src/ui/System/Invitations/InvitationListActions.tsx +0 -167
- package/src/ui/System/Invitations/InvitationListCard.tsx +0 -79
- package/src/ui/System/Invitations/InvitationListPage.tsx +0 -32
- package/src/ui/System/Invitations/InvitationListPagination.tsx +0 -19
- package/src/ui/System/Permissions/RoleListCard.tsx +0 -33
- package/src/ui/System/Permissions/RolePermissionsPage.tsx +0 -18
- package/src/ui/System/Permissions/RolePermissionsTable.tsx +0 -36
- package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.module.css +0 -5
- package/src/ui/System/SystemUser/CurrentSystemUserButton/CurrentSystemUserButton.tsx +0 -102
- package/src/ui/System/SystemUser/CurrentSystemUserPage.tsx +0 -12
- package/src/ui/System/SystemUser/SystemUserActions.tsx +0 -45
- package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.module.css +0 -6
- package/src/ui/System/SystemUser/SystemUserDetails/SystemUserDetails.tsx +0 -71
- package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.module.css +0 -7
- package/src/ui/System/SystemUser/SystemUserDetailsForm/SystemUserDetailsForm.tsx +0 -114
- package/src/ui/System/SystemUser/SystemUserList.tsx +0 -18
- package/src/ui/System/SystemUser/SystemUserListActions.tsx +0 -17
- package/src/ui/System/SystemUser/SystemUserListCard.tsx +0 -85
- package/src/ui/System/SystemUser/SystemUserListPage.tsx +0 -33
- package/src/ui/System/SystemUser/SystemUserListPagination.tsx +0 -19
- package/src/ui/System/SystemUser/SystemUserPage.tsx +0 -30
- package/src/ui/System/SystemUser/SystemUserPageContent.tsx +0 -54
- package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.module.css +0 -17
- package/src/ui/System/SystemUser/SystemUserRole/SystemUserRole.tsx +0 -64
- package/src/ui/System/SystemUser/SystemUserRoleForm/SystemUserRoleForm.tsx +0 -51
- package/src/ui/System/SystemUser/SystemUserTimestamps.tsx +0 -56
- package/src/ui/System/WelcomePage/WelcomePage.module.css +0 -18
- package/src/ui/System/WelcomePage/WelcomePage.tsx +0 -43
- package/src/utils/proxyFunctions.ts +0 -37
- package/tsconfig.json +0 -32
- /package/{src/clerk/_index.ts → dist/clerk/_index.d.ts} +0 -0
- /package/{src/clerk/actions/_index.ts → dist/clerk/actions/_index.d.ts} +0 -0
- /package/{src/clerk/schemas/_index.ts → dist/clerk/schemas/_index.d.ts} +0 -0
- /package/{src/constants/_index.ts → dist/constants/_index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/providers/_index.ts → dist/providers/_index.d.ts} +0 -0
- /package/{src/ui/Inputs/_index.ts → dist/ui/Inputs/_index.d.ts} +0 -0
- /package/{src/ui/Layout/CMSSidebar/_index.ts → dist/ui/Layout/CMSSidebar/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/SignIn/_index.ts → dist/ui/System/Auth/SignIn/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/SignUp/_index.ts → dist/ui/System/Auth/SignUp/_index.d.ts} +0 -0
- /package/{src/ui/System/Auth/_index.ts → dist/ui/System/Auth/_index.d.ts} +0 -0
- /package/{src/ui/System/Invitations/_index.ts → dist/ui/System/Invitations/_index.d.ts} +0 -0
- /package/{src/ui/System/Permissions/_index.ts → dist/ui/System/Permissions/_index.d.ts} +0 -0
- /package/{src/ui/System/SystemUser/_index.ts → dist/ui/System/SystemUser/_index.d.ts} +0 -0
- /package/{src/ui/System/_index.ts → dist/ui/System/_index.d.ts} +0 -0
- /package/{src/ui/_index.ts → dist/ui/_index.d.ts} +0 -0
- /package/{src/utils/_index.ts → dist/utils/_index.d.ts} +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { User } from "@clerk/nextjs/server";
|
|
4
|
-
import {
|
|
5
|
-
type CardProps,
|
|
6
|
-
Card,
|
|
7
|
-
ConfirmationForm,
|
|
8
|
-
IdentityDisplay,
|
|
9
|
-
Button,
|
|
10
|
-
TextInput,
|
|
11
|
-
toast,
|
|
12
|
-
} from "@studiocubics/ui";
|
|
13
|
-
import styles from "./SystemUserDetailsForm.module.css";
|
|
14
|
-
import { initialiseForm } from "@studiocubics/utils";
|
|
15
|
-
import { systemUserDetailsUpdateAction } from "../../../../clerk/_index";
|
|
16
|
-
import { useActionState, useEffect, useRef, useState } from "react";
|
|
17
|
-
|
|
18
|
-
const initialSystemUserDetailsUpdateState = initialiseForm(
|
|
19
|
-
"firstName",
|
|
20
|
-
"lastName",
|
|
21
|
-
"imageUrl",
|
|
22
|
-
);
|
|
23
|
-
export type SystemUserDetailsUpdateState =
|
|
24
|
-
typeof initialSystemUserDetailsUpdateState;
|
|
25
|
-
|
|
26
|
-
export function SystemUserDetailsForm({
|
|
27
|
-
imageUrl,
|
|
28
|
-
firstName,
|
|
29
|
-
lastName,
|
|
30
|
-
onClose,
|
|
31
|
-
...rest
|
|
32
|
-
}: {
|
|
33
|
-
imageUrl?: User["imageUrl"];
|
|
34
|
-
firstName?: User["firstName"];
|
|
35
|
-
lastName?: User["lastName"];
|
|
36
|
-
onClose(): void;
|
|
37
|
-
} & CardProps) {
|
|
38
|
-
const [state, action, pending] = useActionState(
|
|
39
|
-
systemUserDetailsUpdateAction.bind(null, "hello"),
|
|
40
|
-
initialSystemUserDetailsUpdateState,
|
|
41
|
-
);
|
|
42
|
-
const [imagePreview, setImagePreview] = useState(imageUrl);
|
|
43
|
-
const [inputImage, setInputImage] = useState<File>();
|
|
44
|
-
const imageInputRef = useRef<HTMLInputElement | null>(null);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (inputImage) setImagePreview(URL.createObjectURL(inputImage));
|
|
48
|
-
}, [inputImage]);
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Card fullWidth {...rest}>
|
|
52
|
-
<ConfirmationForm
|
|
53
|
-
formTitle="Edit Details"
|
|
54
|
-
onCancel={onClose}
|
|
55
|
-
action={action}
|
|
56
|
-
disabled={pending}
|
|
57
|
-
>
|
|
58
|
-
<IdentityDisplay
|
|
59
|
-
profileImage={imagePreview}
|
|
60
|
-
profileName={
|
|
61
|
-
<div className={styles.formRow}>
|
|
62
|
-
<Button
|
|
63
|
-
size="sm"
|
|
64
|
-
variant="outlined"
|
|
65
|
-
disabled={pending}
|
|
66
|
-
onClick={() => imageInputRef.current?.click()}
|
|
67
|
-
>
|
|
68
|
-
Upload
|
|
69
|
-
</Button>
|
|
70
|
-
<input
|
|
71
|
-
type="file"
|
|
72
|
-
accept="image/jpg, image/png"
|
|
73
|
-
ref={imageInputRef}
|
|
74
|
-
name={"imageFile"}
|
|
75
|
-
onChange={(e) =>
|
|
76
|
-
e.target?.files && setInputImage(e.target.files[0])
|
|
77
|
-
}
|
|
78
|
-
hidden
|
|
79
|
-
disabled={pending}
|
|
80
|
-
/>
|
|
81
|
-
<Button
|
|
82
|
-
size="sm"
|
|
83
|
-
color="error"
|
|
84
|
-
onClick={() => toast("hello")}
|
|
85
|
-
disabled={pending}
|
|
86
|
-
>
|
|
87
|
-
Remove
|
|
88
|
-
</Button>
|
|
89
|
-
</div>
|
|
90
|
-
}
|
|
91
|
-
role={"Recommended size 1:1, up to 10MB."}
|
|
92
|
-
/>
|
|
93
|
-
<div className={styles.formRow}>
|
|
94
|
-
<TextInput
|
|
95
|
-
fullWidth
|
|
96
|
-
label="First Name"
|
|
97
|
-
defaultValue={firstName!}
|
|
98
|
-
name="firstName"
|
|
99
|
-
error={state.fieldErrors?.firstName}
|
|
100
|
-
disabled={pending}
|
|
101
|
-
/>
|
|
102
|
-
<TextInput
|
|
103
|
-
fullWidth
|
|
104
|
-
label="Last Name"
|
|
105
|
-
defaultValue={lastName!}
|
|
106
|
-
name="lastName"
|
|
107
|
-
error={state.fieldErrors?.lastName}
|
|
108
|
-
disabled={pending}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
</ConfirmationForm>
|
|
112
|
-
</Card>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { systemUserListReadAction } from "../../../clerk/actions/systemUsers";
|
|
2
|
-
import type { Role } from "../../../clerk/rbacConfig";
|
|
3
|
-
import { SystemUserListCard } from "./SystemUserListCard";
|
|
4
|
-
|
|
5
|
-
export async function SystemUserList(params: ClerkUserListParams) {
|
|
6
|
-
const systemUserList = await systemUserListReadAction(params);
|
|
7
|
-
return systemUserList.data.map((user) => (
|
|
8
|
-
<SystemUserListCard
|
|
9
|
-
key={user.id}
|
|
10
|
-
id={user.id}
|
|
11
|
-
fullName={user.fullName}
|
|
12
|
-
imageUrl={user.imageUrl}
|
|
13
|
-
emailAddress={user.primaryEmailAddress?.emailAddress}
|
|
14
|
-
role={user.publicMetadata.role as Role}
|
|
15
|
-
lastSignInAt={user.lastSignInAt}
|
|
16
|
-
/>
|
|
17
|
-
));
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Button } from "@studiocubics/ui";
|
|
2
|
-
import { Search, ChartNoAxesGantt } from "lucide-react";
|
|
3
|
-
import { InvitationCreateDialog } from "../Invitations/InvitationListActions";
|
|
4
|
-
|
|
5
|
-
export function SystemUserListActions() {
|
|
6
|
-
return (
|
|
7
|
-
<>
|
|
8
|
-
<InvitationCreateDialog />
|
|
9
|
-
<Button size="sm" square>
|
|
10
|
-
<Search />
|
|
11
|
-
</Button>
|
|
12
|
-
<Button size="sm" square>
|
|
13
|
-
<ChartNoAxesGantt />
|
|
14
|
-
</Button>
|
|
15
|
-
</>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { User } from "@clerk/nextjs/server";
|
|
4
|
-
import {
|
|
5
|
-
CollectionItemCard,
|
|
6
|
-
CollectionItemCardActions,
|
|
7
|
-
type DocumentAction,
|
|
8
|
-
List,
|
|
9
|
-
ListItem,
|
|
10
|
-
} from "@studiocubics/ui";
|
|
11
|
-
import { toCapitalised } from "@studiocubics/utils";
|
|
12
|
-
import {
|
|
13
|
-
BrickWallShield,
|
|
14
|
-
EllipsisVertical,
|
|
15
|
-
History,
|
|
16
|
-
OctagonX,
|
|
17
|
-
} from "lucide-react";
|
|
18
|
-
import Link from "next/link";
|
|
19
|
-
import { SystemUserDeleteListItem } from "./SystemUserActions";
|
|
20
|
-
import type { Route } from "next";
|
|
21
|
-
import type { Role } from "../../../clerk/rbacConfig";
|
|
22
|
-
|
|
23
|
-
export interface SystemUserListCardProps {
|
|
24
|
-
id: User["id"];
|
|
25
|
-
fullName: User["fullName"];
|
|
26
|
-
imageUrl: User["imageUrl"];
|
|
27
|
-
emailAddress?: NonNullable<User["primaryEmailAddress"]>["emailAddress"];
|
|
28
|
-
role?: Role;
|
|
29
|
-
lastSignInAt?: User["lastActiveAt"];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function SystemUserListCard(props: SystemUserListCardProps) {
|
|
33
|
-
const { id, fullName, imageUrl, emailAddress, role, lastSignInAt } = props;
|
|
34
|
-
const actions: DocumentAction[] = [
|
|
35
|
-
{
|
|
36
|
-
actionType: "link",
|
|
37
|
-
icon: <BrickWallShield />,
|
|
38
|
-
label: "View Sessions",
|
|
39
|
-
href: `/dashboard/security/systemUsers/${id}/sessions`,
|
|
40
|
-
prefetch: true,
|
|
41
|
-
// @ts-expect-error
|
|
42
|
-
// This is dumb polymorphism garbage!
|
|
43
|
-
as: Link,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
actionType: "popover",
|
|
47
|
-
icon: <EllipsisVertical />,
|
|
48
|
-
popoverChildren: (
|
|
49
|
-
<List className="surfaceContainer">
|
|
50
|
-
<SystemUserDeleteListItem uid={id} fullName={fullName} />
|
|
51
|
-
<ListItem
|
|
52
|
-
{...{
|
|
53
|
-
startIcon: <OctagonX />,
|
|
54
|
-
children: "Ban User",
|
|
55
|
-
color: "error",
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
58
|
-
</List>
|
|
59
|
-
),
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<CollectionItemCard
|
|
65
|
-
as={Link}
|
|
66
|
-
href={`/dashboard/security/systemUsers/${id}` as Route}
|
|
67
|
-
title={fullName ?? "Name is missing"}
|
|
68
|
-
thumbnail={<img src={imageUrl} alt={fullName ?? ""} />}
|
|
69
|
-
subtitle={emailAddress}
|
|
70
|
-
chip={toCapitalised(role)}
|
|
71
|
-
description={
|
|
72
|
-
lastSignInAt ? (
|
|
73
|
-
<>
|
|
74
|
-
<History size={16} />
|
|
75
|
-
 Last Active 
|
|
76
|
-
<strong>{new Date(lastSignInAt).toDateString()}</strong>
|
|
77
|
-
</>
|
|
78
|
-
) : (
|
|
79
|
-
"No activity found!"
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
footer={<CollectionItemCardActions actions={actions} />}
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { SYSTEM_USERS_PAGE_LIMIT as limit } from "../../../constants/pageLimits";
|
|
2
|
-
import type { SecurityPageProps } from "../types";
|
|
3
|
-
import { PageLayoutPagination } from "@studiocubics/ui";
|
|
4
|
-
import { SystemUserListActions } from "./SystemUserListActions";
|
|
5
|
-
import { SystemUserList } from "./SystemUserList";
|
|
6
|
-
import { SystemUserListPagination } from "./SystemUserListPagination";
|
|
7
|
-
|
|
8
|
-
export async function SystemUserListPage({
|
|
9
|
-
searchParams,
|
|
10
|
-
securityLinks,
|
|
11
|
-
}: SecurityPageProps) {
|
|
12
|
-
const sp = await searchParams;
|
|
13
|
-
const page = Number(sp.page ?? 1);
|
|
14
|
-
const orderBy = String(sp.orderBy ?? "created_at");
|
|
15
|
-
const query = String(sp.query ?? "");
|
|
16
|
-
const offset = (page - 1) * limit;
|
|
17
|
-
const params = {
|
|
18
|
-
limit,
|
|
19
|
-
offset,
|
|
20
|
-
orderBy,
|
|
21
|
-
query,
|
|
22
|
-
};
|
|
23
|
-
return (
|
|
24
|
-
<PageLayoutPagination
|
|
25
|
-
actions={<SystemUserListActions />}
|
|
26
|
-
size="sm"
|
|
27
|
-
title={securityLinks[2]?.children}
|
|
28
|
-
paginationComponent={<SystemUserListPagination page={page} {...params} />}
|
|
29
|
-
>
|
|
30
|
-
<SystemUserList {...params} />
|
|
31
|
-
</PageLayoutPagination>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NextSSRPagination } from "@studiocubics/next";
|
|
2
|
-
import { systemUserListReadAction } from "../../../clerk/actions/systemUsers";
|
|
3
|
-
|
|
4
|
-
export async function SystemUserListPagination({
|
|
5
|
-
page,
|
|
6
|
-
...params
|
|
7
|
-
}: {
|
|
8
|
-
page: number;
|
|
9
|
-
limit: number;
|
|
10
|
-
} & ClerkUserListParams) {
|
|
11
|
-
const systemUsersList = await systemUserListReadAction(params);
|
|
12
|
-
return (
|
|
13
|
-
<NextSSRPagination
|
|
14
|
-
page={page}
|
|
15
|
-
limit={params.limit}
|
|
16
|
-
total={systemUsersList.totalCount}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Breadcrumbs, PageTitle } from "@studiocubics/ui";
|
|
2
|
-
import { SystemUserPageContent } from "./SystemUserPageContent";
|
|
3
|
-
import Link from "next/link";
|
|
4
|
-
import { auth } from "../../../clerk/auth";
|
|
5
|
-
import { systemUserReadAction } from "../../../clerk/actions/systemUsers";
|
|
6
|
-
export async function SystemUserPage({
|
|
7
|
-
params,
|
|
8
|
-
}: PageProps<"/dashboard/security/systemUsers/[userId]">) {
|
|
9
|
-
const userId = (await params).userId;
|
|
10
|
-
const session = await auth();
|
|
11
|
-
const allowEdit = await session.hasPermission("systemUsers", "update");
|
|
12
|
-
const user = await systemUserReadAction(userId);
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<PageTitle
|
|
16
|
-
size="sm"
|
|
17
|
-
title={
|
|
18
|
-
<Breadcrumbs defaultActive={1}>
|
|
19
|
-
<h4>
|
|
20
|
-
<Link href={"/dashboard/security/systemUsers"}>System Users</Link>
|
|
21
|
-
</h4>
|
|
22
|
-
<h4>{user.fullName}'s Account</h4>
|
|
23
|
-
</Breadcrumbs>
|
|
24
|
-
}
|
|
25
|
-
noBorders
|
|
26
|
-
/>
|
|
27
|
-
<SystemUserPageContent user={user} allowEdit={allowEdit} />
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { SectionWrapper } from "@studiocubics/ui";
|
|
2
|
-
import { SystemUserDetails } from "./SystemUserDetails/SystemUserDetails";
|
|
3
|
-
import { SystemUserRole } from "./SystemUserRole/SystemUserRole";
|
|
4
|
-
import { SystemUserTimestamps } from "./SystemUserTimestamps";
|
|
5
|
-
import Link from "next/link";
|
|
6
|
-
import type { User } from "@clerk/nextjs/server";
|
|
7
|
-
import type { Role } from "../../../clerk/rbacConfig";
|
|
8
|
-
|
|
9
|
-
export function SystemUserPageContent({
|
|
10
|
-
allowEdit,
|
|
11
|
-
user,
|
|
12
|
-
}: {
|
|
13
|
-
allowEdit: boolean;
|
|
14
|
-
user: User;
|
|
15
|
-
}) {
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<SectionWrapper title={"Account Details"} noBorders>
|
|
19
|
-
<SystemUserDetails
|
|
20
|
-
editable={allowEdit}
|
|
21
|
-
id={user.id}
|
|
22
|
-
fullName={user.fullName}
|
|
23
|
-
firstName={user.firstName}
|
|
24
|
-
lastName={user.lastName}
|
|
25
|
-
imageUrl={user.imageUrl}
|
|
26
|
-
emailAddress={user.primaryEmailAddress?.emailAddress}
|
|
27
|
-
/>
|
|
28
|
-
</SectionWrapper>
|
|
29
|
-
<SectionWrapper title={"Account Timestamps"}>
|
|
30
|
-
<SystemUserTimestamps
|
|
31
|
-
createdAt={user.createdAt}
|
|
32
|
-
updatedAt={user.updatedAt}
|
|
33
|
-
lastSignInAt={user.lastSignInAt}
|
|
34
|
-
/>
|
|
35
|
-
</SectionWrapper>
|
|
36
|
-
<SectionWrapper title={"Assigned Role"}>
|
|
37
|
-
<SystemUserRole
|
|
38
|
-
role={user.publicMetadata.role as Role}
|
|
39
|
-
editable={allowEdit}
|
|
40
|
-
/>
|
|
41
|
-
</SectionWrapper>
|
|
42
|
-
<SectionWrapper
|
|
43
|
-
title={"Active Sessions"}
|
|
44
|
-
subtitle={
|
|
45
|
-
<p style={{ fontSize: "var(--fs-body2)" }}>
|
|
46
|
-
<Link href={`/dashboard/security/systemUsers/${user.id}/sessions`}>
|
|
47
|
-
View All Sessions
|
|
48
|
-
</Link>
|
|
49
|
-
</p>
|
|
50
|
-
}
|
|
51
|
-
></SectionWrapper>
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
align-items: flex-start;
|
|
5
|
-
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
.main {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex: 1;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
gap: var(--spacing-gap-2);
|
|
12
|
-
align-items: flex-start;
|
|
13
|
-
p {
|
|
14
|
-
font-size: var(--fs-body2);
|
|
15
|
-
color: var(--color-on-background-faint);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { toCapitalised } from "@studiocubics/utils";
|
|
4
|
-
import { Edit, User } from "lucide-react";
|
|
5
|
-
import { Button, Tooltip, TransitionAnimation } from "@studiocubics/ui";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
import { useDisclosure } from "@studiocubics/hooks";
|
|
8
|
-
import styles from "./SystemUserRole.module.css";
|
|
9
|
-
import { RBAC_CONFIG, type Role } from "../../../../clerk/rbacConfig";
|
|
10
|
-
import type { Route } from "next";
|
|
11
|
-
import { SystemUserRoleForm } from "../SystemUserRoleForm/SystemUserRoleForm";
|
|
12
|
-
|
|
13
|
-
export interface SystemUserRoleProps {
|
|
14
|
-
role: Role;
|
|
15
|
-
editable?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function SystemUserRole({ role, editable }: SystemUserRoleProps) {
|
|
19
|
-
const roleDetails = RBAC_CONFIG[role];
|
|
20
|
-
const { open, handleOpen, handleClose } = useDisclosure();
|
|
21
|
-
if (!roleDetails) return null;
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<>
|
|
25
|
-
<TransitionAnimation
|
|
26
|
-
in={!open}
|
|
27
|
-
transformOrigin={"top"}
|
|
28
|
-
mountOnly
|
|
29
|
-
unmountOnExit
|
|
30
|
-
>
|
|
31
|
-
<div className={styles.root}>
|
|
32
|
-
<div className={styles.main}>
|
|
33
|
-
<Tooltip renderArrow title={"View resource permissions"}>
|
|
34
|
-
<Button
|
|
35
|
-
as={Link}
|
|
36
|
-
variant="contained"
|
|
37
|
-
color="primary"
|
|
38
|
-
startIcon={<User size={16} />}
|
|
39
|
-
size="sm"
|
|
40
|
-
href={`/dashboard/security/permissions/${role}` as Route}
|
|
41
|
-
>
|
|
42
|
-
{toCapitalised(role)}
|
|
43
|
-
</Button>
|
|
44
|
-
</Tooltip>
|
|
45
|
-
<p>{roleDetails.desc}</p>
|
|
46
|
-
</div>
|
|
47
|
-
{editable && (
|
|
48
|
-
<Button size="sm" startIcon={<Edit />} onClick={handleOpen}>
|
|
49
|
-
Edit Role
|
|
50
|
-
</Button>
|
|
51
|
-
)}
|
|
52
|
-
</div>
|
|
53
|
-
</TransitionAnimation>
|
|
54
|
-
<TransitionAnimation
|
|
55
|
-
in={open}
|
|
56
|
-
transformOrigin={"top right"}
|
|
57
|
-
mountOnly
|
|
58
|
-
unmountOnExit
|
|
59
|
-
>
|
|
60
|
-
<SystemUserRoleForm role={role} onClose={handleClose} />
|
|
61
|
-
</TransitionAnimation>
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
type CardProps,
|
|
5
|
-
Card,
|
|
6
|
-
ConfirmationForm,
|
|
7
|
-
Select,
|
|
8
|
-
} from "@studiocubics/ui";
|
|
9
|
-
import { initialiseForm, toCapitalised } from "@studiocubics/utils";
|
|
10
|
-
import { type Role, roles } from "../../../../clerk/rbacConfig";
|
|
11
|
-
import { useActionState } from "react";
|
|
12
|
-
import { systemUserRoleUpdateAction } from "../../../../clerk/_index";
|
|
13
|
-
|
|
14
|
-
const initialSystemUserRoleUpdateState = initialiseForm("role");
|
|
15
|
-
|
|
16
|
-
export type SystemUserRoleUpdateState = typeof initialSystemUserRoleUpdateState;
|
|
17
|
-
|
|
18
|
-
export function SystemUserRoleForm({
|
|
19
|
-
role,
|
|
20
|
-
onClose,
|
|
21
|
-
...rest
|
|
22
|
-
}: { role: Role; onClose(): void } & CardProps) {
|
|
23
|
-
const [state, action, pending] = useActionState(
|
|
24
|
-
systemUserRoleUpdateAction.bind(null, "hello"),
|
|
25
|
-
initialSystemUserRoleUpdateState,
|
|
26
|
-
);
|
|
27
|
-
return (
|
|
28
|
-
<Card {...rest} fullWidth>
|
|
29
|
-
<ConfirmationForm
|
|
30
|
-
variant="danger"
|
|
31
|
-
confirmText="Change Role"
|
|
32
|
-
action={action}
|
|
33
|
-
formTitle="Edit Role"
|
|
34
|
-
onCancel={onClose}
|
|
35
|
-
>
|
|
36
|
-
<Select
|
|
37
|
-
label="Current role"
|
|
38
|
-
error={state.fieldErrors?.role}
|
|
39
|
-
defaultValue={role}
|
|
40
|
-
disabled={pending}
|
|
41
|
-
>
|
|
42
|
-
{roles.map((r) => (
|
|
43
|
-
<option key={r} value={r}>
|
|
44
|
-
{toCapitalised(r)}
|
|
45
|
-
</option>
|
|
46
|
-
))}
|
|
47
|
-
</Select>
|
|
48
|
-
</ConfirmationForm>
|
|
49
|
-
</Card>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useUser } from "@clerk/nextjs";
|
|
4
|
-
import type { User } from "@clerk/nextjs/server";
|
|
5
|
-
import { LabeledValue, Skeleton } from "@studiocubics/ui";
|
|
6
|
-
|
|
7
|
-
export function CurrentSystemUserTimestamps() {
|
|
8
|
-
const { user, isLoaded } = useUser();
|
|
9
|
-
// if (!user) return null;
|
|
10
|
-
return (
|
|
11
|
-
<SystemUserTimestamps
|
|
12
|
-
isLoaded={isLoaded}
|
|
13
|
-
createdAt={user?.createdAt}
|
|
14
|
-
updatedAt={user?.updatedAt}
|
|
15
|
-
lastSignInAt={user?.lastSignInAt}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
export interface SystemUserTimestampsProps {
|
|
20
|
-
createdAt?: User["createdAt"] | NonNullable<ClerkClientUser>["createdAt"];
|
|
21
|
-
updatedAt?: User["updatedAt"] | NonNullable<ClerkClientUser>["updatedAt"];
|
|
22
|
-
lastSignInAt?:
|
|
23
|
-
| User["lastSignInAt"]
|
|
24
|
-
| NonNullable<ClerkClientUser>["lastSignInAt"];
|
|
25
|
-
isLoaded?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function SystemUserTimestamps(props: SystemUserTimestampsProps) {
|
|
29
|
-
const { createdAt, updatedAt, lastSignInAt, isLoaded = true } = props;
|
|
30
|
-
const timestamps = [
|
|
31
|
-
{ stamp: "Created at", time: createdAt },
|
|
32
|
-
{ stamp: "Updated", time: updatedAt },
|
|
33
|
-
{ stamp: "Last Sign in", time: lastSignInAt },
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
return timestamps.map((timestamp) => {
|
|
37
|
-
let timestampTime =
|
|
38
|
-
timestamp.time && typeof timestamp.time == "number"
|
|
39
|
-
? new Date(timestamp.time)
|
|
40
|
-
: timestamp.time;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<LabeledValue key={timestamp.stamp} label={timestamp.stamp}>
|
|
44
|
-
{isLoaded ? (
|
|
45
|
-
!timestamp.time ? (
|
|
46
|
-
"-"
|
|
47
|
-
) : (
|
|
48
|
-
timestampTime?.toLocaleString()
|
|
49
|
-
)
|
|
50
|
-
) : (
|
|
51
|
-
<Skeleton width={150} height={24} />
|
|
52
|
-
)}
|
|
53
|
-
</LabeledValue>
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: var(--spacing-gap-4);
|
|
7
|
-
width: 100dvw;
|
|
8
|
-
height: 100dvh;
|
|
9
|
-
}
|
|
10
|
-
.desc {
|
|
11
|
-
max-width: 65ch;
|
|
12
|
-
text-align: center;
|
|
13
|
-
font-size: var(--fs-body);
|
|
14
|
-
color: var(--color-on-background-faint);
|
|
15
|
-
}
|
|
16
|
-
.catcall {
|
|
17
|
-
font-size: var(--fs-body2);
|
|
18
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Button, CubicsUILogo, PoweredByBanner } from "@studiocubics/ui";
|
|
2
|
-
import styles from "./WelcomePage.module.css";
|
|
3
|
-
import Link from "next/link";
|
|
4
|
-
import { LayoutDashboardIcon, LogIn } from "lucide-react";
|
|
5
|
-
import { auth } from "../../../clerk/auth";
|
|
6
|
-
export async function WelcomePage() {
|
|
7
|
-
const { userId } = await auth();
|
|
8
|
-
const loggedOutUser = (
|
|
9
|
-
<Link href={"/auth/signIn/"}>
|
|
10
|
-
<Button variant="contained" endIcon={<LogIn />}>
|
|
11
|
-
Get Started
|
|
12
|
-
</Button>
|
|
13
|
-
</Link>
|
|
14
|
-
);
|
|
15
|
-
const loggedInUser = (
|
|
16
|
-
<Link href={"/dashboard"}>
|
|
17
|
-
<Button variant="contained" endIcon={<LayoutDashboardIcon />}>
|
|
18
|
-
Go to dashboard
|
|
19
|
-
</Button>
|
|
20
|
-
</Link>
|
|
21
|
-
);
|
|
22
|
-
return (
|
|
23
|
-
<div className={styles.root}>
|
|
24
|
-
<CubicsUILogo width={"10rem"} height={"auto"} onlyFavicon />
|
|
25
|
-
<PoweredByBanner size={"md"} />
|
|
26
|
-
<h2>Welcome to Cubics CMS!</h2>
|
|
27
|
-
<p className={styles.desc}>
|
|
28
|
-
A powerful and intuitive platform to manage your content effortlessly.
|
|
29
|
-
Streamline updates, enhance collaboration, and take full control of your
|
|
30
|
-
digital presence.
|
|
31
|
-
</p>
|
|
32
|
-
{userId ? loggedInUser : loggedOutUser}
|
|
33
|
-
{!userId && (
|
|
34
|
-
<p className={styles.catcall}>
|
|
35
|
-
Dont have an account?
|
|
36
|
-
{/* TODO add request account from admin flow.
|
|
37
|
-
//@ts-ignore */}
|
|
38
|
-
<Link href="/auth/requestAccount">Request from an admin</Link>
|
|
39
|
-
</p>
|
|
40
|
-
)}
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
|
|
2
|
-
import { NextResponse } from "next/server";
|
|
3
|
-
|
|
4
|
-
const isPublicRoute = createRouteMatcher(["/", "/auth(.*)"]);
|
|
5
|
-
|
|
6
|
-
export const cmsMiddleware = clerkMiddleware(async (auth, req) => {
|
|
7
|
-
const { userId, sessionClaims, redirectToSignIn } = await auth();
|
|
8
|
-
|
|
9
|
-
// If the user isn't signed in and the route is private, redirect to sign-in
|
|
10
|
-
if (!userId && !isPublicRoute(req)) {
|
|
11
|
-
return redirectToSignIn({ returnBackUrl: req.url });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Catch users who do not have `onboardingComplete: true` in their publicMetadata
|
|
15
|
-
// Redirect them to the /auth/onboarding route to complete onboarding
|
|
16
|
-
if (
|
|
17
|
-
userId &&
|
|
18
|
-
!sessionClaims?.metadata?.onboardingComplete &&
|
|
19
|
-
req.nextUrl.pathname !== "/auth/onboarding"
|
|
20
|
-
) {
|
|
21
|
-
const onboardingUrl = new URL("/auth/onboarding", req.url);
|
|
22
|
-
return NextResponse.redirect(onboardingUrl);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// If the user is logged in and the route is protected, let them view.
|
|
26
|
-
if (userId && !isPublicRoute(req)) {
|
|
27
|
-
return NextResponse.next();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
export const cmsConfig = {
|
|
31
|
-
matcher: [
|
|
32
|
-
// Skip Next.js internals and all static files, unless found in search params
|
|
33
|
-
"/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
|
|
34
|
-
// Always run for API routes
|
|
35
|
-
"/(api|trpc)(.*)",
|
|
36
|
-
],
|
|
37
|
-
};
|