Skip to content

Commit 6f4e689

Browse files
authored
Bungie Day Update (#282)
* fix raid filtering * leaderboard urls on user page * add bungie day banner * fix pfp aspect ratio * fix missing badges * fix delete report button * allow alt profiles for instance finder
1 parent 7c165b0 commit 6f4e689

17 files changed

Lines changed: 299 additions & 315 deletions

File tree

src/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Viewport } from "next"
22
import dynamic from "next/dynamic"
33
import NextTopLoader from "nextjs-toploader"
44
import { type ReactNode } from "react"
5+
import { BungieFoundationBanner } from "~/components/overlays/BungieFoundationBanner"
56
import { DestinyServiceStatusBanner } from "~/components/overlays/DestinyServiceStatusBanner"
67
import { DonationBanner } from "~/components/overlays/DonationBanner"
78
import { RaidHubStatusBanner } from "~/components/overlays/RaidHubStatusBanner"
@@ -66,7 +67,7 @@ export default async function RootLayout(params: { children: ReactNode }) {
6667
<HeaderContent />
6768
</Header>
6869
<DonationBanner />
69-
{/* <G2GBanner /> */}
70+
<BungieFoundationBanner />
7071
<DestinyServiceStatusBanner />
7172
<RaidHubStatusBanner />
7273
<SearchModal />

src/app/leaderboards/LeaderboardEntries.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const LeaderboardEntries = (props: {
3333
icons?: Record<number, JSX.Element>
3434
}) => {
3535
const params = useSearchParams()
36-
params.get("position")
36+
3737
return (
3838
<Flex
3939
$direction="row"

src/app/leaderboards/LeaderboardEntryComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { OptionalWrapper } from "~/components/OptionalWrapper"
66
import { useLocale } from "~/components/providers/LocaleManager"
77
import { useQueryParams } from "~/hooks/util/useQueryParams"
88
import { cn } from "~/lib/tw"
9-
import { formattedNumber, secondsToHMS, truncatedNumber } from "~/util/presentation/formatting"
9+
import { formattedNumber, secondsToYDHMS, truncatedNumber } from "~/util/presentation/formatting"
1010
import { type LeaderboardEntry } from "./LeaderboardEntries"
1111
import { LeaderboardEntryPlayerComponent } from "./LeaderboardEntryPlayer"
1212

@@ -25,7 +25,7 @@ export const LeaderboardEntryComponent = ({
2525
const { locale } = useLocale()
2626
const value =
2727
valueFormat === "duration"
28-
? secondsToHMS(entry.value, true)
28+
? secondsToYDHMS(entry.value, 3)
2929
: formattedNumber(entry.value, locale, 3)
3030

3131
const lg = useRef<HTMLDivElement>(null)

src/components/CloudflareImage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Image, { type ImageLoader } from "next/image"
22
import { type ComponentPropsWithoutRef } from "react"
33
import { R2RaidSplash } from "~/lib/activity-images"
4-
import { G2GEmblems } from "~/lib/g2g-emblems"
4+
import { VaultEmblems } from "~/lib/bungie-foundation-emblems"
55

66
const cloudflareVariants = [
77
{ name: "tiny", w: 320, h: 180 },
@@ -46,8 +46,16 @@ const CloudflareImages = {
4646
large: "large.png"
4747
}
4848
},
49+
bungieFoundation: {
50+
path: "bungieFoundation/banner",
51+
variants: {
52+
tiny: "tiny.png",
53+
small: "small.png",
54+
medium: "medium.png"
55+
}
56+
},
4957
...R2RaidSplash,
50-
...G2GEmblems
58+
...VaultEmblems
5159
} as const satisfies Record<
5260
string,
5361
{ path: string; variants: Partial<Record<(typeof cloudflareVariants)[number]["name"], string>> }

src/components/__deprecated__/profile/raids/RaidCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useRaidCardContext } from "~/components/profile/raids/RaidCardContext"
88
import { WeeklyProgress } from "~/components/profile/raids/expanded/WeeklyProgress"
99
import { useLocale } from "~/components/providers/LocaleManager"
1010
import { useRaidHubManifest } from "~/components/providers/RaidHubManifestManager"
11-
import { useRaidTags } from "~/hooks/profile/useRaidTags"
11+
import { basicActivityFilter, useRaidTags } from "~/hooks/profile/useRaidTags"
1212
import { useTimeout } from "~/hooks/util/useTimeout"
1313
import { getRaidSplash } from "~/lib/activity-images"
1414
import {
@@ -80,7 +80,7 @@ export default function RaidCard({
8080
}, [activities, isReprisedRaid, isChallengeMode, leaderboardEntry, activityDefinition])
8181

8282
const { fastestFullClear, averageClear, stats } = useMemo(() => {
83-
const freshFulls = activities?.filter(a => a.player.completed && a.fresh)
83+
const freshFulls = activities?.filter(basicActivityFilter).filter(a => a.fresh)
8484
const fastestFullClear = freshFulls?.size
8585
? freshFulls?.reduce<RaidHubInstanceForPlayer>((curr, nxt) =>
8686
nxt.duration < curr.duration ? nxt : curr

src/components/admin/badge/badges-display.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client"
22

3-
import Image from "next/image"
3+
import { CloudflareIcon } from "~/components/CloudflareImage"
44
import { trpc } from "~/lib/trpc"
55

66
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/shad/card"
@@ -38,8 +38,8 @@ export function BadgesDisplay() {
3838
<TableCell>{badge.description}</TableCell>
3939
<TableCell>
4040
<div className="relative h-10 w-10">
41-
<Image
42-
src={badge.icon || "/placeholder.svg"}
41+
<CloudflareIcon
42+
path={badge.icon || "/placeholder.svg"}
4343
alt={badge.name}
4444
fill
4545
className="object-contain"

src/components/admin/reporting/tabs/actions-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export function ActionsTab({
166166
<Button
167167
variant="destructive"
168168
className="mt-4 space-x-1 rounded-sm"
169-
onClick={() => deleteMutation.mutate({ reportId: 1 })}>
169+
onClick={() => deleteMutation.mutate({ reportId: report.reportId })}>
170170
<Trash className="size-4" />
171171
Delete Report
172172
</Button>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
"use client"
3+
4+
import { X } from "lucide-react"
5+
import Link from "next/link"
6+
import { useMemo } from "react"
7+
import { CloudflareImage, type CloudflareImageId } from "~/components/CloudflareImage"
8+
import { useLocalStorage } from "~/hooks/util/useLocalStorage"
9+
10+
const eventName = "Bungie Day 2025"
11+
const localStorageKey = "bungieDay2025BannerDismissDate"
12+
const campaignUrl = "https://tiltify.com/@raidhub/bungie-day-2025"
13+
const donateUrl = "https://donate.tiltify.com/917cb375-cc2a-4377-9ee6-5e75600b9567/incentives"
14+
const banner: CloudflareImageId = "bungieFoundation"
15+
16+
// const allG2GEmblems = o.entries(VaultEmblems)
17+
18+
export const BungieFoundationBanner = () => {
19+
// const [randomIdx, setRandomIdx] = useState(
20+
// () => 1 + Math.floor(Math.random() * (allG2GEmblems.length - 1))
21+
// )
22+
23+
// useInterval(15_000, () => {
24+
// setRandomIdx(old => 1 + ((old + 1) % (allG2GEmblems.length - 1)))
25+
// })
26+
27+
const [g2gBannerDismissDate, setG2gBannerDismissDate] = useLocalStorage<string | null>(
28+
localStorageKey,
29+
null
30+
)
31+
32+
const dismissedBannerDate = useMemo(
33+
() => (g2gBannerDismissDate ? new Date(g2gBannerDismissDate) : new Date(0)),
34+
[g2gBannerDismissDate]
35+
)
36+
37+
const oneWeekAgo = useMemo(() => {
38+
const d = new Date()
39+
d.setDate(d.getDate() - 7)
40+
return d
41+
}, [])
42+
43+
const shouldShowBanner = dismissedBannerDate < oneWeekAgo
44+
45+
if (!shouldShowBanner) return null
46+
47+
return (
48+
<div className="border-border-dark bg-background/30 text-primary relative w-full border px-2 py-2 text-sm font-semibold tracking-wide sm:text-base">
49+
<div className="mx-auto flex max-w-screen-xl flex-wrap items-center gap-8 px-6">
50+
<div className="max-w-150 basis-100">
51+
<a href={campaignUrl} target="_blank">
52+
<CloudflareImage
53+
cloudflareId={banner}
54+
priority
55+
alt={eventName}
56+
height={500}
57+
width={1500}
58+
/>
59+
</a>
60+
<DonateButton />
61+
</div>
62+
63+
<div className="min-w-[320px] flex-2 space-y-4">
64+
<div className="flex flex-wrap gap-8 font-normal max-sm:flex-col max-sm:gap-4">
65+
<p className="min-w-30 flex-1">
66+
This year, as a part of <strong>{eventName}</strong>, RaidHub is raising
67+
money for the{" "}
68+
<Link
69+
href="https://bungiefoundation.org/"
70+
className="underline underline-offset-2">
71+
Bungie Foundation
72+
</Link>
73+
. Click the &quot;donate&quot; button to see the specific Bungie rewards
74+
and incentives available.
75+
</p>
76+
<p className="min-w-30 flex-1">
77+
This year, we are collaborating with other Destiny 2 API developers to
78+
offer the{" "}
79+
<a
80+
className="text-yellow-300"
81+
href="https://donate.tiltify.com/917cb375-cc2a-4377-9ee6-5e75600b9567/incentives?rewardPublicId=a20d75dc-5d22-49cf-b507-a802d66d0d63"
82+
target="_blank">
83+
D2 DEVS MEGAPACK!!!!
84+
</a>
85+
, a bundle of unique perks across all your favorite D2 API tools,
86+
including <span className="text-blue-300">GM Report</span>,{" "}
87+
<span className="text-red-300">Trials Report</span>,{" "}
88+
<span className="text-pink-300">Braytech</span>, and more!
89+
</p>
90+
<p className="min-w-30 flex-1">
91+
As a form of gratitude, all those who choose to donate through
92+
RaidHub&apos;s fundraiser will also be eligible to receive a{" "}
93+
<strong>profile badge</strong> at the end of the event.
94+
</p>
95+
</div>
96+
97+
{/* emblem carousel */}
98+
{/* <div className="flex items-center gap-4">
99+
<div className="relative hidden aspect-[474/96] min-h-8 flex-1 md:block">
100+
<CloudflareImage
101+
cloudflareId="darkHeroNameplate"
102+
fill
103+
alt="Dark Hero Nameplate"
104+
/>
105+
</div>
106+
107+
<DonateButton />
108+
109+
<m.div
110+
key={allG2GEmblems[randomIdx][0]}
111+
className="relative hidden aspect-[474/96] min-h-8 flex-1 md:block"
112+
initial={{ opacity: 0 }}
113+
animate={{
114+
opacity: Array(26).fill(1).concat([0])
115+
}}
116+
transition={{
117+
duration: 15,
118+
repeat: Infinity,
119+
ease: "easeInOut"
120+
}}>
121+
<CloudflareImage
122+
cloudflareId={allG2GEmblems[randomIdx][0]}
123+
fill
124+
alt={allG2GEmblems[randomIdx][0]}
125+
/>
126+
</m.div>
127+
</div> */}
128+
</div>
129+
130+
<X
131+
onClick={() => setG2gBannerDismissDate(new Date().toISOString())}
132+
className="absolute top-0 right-0 size-8 cursor-pointer rounded p-2 text-white hover:bg-white/10"
133+
/>
134+
</div>
135+
</div>
136+
)
137+
}
138+
139+
const DonateButton = () => (
140+
<Link
141+
href={donateUrl}
142+
className="bg-blue-600 px-4 py-2 text-lg font-semibold text-white uppercase transition hover:bg-blue-700">
143+
Donate
144+
</Link>
145+
)

0 commit comments

Comments
 (0)