chore(menu): add API reference link to the sidebar (#6289)

Co-authored-by: Pablo Lara <larabjj@gmail.com>
This commit is contained in:
Prowler Bot
2024-12-20 15:13:17 +01:00
committed by GitHub
parent ff7f7af78b
commit 7022b7bf25
3 changed files with 53 additions and 2 deletions
+1
View File
@@ -6,6 +6,7 @@
PROWLER_UI_VERSION="latest"
SITE_URL=http://localhost:3000
API_BASE_URL=http://prowler-api:8080/api/v1
NEXT_PUBLIC_API_DOCS_URL=http://prowler-api:8080/api/v1/docs
AUTH_TRUST_HOST=true
UI_PORT=3000
# openssl rand -base64 32
@@ -26,8 +26,14 @@ interface InvitationDetailsProps {
}
export const InvitationDetails = ({ attributes }: InvitationDetailsProps) => {
const baseURL = process.env.SITE_URL;
const invitationLink = `${baseURL}/sign-up?invitation_token=${attributes.token}`;
// window.location.origin to get the current base URL
const baseUrl =
typeof window !== "undefined"
? window.location.origin
: "http://localhost:3000";
const invitationLink = `${baseUrl}/invitations/check-details?id=${attributes.token}`;
return (
<div className="flex flex-col gap-x-4 gap-y-8">
<Card
+44
View File
@@ -160,6 +160,50 @@ export const SidebarWrap = () => {
)}
</CustomButton>
</Tooltip>
<Tooltip
content="API reference"
isDisabled={!isCompact}
placement="right"
>
<CustomButton
asLink={
process.env.NEXT_PUBLIC_IS_CLOUD_ENV === "true"
? "https://api.prowler.com/api/v1/docs"
: `${process.env.NEXT_PUBLIC_API_DOCS_URL}`
}
target="_blank"
ariaLabel="API reference"
variant="flat"
className={clsx(
"justify-start truncate bg-transparent text-default-500 data-[hover=true]:text-foreground dark:bg-transparent",
{
"justify-center": isCompact,
},
)}
isIconOnly={isCompact}
startContent={
isCompact ? null : (
<Icon
className="flex-none text-default-500"
icon="tabler:api"
width={24}
aria-hidden="true"
/>
)
}
>
{isCompact ? (
<Icon
className="text-default-500"
icon="tabler:api"
width={24}
aria-hidden="true"
/>
) : (
"API reference"
)}
</CustomButton>
</Tooltip>
<Tooltip content="Support" isDisabled={!isCompact} placement="right">
<CustomButton