Skip to content

Commit 3978926

Browse files
committed
feat: batch scan btn
1 parent dadd6d1 commit 3978926

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<script setup lang="ts">
2-
import { FilterIcon, SearchIcon, SortAscIcon, SortDescIcon, XIcon } from '@modrinth/assets'
3-
import { Button, DropdownSelect, Pagination } from '@modrinth/ui'
2+
import {
3+
FilterIcon,
4+
SearchIcon,
5+
ShieldAlertIcon,
6+
SortAscIcon,
7+
SortDescIcon,
8+
XIcon,
9+
} from '@modrinth/assets'
10+
import { Button, ButtonStyled, DropdownSelect, Pagination } from '@modrinth/ui'
411
import { defineMessages, useVIntl } from '@vintl/vintl'
512
import Fuse from 'fuse.js'
613
import BatchScanProgressAlert, {
@@ -9,14 +16,11 @@ import BatchScanProgressAlert, {
916
import ModerationTechRevCard from '~/components/ui/moderation/ModerationTechRevCard.vue'
1017
import { fetchDelphiIssues, fetchIssueTypeSchema, type OrderBy } from '~/helpers/tech-review'
1118
12-
// Data from backend helper (with dummy fallback)
1319
type TechReviewItem = Awaited<ReturnType<typeof fetchDelphiIssues>>[number]
1420
const reviewItems = ref<TechReviewItem[]>([])
1521
16-
// Basic pagination state (mirrors moderation pages)
1722
const currentPage = ref(1)
1823
const itemsPerPage = 15
19-
// Search/filter/sort UI state
2024
const { formatMessage } = useVIntl()
2125
const route = useRoute()
2226
const router = useRouter()
@@ -158,7 +162,6 @@ function goToPage(page: number) {
158162
currentPage.value = page
159163
}
160164
161-
// Map sort label to backend order_by param
162165
function toOrderBy(label: string): OrderBy | null {
163166
switch (label) {
164167
case 'Oldest':
@@ -176,7 +179,6 @@ function toOrderBy(label: string): OrderBy | null {
176179
}
177180
}
178181
179-
// Initial fetch and reactive refetch on filter/sort changes
180182
onMounted(async () => {
181183
rawIssueTypes.value = await fetchIssueTypeSchema()
182184
const order_by = toOrderBy(currentSortType.value)
@@ -193,7 +195,6 @@ watch(currentFilterType, async (val) => {
193195
watch(currentSortType, async (val) => {
194196
const type = currentFilterType.value === 'All issues' ? null : currentFilterType.value
195197
const order_by = toOrderBy(val)
196-
// If you prefer server-side sorting only, keep this; otherwise client-side above already reorders
197198
reviewItems.value = await fetchDelphiIssues({ type, count: 350, offset: 0, order_by })
198199
goToPage(1)
199200
})
@@ -264,26 +265,24 @@ const batchScanProgressInformation = computed<BatchScanProgress | undefined>(()
264265
<span class="truncate">{{ selected }}</span>
265266
</span>
266267
</DropdownSelect>
268+
269+
<ButtonStyled color="orange">
270+
<button><ShieldAlertIcon /> Batch scan</button>
271+
</ButtonStyled>
267272
</div>
268273
</div>
269274

270275
<div v-if="totalPages > 1" class="flex justify-center lg:hidden">
271276
<Pagination :page="currentPage" :count="totalPages" @switch-page="goToPage" />
272277
</div>
273278

274-
<div class="flex flex-col gap-2">
279+
<div class="flex flex-col gap-4">
275280
<div v-if="paginatedItems.length === 0" class="universal-card h-24 animate-pulse"></div>
276-
<div
277-
v-else
278-
v-for="(item, idx) in paginatedItems"
279-
:key="item.issue.id ?? idx"
280-
class=""
281-
>
281+
<div v-else v-for="(item, idx) in paginatedItems" :key="item.issue.id ?? idx" class="">
282282
<ModerationTechRevCard :item="item" />
283283
</div>
284284
</div>
285285

286-
<!-- Bottom pagination -->
287286
<div v-if="totalPages > 1" class="mt-4 flex justify-center">
288287
<Pagination :page="currentPage" :count="totalPages" @switch-page="goToPage" />
289288
</div>

packages/assets/generated-icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ import _ServerPlusIcon from './icons/server-plus.svg?component'
168168
import _SettingsIcon from './icons/settings.svg?component'
169169
import _ShareIcon from './icons/share.svg?component'
170170
import _ShieldIcon from './icons/shield.svg?component'
171+
import _ShieldAlertIcon from './icons/shield-alert.svg?component'
171172
import _SignalIcon from './icons/signal.svg?component'
172173
import _SkullIcon from './icons/skull.svg?component'
173174
import _SlashIcon from './icons/slash.svg?component'
@@ -382,6 +383,7 @@ export const ServerPlusIcon = _ServerPlusIcon
382383
export const ServerIcon = _ServerIcon
383384
export const SettingsIcon = _SettingsIcon
384385
export const ShareIcon = _ShareIcon
386+
export const ShieldAlertIcon = _ShieldAlertIcon
385387
export const ShieldIcon = _ShieldIcon
386388
export const SignalIcon = _SignalIcon
387389
export const SkullIcon = _SkullIcon
Lines changed: 18 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)