Files
modrinth/apps/frontend/src/components/ui/banner/VerifyEmailBanner.vue
T
Prospectorandcoolbot100s 0ffdabb2a3 feat: new proj moderation page (#6044)
* feat: new proj moderation page

* make requested changes

* add boolean for showing delay message

* fix server icon + shortened code

* fix server icon

* refactor admonitions

* msg correction.

* correction + change spam-notice

* Separate status info from instruction details

* Tweak timing delay msg, thread activity warning, and refer to moderation with consistent terms.

* Whoops, actually updated msgs correctly now.

* prepr + margin

* split out strings, simplify code again

* fix: a few more moderation fixes (#6048)

* fix: move tooltip to button

* fix: lock status buttons after pressing

* fix: unlisted/withheld icon on legacy badge

* prepprrr

* fix banners, add some extra dev mode stuff

* fix thread id copy padding

* tweak: adjust some of the status change messages (#6041)

* update messages & bunch of other stuff

* rename toggle

* change hover to 2.5, fix error size

* private msg overlay

---------

Co-authored-by: coolbot100s <76798835+coolbot100s@users.noreply.github.com>
2026-05-12 22:23:18 -07:00

112 lines
2.6 KiB
Vue

<script setup lang="ts">
import { SettingsIcon } from '@modrinth/assets'
import {
ButtonStyled,
defineMessages,
injectNotificationManager,
PagewideBanner,
useVIntl,
} from '@modrinth/ui'
import { FetchError } from 'ofetch'
const { addNotification } = injectNotificationManager()
const { formatMessage } = useVIntl()
defineProps<{
hasEmail: boolean
}>()
const verifyEmailBannerMessages = defineMessages({
title: {
id: 'layout.banner.account-action',
defaultMessage: 'Account action required',
},
description: {
id: 'layout.banner.verify-email.description',
defaultMessage:
'For security reasons, Modrinth needs you to verify the email address associated with your account.',
},
action: {
id: 'layout.banner.verify-email.action',
defaultMessage: 'Re-send verification email',
},
})
const addEmailBannerMessages = defineMessages({
title: {
id: 'layout.banner.account-action',
defaultMessage: 'Account action required',
},
description: {
id: 'layout.banner.add-email.description',
defaultMessage:
'For security reasons, Modrinth needs you to register an email address to your account.',
},
action: {
id: 'layout.banner.add-email.button',
defaultMessage: 'Visit account settings',
},
})
async function handleResendEmailVerification() {
try {
await resendVerifyEmail()
addNotification({
title: 'Verification email sent',
text: 'Please check your inbox for the verification email.',
type: 'success',
})
} catch (err) {
if (err instanceof FetchError) {
const description = err.data?.description || err.message
addNotification({
title: 'An error occurred',
text: description,
type: 'error',
})
} else {
addNotification({
title: 'An error occurred',
text: `${err}`,
type: 'error',
})
}
}
}
</script>
<template>
<PagewideBanner variant="warning">
<template #title>
<span>
{{
hasEmail
? formatMessage(verifyEmailBannerMessages.title)
: formatMessage(addEmailBannerMessages.title)
}}
</span>
</template>
<template #description>
<span>
{{
hasEmail
? formatMessage(verifyEmailBannerMessages.description)
: formatMessage(addEmailBannerMessages.description)
}}
</span>
</template>
<template #actions_right>
<ButtonStyled color="orange">
<button v-if="hasEmail" @click="handleResendEmailVerification">
{{ formatMessage(verifyEmailBannerMessages.action) }}
</button>
<nuxt-link v-else to="/settings/account">
<SettingsIcon aria-hidden="true" />
{{ formatMessage(addEmailBannerMessages.action) }}
</nuxt-link>
</ButtonStyled>
</template>
</PagewideBanner>
</template>