Skip to content

Commit d3459e4

Browse files
authored
Medal promo v2 (#4220)
* Revert "Revert "feat: medal promotion on servers page (#4117)"" This reverts commit 2e6cff7. * Revert "Revert "update changelog"" This reverts commit b2ff2d8. * Revert "Revert "turn off medal promo"" This reverts commit eaa4b44. * Revert "Revert "Revert "turn off medal promo""" This reverts commit 76d0ef0. * Revert "Revert "fix medal thing showing up for everyone"" This reverts commit ee8c47a. * New medal colors * Update medal server listings * Upgrade modal enhancements & more medal consistency * undo app promo changes * Only apply medal promo with flag on * remove unneessary files * lint * disable medal flag
1 parent 07703e4 commit d3459e4

37 files changed

+2071
-341
lines changed

apps/docs/src/styles/modrinth.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
::backdrop,
33
:root[data-theme='light'],
44
[data-theme='light'] ::backdrop {
5-
--sl-font-system:
6-
Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Roboto, Cantarell,
7-
Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
5+
--sl-font-system: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Roboto,
6+
Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
87

98
--sl-color-white: var(--color-contrast); /* “white” */
109
--sl-color-gray-1: var(--color-base);
Lines changed: 11 additions & 0 deletions
Loading

apps/frontend/src/assets/styles/global.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ html {
131131

132132
--landing-raw-bg: #fff;
133133

134+
--medal-promotion-bg: #fff;
135+
--medal-promotion-bg-orange: #48aaff;
136+
--medal-promotion-text-orange: #156db8;
137+
--medal-promotion-bg-gradient: linear-gradient(
138+
90deg,
139+
rgba(152, 207, 255, 0.2) 20%,
140+
rgba(152, 207, 255, 0.1) 100%
141+
);
142+
134143
--banner-error-bg: #fee2e2;
135144
--banner-error-text: #991b1b;
136145
--banner-error-border: #ef4444;
@@ -237,6 +246,15 @@ html {
237246

238247
--landing-raw-bg: #000;
239248

249+
--medal-promotion-bg: #000;
250+
--medal-promotion-bg-orange: rgba(208, 246, 255, 0.25);
251+
--medal-promotion-text-orange: #42abff;
252+
--medal-promotion-bg-gradient: linear-gradient(
253+
90deg,
254+
rgba(66, 170, 255, 0.15),
255+
rgba(0, 0, 0, 0) 100%
256+
);
257+
240258
--hover-filter: brightness(120%);
241259
--active-filter: brightness(140%);
242260

apps/frontend/src/components/ui/AdPlaceholder.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
22
<div class="ad-parent relative mb-3 flex w-full justify-center rounded-2xl bg-bg-raised">
33
<nuxt-link
4-
to="/servers"
4+
:to="flags.enableMedalPromotion ? '/servers?plan&ref=medal' : '/servers'"
55
class="flex max-h-[250px] min-h-[250px] min-w-[300px] max-w-[300px] flex-col gap-4 rounded-[inherit]"
66
>
77
<img
8-
src="https://cdn-raw.modrinth.com/modrinth-servers-placeholder-light.webp"
8+
:src="`https://cdn-raw.modrinth.com/${flags.enableMedalPromotion ? 'medal-modrinth-servers' : 'modrinth-servers-placeholder'}-light.webp`"
99
alt="Host your next server with Modrinth Servers"
1010
class="light-image hidden rounded-[inherit]"
1111
/>
1212
<img
13-
src="https://cdn-raw.modrinth.com/modrinth-servers-placeholder-dark.webp"
13+
:src="`https://cdn-raw.modrinth.com/${flags.enableMedalPromotion ? 'medal-modrinth-servers' : 'modrinth-servers-placeholder'}-dark.webp`"
1414
alt="Host your next server with Modrinth Servers"
1515
class="dark-image rounded-[inherit]"
1616
/>
@@ -23,6 +23,8 @@
2323
</div>
2424
</template>
2525
<script setup>
26+
const flags = useFeatureFlags()
27+
2628
useHead({
2729
script: [
2830
// {

apps/frontend/src/components/ui/servers/ServerIcon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="experimental-styles-within flex size-24 shrink-0 overflow-hidden rounded-xl border-[1px] border-solid border-button-border bg-button-bg shadow-sm"
3+
class="experimental-styles-within flex size-16 shrink-0 overflow-hidden rounded-xl border-[1px] border-solid border-button-border bg-button-bg shadow-sm"
44
>
55
<client-only>
66
<img
Lines changed: 92 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,69 @@
11
<template>
2-
<NuxtLink
3-
class="contents"
4-
:to="status === 'suspended' ? '' : `/servers/manage/${props.server_id}`"
5-
>
6-
<div
7-
v-tooltip="
8-
status === 'suspended'
9-
? suspension_reason === 'upgrading'
10-
? 'This server is being transferred to a new node. It will be unavailable until this process finishes.'
11-
: 'This server has been suspended. Please visit your billing settings or contact Modrinth Support for more information.'
12-
: ''
13-
"
14-
class="flex cursor-pointer flex-row items-center overflow-x-hidden rounded-3xl bg-bg-raised p-4 transition-transform duration-100"
15-
:class="status === 'suspended' ? '!rounded-b-none opacity-75' : 'active:scale-95'"
16-
data-pyro-server-listing
17-
:data-pyro-server-listing-id="server_id"
18-
>
19-
<ServerIcon v-if="status !== 'suspended'" :image="image" />
2+
<div>
3+
<NuxtLink :to="status === 'suspended' ? '' : `/servers/manage/${props.server_id}`">
204
<div
21-
v-else
22-
class="bg-bg-secondary flex size-24 items-center justify-center rounded-xl border-[1px] border-solid border-button-border bg-button-bg shadow-sm"
5+
class="flex flex-row items-center overflow-x-hidden rounded-2xl border-[1px] border-solid border-button-bg bg-bg-raised p-4 transition-transform duration-100"
6+
:class="{
7+
'!rounded-b-none border-b-0': status === 'suspended' || !!pendingChange,
8+
'opacity-75': status === 'suspended',
9+
'active:scale-95': status !== 'suspended' && !pendingChange,
10+
}"
11+
data-pyro-server-listing
12+
:data-pyro-server-listing-id="server_id"
2313
>
24-
<LockIcon class="size-20 text-secondary" />
25-
</div>
26-
<div class="ml-8 flex flex-col gap-2.5">
27-
<div class="flex flex-row items-center gap-2">
28-
<h2 class="m-0 text-xl font-bold text-contrast">{{ name }}</h2>
29-
<ChevronRightIcon />
30-
</div>
31-
14+
<ServerIcon v-if="status !== 'suspended'" :image="image" />
3215
<div
33-
v-if="projectData?.title"
34-
class="m-0 flex flex-row items-center gap-2 text-sm font-medium text-secondary"
16+
v-else
17+
class="bg-bg-secondary flex size-16 items-center justify-center rounded-xl border-[1px] border-solid border-button-border bg-button-bg shadow-sm"
3518
>
36-
<Avatar
37-
:src="iconUrl"
38-
no-shadow
39-
style="min-height: 20px; min-width: 20px; height: 20px; width: 20px"
40-
alt="Server Icon"
41-
/>
42-
Using {{ projectData?.title || 'Unknown' }}
19+
<LockIcon class="size-12 text-secondary" />
4320
</div>
44-
<div v-else class="min-h-[20px]"></div>
21+
<div class="ml-4 flex flex-col gap-2.5">
22+
<div class="flex flex-row items-center gap-2">
23+
<h2 class="m-0 text-xl font-bold text-contrast">{{ name }}</h2>
24+
<ChevronRightIcon />
25+
</div>
4526

46-
<div
47-
v-if="isConfiguring"
48-
class="flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-brand"
49-
>
50-
<SparklesIcon class="size-5 shrink-0" /> New server
27+
<div
28+
v-if="projectData?.title"
29+
class="m-0 flex flex-row items-center gap-2 text-sm font-medium text-secondary"
30+
>
31+
<Avatar
32+
:src="iconUrl"
33+
no-shadow
34+
style="min-height: 20px; min-width: 20px; height: 20px; width: 20px"
35+
alt="Server Icon"
36+
/>
37+
Using {{ projectData?.title || 'Unknown' }}
38+
</div>
39+
40+
<div
41+
v-if="isConfiguring"
42+
class="flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-brand"
43+
>
44+
<SparklesIcon class="size-5 shrink-0" /> New server
45+
</div>
46+
<ServerInfoLabels
47+
v-else
48+
:server-data="{ game, mc_version, loader, loader_version, net }"
49+
:show-game-label="showGameLabel"
50+
:show-loader-label="showLoaderLabel"
51+
:linked="false"
52+
class="pointer-events-none flex w-full flex-row flex-wrap items-center gap-4 text-secondary *:hidden sm:flex-row sm:*:flex"
53+
/>
5154
</div>
52-
<ServerInfoLabels
53-
v-else
54-
:server-data="{ game, mc_version, loader, loader_version, net }"
55-
:show-game-label="showGameLabel"
56-
:show-loader-label="showLoaderLabel"
57-
:linked="false"
58-
class="pointer-events-none flex w-full flex-row flex-wrap items-center gap-4 text-secondary *:hidden sm:flex-row sm:*:flex"
59-
/>
6055
</div>
61-
</div>
56+
</NuxtLink>
6257
<div
6358
v-if="status === 'suspended' && suspension_reason === 'upgrading'"
64-
class="relative -mt-4 flex w-full flex-row items-center gap-2 rounded-b-3xl bg-bg-blue p-4 text-sm font-bold text-contrast"
59+
class="relative flex w-full flex-row items-center gap-2 rounded-b-2xl border-[1px] border-t-0 border-solid border-bg-blue bg-bg-blue p-4 text-sm font-bold text-contrast"
6560
>
6661
<PanelSpinner />
6762
Your server's hardware is currently being upgraded and will be back online shortly.
6863
</div>
6964
<div
7065
v-else-if="status === 'suspended' && suspension_reason === 'cancelled'"
71-
class="relative -mt-4 flex w-full flex-col gap-2 rounded-b-3xl bg-bg-red p-4 text-sm font-bold text-contrast"
66+
class="relative flex w-full flex-col gap-2 rounded-b-2xl border-[1px] border-t-0 border-solid border-bg-red bg-bg-red p-4 text-sm font-bold text-contrast"
7267
>
7368
<div class="flex flex-row gap-2">
7469
<PanelErrorIcon class="!size-5" /> Your server has been cancelled. Please update your
@@ -78,7 +73,7 @@
7873
</div>
7974
<div
8075
v-else-if="status === 'suspended' && suspension_reason"
81-
class="relative -mt-4 flex w-full flex-col gap-2 rounded-b-3xl bg-bg-red p-4 text-sm font-bold text-contrast"
76+
class="relative flex w-full flex-col gap-2 rounded-b-2xl border-[1px] border-t-0 border-solid border-bg-red bg-bg-red p-4 text-sm font-bold text-contrast"
8277
>
8378
<div class="flex flex-row gap-2">
8479
<PanelErrorIcon class="!size-5" /> Your server has been suspended: {{ suspension_reason }}.
@@ -88,21 +83,39 @@
8883
</div>
8984
<div
9085
v-else-if="status === 'suspended'"
91-
class="relative -mt-4 flex w-full flex-col gap-2 rounded-b-3xl bg-bg-red p-4 text-sm font-bold text-contrast"
86+
class="relative flex w-full flex-col gap-2 rounded-b-2xl border-[1px] border-t-0 border-solid border-bg-red bg-bg-red p-4 text-sm font-bold text-contrast"
9287
>
9388
<div class="flex flex-row gap-2">
9489
<PanelErrorIcon class="!size-5" /> Your server has been suspended. Please update your
9590
billing information or contact Modrinth Support for more information.
9691
</div>
9792
<CopyCode :text="`${props.server_id}`" class="ml-auto" />
9893
</div>
99-
</NuxtLink>
94+
<div
95+
v-if="pendingChange && status !== 'suspended'"
96+
class="relative flex w-full flex-col gap-2 rounded-b-2xl border-[1px] border-t-0 border-solid border-orange bg-bg-orange p-4 text-sm font-bold text-contrast"
97+
>
98+
<div>
99+
Your server will {{ pendingChange.verb.toLowerCase() }} to the "{{
100+
pendingChange.planSize
101+
}}" plan on {{ formatDate(pendingChange.date) }}.
102+
</div>
103+
<ServersSpecs
104+
class="!font-normal !text-contrast"
105+
:ram="Math.round((pendingChange.ramGb ?? 0) * 1024)"
106+
:storage="Math.round((pendingChange.storageGb ?? 0) * 1024)"
107+
:cpus="pendingChange.cpuBurst"
108+
bursting-link="https://docs.modrinth.com/servers/bursting"
109+
/>
110+
</div>
111+
</div>
100112
</template>
101113

102114
<script setup lang="ts">
103115
import { ChevronRightIcon, LockIcon, SparklesIcon } from '@modrinth/assets'
104-
import { Avatar, CopyCode } from '@modrinth/ui'
116+
import { Avatar, CopyCode, ServersSpecs } from '@modrinth/ui'
105117
import type { Project, Server } from '@modrinth/utils'
118+
import dayjs from 'dayjs'
106119
107120
import { useModrinthServers } from '~/composables/servers/modrinth-servers.ts'
108121
@@ -111,7 +124,19 @@ import PanelSpinner from './PanelSpinner.vue'
111124
import ServerIcon from './ServerIcon.vue'
112125
import ServerInfoLabels from './ServerInfoLabels.vue'
113126
114-
const props = defineProps<Partial<Server>>()
127+
type PendingChange = {
128+
planSize: string
129+
cpu: number
130+
cpuBurst: number
131+
ramGb: number
132+
swapGb?: number
133+
storageGb?: number
134+
date: string | number | Date
135+
intervalChange?: string | null
136+
verb: string
137+
}
138+
139+
const props = defineProps<Partial<Server> & { pendingChange?: PendingChange }>()
115140
116141
if (props.server_id && props.status === 'available') {
117142
// Necessary only to get server icon
@@ -138,4 +163,12 @@ if (props.upstream) {
138163
const image = useState<string | undefined>(`server-icon-${props.server_id}`, () => undefined)
139164
const iconUrl = computed(() => projectData.value?.icon_url || undefined)
140165
const isConfiguring = computed(() => props.flows?.intro)
166+
167+
const formatDate = (d: unknown) => {
168+
try {
169+
return dayjs(d as any).format('MMMM D, YYYY')
170+
} catch {
171+
return ''
172+
}
173+
}
141174
</script>

0 commit comments

Comments
 (0)