Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/api/plane/app/views/project/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Django imports
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Exists, F, OuterRef, Prefetch, Q, Subquery
from django.db.models import Exists, F, OuterRef, Prefetch, Q, Subquery, Count
from django.utils import timezone

# Third Party imports
Expand All @@ -24,18 +24,18 @@
from plane.db.models import (
UserFavorite,
DeployBoard,
ProjectUserProperty,
Intake,
Project,
ProjectIdentifier,
ProjectMember,
ProjectNetwork,
State,
DEFAULT_STATES,
UserFavorite,
Workspace,
WorkspaceMember,
IntakeIssue,
)
from plane.db.models.intake import IntakeIssueStatus
from plane.utils.host import base_host


Expand Down Expand Up @@ -153,6 +153,11 @@ def list(self, request, slug):
is_active=True,
).values("role")
)
.annotate(
intake_count=Count(
"project_intakeissue", filter=Q(project_intakeissue__status=IntakeIssueStatus.PENDING.value)
)
)
.annotate(inbox_view=F("intake_view"))
.annotate(sort_order=Subquery(sort_order))
.distinct()
Expand All @@ -163,6 +168,7 @@ def list(self, request, slug):
"sort_order",
"logo_props",
"member_role",
"intake_count",
"archived_at",
"workspace",
"cycle_view",
Expand Down
13 changes: 10 additions & 3 deletions apps/web/core/components/workspace/sidebar/project-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,19 @@ export const ProjectNavigation = observer(function ProjectNavigation(props: TPro
const hasAccess = allowPermissions(item.access, EUserPermissionsLevel.PROJECT, workspaceSlug, project.id);
if (!hasAccess) return null;

const shouldShowCount = item.key === "intake" && (project.intake_count ?? 0) > 0;

return (
<Link key={item.key} href={item.href} onClick={handleProjectClick}>
<SidebarNavItem isActive={!!isActive(item)}>
<div className="flex items-center gap-1.5 py-[1px]">
<item.icon className={`flex-shrink-0 size-4 ${item.name === "Intake" ? "stroke-1" : "stroke-[1.5]"}`} />
<span className="text-11 font-medium">{t(item.i18n_key)}</span>
<div className="flex items-center justify-between gap-1.5 py-[1px] w-full">
<div className="flex items-center gap-1.5">
<item.icon
className={`flex-shrink-0 size-4 ${item.name === "Intake" ? "stroke-1" : "stroke-[1.5]"}`}
/>
<span className="text-11 font-medium">{t(item.i18n_key)}</span>
</div>
{shouldShowCount && <span className="text-11 font-medium text-tertiary">{project.intake_count}</span>}
</div>
</SidebarNavItem>
</Link>
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/project/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface IPartialProject {
// actor
created_by?: string;
updated_by?: string;
intake_count?: number;
}

export interface IProject extends IPartialProject {
Expand Down
Loading