Skip to content

Commit

Permalink
fix: improve feature not enabled UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Chakravarthy7102 committed Dec 19, 2023
1 parent 9c4c672 commit dafd657
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
3 changes: 1 addition & 2 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import Passwordless from "supertokens-node/recipe/passwordless";
import Session from "supertokens-node/recipe/session";
import ThirdParty from "supertokens-node/recipe/thirdparty";
import UserMetaData from "supertokens-node/recipe/usermetadata";
import UserRoles from "supertokens-node/recipe/userroles";

const websiteDomain = "http://localhost:3000";

Expand Down Expand Up @@ -89,7 +88,7 @@ SuperTokens.init({
}),
Session.init(),
AccountLinking.init(),
UserRoles.init(),
// UserRoles.init(),
],
});

Expand Down
9 changes: 9 additions & 0 deletions src/ui/components/alert/alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
& > div {
color: #a44915;
}

a {
color: #a44915;
font-weight: 500;
}
}

a:hover {
background: transparent !important;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/ui/components/alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import "./alert.scss";
type AlertProps = {
type?: "primary";
title: string;
content: string;
children: React.ReactNode;
};

export default function Alert({ content, title, type = "primary" }: AlertProps) {
export default function Alert({ children, title, type = "primary" }: AlertProps) {
return (
<div className={`alert ${type}`}>
<span>{title}</span>
<div>{content}</div>
<div>{children}</div>
</div>
);
}
11 changes: 7 additions & 4 deletions src/ui/components/userDetail/userRoles/UserRolesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ export default function UserRolesList() {
) : null}
</>
) : (
<Alert
title="Feature is not enabled"
content="Please enable this feature first to manage your user roles and permissions!"
/>
<Alert title="Feature is not enabled">
Enable this feature to manage user roles and permissions. Start by initializing the
UserRoles recipe in the recipeList on the backend. For more details, see{" "}
<a href="https://supertokens.com/docs/userdashboard/managing-user-roles-and-permissions">
this page.
</a>
</Alert>
)}
</>
</div>
Expand Down
11 changes: 7 additions & 4 deletions src/ui/pages/userroles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ export default function UserRolesList() {
function renderContent() {
if (isFeatureEnabled === false) {
return (
<Alert
title="Feature is not enabled"
content="Please enable this feature first to manage your user roles and permissions!"
/>
<Alert title="Feature is not enabled">
Enable this feature to manage user roles and permissions. Start by initializing the UserRoles recipe
in the recipeList on the backend. For more details, see{" "}
<a href="https://supertokens.com/docs/userdashboard/managing-user-roles-and-permissions">
this page.
</a>
</Alert>
);
}

Expand Down

0 comments on commit dafd657

Please sign in to comment.