feat(dashboard): add environment availability alert for projects

- Implemented a check for projects with no accessible environments, displaying an alert message to inform users.
- Updated project link behavior to prevent navigation when no environments are available, enhancing user experience.
This commit is contained in:
Mauricio Siu
2026-01-21 11:22:52 +01:00
parent b8d8d9e5b2
commit a8fc2adab6

View File

@@ -293,13 +293,24 @@ export const ShowProjects = () => {
project?.environments.find((env) => env.isDefault) ||
project?.environments?.[0];
const hasNoEnvironments = !accessibleEnvironment;
return (
<div
key={project.projectId}
className="w-full lg:max-w-md"
>
<Link
href={`/dashboard/project/${project.projectId}/environment/${accessibleEnvironment?.environmentId}`}
href={
hasNoEnvironments
? "#"
: `/dashboard/project/${project.projectId}/environment/${accessibleEnvironment?.environmentId}`
}
onClick={(e) => {
if (hasNoEnvironments) {
e.preventDefault();
}
}}
>
<Card className="group relative w-full h-full bg-transparent transition-colors hover:bg-border">
{haveServicesWithDomains ? (
@@ -431,6 +442,16 @@ export const ShowProjects = () => {
<span className="text-sm font-medium text-muted-foreground break-all">
{project.description}
</span>
{hasNoEnvironments && (
<div className="flex flex-row gap-2 items-center rounded-lg bg-yellow-50 p-2 mt-2 dark:bg-yellow-950">
<AlertTriangle className="size-4 text-yellow-600 dark:text-yellow-400 shrink-0" />
<span className="text-xs text-yellow-600 dark:text-yellow-400">
You have access to this project but no
environments are available
</span>
</div>
)}
</span>
<div className="flex self-start space-x-1">
<DropdownMenu>