Skip to content

Commit 325926a

Browse files
authored
feat: pride 2026 frontend (#6205)
* feat: pride 2026 banner app sidebar * feat: use ProgressBar component * feat: pride skins * feat: pride skins * feat: blog post * fix: blogpost * fix: pride skin condition * fix: types * fix: show logic * fix: qa * fix: lint * fix: unused var
1 parent 34b8799 commit 325926a

31 files changed

Lines changed: 553 additions & 31 deletions

File tree

‎apps/app-frontend/src/App.vue‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import InstallToPlayModal from '@/components/ui/modal/InstallToPlayModal.vue'
8484
import ModpackAlreadyInstalledModal from '@/components/ui/modal/ModpackAlreadyInstalledModal.vue'
8585
import UpdateToPlayModal from '@/components/ui/modal/UpdateToPlayModal.vue'
8686
import NavButton from '@/components/ui/NavButton.vue'
87+
import PrideFundraiserBanner from '@/components/ui/PrideFundraiserBanner.vue'
8788
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
8889
import QuickInstanceSwitcher from '@/components/ui/QuickInstanceSwitcher.vue'
8990
import SplashScreen from '@/components/ui/SplashScreen.vue'
@@ -101,6 +102,7 @@ import { list } from '@/helpers/profile.js'
101102
import { mergeUrlQuery, parseModrinthLink } from '@/helpers/project-links.ts'
102103
import { get as getSettings, set as setSettings } from '@/helpers/settings.ts'
103104
import { get_opening_command, initialize_state } from '@/helpers/state'
105+
import { hasActivePride26Midas, hasMidasBadge } from '@/helpers/user-campaigns.ts'
104106
import {
105107
areUpdatesEnabled,
106108
enqueueUpdateForInstallation,
@@ -134,6 +136,7 @@ const route = useRoute()
134136
const APP_LEFT_NAV_WIDTH = '4rem'
135137
const APP_SIDEBAR_WIDTH = 300
136138
const INTERCOM_BUBBLE_DEFAULT_PADDING = 20
139+
const PRIDE_FUNDRAISER_END_DATE = new Date('2026-07-01T00:00:00Z').getTime()
137140
const credentials = ref()
138141
const sidebarToggled = ref(true)
139142
const unsubscribeSidebarToggle = themeStore.$subscribe(() => {
@@ -144,6 +147,9 @@ const forceSidebar = computed(
144147
)
145148
const sidebarVisible = computed(() => sidebarToggled.value || forceSidebar.value)
146149
const hostingRouteActive = computed(() => route.path.startsWith('/hosting'))
150+
const prideFundraiserEnabled = computed(
151+
() => themeStore.getFeatureFlag('pride_fundraiser') && Date.now() < PRIDE_FUNDRAISER_END_DATE,
152+
)
147153
const hostingIntercomIdentityKey = computed(() => {
148154
const rawServerId = route.params.id
149155
const serverId = Array.isArray(rawServerId) ? rawServerId[0] : rawServerId
@@ -192,6 +198,12 @@ const tauriApiClient = new TauriModrinthClient({
192198
],
193199
})
194200
provideModrinthClient(tauriApiClient)
201+
const { data: authenticatedModrinthUser } = useQuery({
202+
queryKey: computed(() => ['authenticated-user', 'campaigns', credentials.value?.user?.id]),
203+
queryFn: () => tauriApiClient.labrinth.users_v3.getAuthenticated(),
204+
enabled: () => !!credentials.value?.session,
205+
retry: false,
206+
})
195207
providePageContext({
196208
hierarchicalSidebarAvailable: ref(true),
197209
showAds: ref(false),
@@ -676,12 +688,11 @@ async function logOut() {
676688
await fetchCredentials()
677689
}
678690
679-
const MIDAS_BITFLAG = 1 << 0
680691
const hasPlus = computed(
681692
() =>
682-
credentials.value &&
683-
credentials.value.user &&
684-
(credentials.value.user.badges & MIDAS_BITFLAG) === MIDAS_BITFLAG,
693+
!!credentials.value?.user &&
694+
(hasMidasBadge(credentials.value.user) ||
695+
hasActivePride26Midas(authenticatedModrinthUser.value?.campaigns?.pride_26)),
685696
)
686697
687698
const showAd = computed(
@@ -1479,6 +1490,10 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
14791490
<FriendsList :credentials="credentials" :sign-in="() => signIn()" />
14801491
</suspense>
14811492
</div>
1493+
<PrideFundraiserBanner
1494+
v-if="prideFundraiserEnabled"
1495+
class="p-4 border-0 border-b-[1px] border-[--brand-gradient-border] border-solid"
1496+
/>
14821497
<div v-if="news && news.length > 0" class="p-4 flex flex-col items-center">
14831498
<h3 class="text-base mb-4 text-primary font-medium m-0 text-left w-full">News</h3>
14841499
<div class="space-y-4 flex flex-col items-center w-full">
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<script setup lang="ts">
2+
import { CalendarIcon, UsersIcon, XIcon } from '@modrinth/assets'
3+
import { injectModrinthClient, ProgressBar } from '@modrinth/ui'
4+
import { useQuery } from '@tanstack/vue-query'
5+
import { openUrl } from '@tauri-apps/plugin-opener'
6+
import { computed, ref } from 'vue'
7+
8+
const DISMISSED_STORAGE_KEY = 'pride-fundraiser-2026-dismissed'
9+
10+
const client = injectModrinthClient()
11+
const dismissed = ref(localStorage.getItem(DISMISSED_STORAGE_KEY) === 'true')
12+
13+
const { data: campaignInfo } = useQuery({
14+
queryKey: ['campaign', 'pride-26'],
15+
queryFn: () => client.labrinth.campaign_internal.getPride26(),
16+
enabled: () => !dismissed.value,
17+
staleTime: 15 * 60 * 1000,
18+
refetchInterval: 15 * 60 * 1000,
19+
retry: false,
20+
})
21+
const shouldShowBanner = computed(
22+
() => !dismissed.value && Number(campaignInfo.value?.target_usd) > 0,
23+
)
24+
25+
async function openPrideFundraiser() {
26+
await openUrl('https://modrinth.com/pride')
27+
}
28+
29+
function dismissBanner() {
30+
dismissed.value = true
31+
localStorage.setItem(DISMISSED_STORAGE_KEY, 'true')
32+
}
33+
34+
function formatUsd(amount: string | number) {
35+
return Number(amount).toLocaleString('en-US', {
36+
style: 'currency',
37+
currency: 'USD',
38+
maximumFractionDigits: 0,
39+
})
40+
}
41+
42+
function daysLeft() {
43+
return Math.max(
44+
0,
45+
Math.ceil((new Date('2026-07-01T00:00:00Z').getTime() - Date.now()) / (24 * 60 * 60 * 1000)),
46+
)
47+
}
48+
</script>
49+
50+
<template>
51+
<div v-if="shouldShowBanner && campaignInfo">
52+
<section
53+
role="link"
54+
tabindex="0"
55+
class="flex w-full cursor-pointer flex-col gap-3 rounded-xl border border-solid border-surface-5 bg-button-bg p-3 text-primary transition-[border-color,filter] hover:border-surface-6 hover:brightness-125 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand"
56+
aria-label="Open Pride fundraiser"
57+
@click="openPrideFundraiser"
58+
@keydown.enter="openPrideFundraiser"
59+
@keydown.space.prevent="openPrideFundraiser"
60+
>
61+
<div class="flex w-full items-center justify-between gap-2">
62+
<h2 class="m-0 min-w-0 truncate text-base font-semibold text-contrast">
63+
Pride Fundraiser 2026
64+
</h2>
65+
<button
66+
type="button"
67+
class="m-0 flex size-5 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent p-0 text-primary transition-colors hover:text-contrast focus-visible:text-contrast"
68+
aria-label="Dismiss Pride fundraiser"
69+
@click.stop="dismissBanner"
70+
@keydown.stop
71+
>
72+
<XIcon aria-hidden="true" class="size-5" />
73+
</button>
74+
</div>
75+
<div class="h-px w-full bg-surface-5" />
76+
<div class="flex w-full flex-col gap-2.5">
77+
<div class="flex items-end gap-1 whitespace-nowrap">
78+
<span class="text-base font-semibold leading-5 text-contrast">
79+
{{ formatUsd(campaignInfo.total_donations_usd) }}
80+
</span>
81+
<span class="text-xs font-medium leading-4">
82+
of {{ formatUsd(campaignInfo.target_usd) }}
83+
</span>
84+
</div>
85+
<ProgressBar
86+
class="pride-fundraiser-banner__progress"
87+
:progress="Number(campaignInfo.total_donations_usd)"
88+
:max="Number(campaignInfo.target_usd)"
89+
color="purple"
90+
full-width
91+
:gradient-border="false"
92+
:aria-label="`${formatUsd(campaignInfo.total_donations_usd)} of ${formatUsd(
93+
campaignInfo.target_usd,
94+
)} raised`"
95+
/>
96+
<div class="flex flex-wrap items-center gap-2 text-xs font-medium leading-4">
97+
<span class="flex items-center gap-1">
98+
<UsersIcon aria-hidden="true" class="size-4 shrink-0" />
99+
{{ campaignInfo.num_donators.toLocaleString('en-US') }}
100+
{{ campaignInfo.num_donators === 1 ? 'supporter' : 'supporters' }}
101+
</span>
102+
<span class="flex items-center gap-1">
103+
<CalendarIcon aria-hidden="true" class="size-4 shrink-0" />
104+
{{ daysLeft() }} {{ daysLeft() === 1 ? 'day left' : 'days left' }}
105+
</span>
106+
</div>
107+
</div>
108+
</section>
109+
</div>
110+
</template>
111+
112+
<style scoped>
113+
.pride-fundraiser-banner__progress :deep(.progress-bar) {
114+
background: linear-gradient(
115+
90deg,
116+
var(--color-red) 0%,
117+
var(--color-orange) 20%,
118+
var(--color-green) 50%,
119+
var(--color-blue) 75%,
120+
var(--color-purple) 100%
121+
);
122+
}
123+
</style>

‎apps/app-frontend/src/components/ui/friends/FriendsList.vue‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ const messages = defineMessages({
393393
<FriendsSection
394394
v-if="pendingFriends.length > 0"
395395
:is-searching="!!search"
396-
open-by-default
397396
:friends="pendingFriends"
398397
:heading="formatMessage(messages.pending)"
399398
:remove-friend="removeFriend"

‎apps/app-frontend/src/components/ui/skin/VirtualSkinSectionList.vue‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { DropdownIcon, EditIcon, PlusIcon, TrashIcon } from '@modrinth/assets'
2+
import { DropdownIcon, EditIcon, PlusIcon, TrashIcon, UnknownIcon } from '@modrinth/assets'
33
import {
44
Accordion,
55
ButtonStyled,
@@ -11,6 +11,7 @@ import {
1111
useVIntl,
1212
} from '@modrinth/ui'
1313
import { useElementSize, useWindowSize } from '@vueuse/core'
14+
import { Tooltip } from 'floating-vue'
1415
import { computed, nextTick, onUnmounted, ref, useTemplateRef, watch } from 'vue'
1516
1617
import type { RenderResult } from '@/helpers/rendering/batch-skin-renderer.ts'
@@ -24,13 +25,15 @@ type AddSkinButtonRef = SkinLikeTextButtonExpose | SkinLikeTextButtonExpose[]
2425
2526
interface DefaultSkinSection {
2627
title: string
28+
infoTooltip?: string
2729
skins: Skin[]
2830
}
2931
3032
interface SkinSection {
3133
key: string
3234
title: string
3335
kind: SkinSectionKind
36+
infoTooltip?: string
3437
skins: Skin[]
3538
}
3639
@@ -145,6 +148,7 @@ const sections = computed<SkinSection[]>(() => [
145148
key: defaultSkinSectionKey(section.title),
146149
title: section.title,
147150
kind: 'default' as const,
151+
infoTooltip: section.infoTooltip,
148152
skins: section.skins,
149153
})),
150154
])
@@ -330,6 +334,24 @@ defineExpose({ getAddSkinButtonElement })
330334
<span class="min-w-0 text-xl font-semibold leading-7 text-primary">
331335
{{ section.title }}
332336
</span>
337+
<Tooltip
338+
v-if="section.infoTooltip"
339+
theme="dismissable-prompt"
340+
placement="top"
341+
:triggers="['hover', 'focus']"
342+
>
343+
<span
344+
class="inline-flex size-6 shrink-0 items-center justify-center text-secondary transition-colors group-hover:text-primary"
345+
@click.stop
346+
>
347+
<UnknownIcon class="size-5" />
348+
</span>
349+
<template #popper>
350+
<p class="m-0 max-w-96 text-wrap text-sm font-medium leading-tight">
351+
{{ section.infoTooltip }}
352+
</p>
353+
</template>
354+
</Tooltip>
333355
</template>
334356

335357
<div
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { Labrinth } from '@modrinth/api-client'
2+
3+
const MIDAS_BITFLAG = 1 << 0
4+
const PRIDE_26_MIDAS_DURATION_MS = 30 * 24 * 60 * 60 * 1000
5+
6+
type Pride26Campaign = Labrinth.Users.v3.Pride26CampaignDonation | null | undefined
7+
8+
export function hasMidasBadge(user?: { badges?: number } | null) {
9+
return !!user?.badges && (user.badges & MIDAS_BITFLAG) === MIDAS_BITFLAG
10+
}
11+
12+
export function hasPride26Badge(campaign: Pride26Campaign) {
13+
return campaign?.has_badge === true
14+
}
15+
16+
export function hasActivePride26Midas(campaign: Pride26Campaign, now = Date.now()) {
17+
if (campaign?.has_midas !== true) {
18+
return false
19+
}
20+
21+
const donatedAt = new Date(campaign.last_donated_at).getTime()
22+
return Number.isFinite(donatedAt) && donatedAt + PRIDE_26_MIDAS_DURATION_MS > now
23+
}

‎apps/app-frontend/src/locales/en-US/index.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,15 @@
431431
"app.skins.section.minecon-earth-2017": {
432432
"message": "MINECON Earth 2017"
433433
},
434+
"app.skins.section.modrinth": {
435+
"message": "Modrinth"
436+
},
437+
"app.skins.section.modrinth-pride": {
438+
"message": "Modrinth Pride"
439+
},
440+
"app.skins.section.modrinth-pride.tooltip": {
441+
"message": "You received these skins for donating to a Modrinth Pride fundraiser during Pride Month."
442+
},
434443
"app.skins.section.mounts-of-mayhem": {
435444
"message": "Mounts of Mayhem"
436445
},

0 commit comments

Comments
 (0)