Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { CalendarIcon, UsersIcon, XIcon } from '@modrinth/assets'
import { injectModrinthClient, ProgressBar } from '@modrinth/ui'
import { daysLeft, injectModrinthClient, ProgressBar } from '@modrinth/ui'
import { useQuery } from '@tanstack/vue-query'
import { openUrl } from '@tauri-apps/plugin-opener'
import { computed, ref } from 'vue'
Expand Down Expand Up @@ -47,9 +47,7 @@ function formatUsd(amount: string | number) {
})
}
function daysLeft() {
return Math.max(0, Math.ceil((PRIDE_FUNDRAISER_END_DATE - Date.now()) / (24 * 60 * 60 * 1000)))
}
const remainingDays = computed(() => daysLeft(PRIDE_FUNDRAISER_END_DATE))
</script>

<template>
Expand Down Expand Up @@ -106,7 +104,7 @@ function daysLeft() {
</span>
<span class="flex items-center gap-1">
<CalendarIcon aria-hidden="true" class="size-4 shrink-0" />
{{ daysLeft() }} {{ daysLeft() === 1 ? 'day left' : 'days left' }}
{{ remainingDays }} {{ remainingDays === 1 ? 'day left' : 'days left' }}
</span>
</div>
</div>
Expand Down
20 changes: 20 additions & 0 deletions apps/app-frontend/src/pages/project/Index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<div v-if="data">
<Teleport to="#sidebar-teleport-target">
<GameAwardsNomineeCard
v-if="gameAwardsNominee"
v-bind="gameAwardsNominee"
:dismissed="gameAwardsDismissed"
class="!mb-0 border-x-0 border-t-0 !rounded-none pr-6"
@dismiss="dismissGameAwardsVotingDetails"
/>
<ProjectSidebarCompatibility
v-if="!isServerProject"
:project="data"
Expand Down Expand Up @@ -264,6 +271,8 @@ import {
ContextMenu,
CreationFlowModal,
defineMessages,
GameAwardsNomineeCard,
getGameAwardsNominee,
getTargetInstallPreferences,
IconButton,
injectNotificationManager,
Expand Down Expand Up @@ -384,6 +393,17 @@ const { installingServerProjects, playServerProject, showAddServerToInstanceModa
const installing = ref(false)
const data = shallowRef(null)
const GAME_AWARDS_VOTING_DETAILS_DISMISSED_KEY = 'game-awards-voting-details-dismissed'
const gameAwardsDismissed = ref(
localStorage.getItem(GAME_AWARDS_VOTING_DETAILS_DISMISSED_KEY) === 'true',
)
const gameAwardsNominee = computed(() => getGameAwardsNominee(data.value))
function dismissGameAwardsVotingDetails() {
gameAwardsDismissed.value = true
localStorage.setItem(GAME_AWARDS_VOTING_DETAILS_DISMISSED_KEY, 'true')
}
function getProjectBreadcrumbSummary(projectId) {
const identifier = Array.isArray(projectId) ? projectId[0] : projectId
if (typeof identifier !== 'string' || !identifier) return undefined
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/composables/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const DEFAULT_FEATURE_FLAGS = validateValues({
alwaysShowVersionDevInfo: false,
advancedFiltersCollapsed: true,
dismissedPhotosensitivityFilterWarning: false,
hideGameAwardsVotingDetails: false,
} as const)

export type FeatureFlag = keyof typeof DEFAULT_FEATURE_FLAGS
Expand Down
24 changes: 24 additions & 0 deletions apps/frontend/src/pages/[type]/[project].vue
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@
</div>

<div class="normal-page__sidebar">
<GameAwardsNomineeCard
v-if="gameAwardsNominee"
v-bind="gameAwardsNominee"
:dismissed="flags.hideGameAwardsVotingDetails"
:class="isProjectDescriptionPage ? 'max-lg:hidden' : undefined"
@dismiss="dismissGameAwardsVotingDetails"
/>
<ProjectSidebarServerInfo
v-if="isServerProject"
:loading="!serverDataLoaded"
Expand Down Expand Up @@ -538,6 +545,13 @@

<div class="normal-page__content">
<NavTabs :links="navLinks" replace page-nav />
<GameAwardsNomineeCard
v-if="gameAwardsNominee && isProjectDescriptionPage"
v-bind="gameAwardsNominee"
:dismissed="flags.hideGameAwardsVotingDetails"
class="lg:hidden"
@dismiss="dismissGameAwardsVotingDetails"
/>
<NuxtPage @on-download="triggerDownloadAnimation" @delete-version="deleteVersion" />
</div>
</div>
Expand Down Expand Up @@ -581,7 +595,9 @@ import {
defineMessages,
formatDependencyProjectFilterOption,
formatProjectTypeSentence,
GameAwardsNomineeCard,
getActiveDisclosures,
getGameAwardsNominee,
IconButton,
injectModrinthClient,
injectNotificationManager,
Expand Down Expand Up @@ -1028,6 +1044,14 @@ const project = computed(() => {
}
})

const gameAwardsNominee = computed(() => getGameAwardsNominee(project.value))
const isProjectDescriptionPage = computed(() => route.name === 'type-project')

function dismissGameAwardsVotingDetails() {
flags.value.hideGameAwardsVotingDetails = true
saveFeatureFlags()
}

const routeProjectType = computed(() =>
Array.isArray(route.params.type) ? route.params.type[0] : route.params.type,
)
Expand Down
12 changes: 12 additions & 0 deletions packages/assets/external/thegameawards.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions packages/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import _FlathubIcon from './external/flathub.svg?component'
import _GithubIcon from './external/github.svg?component'
import _IntercomBubbleIcon from './external/illustrations/intercom_bubble_icon.png?url'
import _MinecraftServerIcon from './external/illustrations/minecraft_server_icon.png?url'
import _ServerInviteFriendsIllustration from './illustrations/server-invite-friends.png?url'
import _InstagramIcon from './external/instagram.svg?component'
import _KoFiIcon from './external/kofi.svg?component'
import _LinuxIcon from './external/linux.svg?component'
import _MastodonIcon from './external/mastodon.svg?component'
import _OpenCollectiveIcon from './external/opencollective.svg?component'
import _PatreonIcon from './external/patreon.svg?component'
Expand All @@ -55,6 +55,7 @@ import _PolygonIcon from './external/polygon.svg?component'
import _RedditIcon from './external/reddit.svg?component'
import _ReelsIcon from './external/reels.svg?component'
import _SnapchatIcon from './external/snapchat.svg?component'
import _TheGameAwardsIcon from './external/thegameawards.svg?component'
import _ThreadsIcon from './external/threads.svg?component'
import _TikTokIcon from './external/tiktok.svg?component'
import _TumblrIcon from './external/tumblr.svg?component'
Expand All @@ -66,7 +67,6 @@ import _WindowsIcon from './external/windows.svg?component'
import _YouTubeIcon from './external/youtube.svg?component'
import _YouTubeGaming from './external/youtubegaming.svg?component'
import _YouTubeShortsIcon from './external/youtubeshorts.svg?component'
import _LinuxIcon from './external/linux.svg?component'
// Tag icon helpers - import maps from generated-icons
import type { IconComponent } from './generated-icons'
import { categoryIconMap, loaderIconMap } from './generated-icons'
Expand All @@ -83,7 +83,7 @@ import _NoItemsCartIllustration from './illustrations/no-items-cart.svg?componen
import _NoMessagesIllustration from './illustrations/no-messages.svg?component'
import _NoSearchResultIllustration from './illustrations/no-search-result.svg?component'
import _NoTasksIllustration from './illustrations/no-tasks.svg?component'

import _ServerInviteFriendsIllustration from './illustrations/server-invite-friends.png?url'
export const ModrinthIcon = _ModrinthIcon
export const BrowserWindowSuccessIllustration = _BrowserWindowSuccessIllustration
export const InviteBackgroundIllustration = _InviteBackgroundIllustration
Expand Down Expand Up @@ -141,7 +141,7 @@ export const IntercomBubbleIcon = _IntercomBubbleIcon
export const MinecraftServerIcon = _MinecraftServerIcon
export const ServerInviteFriendsIllustration = _ServerInviteFriendsIllustration
export const LinuxIcon = _LinuxIcon

export const TheGameAwardsIcon = _TheGameAwardsIcon
export * from './generated-icons'
export { default as ClassicPlayerModel } from './models/classic-player.gltf?url'
export { default as SlimPlayerModel } from './models/slim-player.gltf?url'
Expand Down
182 changes: 182 additions & 0 deletions packages/ui/src/components/project/GameAwardsNomineeCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<template>
<component
:is="compact ? 'a' : 'section'"
class="game-awards-nominee-card mb-3 flex flex-col gap-2.5 rounded-[var(--radius-lg)] border border-solid p-4 !border-[color:var(--tga-divider)] bg-[image:var(--tga-background)] text-[--tga-meta]"
Comment thread
Prospector marked this conversation as resolved.
Resolved
:class="
compact
? 'cursor-pointer no-underline transition-[filter] hover:brightness-110 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--tga-accent)]'
: undefined
"
:aria-labelledby="compact ? undefined : titleId"
v-bind="compact ? { href: link, target: '_blank', rel: 'noopener noreferrer' } : {}"
>
<div class="flex gap-2" :class="compact ? 'items-center' : 'items-start'">
<div class="flex min-w-0 flex-1 items-center gap-2">
<TheGameAwardsIcon class="size-8 shrink-0 text-[--tga-accent]" aria-hidden="true" />
<div>
<p class="m-0 text-sm text-[--tga-accent] font-normal">
{{ eyebrow }}
</p>
<p class="m-0 text-sm font-medium text-[--tga-heading]">
{{ formatMessage(messages.eventName, { year: String(year) }) }}
</p>
</div>
</div>
<IconButton
v-if="!compact"
v-tooltip="formatMessage(messages.dismiss)"
type="quiet"
class="!size-6 shrink-0 !text-[--tga-meta]"
:label="formatMessage(messages.dismiss)"
@click="emit('dismiss')"
>
<XIcon aria-hidden="true" />
</IconButton>
</div>
<template v-if="!compact">
<hr class="w-full border-0 border-t border-solid border-t-[--tga-divider]" />
<div class="flex flex-col gap-1.5">
<h2 :id="titleId" class="m-0 text-lg font-semibold leading-none text-[--tga-heading]">
{{ formatMessage(messages.category) }}
</h2>
<p class="m-0 text-sm leading-tight">
{{ formatMessage(messages.body, { projectName }) }}
</p>
</div>
<ButtonLink
type="colored"
class="w-full !text-[--tga-button-text] ![--button-color:var(--tga-accent)]"
:href="link"
target="_blank"
>
<span class="game-awards-nominee-card__vote">{{ formatMessage(messages.vote) }}</span>
<span class="game-awards-nominee-card__vote-short">{{
formatMessage(messages.voteNow)
}}</span>
<ExternalIcon aria-hidden="true" />
</ButtonLink>
<div class="flex items-center gap-1.5 text-sm">
<CalendarIcon class="mb-[2px] size-4 shrink-0" aria-hidden="true" />
<span>{{ formatDeadline(votingDeadline) }}</span>
<span class="size-1.5 shrink-0 rounded-full bg-[--tga-divider]" aria-hidden="true" />
<span>{{ formatMessage(messages.daysLeft, { days: daysLeft(votingDeadline) }) }}</span>
</div>
</template>
</component>
</template>

<script setup lang="ts">
import { CalendarIcon, ExternalIcon, TheGameAwardsIcon, XIcon } from '@modrinth/assets'
import { computed, useId } from 'vue'

import ButtonLink from '#ui/components/base/buttons/ButtonLink.vue'
import IconButton from '#ui/components/base/buttons/IconButton.vue'
import { useFormatDateTime } from '#ui/composables/format-date-time'
import { daysLeft } from '#ui/composables/how-ago'
import { defineMessages, useVIntl } from '#ui/composables/i18n'

const props = defineProps<{
projectName: string
year: number
votingDeadline: Date
link: string
dismissed?: boolean
}>()
Comment thread
Prospector marked this conversation as resolved.
Resolved

const emit = defineEmits<{
dismiss: []
}>()

const { formatMessage } = useVIntl()
const formatDeadline = useFormatDateTime({ month: 'short', day: 'numeric' })
const titleId = useId()

const messages = defineMessages({
officialNominee: {
id: 'project.game-awards.official-nominee',
defaultMessage: 'Official nominee',
},
eventName: {
id: 'project.game-awards.event-name',
defaultMessage: 'The Game Awards {year}',
},
category: {
id: 'project.game-awards.category.best-user-creation',
defaultMessage: 'Best User Creation',
},
nomineeFor: {
id: 'project.game-awards.nominee-for',
defaultMessage: 'Nominee for {category}',
},
body: {
id: 'project.game-awards.body',
defaultMessage: '{projectName} is one of five nominees. Now it needs your vote!',
},
vote: {
id: 'project.game-awards.vote',
defaultMessage: 'Vote at The Game Awards',
},
voteNow: {
id: 'project.game-awards.vote-now',
defaultMessage: 'Vote now',
},
daysLeft: {
id: 'project.game-awards.days-left',
defaultMessage: '{days, plural, one {# day left} other {# days left}}',
},
dismiss: {
id: 'project.game-awards.hide-voting-details',
defaultMessage: 'Hide voting details',
},
})

const compact = computed(
() => props.dismissed === true || props.votingDeadline.getTime() <= Date.now(),
)
Comment thread
Prospector marked this conversation as resolved.
Resolved

const eyebrow = computed(() => {
if (compact.value) {
return formatMessage(messages.nomineeFor, {
category: formatMessage(messages.category),
})
}

return formatMessage(messages.officialNominee)
})
</script>

<style>
.game-awards-nominee-card {
--tga-accent: #20a4b7;
--tga-heading: var(--color-contrast);
--tga-meta: var(--color-secondary);
--tga-button-text: #ffffff;
--tga-divider: #d5eef3;
--tga-background: linear-gradient(to bottom right, #ffffff 0%, #e8fbff 100%);
}

.game-awards-nominee-card__vote-short {
display: none;
}

@media (max-width: 349px) {
.game-awards-nominee-card__vote {
display: none;
}

.game-awards-nominee-card__vote-short {
display: inline;
}
}

html.dark-mode .game-awards-nominee-card,
html.oled-mode .game-awards-nominee-card,
html.retro-mode .game-awards-nominee-card {
--tga-accent: #ff9f59;
--tga-heading: #daede5;
--tga-meta: #afc6c2;
--tga-button-text: #1a1009;
--tga-divider: #0c4656;
--tga-background: linear-gradient(to bottom right, #022e3b 0%, #021418 100%);
}
</style>
23 changes: 23 additions & 0 deletions packages/ui/src/components/project/game-awards.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export interface GameAwardsNominee {
projectName: string
year: number
votingDeadline: Date
link: string
}

const CREATE_AERONAUTICS_PROJECT_ID = 'oWaK0Q19'

export function getGameAwardsNominee(
project: { id?: string | null; title?: string | null } | null | undefined,
): GameAwardsNominee | null {
if (project?.id === CREATE_AERONAUTICS_PROJECT_ID && project.title) {
return {
projectName: project.title,
year: 2026,
votingDeadline: new Date(2026, 11, 10),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Deadline changes by time zone

new Date(2026, 11, 10) sets the deadline to each viewer’s local midnight rather than one shared instant. Visitors in different time zones lose the voting details at different times. If the server and browser use different time zones, their countdowns can also differ. Use an explicit timestamp with the event’s time zone.

Knowledge Base Used: Web marketplace application

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/components/project/game-awards.ts
Line: 17

Comment:
**Deadline changes by time zone**

`new Date(2026, 11, 10)` sets the deadline to each viewer’s local midnight rather than one shared instant. Visitors in different time zones lose the voting details at different times. If the server and browser use different time zones, their countdowns can also differ. Use an explicit timestamp with the event’s time zone.

**Knowledge Base Used:** [Web marketplace application](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Fweb-marketplace.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

link: 'https://thegameawards.com/categories/best-user-creation',
}
}

return null
}
Loading
Loading