Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion apps/app-frontend/src/pages/project/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
v-else
:project="data"
:project-v3="projectV3"
:show-status-badge="data.status !== 'approved'"
:status-badge="data.status !== 'approved' ? projectV3?.status : undefined"
@contextmenu.prevent.stop="handleRightClick"
@category="(category) => router.push(`${projectSearchUrl}?f=categories:${category}`)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ const project: Labrinth.Projects.v3.Project = {
description: '',
published: '2026-01-01T00:00:00.000Z',
updated: '2026-01-01T00:00:00.000Z',
visibility: 'public',
status: 'processing',
in_review: true,
review_outcome: 'never_reviewed',
license: { id: 'MIT', name: 'MIT License' },
downloads: 0,
followers: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const project: Labrinth.Projects.v3.Project = {
description: '',
published: '2026-11-01T00:00:00Z',
updated: '2026-11-02T00:00:00Z',
visibility: 'public',
status: 'processing',
in_review: true,
review_outcome: 'never_reviewed',
license: { id: 'MIT', name: 'MIT License' },
downloads: 0,
followers: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function createProject(status: Labrinth.Projects.v2.ProjectStatus): Labrinth.Pro
}
}

function createProjectV3(status: Labrinth.Projects.v2.ProjectStatus): Labrinth.Projects.v3.Project {
function createProjectV3(status: 'draft' | 'rejected' | 'withheld'): Labrinth.Projects.v3.Project {
return {
id: 'storybook-publishing-checklist',
slug: 'storybook-publishing-checklist',
Expand All @@ -63,7 +63,10 @@ function createProjectV3(status: Labrinth.Projects.v2.ProjectStatus): Labrinth.P
description: '',
published: '2026-01-01T00:00:00.000Z',
updated: '2026-01-01T00:00:00.000Z',
visibility: 'public',
status,
in_review: false,
review_outcome: status === 'draft' ? 'never_reviewed' : status,
license: {
id: 'MIT',
name: 'MIT License',
Expand Down
26 changes: 25 additions & 1 deletion apps/frontend/src/pages/[type]/[project].vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
v-if="projectV3Loaded"
:project="project"
:project-v3="projectV3"
:show-status-badge="!!currentMember || projectV3.status !== 'approved'"
:status-badge="projectStatusBadge"
@category="(category) => router.push(`${projectSearchUrl}?f=categories:${category}`)"
>
<template #actions>
Expand Down Expand Up @@ -1776,6 +1776,30 @@ const currentMember = computed(() => {
return val
})

const projectStatusBadge = computed(() => {
const project = projectV3.value
if (!project) return
if (!project.in_review) {
return currentMember.value || project.status !== 'approved' ? project.status : undefined
}

const user = auth.value.user
if (
user &&
(isStaff(user) ||
[...allMembers.value, ...(organization.value?.members ?? [])].some(
(member) => member.accepted && member.user.id === user.id,
))
) {
return 'processing'
}

if (project.review_outcome === 'approved') {
return project.visibility === 'public' ? undefined : project.visibility
}
return project.review_outcome === 'never_reviewed' ? 'draft' : project.review_outcome
})

const {
data: projectValidationResponse,
isFetching: projectValidationLoading,
Expand Down
3 changes: 3 additions & 0 deletions packages/api-client/src/modules/labrinth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,11 @@ export namespace Labrinth {
updated: string
approved?: string
queued?: string
visibility: ProjectVisibility
status: v2.ProjectStatus
requested_status?: v2.ProjectStatus
in_review: boolean
review_outcome: ProjectReviewOutcome
license: {
id: string
name: string
Expand Down
7 changes: 3 additions & 4 deletions packages/ui/src/components/project/ProjectPageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
/>
</template>

<template v-if="showStatusBadge" #badges>
<ProjectStatusBadge :status="projectV3.status" />
<template v-if="statusBadge" #badges>
<ProjectStatusBadge :status="statusBadge" />
</template>

<template #metadata>
Expand Down Expand Up @@ -95,11 +95,10 @@ withDefaults(
defineProps<{
project: HeaderProject
projectV3?: HeaderProjectV3 | null
showStatusBadge?: boolean
statusBadge?: Labrinth.Projects.v2.ProjectStatus
}>(),
{
projectV3: null,
showStatusBadge: false,
},
)

Expand Down
Loading