mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
d471b418b9
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).
Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces dorknet-clientpatch-{key}.zip
for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
dorknet-server-march_2020_03_10-win-x64.zip and
dorknet-clientpatch-march_2020_03_10.zip as Release assets.
Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { useState } from 'react';
|
|
import { profileImageUrl } from '../lib/types';
|
|
|
|
// Round avatar tile that falls back to the player's display-name
|
|
// initial if there's no ProfileImageName or the request 404s. The
|
|
// img.* CDN signs every response, so we don't have to do anything
|
|
// special on this side — just point at the URL and let the browser
|
|
// render or fail to render. Size in pixels controls both the rendered
|
|
// box and the `?width=N` hint we send so the CDN can resize.
|
|
export function PlayerAvatar({
|
|
name,
|
|
displayName,
|
|
size = 28,
|
|
className = '',
|
|
}: {
|
|
name?: string | null;
|
|
displayName?: string | null;
|
|
size?: number;
|
|
className?: string;
|
|
}) {
|
|
const [errored, setErrored] = useState(false);
|
|
const url = errored ? null : profileImageUrl(name, Math.max(size * 2, 64));
|
|
const initial = (displayName ?? '?').charAt(0).toUpperCase();
|
|
const dim = { width: size, height: size };
|
|
|
|
if (!url) {
|
|
return (
|
|
<div
|
|
style={dim}
|
|
className={`shrink-0 rounded-full bg-gradient-to-br from-ink-700 to-ink-800 flex items-center justify-center font-semibold text-ink-200 ${className}`}
|
|
>
|
|
<span style={{ fontSize: size * 0.42 }}>{initial}</span>
|
|
</div>
|
|
);
|
|
}
|
|
return (
|
|
<img
|
|
src={url}
|
|
style={dim}
|
|
onError={() => setErrored(true)}
|
|
alt={displayName ? `${displayName}'s avatar` : 'player avatar'}
|
|
className={`shrink-0 rounded-full bg-ink-800 object-cover ${className}`}
|
|
loading="lazy"
|
|
/>
|
|
);
|
|
}
|