You've already forked pages
forked from didirus/AstralRinth
fix: issues with files tab + tech rev cards (#4941)
This commit is contained in:
@@ -6,14 +6,14 @@
|
|||||||
:searchable="true"
|
:searchable="true"
|
||||||
search-placeholder="Search by name or paste ID..."
|
search-placeholder="Search by name or paste ID..."
|
||||||
:no-options-message="searchLoading ? 'Loading...' : 'No results found'"
|
:no-options-message="searchLoading ? 'Loading...' : 'No results found'"
|
||||||
|
:disable-search-filter="true"
|
||||||
@search-input="(query) => handleSearch(query)"
|
@search-input="(query) => handleSearch(query)"
|
||||||
:disableSearchFilter="true"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { ComboboxOption } from '@modrinth/ui'
|
||||||
import { Combobox, injectModrinthClient, injectNotificationManager } from '@modrinth/ui'
|
import { Combobox, injectModrinthClient, injectNotificationManager } from '@modrinth/ui'
|
||||||
import type { DropdownOption } from '@modrinth/ui/src/components/base/Combobox.vue'
|
|
||||||
import { useDebounceFn } from '@vueuse/core'
|
import { useDebounceFn } from '@vueuse/core'
|
||||||
import { defineAsyncComponent, h } from 'vue'
|
import { defineAsyncComponent, h } from 'vue'
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ const { addNotification } = injectNotificationManager()
|
|||||||
const projectId = defineModel<string>()
|
const projectId = defineModel<string>()
|
||||||
|
|
||||||
const searchLoading = ref(false)
|
const searchLoading = ref(false)
|
||||||
const options = ref<DropdownOption<string>[]>([])
|
const options = ref<ComboboxOption<string>[]>([])
|
||||||
|
|
||||||
const { labrinth } = injectModrinthClient()
|
const { labrinth } = injectModrinthClient()
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ const client = injectModrinthClient()
|
|||||||
|
|
||||||
const severityOrder = { severe: 3, high: 2, medium: 1, low: 0 } as Record<string, number>
|
const severityOrder = { severe: 3, high: 2, medium: 1, low: 0 } as Record<string, number>
|
||||||
|
|
||||||
|
const detailDecisions = ref<Map<string, 'safe' | 'malware'>>(new Map())
|
||||||
|
const updatingDetails = ref<Set<string>>(new Set())
|
||||||
|
|
||||||
function getFileHighestSeverity(
|
function getFileHighestSeverity(
|
||||||
file: FlattenedFileReport,
|
file: FlattenedFileReport,
|
||||||
): Labrinth.TechReview.Internal.DelphiSeverity {
|
): Labrinth.TechReview.Internal.DelphiSeverity {
|
||||||
@@ -303,9 +306,6 @@ async function copyToClipboard(code: string, detailId: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const detailDecisions = ref<Map<string, 'safe' | 'malware'>>(new Map())
|
|
||||||
const updatingDetails = ref<Set<string>>(new Set())
|
|
||||||
|
|
||||||
function getDetailDecision(
|
function getDetailDecision(
|
||||||
detailId: string,
|
detailId: string,
|
||||||
backendStatus: Labrinth.TechReview.Internal.DelphiReportIssueStatus,
|
backendStatus: Labrinth.TechReview.Internal.DelphiReportIssueStatus,
|
||||||
|
|||||||
@@ -74,8 +74,14 @@ import {
|
|||||||
RightArrowIcon,
|
RightArrowIcon,
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
} from '@modrinth/assets'
|
} from '@modrinth/assets'
|
||||||
import { ButtonStyled, getFileExtensionIcon } from '@modrinth/ui'
|
import {
|
||||||
import { computed, ref, shallowRef } from 'vue'
|
ButtonStyled,
|
||||||
|
CODE_EXTENSIONS,
|
||||||
|
getFileExtensionIcon,
|
||||||
|
IMAGE_EXTENSIONS,
|
||||||
|
TEXT_EXTENSIONS,
|
||||||
|
} from '@modrinth/ui'
|
||||||
|
import { computed, h, ref, shallowRef } from 'vue'
|
||||||
import { renderToString } from 'vue/server-renderer'
|
import { renderToString } from 'vue/server-renderer'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
@@ -108,7 +114,6 @@ const emit = defineEmits<{
|
|||||||
const isDragOver = ref(false)
|
const isDragOver = ref(false)
|
||||||
const isDragging = ref(false)
|
const isDragging = ref(false)
|
||||||
|
|
||||||
const textExtensions = Object.freeze(['txt', 'md', 'log', 'cfg', 'conf', 'properties', 'ini', 'sk'])
|
|
||||||
const units = Object.freeze(['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])
|
const units = Object.freeze(['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])
|
||||||
|
|
||||||
const route = shallowRef(useRoute())
|
const route = shallowRef(useRoute())
|
||||||
@@ -203,9 +208,9 @@ const isEditableFile = computed(() => {
|
|||||||
const ext = fileExtension.value
|
const ext = fileExtension.value
|
||||||
return (
|
return (
|
||||||
!props.name.includes('.') ||
|
!props.name.includes('.') ||
|
||||||
textExtensions.includes(ext) ||
|
TEXT_EXTENSIONS.includes(ext) ||
|
||||||
codeExtensions.includes(ext) ||
|
CODE_EXTENSIONS.includes(ext) ||
|
||||||
imageExtensions.includes(ext)
|
IMAGE_EXTENSIONS.includes(ext)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -252,32 +257,7 @@ const selectItem = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getDragIcon = async () => {
|
const getDragIcon = async () => {
|
||||||
let iconToUse
|
return await renderToString(h(iconComponent.value))
|
||||||
|
|
||||||
if (props.type === 'directory') {
|
|
||||||
if (props.name === 'config') {
|
|
||||||
iconToUse = UiServersIconsCogFolderIcon
|
|
||||||
} else if (props.name === 'world') {
|
|
||||||
iconToUse = UiServersIconsEarthIcon
|
|
||||||
} else if (props.name === 'resourcepacks') {
|
|
||||||
iconToUse = PaletteIcon
|
|
||||||
} else {
|
|
||||||
iconToUse = FolderOpenIcon
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const ext = fileExtension.value
|
|
||||||
if (codeExtensions.includes(ext)) {
|
|
||||||
iconToUse = UiServersIconsCodeFileIcon
|
|
||||||
} else if (textExtensions.includes(ext)) {
|
|
||||||
iconToUse = UiServersIconsTextFileIcon
|
|
||||||
} else if (imageExtensions.includes(ext)) {
|
|
||||||
iconToUse = UiServersIconsImageFileIcon
|
|
||||||
} else {
|
|
||||||
iconToUse = FileIcon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return await renderToString(h(iconToUse))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDragStart = async (event: DragEvent) => {
|
const handleDragStart = async (event: DragEvent) => {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const BLOCKCHAIN_CONFIG: Record<string, { icon: Component; color: string }> = {
|
|||||||
polygon: { icon: PolygonIcon, color: 'text-purple' },
|
polygon: { icon: PolygonIcon, color: 'text-purple' },
|
||||||
}
|
}
|
||||||
|
|
||||||
const CODE_EXTENSIONS: string[] = [
|
export const CODE_EXTENSIONS: readonly string[] = [
|
||||||
'json',
|
'json',
|
||||||
'json5',
|
'json5',
|
||||||
'jsonc',
|
'jsonc',
|
||||||
@@ -115,7 +115,7 @@ const CODE_EXTENSIONS: string[] = [
|
|||||||
'go',
|
'go',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
const TEXT_EXTENSIONS: string[] = [
|
export const TEXT_EXTENSIONS: readonly string[] = [
|
||||||
'txt',
|
'txt',
|
||||||
'md',
|
'md',
|
||||||
'log',
|
'log',
|
||||||
@@ -125,7 +125,7 @@ const TEXT_EXTENSIONS: string[] = [
|
|||||||
'ini',
|
'ini',
|
||||||
'sk',
|
'sk',
|
||||||
] as const
|
] as const
|
||||||
const IMAGE_EXTENSIONS: string[] = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'] as const
|
export const IMAGE_EXTENSIONS: readonly string[] = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'] as const
|
||||||
const ARCHIVE_EXTENSIONS: string[] = ['zip', 'jar', 'tar', 'gz', 'rar', '7z'] as const
|
const ARCHIVE_EXTENSIONS: string[] = ['zip', 'jar', 'tar', 'gz', 'rar', '7z'] as const
|
||||||
|
|
||||||
export function getProjectTypeIcon(projectType: ProjectType): Component {
|
export function getProjectTypeIcon(projectType: ProjectType): Component {
|
||||||
|
|||||||
Reference in New Issue
Block a user