mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 10:34:53 +00:00
feat: malware warning modal changes (#6721)
* feat: improved warning modals * fix: qa * feat: install to play and update to play changes * fix: dont warn for server projects as already reviewed * fix: lint
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import ButtonStyled from '../../components/base/ButtonStyled.vue'
|
||||
import UnknownFileWarningModal from '../../components/modal/UnknownFileWarningModal.vue'
|
||||
|
||||
const meta = {
|
||||
title: 'Modal/UnknownFileWarningModal',
|
||||
component: UnknownFileWarningModal,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
} satisfies Meta<typeof UnknownFileWarningModal>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Modpack: Story = {
|
||||
render: () => ({
|
||||
components: { ButtonStyled, UnknownFileWarningModal },
|
||||
setup() {
|
||||
const modalRef = ref<InstanceType<typeof UnknownFileWarningModal> | null>(null)
|
||||
return { modalRef }
|
||||
},
|
||||
template: /* html */ `
|
||||
<ButtonStyled color="brand">
|
||||
<button @click="modalRef?.show()">Open modpack warning</button>
|
||||
</ButtonStyled>
|
||||
<UnknownFileWarningModal
|
||||
ref="modalRef"
|
||||
mode="modpack"
|
||||
file-name="cozy-cottage-1.4.0.mrpack"
|
||||
:external-files-in-modpack="[
|
||||
'voicechat-fabric-1.20.1-2.5.26.jar',
|
||||
'xaeros-minimap-24.6.1_Fabric_1.20.jar',
|
||||
'InventoryProfilesNext-forge-1.20.1-1.10.12.jar',
|
||||
'MouseTweaks-forge-mc1.20.1-2.25.jar',
|
||||
'Terralith_1.20.x_v2.5.4.jar',
|
||||
'YungsApi-1.20-Forge-4.0.5.jar',
|
||||
]"
|
||||
/>
|
||||
`,
|
||||
}),
|
||||
}
|
||||
|
||||
export const Mod: Story = {
|
||||
render: () => ({
|
||||
components: { ButtonStyled, UnknownFileWarningModal },
|
||||
setup() {
|
||||
const modalRef = ref<InstanceType<typeof UnknownFileWarningModal> | null>(null)
|
||||
return { modalRef }
|
||||
},
|
||||
template: /* html */ `
|
||||
<ButtonStyled color="brand">
|
||||
<button @click="modalRef?.show()">Open file warning</button>
|
||||
</ButtonStyled>
|
||||
<UnknownFileWarningModal
|
||||
ref="modalRef"
|
||||
mode="mod"
|
||||
file-name="voicechat-fabric-1.20.1-2.5.26.jar"
|
||||
/>
|
||||
`,
|
||||
}),
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import { DownloadIcon } from '@modrinth/assets'
|
||||
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import ButtonStyled from '../../components/base/ButtonStyled.vue'
|
||||
import ContentDiffModal from '../../layouts/shared/installation-settings/components/ContentDiffModal.vue'
|
||||
import type { ContentDiffItem } from '../../layouts/shared/installation-settings/types'
|
||||
|
||||
const meta = {
|
||||
title: 'Modal/UpdateToPlayModal',
|
||||
component: ContentDiffModal,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
} satisfies Meta<typeof ContentDiffModal>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
const diffs: ContentDiffItem[] = [
|
||||
{
|
||||
type: 'added',
|
||||
external: true,
|
||||
fileName: 'voicechat-fabric-1.20.1-2.5.26.jar',
|
||||
},
|
||||
{
|
||||
type: 'added',
|
||||
external: true,
|
||||
fileName: 'xaeros-minimap-24.6.1_Fabric_1.20.jar',
|
||||
},
|
||||
{
|
||||
type: 'updated',
|
||||
projectName: 'Cloth Config API',
|
||||
currentVersionName: '18.0.145+neoforge',
|
||||
newVersionName: '20.0.149+neoforge',
|
||||
},
|
||||
{
|
||||
type: 'added',
|
||||
projectName: 'Sodium',
|
||||
newVersionName: '1.21.10-0.7.3-neoforge',
|
||||
},
|
||||
{
|
||||
type: 'updated',
|
||||
projectName: 'Iris Shaders',
|
||||
currentVersionName: '1.8.8+1.21.8-neoforge',
|
||||
newVersionName: '1.9.6+1.21.10-neoforge',
|
||||
},
|
||||
{
|
||||
type: 'updated',
|
||||
projectName: 'Entity Culling',
|
||||
currentVersionName: '1.8.1',
|
||||
newVersionName: '1.9.3',
|
||||
},
|
||||
{
|
||||
type: 'updated',
|
||||
projectName: 'FerriteCore',
|
||||
currentVersionName: '7.0.2',
|
||||
newVersionName: '8.0.0',
|
||||
},
|
||||
{
|
||||
type: 'removed',
|
||||
projectName: 'Lithium',
|
||||
currentVersionName: '0.15.0+mc1.21.8',
|
||||
},
|
||||
]
|
||||
|
||||
export const ExternalFiles: Story = {
|
||||
render: () => ({
|
||||
components: { ButtonStyled, ContentDiffModal },
|
||||
setup() {
|
||||
const modalRef = ref<InstanceType<typeof ContentDiffModal> | null>(null)
|
||||
return { diffs, DownloadIcon, modalRef }
|
||||
},
|
||||
template: /* html */ `
|
||||
<ButtonStyled color="brand">
|
||||
<button @click="modalRef?.show()">Open update warning</button>
|
||||
</ButtonStyled>
|
||||
<ContentDiffModal
|
||||
ref="modalRef"
|
||||
header="Update to play"
|
||||
description="An update is required to play Epic Modrinth Pack. Please update to the latest version to launch the game."
|
||||
:diffs="diffs"
|
||||
version-date="November 25, 2025"
|
||||
show-external-warnings
|
||||
confirm-label="Update"
|
||||
:confirm-icon="DownloadIcon"
|
||||
removed-label="Removed"
|
||||
/>
|
||||
`,
|
||||
}),
|
||||
}
|
||||
Reference in New Issue
Block a user