Skip to content

Commit 537eade

Browse files
authored
fix: issues with files tab + tech rev cards (#4941)
1 parent 39f2b0e commit 537eade

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

apps/frontend/src/components/ui/create-project-version/components/DependencySelect.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
:searchable="true"
77
search-placeholder="Search by name or paste ID..."
88
:no-options-message="searchLoading ? 'Loading...' : 'No results found'"
9+
:disable-search-filter="true"
910
@search-input="(query) => handleSearch(query)"
10-
:disableSearchFilter="true"
1111
/>
1212
</template>
1313

1414
<script lang="ts" setup>
15+
import type { ComboboxOption } from '@modrinth/ui'
1516
import { Combobox, injectModrinthClient, injectNotificationManager } from '@modrinth/ui'
16-
import type { DropdownOption } from '@modrinth/ui/src/components/base/Combobox.vue'
1717
import { useDebounceFn } from '@vueuse/core'
1818
import { defineAsyncComponent, h } from 'vue'
1919
2020
const { addNotification } = injectNotificationManager()
2121
const projectId = defineModel<string>()
2222
2323
const searchLoading = ref(false)
24-
const options = ref<DropdownOption<string>[]>([])
24+
const options = ref<ComboboxOption<string>[]>([])
2525
2626
const { labrinth } = injectModrinthClient()
2727

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ const client = injectModrinthClient()
158158
159159
const severityOrder = { severe: 3, high: 2, medium: 1, low: 0 } as Record<string, number>
160160
161+
const detailDecisions = ref<Map<string, 'safe' | 'malware'>>(new Map())
162+
const updatingDetails = ref<Set<string>>(new Set())
163+
161164
function getFileHighestSeverity(
162165
file: FlattenedFileReport,
163166
): Labrinth.TechReview.Internal.DelphiSeverity {
@@ -303,9 +306,6 @@ async function copyToClipboard(code: string, detailId: string) {
303306
}
304307
}
305308
306-
const detailDecisions = ref<Map<string, 'safe' | 'malware'>>(new Map())
307-
const updatingDetails = ref<Set<string>>(new Set())
308-
309309
function getDetailDecision(
310310
detailId: string,
311311
backendStatus: Labrinth.TechReview.Internal.DelphiReportIssueStatus,

apps/frontend/src/components/ui/servers/FileItem.vue

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,14 @@ import {
7474
RightArrowIcon,
7575
TrashIcon,
7676
} from '@modrinth/assets'
77-
import { ButtonStyled, getFileExtensionIcon } from '@modrinth/ui'
78-
import { computed, ref, shallowRef } from 'vue'
77+
import {
78+
ButtonStyled,
79+
CODE_EXTENSIONS,
80+
getFileExtensionIcon,
81+
IMAGE_EXTENSIONS,
82+
TEXT_EXTENSIONS,
83+
} from '@modrinth/ui'
84+
import { computed, h, ref, shallowRef } from 'vue'
7985
import { renderToString } from 'vue/server-renderer'
8086
import { useRoute, useRouter } from 'vue-router'
8187
@@ -108,7 +114,6 @@ const emit = defineEmits<{
108114
const isDragOver = ref(false)
109115
const isDragging = ref(false)
110116
111-
const textExtensions = Object.freeze(['txt', 'md', 'log', 'cfg', 'conf', 'properties', 'ini', 'sk'])
112117
const units = Object.freeze(['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])
113118
114119
const route = shallowRef(useRoute())
@@ -203,9 +208,9 @@ const isEditableFile = computed(() => {
203208
const ext = fileExtension.value
204209
return (
205210
!props.name.includes('.') ||
206-
textExtensions.includes(ext) ||
207-
codeExtensions.includes(ext) ||
208-
imageExtensions.includes(ext)
211+
TEXT_EXTENSIONS.includes(ext) ||
212+
CODE_EXTENSIONS.includes(ext) ||
213+
IMAGE_EXTENSIONS.includes(ext)
209214
)
210215
}
211216
return false
@@ -252,32 +257,7 @@ const selectItem = () => {
252257
}
253258
254259
const getDragIcon = async () => {
255-
let iconToUse
256-
257-
if (props.type === 'directory') {
258-
if (props.name === 'config') {
259-
iconToUse = UiServersIconsCogFolderIcon
260-
} else if (props.name === 'world') {
261-
iconToUse = UiServersIconsEarthIcon
262-
} else if (props.name === 'resourcepacks') {
263-
iconToUse = PaletteIcon
264-
} else {
265-
iconToUse = FolderOpenIcon
266-
}
267-
} else {
268-
const ext = fileExtension.value
269-
if (codeExtensions.includes(ext)) {
270-
iconToUse = UiServersIconsCodeFileIcon
271-
} else if (textExtensions.includes(ext)) {
272-
iconToUse = UiServersIconsTextFileIcon
273-
} else if (imageExtensions.includes(ext)) {
274-
iconToUse = UiServersIconsImageFileIcon
275-
} else {
276-
iconToUse = FileIcon
277-
}
278-
}
279-
280-
return await renderToString(h(iconToUse))
260+
return await renderToString(h(iconComponent.value))
281261
}
282262
283263
const handleDragStart = async (event: DragEvent) => {

packages/ui/src/utils/auto-icons.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const BLOCKCHAIN_CONFIG: Record<string, { icon: Component; color: string }> = {
8888
polygon: { icon: PolygonIcon, color: 'text-purple' },
8989
}
9090

91-
const CODE_EXTENSIONS: string[] = [
91+
export const CODE_EXTENSIONS: readonly string[] = [
9292
'json',
9393
'json5',
9494
'jsonc',
@@ -115,7 +115,7 @@ const CODE_EXTENSIONS: string[] = [
115115
'go',
116116
] as const
117117

118-
const TEXT_EXTENSIONS: string[] = [
118+
export const TEXT_EXTENSIONS: readonly string[] = [
119119
'txt',
120120
'md',
121121
'log',
@@ -125,7 +125,7 @@ const TEXT_EXTENSIONS: string[] = [
125125
'ini',
126126
'sk',
127127
] as const
128-
const IMAGE_EXTENSIONS: string[] = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'] as const
128+
export const IMAGE_EXTENSIONS: readonly string[] = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'] as const
129129
const ARCHIVE_EXTENSIONS: string[] = ['zip', 'jar', 'tar', 'gz', 'rar', '7z'] as const
130130

131131
export function getProjectTypeIcon(projectType: ProjectType): Component {

0 commit comments

Comments
 (0)