diff --git a/apps/app-frontend/src/features/campaigns/pride-fundraiser-banner.vue b/apps/app-frontend/src/features/campaigns/pride-fundraiser-banner.vue index 546ba5d3cd3..fe11fd5a2bb 100644 --- a/apps/app-frontend/src/features/campaigns/pride-fundraiser-banner.vue +++ b/apps/app-frontend/src/features/campaigns/pride-fundraiser-banner.vue @@ -1,6 +1,6 @@ @@ -106,7 +104,7 @@ function daysLeft() { - {{ daysLeft() }} {{ daysLeft() === 1 ? 'day left' : 'days left' }} + {{ remainingDays }} {{ remainingDays === 1 ? 'day left' : 'days left' }} diff --git a/apps/app-frontend/src/pages/project/Index.vue b/apps/app-frontend/src/pages/project/Index.vue index 7f8d0b6a402..53adf307fcc 100644 --- a/apps/app-frontend/src/pages/project/Index.vue +++ b/apps/app-frontend/src/pages/project/Index.vue @@ -1,6 +1,13 @@ + 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 diff --git a/apps/frontend/src/composables/featureFlags.ts b/apps/frontend/src/composables/featureFlags.ts index ee2b35495d1..cbd0f8ce7f7 100644 --- a/apps/frontend/src/composables/featureFlags.ts +++ b/apps/frontend/src/composables/featureFlags.ts @@ -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 diff --git a/apps/frontend/src/pages/[type]/[project].vue b/apps/frontend/src/pages/[type]/[project].vue index 1213bff423f..4f56e6b0eff 100644 --- a/apps/frontend/src/pages/[type]/[project].vue +++ b/apps/frontend/src/pages/[type]/[project].vue @@ -475,6 +475,13 @@ + + @@ -581,7 +595,9 @@ import { defineMessages, formatDependencyProjectFilterOption, formatProjectTypeSentence, + GameAwardsNomineeCard, getActiveDisclosures, + getGameAwardsNominee, IconButton, injectModrinthClient, injectNotificationManager, @@ -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, ) diff --git a/packages/assets/external/thegameawards.svg b/packages/assets/external/thegameawards.svg new file mode 100644 index 00000000000..6eda58298b3 --- /dev/null +++ b/packages/assets/external/thegameawards.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/packages/assets/index.ts b/packages/assets/index.ts index 29b9cc5774c..5cc7bc07122 100644 --- a/packages/assets/index.ts +++ b/packages/assets/index.ts @@ -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' @@ -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' @@ -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' @@ -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 @@ -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' diff --git a/packages/ui/src/components/project/GameAwardsNomineeCard.vue b/packages/ui/src/components/project/GameAwardsNomineeCard.vue new file mode 100644 index 00000000000..03492d4490a --- /dev/null +++ b/packages/ui/src/components/project/GameAwardsNomineeCard.vue @@ -0,0 +1,182 @@ + + + + + + + + {{ eyebrow }} + + + {{ formatMessage(messages.eventName, { year: String(year) }) }} + + + + + + + + + + + + {{ formatMessage(messages.category) }} + + + {{ formatMessage(messages.body, { projectName }) }} + + + + {{ formatMessage(messages.vote) }} + {{ + formatMessage(messages.voteNow) + }} + + + + + {{ formatDeadline(votingDeadline) }} + + {{ formatMessage(messages.daysLeft, { days: daysLeft(votingDeadline) }) }} + + + + + + + + diff --git a/packages/ui/src/components/project/game-awards.ts b/packages/ui/src/components/project/game-awards.ts new file mode 100644 index 00000000000..01ae93ae24a --- /dev/null +++ b/packages/ui/src/components/project/game-awards.ts @@ -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), + link: 'https://thegameawards.com/categories/best-user-creation', + } + } + + return null +} diff --git a/packages/ui/src/components/project/index.ts b/packages/ui/src/components/project/index.ts index cf8067ebb36..b55b5661c45 100644 --- a/packages/ui/src/components/project/index.ts +++ b/packages/ui/src/components/project/index.ts @@ -4,6 +4,8 @@ export * from './settings' // Other export { default as ArchivedProjectBanner } from './ArchivedProjectBanner.vue' export { default as ProjectCard } from './card/ProjectCard.vue' +export { getGameAwardsNominee } from './game-awards' +export { default as GameAwardsNomineeCard } from './GameAwardsNomineeCard.vue' export { default as ProjectBackgroundGradient } from './ProjectBackgroundGradient.vue' export { default as ProjectCardList } from './ProjectCardList.vue' export { default as ProjectCombobox } from './ProjectCombobox.vue' diff --git a/packages/ui/src/composables/how-ago.ts b/packages/ui/src/composables/how-ago.ts index 64f98875fd5..cfb6e6969b3 100644 --- a/packages/ui/src/composables/how-ago.ts +++ b/packages/ui/src/composables/how-ago.ts @@ -4,6 +4,12 @@ import { injectI18n } from '../providers/i18n' import { LOCALES } from './i18n.ts' const formatterCache = new LRUCache({ max: 15 }) +const MS_PER_DAY = 24 * 60 * 60 * 1000 + +export function daysLeft(end: Date | number, now = Date.now()): number { + const endTime = end instanceof Date ? end.getTime() : end + return Math.max(0, Math.ceil((endTime - now) / MS_PER_DAY)) +} export function useRelativeTime(options?: Intl.RelativeTimeFormatOptions) { const { locale } = injectI18n() diff --git a/packages/ui/src/locales/en-US/index.json b/packages/ui/src/locales/en-US/index.json index ec47de88934..d28dcee3421 100644 --- a/packages/ui/src/locales/en-US/index.json +++ b/packages/ui/src/locales/en-US/index.json @@ -4442,6 +4442,33 @@ "project.follower-count-tooltip": { "defaultMessage": "{count, number} {count, plural, one {follower} other {followers}}" }, + "project.game-awards.body": { + "defaultMessage": "{projectName} is one of five nominees. Now it needs your vote!" + }, + "project.game-awards.category.best-user-creation": { + "defaultMessage": "Best User Creation" + }, + "project.game-awards.days-left": { + "defaultMessage": "{days, plural, one {# day left} other {# days left}}" + }, + "project.game-awards.event-name": { + "defaultMessage": "The Game Awards {year}" + }, + "project.game-awards.hide-voting-details": { + "defaultMessage": "Hide voting details" + }, + "project.game-awards.nominee-for": { + "defaultMessage": "Nominee for {category}" + }, + "project.game-awards.official-nominee": { + "defaultMessage": "Official nominee" + }, + "project.game-awards.vote": { + "defaultMessage": "Vote at The Game Awards" + }, + "project.game-awards.vote-now": { + "defaultMessage": "Vote now" + }, "project.license.error": { "defaultMessage": "License text could not be retrieved." },
+ {{ eyebrow }} +
+ {{ formatMessage(messages.eventName, { year: String(year) }) }} +
+ {{ formatMessage(messages.body, { projectName }) }} +