Updated displayname and added keymap
This commit is contained in:
@@ -89,6 +89,7 @@ async function SuspendedPage({ ign: pign }: { ign: string }) {
|
|||||||
specialRank={player.rank}
|
specialRank={player.rank}
|
||||||
lastLogin={player.lastLogin}
|
lastLogin={player.lastLogin}
|
||||||
lastLogout={player.lastLogout}
|
lastLogout={player.lastLogout}
|
||||||
|
prefix={player.prefix}
|
||||||
/>
|
/>
|
||||||
<h1>
|
<h1>
|
||||||
{player.uuid}
|
{player.uuid}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ type MonthlyPackageRank = Player["player"]["monthlyPackageRank"]
|
|||||||
type RankColor = Player["player"]["monthlyRankColor"]
|
type RankColor = Player["player"]["monthlyRankColor"]
|
||||||
|
|
||||||
export default function DisplayName(
|
export default function DisplayName(
|
||||||
{ ign, rank, monthly, rankColor, plusColor, guildTag, tagColor, specialRank, lastLogin, lastLogout }: {
|
{ ign, rank, monthly, rankColor, plusColor, guildTag, tagColor, specialRank, lastLogin, lastLogout, prefix }: {
|
||||||
ign: string
|
ign: string
|
||||||
rank: NewPackageRank
|
rank: NewPackageRank
|
||||||
monthly: MonthlyPackageRank
|
monthly: MonthlyPackageRank
|
||||||
@@ -20,6 +20,7 @@ export default function DisplayName(
|
|||||||
specialRank: string | undefined
|
specialRank: string | undefined
|
||||||
lastLogin: number | undefined
|
lastLogin: number | undefined
|
||||||
lastLogout: number | undefined
|
lastLogout: number | undefined
|
||||||
|
prefix: string | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
@@ -35,8 +36,9 @@ export default function DisplayName(
|
|||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
<h1 className="text-3xl font-bold text-stroke text-stroke-foreground dark:text-stroke-transparent">
|
<h1 className="text-3xl font-bold text-stroke text-stroke-foreground dark:text-stroke-transparent">
|
||||||
<PlayerRank rank={rank} monthly={monthly} plusColor={plusColor} rankColor={rankColor} specialRank={specialRank} />{" "}
|
<PlayerRank rank={rank} monthly={monthly} plusColor={plusColor} rankColor={rankColor} specialRank={specialRank} prefix={prefix} />
|
||||||
<PlayerIGN ign={ign} rank={rank} monthly={monthly} rankColor={rankColor} specialRank={specialRank} />{" "}
|
{" "}
|
||||||
|
<PlayerIGN ign={ign} rank={rank} monthly={monthly} rankColor={rankColor} specialRank={specialRank} prefix={prefix} />{" "}
|
||||||
<GuildTag tag={guildTag} tagColor={tagColor} ign={ign} />
|
<GuildTag tag={guildTag} tagColor={tagColor} ign={ign} />
|
||||||
</h1>
|
</h1>
|
||||||
<OnlineStatus lastLogin={lastLogin} lastLogout={lastLogout} />
|
<OnlineStatus lastLogin={lastLogin} lastLogout={lastLogout} />
|
||||||
@@ -45,14 +47,19 @@ export default function DisplayName(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PlayerIGN(
|
function PlayerIGN(
|
||||||
{ ign, rank, monthly, rankColor, specialRank }: {
|
{ ign, rank, monthly, rankColor, specialRank, prefix }: {
|
||||||
ign: string
|
ign: string
|
||||||
rank: NewPackageRank
|
rank: NewPackageRank
|
||||||
monthly: MonthlyPackageRank
|
monthly: MonthlyPackageRank
|
||||||
rankColor: RankColor
|
rankColor: RankColor
|
||||||
specialRank: string | undefined
|
specialRank: string | undefined
|
||||||
|
prefix: string | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
if (prefix === "[PIG+++]") {
|
||||||
|
return <span className="text-mc-light-purple">{ign}</span>
|
||||||
|
}
|
||||||
|
|
||||||
if (specialRank) {
|
if (specialRank) {
|
||||||
if (specialRank === "YOUTUBER") {
|
if (specialRank === "YOUTUBER") {
|
||||||
return <span className="text-mc-red">{ign}</span>
|
return <span className="text-mc-red">{ign}</span>
|
||||||
@@ -86,14 +93,25 @@ function PlayerIGN(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PlayerRank(
|
function PlayerRank(
|
||||||
{ rank, monthly, plusColor, rankColor, specialRank }: {
|
{ rank, monthly, plusColor, rankColor, specialRank, prefix }: {
|
||||||
rank: NewPackageRank
|
rank: NewPackageRank
|
||||||
monthly: MonthlyPackageRank
|
monthly: MonthlyPackageRank
|
||||||
plusColor?: string
|
plusColor?: string
|
||||||
rankColor: RankColor
|
rankColor: RankColor
|
||||||
specialRank: string | undefined
|
specialRank: string | undefined
|
||||||
|
prefix: string | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
if (prefix === "[PIG+++]") {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<span className="text-mc-light-purple">[PIG</span>
|
||||||
|
<span className="text-mc-aqua">+++</span>
|
||||||
|
<span className="text-mc-light-purple">]</span>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (specialRank) {
|
if (specialRank) {
|
||||||
if (specialRank === "YOUTUBER") {
|
if (specialRank === "YOUTUBER") {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,13 +4,31 @@ import { Input } from "@/components/ui/input"
|
|||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
import { Search } from "lucide-react"
|
import { Search } from "lucide-react"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { useState } from "react"
|
import { useEffect, useRef, useState } from "react"
|
||||||
import { Button } from "./ui/button"
|
import { Button } from "./ui/button"
|
||||||
|
|
||||||
export function SearchBar({ navbar }: { navbar?: boolean }) {
|
export function SearchBar({ navbar }: { navbar?: boolean }) {
|
||||||
const [input, setInput] = useState("")
|
const [input, setInput] = useState("")
|
||||||
|
const ref = useRef<HTMLInputElement>(null)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const controller = new AbortController()
|
||||||
|
|
||||||
|
window.addEventListener("keydown", (ev) => {
|
||||||
|
if (!ref.current) return
|
||||||
|
|
||||||
|
if (ev.ctrlKey && ev.key === "k") {
|
||||||
|
ev.preventDefault()
|
||||||
|
ref.current.focus()
|
||||||
|
}
|
||||||
|
}, { signal: controller.signal })
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
controller.abort()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
async function handleSearch(e: React.FormEvent) {
|
async function handleSearch(e: React.FormEvent) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
@@ -30,6 +48,7 @@ export function SearchBar({ navbar }: { navbar?: boolean }) {
|
|||||||
type="text"
|
type="text"
|
||||||
placeholder={!navbar ? "Search for a player..." : ""}
|
placeholder={!navbar ? "Search for a player..." : ""}
|
||||||
className="px-5"
|
className="px-5"
|
||||||
|
ref={ref}
|
||||||
value={input}
|
value={input}
|
||||||
onChange={(e) => setInput(e.target.value)}
|
onChange={(e) => setInput(e.target.value)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ export const playerSchema = z.looseObject({
|
|||||||
}).optional()
|
}).optional()
|
||||||
}).optional(),
|
}).optional(),
|
||||||
rank: z.string().optional(),
|
rank: z.string().optional(),
|
||||||
eulaCoins: z.boolean().optional()
|
eulaCoins: z.boolean().optional(),
|
||||||
|
prefix: z.string().transform(v => v.replaceAll(/§[a-z]/g, "")).optional()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user