Skip to content

Commit b3782e5

Browse files
committed
fix: layout issues
1 parent bc46361 commit b3782e5

File tree

4 files changed

+47
-87
lines changed

4 files changed

+47
-87
lines changed

apps/frontend/src/components/ui/moderation/ModerationTechRevCard.vue

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function toggleIssue(issueId: string) {
117117

118118
<div class="flex flex-col gap-1.5">
119119
<div class="flex items-center gap-2">
120-
<span class="text-xl font-semibold text-contrast">{{ item.project.title }}</span>
120+
<span class="text-lg font-semibold text-contrast">{{ item.project.name }}</span>
121121

122122
<div
123123
class="flex items-center gap-1 rounded-full border border-surface-5 bg-surface-4 px-2.5 py-1"
@@ -130,7 +130,7 @@ function toggleIssue(issueId: string) {
130130
<span
131131
class="text-sm font-medium text-secondary"
132132
v-for="project_type in item.project.project_types"
133-
>{{ formatProjectType(project_type) }}</span
133+
>{{ formatProjectType(project_type, true) }}</span
134134
>
135135
</div>
136136

@@ -178,12 +178,12 @@ function toggleIssue(issueId: string) {
178178
<div class="h-px w-full bg-surface-5"></div>
179179

180180
<div class="flex items-center gap-1 rounded-full bg-surface-3 p-1">
181-
<button
181+
<div
182182
v-for="tab in tabs"
183183
:key="tab"
184-
class="rounded-full px-3 py-1.5 text-base font-semibold transition-colors"
184+
class="rounded-full px-3 py-1.5 text-base font-semibold transition-colors hover:cursor-pointer"
185185
:class="{
186-
'bg-green/30 text-green': currentTab === tab,
186+
'bg-highlight-green text-green': currentTab === tab,
187187
'text-contrast': currentTab !== tab,
188188
}"
189189
@click="
@@ -194,7 +194,7 @@ function toggleIssue(issueId: string) {
194194
"
195195
>
196196
{{ tab }}
197-
</button>
197+
</div>
198198

199199
<span
200200
v-if="currentTab === 'Files' && selectedFile"
@@ -207,82 +207,22 @@ function toggleIssue(issueId: string) {
207207

208208
<div class="border-t border-surface-3 bg-surface-2">
209209
<div v-if="currentTab === 'Thread'" class="p-4">
210-
<div
211-
v-if="item.thread.messages.length === 0"
212-
class="flex min-h-[200px] items-center justify-center"
213-
>
210+
<div v-if="true" class="flex min-h-[75px] items-center justify-center">
214211
<div class="text-center text-secondary">
215-
<p class="text-sm">No messages yet</p>
212+
<p class="text-sm">No messages yet {{ ':(' }}</p>
216213
</div>
217214
</div>
218215

219216
<div v-else class="flex flex-col gap-6">
220-
<div v-for="message in item.thread.messages" :key="message.id" class="flex gap-3">
221-
<Avatar
222-
src="https://via.placeholder.com/40"
223-
class="rounded-full border border-surface-5"
224-
size="2.5rem"
225-
circle
226-
/>
227-
228-
<div class="flex flex-1 flex-col">
229-
<div class="flex items-end gap-2">
230-
<span class="font-semibold text-contrast">{{ message.author_id || 'System' }}</span>
231-
<span class="text-xs text-secondary">{{
232-
new Date(message.created).toLocaleTimeString()
233-
}}</span>
234-
</div>
235-
236-
<p v-if="message.body.type === 'text'" class="text-secondary">
237-
{{ message.body.body }}
238-
</p>
239-
<p v-else-if="message.body.type === 'status_change'" class="italic text-secondary">
240-
Status changed from {{ message.body.old_status }} to {{ message.body.new_status }}
241-
</p>
242-
<p v-else class="italic text-secondary">
243-
{{ message.body.type }}
244-
</p>
245-
</div>
246-
</div>
247-
248-
<div class="flex flex-col gap-3">
249-
<div class="flex items-center gap-2">
250-
<div
251-
class="flex h-8 w-8 items-center justify-center rounded-full bg-surface-4 text-xs font-medium text-secondary"
252-
>
253-
Aa
254-
</div>
255-
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-surface-4"></div>
256-
</div>
257-
258-
<div class="rounded-2xl bg-surface-4 px-4 py-2.5">
259-
<span class="text-secondary/60 text-sm">Message @{{ item.project_owner.name }}</span>
260-
</div>
261-
262-
<div class="flex items-center justify-between">
263-
<div class="flex items-center gap-2">
264-
<ButtonStyled color="green" class="opacity-50">
265-
<button>Reply</button>
266-
</ButtonStyled>
267-
268-
<ButtonStyled class="opacity-50">
269-
<button>Add note</button>
270-
</ButtonStyled>
271-
272-
<ButtonStyled>
273-
<button>Quick reply <ChevronDownIcon class="-scale-y-100" /></button>
274-
</ButtonStyled>
275-
</div>
276-
</div>
277-
</div>
217+
<!-- TODO: Report thread stuff -->
278218
</div>
279219
</div>
280220

281221
<div v-else-if="currentTab === 'Files' && !selectedFile" class="flex flex-col">
282222
<div
283223
v-for="(file, idx) in allFiles"
284224
:key="idx"
285-
class="flex items-center justify-between border-x border-b border-surface-3 bg-surface-2 p-4"
225+
class="flex items-center justify-between border-0 border-x border-b border-solid border-surface-3 bg-surface-2 px-4 py-3"
286226
:class="{ 'rounded-bl-2xl rounded-br-2xl': idx === allFiles.length - 1 }"
287227
>
288228
<div class="flex items-center gap-3">

apps/frontend/src/pages/moderation/technical-review.vue

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ import {
2020
import { defineMessages, useVIntl } from '@vintl/vintl'
2121
import Fuse from 'fuse.js'
2222
23-
import BatchScanProgressAlert, {
24-
type BatchScanProgress,
25-
} from '~/components/ui/moderation/BatchScanProgressAlert.vue'
23+
import { type BatchScanProgress } from '~/components/ui/moderation/BatchScanProgressAlert.vue'
2624
import ModerationTechRevCard from '~/components/ui/moderation/ModerationTechRevCard.vue'
2725
2826
// TEMPORARY: Mock data for development
2927
import { generateMockProjectReviews } from '~/utils/mockTechReviewData'
3028
31-
type ProjectReview = Labrinth.TechReview.Internal.ProjectReview
3229
// const client = injectModrinthClient() // TEMPORARY: Commented out while using mock data
3330
3431
const currentPage = ref(1)
@@ -127,7 +124,9 @@ const fuse = computed(() => {
127124
128125
const searchResults = computed(() => {
129126
if (!query.value || !fuse.value) return null
130-
return fuse.value.search(query.value).map((result) => result.item as ProjectReview)
127+
return fuse.value
128+
.search(query.value)
129+
.map((result) => result.item as Labrinth.TechReview.Internal.ProjectReview)
131130
})
132131
133132
const baseFiltered = computed(() => {
@@ -146,27 +145,24 @@ const typeFiltered = computed(() => {
146145
})
147146
})
148147
149-
function getHighestSeverity(review: ProjectReview): string {
148+
function getHighestSeverity(review: Labrinth.TechReview.Internal.ProjectReview): string {
150149
const severities = review.reports
151150
.flatMap((r) => r.files)
152151
.flatMap((f) => f.issues)
153152
.flatMap((i) => i.details)
154153
.map((d) => d.severity)
155154
156155
const order = { SEVERE: 3, HIGH: 2, MEDIUM: 1, LOW: 0 } as Record<string, number>
157-
return (
158-
severities.sort((a, b) => (order[b] ?? 0) - (order[a] ?? 0))[0] ||
159-
('LOW' as Labrinth.TechReview.Internal.DelphiSeverity)
160-
)
156+
return severities.sort((a, b) => (order[b] ?? 0) - (order[a] ?? 0))[0] || 'LOW'
161157
}
162158
163-
function hasPendingIssues(review: ProjectReview): boolean {
159+
function hasPendingIssues(review: Labrinth.TechReview.Internal.ProjectReview): boolean {
164160
return review.reports.some((report) =>
165161
report.files.some((file) => file.issues.some((issue) => issue.status === 'pending')),
166162
)
167163
}
168164
169-
function getEarliestDate(review: ProjectReview): number {
165+
function getEarliestDate(review: Labrinth.TechReview.Internal.ProjectReview): number {
170166
const dates = review.reports.map((r) => new Date(r.created_at).getTime())
171167
return Math.min(...dates)
172168
}
@@ -248,12 +244,14 @@ const {
248244
sort_by: toApiSort(currentSortType.value),
249245
})
250246
},
251-
initialData: [] as ProjectReview[],
247+
initialData: [] as Labrinth.TechReview.Internal.ProjectReview[],
252248
})
253249
*/
254250
255251
// TEMPORARY: Mock data for development (58 items to match batch scan progress)
256-
const reviewItems = ref<ProjectReview[]>(generateMockProjectReviews(58))
252+
const reviewItems = ref<Labrinth.TechReview.Internal.ProjectReview[]>(
253+
generateMockProjectReviews(58),
254+
)
257255
const isLoading = ref(false)
258256
const refetch = () => {
259257
reviewItems.value = generateMockProjectReviews(58)
@@ -274,10 +272,10 @@ const batchScanProgressInformation = computed<BatchScanProgress | undefined>(()
274272

275273
<template>
276274
<div class="flex flex-col gap-6">
277-
<BatchScanProgressAlert
275+
<!-- <BatchScanProgressAlert
278276
v-if="batchScanProgressInformation"
279277
:progress="batchScanProgressInformation"
280-
/>
278+
/> -->
281279

282280
<div class="flex flex-col justify-between gap-2 lg:flex-row">
283281
<div class="iconified-input flex-1 lg:max-w-md">

packages/api-client/src/modules/labrinth/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ export namespace Labrinth {
336336
monetization_status: v2.MonetizationStatus
337337
side_types_migration_review_status: 'reviewed' | 'pending'
338338
environment?: Environment[]
339+
340+
/**
341+
* @deprecated Not recommended to use.
342+
*/
339343
[key: string]: unknown
340344
}
341345

packages/utils/utils.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,29 @@ export const formatWallet = (name) => {
134134
return capitalizeString(name)
135135
}
136136

137-
export const formatProjectType = (name) => {
137+
export const formatProjectType = (name, short = false) => {
138+
if (short) {
139+
if (name === 'resourcepack') {
140+
return 'RPK'
141+
} else if (name === 'mod') {
142+
return 'MOD'
143+
} else if (name === 'modpack') {
144+
return 'MPK'
145+
} else if (name === 'shader') {
146+
return 'SHD'
147+
} else if (name === 'plugin') {
148+
return 'PLG'
149+
} else if (name === 'datapack') {
150+
return 'DPK'
151+
}
152+
}
153+
138154
if (name === 'resourcepack') {
139155
return 'Resource Pack'
140156
} else if (name === 'datapack') {
141157
return 'Data Pack'
158+
} else if (name === 'modpack') {
159+
return 'Modpack'
142160
}
143161

144162
return capitalizeString(name)

0 commit comments

Comments
 (0)