From 9603f422cac3bea7044c2dfe969c215ec9897dfa Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Wed, 24 Apr 2024 22:17:07 -0700
Subject: fix(badges): awc badge tooltip

---
 src/lib/User/BadgeWall/FallbackBadge.svelte | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'src/lib/User/BadgeWall/FallbackBadge.svelte')

diff --git a/src/lib/User/BadgeWall/FallbackBadge.svelte b/src/lib/User/BadgeWall/FallbackBadge.svelte
index 3e45afc7..829cb71b 100644
--- a/src/lib/User/BadgeWall/FallbackBadge.svelte
+++ b/src/lib/User/BadgeWall/FallbackBadge.svelte
@@ -17,6 +17,8 @@
 	export let badge: Badge;
 	export let style = '';
 	export let selectedBadge: Badge | null = null;
+	export let awc = false;
+	export let index: number | null = null;
 
 	let replaceCount = 0;
 	let badgeReference: HTMLImageElement;
@@ -56,29 +58,33 @@
 	const handleMouseLeave = () => {
 		$mouse = { x: 0, y: 0 };
 	};
+
+	const badgeToAny = (badge: Badge) => badge as any;
 </script>
 
 {#if replaceCount < maxReplaceCount}
 	<Tooltip
-		content={`${dev ? `${badge.id}\n` : ''}${
+		content={`${dev && !awc ? `${badge.id}\n` : ''}${
 			badge.time ? $locale().dateFormatter(databaseTimeToDate(badge.time)) : ''
-		}${badge.description ? `\n${badge.description}` : ''}${
+		}${badge.description ? `${awc ? '' : '\n'}${badge.description}` : ''}${
 			badge.designer ? `\nDesigner: ${badge.designer}` : ''
 		}${badge.source ? `\nSource: ${badge.source}` : ''}`}
-		pin={`badge-${badge.id}`}
+		pin={`badge-${awc ? index : badge.id}`}
 		pinPosition="top"
 		relative
 	>
 		<a
-			href={'#'}
+			href={awc ? badgeToAny(badge).link : '#'}
 			target="_blank"
 			class="badge-container badge"
 			on:mousemove={handleMouseMove}
 			on:mouseleave={handleMouseLeave}
 			on:click={(e) => {
-				e.preventDefault();
+				if (!awc) {
+					e.preventDefault();
 
-				selectedBadge = badge;
+					selectedBadge = badge;
+				}
 			}}
 		>
 			<img
-- 
cgit v1.2.3

