mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
feat: Add download link inside managed content modal for Reports (#7205)
* feat: Add download link inside managed content modal * fix: add missing localization for download file btn added
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
ArrowLeftRightIcon,
|
||||
BoxIcon,
|
||||
ExternalIcon,
|
||||
FileIcon,
|
||||
GlassesIcon,
|
||||
PaintbrushIcon,
|
||||
SearchIcon,
|
||||
@@ -104,6 +105,10 @@ const messages = defineMessages({
|
||||
id: 'instances.managed-content-modal.open-in-slicer',
|
||||
defaultMessage: 'Open in Slicer',
|
||||
},
|
||||
downloadFile: {
|
||||
id: 'instances.managed-content-modal.download-file',
|
||||
defaultMessage: 'Download File',
|
||||
},
|
||||
})
|
||||
|
||||
export interface ManagedContentModalState {
|
||||
@@ -314,6 +319,15 @@ const externalSlicerUrls = computed(() => {
|
||||
}
|
||||
return urls
|
||||
})
|
||||
const externalUrls = computed(() => {
|
||||
const urls: Record<string, string> = {}
|
||||
for (const item of items.value) {
|
||||
if (item.external && item.external_url) {
|
||||
urls[item.id] = item.external_url
|
||||
}
|
||||
}
|
||||
return urls
|
||||
})
|
||||
const hasExternalSlicerUrls = computed(() => Object.keys(externalSlicerUrls.value).length > 0)
|
||||
const showTableActions = computed(() => props.enableToggle || hasExternalSlicerUrls.value)
|
||||
|
||||
@@ -598,6 +612,18 @@ defineExpose({ show, showLoading, hide, getState, restore, updateItem, setItems
|
||||
>
|
||||
<ExternalIcon class="size-4" />
|
||||
</ButtonLink>
|
||||
<ButtonLink
|
||||
v-if="externalUrls[item.id]"
|
||||
v-tooltip="formatMessage(messages.downloadFile)"
|
||||
type="quiet"
|
||||
:aria-label="formatMessage(messages.downloadFile)"
|
||||
:href="externalUrls[item.id]"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="!w-9 !px-0 !rounded-full"
|
||||
>
|
||||
<FileIcon class="size-4" />
|
||||
</ButtonLink>
|
||||
</template>
|
||||
</ContentCardTable>
|
||||
</div>
|
||||
|
||||
@@ -2252,6 +2252,9 @@
|
||||
"instances.content-install.show-unavailable": {
|
||||
"defaultMessage": "Show unavailable"
|
||||
},
|
||||
"instances.managed-content-modal.download-file": {
|
||||
"defaultMessage": "Download File"
|
||||
},
|
||||
"instances.managed-content-modal.empty-description": {
|
||||
"defaultMessage": "This source does not include any managed content."
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user