2023-05-28 16:36:49 -04:00
|
|
|
<template>
|
2025-08-14 21:48:38 +01:00
|
|
|
<NewModal ref="modal" :noblur="noblur" :danger="danger" :on-hide="onHide">
|
|
|
|
|
<template #title>
|
|
|
|
|
<slot name="title">
|
|
|
|
|
<span class="font-extrabold text-contrast text-lg">{{ title }}</span>
|
|
|
|
|
</slot>
|
|
|
|
|
</template>
|
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
|
<template v-if="description">
|
|
|
|
|
<div
|
|
|
|
|
v-if="markdown"
|
|
|
|
|
class="markdown-body max-w-[35rem]"
|
|
|
|
|
v-html="renderString(description)"
|
|
|
|
|
/>
|
|
|
|
|
<p v-else class="max-w-[35rem] m-0">
|
|
|
|
|
{{ description }}
|
|
|
|
|
</p>
|
|
|
|
|
</template>
|
|
|
|
|
<slot />
|
|
|
|
|
<label v-if="hasToType" for="confirmation">
|
|
|
|
|
<span>
|
|
|
|
|
To confirm you want to proceed, type
|
|
|
|
|
<span class="italic font-bold">{{ confirmationText }}</span> below:
|
|
|
|
|
</span>
|
|
|
|
|
</label>
|
2026-02-09 14:57:31 +00:00
|
|
|
<StyledInput
|
2025-08-14 21:48:38 +01:00
|
|
|
v-if="hasToType"
|
|
|
|
|
id="confirmation"
|
|
|
|
|
v-model="confirmation_typed"
|
|
|
|
|
placeholder="Type here..."
|
2026-02-09 14:57:31 +00:00
|
|
|
wrapper-class="max-w-[20rem]"
|
2025-08-14 21:48:38 +01:00
|
|
|
/>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
<ButtonStyled :color="danger ? 'red' : 'brand'">
|
|
|
|
|
<button :disabled="action_disabled" @click="proceed">
|
|
|
|
|
<component :is="proceedIcon" />
|
|
|
|
|
{{ proceedLabel }}
|
|
|
|
|
</button>
|
|
|
|
|
</ButtonStyled>
|
|
|
|
|
<ButtonStyled>
|
2026-03-06 18:11:45 -08:00
|
|
|
<button @click="hide()">
|
2025-08-14 21:48:38 +01:00
|
|
|
<XIcon />
|
|
|
|
|
Cancel
|
|
|
|
|
</button>
|
|
|
|
|
</ButtonStyled>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</NewModal>
|
2023-05-28 16:36:49 -04:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-07-04 21:46:29 -07:00
|
|
|
import { TrashIcon, XIcon } from '@modrinth/assets'
|
2025-08-14 21:48:38 +01:00
|
|
|
import { renderString } from '@modrinth/utils'
|
|
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
|
Project, Search, User redesign (#1281)
* New project page
* fix silly icon tailwind classes
* Start new versions page, add new ButtonStyled component
* Pagination and finish mocking up versions page functionality
* green download button
* hover animation
* New Modal, Avatar refactor, subpages in NavTabs
* lint
* Download modal
* New user page + fix lint
* fix ui lint
* Download animation fix
* Versions filter + finish project page
* Improve consistency of buttons on home page
* Fix ButtonStyled breaking
* Fix margin on version summary
* finish search, new modals, user + project page mobile
* fix gallery image pages
* New project header
* Fix gallery tab showing improperly
* Use auto direction + position for all popouts
* Preliminary user page
* test to see if this fixes login stuff
* remove extra slash
* Add version actions, move download button on versions page
* Listed -> public
* Shorten download modal selector height
* Fix user menu open direction
* Change breakpoint for header collapse
* Only underline title
* Tighten padding on stats a little
* New nav
* Make mobile breakpoint more consistent
* fix header breakpoint regression
* Add sign in button
* Fix edit icon color
* Fix margin at top of screen
* Fix user bios and ad width
* Fix user nav showing when there's only one type of project
* Fix plural projects on user page & extract i18n
* Remove ads on mobile for now
* Fix overflow menu showing hidden items
* NavTabs on mobile
* Fix navbar z index
* Search filter overhaul + negative filters
* fix no-max-height
* port version filters, fix following/collections, lint
* hide promos
* ui lint
* Disable modal background animation to reduce reported motion sickness
* Hide install with modrinth app button on mobile
---------
Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Prospector <prospectordev@gmail.com>
2024-08-20 23:03:16 -07:00
|
|
|
import ButtonStyled from '../base/ButtonStyled.vue'
|
2026-02-09 14:57:31 +00:00
|
|
|
import StyledInput from '../base/StyledInput.vue'
|
2025-08-14 21:48:38 +01:00
|
|
|
import NewModal from './NewModal.vue'
|
2023-05-28 16:36:49 -04:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-08-14 21:48:38 +01:00
|
|
|
confirmationText: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
hasToType: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'No title defined',
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
description: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: undefined,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
proceedIcon: {
|
|
|
|
|
type: Object,
|
2026-01-28 20:09:24 +00:00
|
|
|
default: () => TrashIcon,
|
2025-08-14 21:48:38 +01:00
|
|
|
},
|
|
|
|
|
proceedLabel: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'Proceed',
|
|
|
|
|
},
|
|
|
|
|
noblur: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
danger: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
onHide: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default() {
|
|
|
|
|
return () => {}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
markdown: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
2023-05-28 16:36:49 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['proceed'])
|
|
|
|
|
const modal = ref(null)
|
|
|
|
|
|
|
|
|
|
const confirmation_typed = ref('')
|
|
|
|
|
|
2025-04-17 04:26:13 -04:00
|
|
|
const action_disabled = computed(
|
2025-08-14 21:48:38 +01:00
|
|
|
() =>
|
|
|
|
|
props.hasToType &&
|
|
|
|
|
confirmation_typed.value.toLowerCase() !== props.confirmationText.toLowerCase(),
|
2025-04-17 04:26:13 -04:00
|
|
|
)
|
|
|
|
|
|
2023-05-28 16:36:49 -04:00
|
|
|
function proceed() {
|
2025-08-14 21:48:38 +01:00
|
|
|
modal.value.hide()
|
|
|
|
|
confirmation_typed.value = ''
|
|
|
|
|
emit('proceed')
|
2023-05-28 16:36:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function show() {
|
2025-08-14 21:48:38 +01:00
|
|
|
modal.value.show()
|
2023-05-28 16:36:49 -04:00
|
|
|
}
|
2026-03-06 18:11:45 -08:00
|
|
|
function hide() {
|
|
|
|
|
modal.value.hide()
|
|
|
|
|
}
|
2023-05-28 16:36:49 -04:00
|
|
|
|
2026-03-06 18:11:45 -08:00
|
|
|
defineExpose({ show, hide })
|
2023-05-28 16:36:49 -04:00
|
|
|
</script>
|