diff --git a/src/app/mii/[id]/page.tsx b/src/app/mii/[id]/page.tsx index e6346b9..3456f3c 100644 --- a/src/app/mii/[id]/page.tsx +++ b/src/app/mii/[id]/page.tsx @@ -13,6 +13,7 @@ import ImageViewer from "@/components/image-viewer"; import DeleteMiiButton from "@/components/delete-mii"; import ShareMiiButton from "@/components/share-mii-button"; import ScanTutorialButton from "@/components/tutorial/scan"; +import ProfilePicture from "@/components/profile-picture"; interface Props { params: Promise<{ id: string }>; @@ -214,7 +215,77 @@ export default async function MiiPage({ params }: Props) { {/* Description */} {mii.description && (
- {mii.description}
+ {/* Adds fancy formatting when linking to other pages on the site */}
+ {(() => {
+ const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "https://tomodachishare.com";
+
+ // Match both mii and profile links
+ const regex = new RegExp(`(${baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}/(?:mii|profile)/\\d+)`, "g");
+ const parts = mii.description.split(regex);
+
+ return parts.map(async (part, index) => {
+ const miiMatch = part.match(new RegExp(`^${baseUrl}/mii/(\\d+)$`));
+ const profileMatch = part.match(new RegExp(`^${baseUrl}/profile/(\\d+)$`));
+
+ if (miiMatch) {
+ const id = Number(miiMatch[1]);
+ const linkedMii = await prisma.mii.findUnique({
+ where: {
+ id,
+ },
+ });
+
+ if (!linkedMii) return;
+
+ return (
+
+