Updated copsandcrims
This commit is contained in:
@@ -8,6 +8,7 @@ import { NonNullStats } from "@/lib/schema/player"
|
||||
import CollapsedStats from "../../_components/CollapsedStats"
|
||||
import CopsAndCrimsGeneralStats from "./stats"
|
||||
import CopsAndCrimsStatTable from "./table"
|
||||
import CopsAndCrimsWeaponStats from "./weapons"
|
||||
|
||||
export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["CopsAndCrims"] }) {
|
||||
if (!stats) return null
|
||||
@@ -55,6 +56,8 @@ export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["Cops
|
||||
<Separator className="my-4" />
|
||||
<CopsAndCrimsStatTable stats={stats} />
|
||||
<Separator className="my-4" />
|
||||
<CopsAndCrimsWeaponStats stats={stats} />
|
||||
<Separator className="my-4" />
|
||||
</AccordionContent>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
62
src/app/(stats)/player/[ign]/_stats/copsandcrims/weapons.tsx
Normal file
62
src/app/(stats)/player/[ign]/_stats/copsandcrims/weapons.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import {
|
||||
getCopsAndCrimsGunName,
|
||||
getCopsAndCrimsGunUgrade,
|
||||
getCopsAndCrimsGunUgradeColor,
|
||||
getCopsAndCrimsUpgardeName
|
||||
} from "@/lib/hypixel/copsandcrims/general"
|
||||
import { romanize } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { GenericProgressNoTooltip } from "../../_components/GenericProgress"
|
||||
|
||||
export default function CopsAndCrimsWeaponStats({ stats }: { stats: NonNullable<NonNullStats["CopsAndCrims"]> }) {
|
||||
return (
|
||||
<div>
|
||||
<h2 className="text-xl font-bold">Weapons</h2>
|
||||
<div className="grid grid-cols-2 grid-rows-6 gap-4 pt-6">
|
||||
<KnifeStats gunId="knife" stats={stats} />
|
||||
<KnifeStats gunId="pistol" stats={stats} />
|
||||
<KnifeStats gunId="handgun" stats={stats} />
|
||||
<KnifeStats gunId="magnum" stats={stats} />
|
||||
<KnifeStats gunId="sniper" stats={stats} />
|
||||
<KnifeStats gunId="bullpup" stats={stats} />
|
||||
<KnifeStats gunId="smg" stats={stats} />
|
||||
<KnifeStats gunId="rifle" stats={stats} />
|
||||
<KnifeStats gunId="carbine" stats={stats} />
|
||||
<KnifeStats gunId="scoped_rifle" stats={stats} />
|
||||
<KnifeStats gunId="shotgun" stats={stats} />
|
||||
<KnifeStats gunId="auto_shotgun" stats={stats} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function KnifeStats({ gunId, stats }: { gunId: Parameters<typeof getCopsAndCrimsGunName>[0], stats: NonNullable<NonNullStats["CopsAndCrims"]> }) {
|
||||
const name = getCopsAndCrimsGunName(gunId)
|
||||
const upgrades = getCopsAndCrimsGunUgrade(gunId, stats)
|
||||
return (
|
||||
<div>
|
||||
<h3 className="pb-1 font-bold text-md">{name}</h3>
|
||||
<div className="flex gap-2">
|
||||
<div className="space-y-2">
|
||||
{upgrades.map((u, i) => {
|
||||
const upgrade = getCopsAndCrimsUpgardeName(u.upgradeId)
|
||||
return <p key={i}>{upgrade}</p>
|
||||
})}
|
||||
</div>
|
||||
<div className="flex-1 space-y-2">
|
||||
{upgrades.map((u, i) => {
|
||||
const color = getCopsAndCrimsGunUgradeColor(u.value)
|
||||
const percent = u.value / 9 * 100
|
||||
return (
|
||||
<div key={i}>
|
||||
{percent !== 0 ?
|
||||
<GenericProgressNoTooltip percent={percent} text={romanize(u.value)} className={`bg-mc-${color}`} /> :
|
||||
<div className="flex flex-1 justify-center rounded-md bg-background">-</div>}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user