* Begin UI for threads and moderation overhaul * Hide close button on non-report threads * Fix review age coloring * Add project count * Remove action buttons from queue page and add queued date to project page * Hook up to actual data * Remove unused icon * Get up to 1000 projects in queue * prettier * more prettier * Changed all the things * lint * rebuild * Add omorphia * Workaround formatjs bug in ThreadSummary.vue * Fix notifications page on prod * Fix a few notifications and threads bugs * lockfile * Fix duplicate button styles * more fixes and polishing * More fixes * Remove legacy pages * More bugfixes * Add some error catching for reports and notifications * More error handling * fix lint * Add inbox links * Remove loading component and rename member header * Rely on threads always existing * Handle if project update notifs are not grouped * oops * Fix chips on notifications page * Import ModalModeration * finish threads * New authentication (#1234) * Initial new auth work * more auth pages * Finish most * more * fix on landing page * Finish everything but PATs + Sessions * fix threads merge bugs * fix cf pages ssr * fix most issues * Finish authentication * Fix merge --------- Co-authored-by: triphora <emma@modrinth.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
80 lines
2.4 KiB
JavaScript
80 lines
2.4 KiB
JavaScript
export const getProjectTypeForUrl = (type, categories) => {
|
|
return getProjectTypeForUrlShorthand(type, categories)
|
|
}
|
|
|
|
export const getProjectTypeForUrlShorthand = (type, categories, overrideTags) => {
|
|
const tags = overrideTags ?? useTags().value
|
|
|
|
if (type === 'mod') {
|
|
const isMod = categories.some((category) => {
|
|
return tags.loaderData.modLoaders.includes(category)
|
|
})
|
|
|
|
const isPlugin = categories.some((category) => {
|
|
return tags.loaderData.allPluginLoaders.includes(category)
|
|
})
|
|
|
|
const isDataPack = categories.some((category) => {
|
|
return tags.loaderData.dataPackLoaders.includes(category)
|
|
})
|
|
|
|
if (isDataPack) {
|
|
return 'datapack'
|
|
} else if (isPlugin) {
|
|
return 'plugin'
|
|
} else if (isMod) {
|
|
return 'mod'
|
|
} else {
|
|
return 'mod'
|
|
}
|
|
} else {
|
|
return type
|
|
}
|
|
}
|
|
|
|
export const getProjectLink = (project) => {
|
|
return `/${getProjectTypeForUrl(project.project_type, project.loaders)}/${
|
|
project.slug ? project.slug : project.id
|
|
}`
|
|
}
|
|
|
|
export const getVersionLink = (project, version) => {
|
|
return getProjectLink(project) + '/version/' + version.id
|
|
}
|
|
|
|
export const isApproved = (project) => {
|
|
return project && APPROVED_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isListed = (project) => {
|
|
return project && LISTED_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isUnlisted = (project) => {
|
|
return project && UNLISTED_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isPrivate = (project) => {
|
|
return project && PRIVATE_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isRejected = (project) => {
|
|
return project && REJECTED_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isUnderReview = (project) => {
|
|
return project && UNDER_REVIEW_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const isDraft = (project) => {
|
|
return project && DRAFT_PROJECT_STATUSES.includes(project.status)
|
|
}
|
|
|
|
export const APPROVED_PROJECT_STATUSES = ['approved', 'archived', 'unlisted', 'private']
|
|
export const LISTED_PROJECT_STATUSES = ['approved', 'archived']
|
|
export const UNLISTED_PROJECT_STATUSES = ['unlisted', 'withheld']
|
|
export const PRIVATE_PROJECT_STATUSES = ['private', 'rejected', 'processing']
|
|
export const REJECTED_PROJECT_STATUSES = ['rejected', 'withheld']
|
|
export const UNDER_REVIEW_PROJECT_STATUSES = ['processing']
|
|
export const DRAFT_PROJECT_STATUSES = ['draft']
|