You've already forked pages
forked from didirus/AstralRinth
* chore: fix typo in status message * feat(labrinth): overhaul malware scanner report storage and routes * chore: address some review comments * feat: add Delphi to Docker Compose `with-delphi` profile * chore: fix unused import Clippy lint * feat(labrinth/delphi): use PAT token authorization with project read scopes * chore: expose file IDs in version queries * fix: accept null decompiled source payloads from Delphi * tweak(labrinth): expose base62 file IDs more consistently for Delphi * feat(labrinth/delphi): support new Delphi report severity field * chore(labrinth): run `cargo sqlx prepare` to fix Docker build errors * tweak: add route for fetching Delphi issue type schema, abstract Labrinth away from issue types * chore: run `cargo sqlx prepare` * chore: fix typo on frontend generated state file message * feat: update to use new Delphi issue schema * wip: tech review endpoints * wip: add ToSchema for dependent types * wip: report issues return * wip * wip: returning more data * wip * Fix up db query * Delphi configuration to talk to Labrinth * Get Delphi working with Labrinth * Add Delphi dummy fixture * Better Delphi logging * Improve utoipa for tech review routes * Add more sorting options for tech review queue * Oops join * New routes for fetching issues and reports * Fix which kind of ID is returned in tech review endpoints * Deduplicate tech review report rows * Reduce info sent for projects * Fetch more thread info * Address PR comments * fix ci * fix postgres version mismatch * fix version creation * Implement routes * fix up tech review * Allow adding a moderation comment to Delphi rejections * fix up rebase * exclude rejected projects from tech review * add status change msg to tech review thread * cargo sqlx prepare * also ignore withheld projects * More filtering on issue search * wip: report routes * Fix up for build * cargo sqlx prepare * fix thread message privacy * New tech review search route * submit route * details have statuses now * add default to drid status * dedup issue details * fix sqlx query on empty files * fixes * Dedupe issue detail statuses and message on entering tech rev * Fix qa issues * Fix qa issues * fix review comments * typos * fix ci * feat: tech review frontend (#4781) * chore: fix typo in status message * feat(labrinth): overhaul malware scanner report storage and routes * chore: address some review comments * feat: add Delphi to Docker Compose `with-delphi` profile * chore: fix unused import Clippy lint * feat(labrinth/delphi): use PAT token authorization with project read scopes * chore: expose file IDs in version queries * fix: accept null decompiled source payloads from Delphi * tweak(labrinth): expose base62 file IDs more consistently for Delphi * feat(labrinth/delphi): support new Delphi report severity field * chore(labrinth): run `cargo sqlx prepare` to fix Docker build errors * tweak: add route for fetching Delphi issue type schema, abstract Labrinth away from issue types * chore: run `cargo sqlx prepare` * chore: fix typo on frontend generated state file message * feat: update to use new Delphi issue schema * wip: tech review endpoints * wip: add ToSchema for dependent types * wip: report issues return * wip * wip: returning more data * wip * Fix up db query * Delphi configuration to talk to Labrinth * Get Delphi working with Labrinth * Add Delphi dummy fixture * Better Delphi logging * Improve utoipa for tech review routes * Add more sorting options for tech review queue * Oops join * New routes for fetching issues and reports * Fix which kind of ID is returned in tech review endpoints * Deduplicate tech review report rows * Reduce info sent for projects * Fetch more thread info * Address PR comments * fix ci * fix ci * fix postgres version mismatch * fix version creation * Implement routes * feat: batch scan alert * feat: layout * feat: introduce surface variables * fix: theme selector * feat: rough draft of tech review card * feat: tab switcher * feat: batch scan btn * feat: api-client module for tech review * draft: impl * feat: auto icons * fix: layout issues * feat: fixes to code blocks + flag labels * feat: temp remove mock data * fix: search sort types * fix: intl & lint * chore: re-enable mock data * fix: flag badges + auto open first issue in file tab * feat: update for new routes * fix: more qa issues * feat: lazy load sources * fix: re-enable auth middleware * feat: impl threads * fix: lint & severity * feat: download btn + switch to using NavTabs with new local mode option * feat: re-add toplevel btns * feat: reports page consistency * fix: consistency on project queue * fix: icons + sizing * fix: colors and gaps * fix: impl endpoints * feat: load all flags on file tab * feat: thread generics changes * feat: more qa * feat: fix collapse * fix: qa * feat: msg modal * fix: ISO import * feat: qa fixes * fix: empty state basic * fix: collapsible region * fix: collapse thread by default * feat: rough draft of new process/flow * fix labrinth build * fix thread message privacy * New tech review search route * feat: qa fixes * feat: QA changes * fix: verdict on detail not whole issue * fix: lint + intl * fix: lint * fix: thread message for tech rev verdict * feat: use anim frames * fix: exports + typecheck * polish: qa changes * feat: qa * feat: qa polish * feat: fix malic modal * fix: lint * fix: qa + lint * fix: pagination * fix: lint * fix: qa * intl extract * fix ci --------- Signed-off-by: Calum H. <contact@cal.engineer> Co-authored-by: Alejandro González <me@alegon.dev> Co-authored-by: aecsocket <aecsocket@tutanota.com> --------- Signed-off-by: Calum H. <contact@cal.engineer> Co-authored-by: Alejandro González <me@alegon.dev> Co-authored-by: Calum H. <contact@cal.engineer>
202 lines
4.6 KiB
TypeScript
202 lines
4.6 KiB
TypeScript
import {
|
|
ArchiveIcon,
|
|
BoxIcon,
|
|
BracesIcon,
|
|
CalendarIcon,
|
|
CardIcon,
|
|
CurrencyIcon,
|
|
FileArchiveIcon,
|
|
FileCodeIcon,
|
|
FileIcon,
|
|
FileImageIcon,
|
|
FileTextIcon,
|
|
FolderOpenIcon,
|
|
GithubIcon,
|
|
GlassesIcon,
|
|
GlobeIcon,
|
|
InfoIcon,
|
|
IssuesIcon,
|
|
LinkIcon,
|
|
LockIcon,
|
|
PackageOpenIcon,
|
|
PaintbrushIcon,
|
|
PayPalIcon,
|
|
PlugIcon,
|
|
PolygonIcon,
|
|
UnknownIcon,
|
|
UpdatedIcon,
|
|
USDCColorIcon,
|
|
XCircleIcon,
|
|
XIcon,
|
|
} from '@modrinth/assets'
|
|
import type { ProjectStatus, ProjectType } from '@modrinth/utils'
|
|
import type { Component } from 'vue'
|
|
|
|
export const PROJECT_TYPE_ICONS: Record<ProjectType, Component> = {
|
|
mod: BoxIcon,
|
|
modpack: PackageOpenIcon,
|
|
resourcepack: PaintbrushIcon,
|
|
shader: GlassesIcon,
|
|
plugin: PlugIcon,
|
|
datapack: BracesIcon,
|
|
project: BoxIcon,
|
|
}
|
|
|
|
export const PAYMENT_METHOD_ICONS: Record<string, Component> = {
|
|
card: CardIcon,
|
|
cashapp: CurrencyIcon,
|
|
paypal: PayPalIcon,
|
|
}
|
|
|
|
export const SOCIAL_PLATFORM_ICONS: Record<string, Component> = {
|
|
discord: GithubIcon,
|
|
github: GithubIcon,
|
|
}
|
|
|
|
export const SEVERITY_ICONS: Record<string, Component> = {
|
|
info: InfoIcon,
|
|
warning: IssuesIcon,
|
|
error: XCircleIcon,
|
|
critical: XCircleIcon,
|
|
}
|
|
|
|
export const PROJECT_STATUS_ICONS: Record<ProjectStatus, Component> = {
|
|
approved: GlobeIcon,
|
|
unlisted: LinkIcon,
|
|
withheld: LinkIcon,
|
|
private: LockIcon,
|
|
scheduled: CalendarIcon,
|
|
draft: FileTextIcon,
|
|
archived: ArchiveIcon,
|
|
rejected: XIcon,
|
|
processing: UpdatedIcon,
|
|
unknown: UnknownIcon,
|
|
}
|
|
|
|
export const DIRECTORY_ICONS: Record<string, Component> = {
|
|
config: FolderOpenIcon,
|
|
world: FolderOpenIcon,
|
|
resourcepacks: PaintbrushIcon,
|
|
_default: FolderOpenIcon,
|
|
}
|
|
|
|
const CURRENCY_CONFIG: Record<string, { icon: Component; color: string }> = {
|
|
usdc: { icon: USDCColorIcon, color: 'text-blue' },
|
|
}
|
|
|
|
const BLOCKCHAIN_CONFIG: Record<string, { icon: Component; color: string }> = {
|
|
polygon: { icon: PolygonIcon, color: 'text-purple' },
|
|
}
|
|
|
|
const CODE_EXTENSIONS: string[] = [
|
|
'json',
|
|
'json5',
|
|
'jsonc',
|
|
'java',
|
|
'kt',
|
|
'kts',
|
|
'sh',
|
|
'bat',
|
|
'ps1',
|
|
'yml',
|
|
'yaml',
|
|
'toml',
|
|
'js',
|
|
'ts',
|
|
'py',
|
|
'rb',
|
|
'php',
|
|
'html',
|
|
'css',
|
|
'cpp',
|
|
'c',
|
|
'h',
|
|
'rs',
|
|
'go',
|
|
] as const
|
|
|
|
const TEXT_EXTENSIONS: string[] = [
|
|
'txt',
|
|
'md',
|
|
'log',
|
|
'cfg',
|
|
'conf',
|
|
'properties',
|
|
'ini',
|
|
'sk',
|
|
] as const
|
|
const IMAGE_EXTENSIONS: string[] = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'] as const
|
|
const ARCHIVE_EXTENSIONS: string[] = ['zip', 'jar', 'tar', 'gz', 'rar', '7z'] as const
|
|
|
|
export function getProjectTypeIcon(projectType: ProjectType): Component {
|
|
return PROJECT_TYPE_ICONS[projectType] ?? BoxIcon
|
|
}
|
|
|
|
export function getPaymentMethodIcon(method: string): Component {
|
|
return PAYMENT_METHOD_ICONS[method] ?? UnknownIcon
|
|
}
|
|
|
|
export function getSocialPlatformIcon(platform: string): Component {
|
|
return SOCIAL_PLATFORM_ICONS[platform.toLowerCase()] ?? UnknownIcon
|
|
}
|
|
|
|
export function getSeverityIcon(severity: string): Component {
|
|
return SEVERITY_ICONS[severity] ?? InfoIcon
|
|
}
|
|
|
|
export function getProjectStatusIcon(status: ProjectStatus): Component {
|
|
return PROJECT_STATUS_ICONS[status] ?? UnknownIcon
|
|
}
|
|
|
|
export function getDirectoryIcon(name: string): Component {
|
|
return DIRECTORY_ICONS[name.toLowerCase()] ?? DIRECTORY_ICONS._default
|
|
}
|
|
|
|
export function getFileExtensionIcon(extension: string): Component {
|
|
const ext: string = extension.toLowerCase()
|
|
|
|
if (CODE_EXTENSIONS.includes(ext)) {
|
|
return FileCodeIcon
|
|
}
|
|
if (TEXT_EXTENSIONS.includes(ext)) {
|
|
return FileTextIcon
|
|
}
|
|
if (IMAGE_EXTENSIONS.includes(ext)) {
|
|
return FileImageIcon
|
|
}
|
|
if (ARCHIVE_EXTENSIONS.includes(ext)) {
|
|
return FileArchiveIcon
|
|
}
|
|
|
|
return FileIcon
|
|
}
|
|
|
|
export function getFileIcon(fileName: string): Component {
|
|
const extension = fileName.split('.').pop()?.toLowerCase() || ''
|
|
return getFileExtensionIcon(extension)
|
|
}
|
|
|
|
export function getCurrencyIcon(currency: string): Component | null {
|
|
const lower = currency.toLowerCase()
|
|
const key = Object.keys(CURRENCY_CONFIG).find((k) => lower.includes(k))
|
|
return key ? CURRENCY_CONFIG[key].icon : null
|
|
}
|
|
|
|
export function getCurrencyColor(currency: string): string {
|
|
const lower = currency.toLowerCase()
|
|
const key = Object.keys(CURRENCY_CONFIG).find((k) => lower.includes(k))
|
|
return key ? CURRENCY_CONFIG[key].color : 'text-contrast'
|
|
}
|
|
|
|
export function getBlockchainIcon(blockchain: string): Component | null {
|
|
const lower = blockchain.toLowerCase()
|
|
const key = Object.keys(BLOCKCHAIN_CONFIG).find((k) => lower.includes(k))
|
|
return key ? BLOCKCHAIN_CONFIG[key].icon : null
|
|
}
|
|
|
|
export function getBlockchainColor(blockchain: string): string {
|
|
const lower = blockchain.toLowerCase()
|
|
const key = Object.keys(BLOCKCHAIN_CONFIG).find((k) => lower.includes(k))
|
|
return key ? BLOCKCHAIN_CONFIG[key].color : 'text-contrast'
|
|
}
|