fix: react build errors

This commit is contained in:
trafficlunar 2026-04-17 16:41:40 +01:00
parent 93f9f42e0b
commit f5391d63e6
4 changed files with 16 additions and 9 deletions

View file

@ -13,7 +13,7 @@ export default function ShareMiiButton({ miiId }: Props) {
const [hasCopiedUrl, setHasCopiedUrl] = useState(false);
const [hasCopiedImage, setHasCopiedImage] = useState(false);
const url = `${import.meta.env.PUBLIC_BASE_URL}/mii/${miiId}`;
const url = `${import.meta.env.VITE_BASE_URL}/mii/${miiId}`;
const handleCopyUrl = async () => {
await navigator.clipboard.writeText(url);

View file

@ -12,10 +12,12 @@ interface Props {
export default function ProfileInformation({ user, page }: Props) {
const $session = useStore(session);
if (!user) return null;
const currentUser = user ?? $session?.user;
const isAdmin = currentUser?.id === Number(import.meta.env.PUBLIC_ADMIN_USER_ID);
const isContributor = import.meta.env.PUBLIC_CONTRIBUTORS_USER_IDS?.split(",").includes(user.id);
const isOwnProfile = currentUser?.id === user.id;
const isAdmin = currentUser?.id === Number(import.meta.env.VITE_ADMIN_USER_ID);
const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(user?.id);
const isOwnProfile = currentUser?.id === user?.id;
return (
<div className="bg-amber-50 border-2 border-amber-500 rounded-2xl shadow-lg p-4 flex gap-4 mb-2 max-md:flex-col">

View file

@ -33,7 +33,7 @@ export default function MiiPage() {
setLoading(false);
window.location.href = "/404";
});
}, []);
}, [id]);
if (loading || !mii) {
return <div className="p-6 text-center">Loading...</div>;
@ -258,7 +258,9 @@ export default function MiiPage() {
{/* Tags */}
<div id="tags" className="flex flex-wrap gap-1 mt-1 *:px-2 *:py-1 *:bg-orange-300 *:rounded-full *:text-xs">
{mii.tags.map((tag: string) => (
<Link to={`/tags=${tag}`}>{tag}</Link>
<Link to={`/tags=${tag}`} key={tag}>
{tag}
</Link>
))}
</div>
@ -333,8 +335,11 @@ export default function MiiPage() {
{images.length > 0 ? (
<div className="grid grid-cols-3 gap-2 w-full max-md:grid-cols-2 max-[24rem]:grid-cols-1">
{images.map((src) => (
<div className="relative aspect-3/2 rounded-xl bg-black/65 border-2 border-amber-400 shadow-md overflow-hidden transition hover:shadow-lg shadow-black/30">
{images.map((src, index) => (
<div
key={index}
className="relative aspect-3/2 rounded-xl bg-black/65 border-2 border-amber-400 shadow-md overflow-hidden transition hover:shadow-lg shadow-black/30"
>
<img
src={src}
alt="mii screenshot background blur"

View file

@ -22,7 +22,7 @@ export default function ProfilePage() {
setLoading(false);
window.location.href = "/404";
});
}, []);
}, [id]);
if (loading || !user) {
return <div className="p-6 text-center">Loading...</div>;