mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 13:17:45 +00:00
fix: react build errors
This commit is contained in:
parent
93f9f42e0b
commit
f5391d63e6
4 changed files with 16 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ export default function ShareMiiButton({ miiId }: Props) {
|
||||||
const [hasCopiedUrl, setHasCopiedUrl] = useState(false);
|
const [hasCopiedUrl, setHasCopiedUrl] = useState(false);
|
||||||
const [hasCopiedImage, setHasCopiedImage] = 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 () => {
|
const handleCopyUrl = async () => {
|
||||||
await navigator.clipboard.writeText(url);
|
await navigator.clipboard.writeText(url);
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ interface Props {
|
||||||
export default function ProfileInformation({ user, page }: Props) {
|
export default function ProfileInformation({ user, page }: Props) {
|
||||||
const $session = useStore(session);
|
const $session = useStore(session);
|
||||||
|
|
||||||
|
if (!user) return null;
|
||||||
|
|
||||||
const currentUser = user ?? $session?.user;
|
const currentUser = user ?? $session?.user;
|
||||||
const isAdmin = currentUser?.id === Number(import.meta.env.PUBLIC_ADMIN_USER_ID);
|
const isAdmin = currentUser?.id === Number(import.meta.env.VITE_ADMIN_USER_ID);
|
||||||
const isContributor = import.meta.env.PUBLIC_CONTRIBUTORS_USER_IDS?.split(",").includes(user.id);
|
const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(user?.id);
|
||||||
const isOwnProfile = currentUser?.id === user.id;
|
const isOwnProfile = currentUser?.id === user?.id;
|
||||||
|
|
||||||
return (
|
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">
|
<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">
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export default function MiiPage() {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
window.location.href = "/404";
|
window.location.href = "/404";
|
||||||
});
|
});
|
||||||
}, []);
|
}, [id]);
|
||||||
|
|
||||||
if (loading || !mii) {
|
if (loading || !mii) {
|
||||||
return <div className="p-6 text-center">Loading...</div>;
|
return <div className="p-6 text-center">Loading...</div>;
|
||||||
|
|
@ -258,7 +258,9 @@ export default function MiiPage() {
|
||||||
{/* Tags */}
|
{/* Tags */}
|
||||||
<div id="tags" className="flex flex-wrap gap-1 mt-1 *:px-2 *:py-1 *:bg-orange-300 *:rounded-full *:text-xs">
|
<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) => (
|
{mii.tags.map((tag: string) => (
|
||||||
<Link to={`/tags=${tag}`}>{tag}</Link>
|
<Link to={`/tags=${tag}`} key={tag}>
|
||||||
|
{tag}
|
||||||
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -333,8 +335,11 @@ export default function MiiPage() {
|
||||||
|
|
||||||
{images.length > 0 ? (
|
{images.length > 0 ? (
|
||||||
<div className="grid grid-cols-3 gap-2 w-full max-md:grid-cols-2 max-[24rem]:grid-cols-1">
|
<div className="grid grid-cols-3 gap-2 w-full max-md:grid-cols-2 max-[24rem]:grid-cols-1">
|
||||||
{images.map((src) => (
|
{images.map((src, index) => (
|
||||||
<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">
|
<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
|
<img
|
||||||
src={src}
|
src={src}
|
||||||
alt="mii screenshot background blur"
|
alt="mii screenshot background blur"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export default function ProfilePage() {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
window.location.href = "/404";
|
window.location.href = "/404";
|
||||||
});
|
});
|
||||||
}, []);
|
}, [id]);
|
||||||
|
|
||||||
if (loading || !user) {
|
if (loading || !user) {
|
||||||
return <div className="p-6 text-center">Loading...</div>;
|
return <div className="p-6 text-center">Loading...</div>;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue