From 5dcaa63b95e28d5fea44768e9a20f675e4bedd68 Mon Sep 17 00:00:00 2001
From: "Yeyang (Justin) Sun" <i@jsun.lol>
Date: Wed, 18 Oct 2023 23:10:10 -0500
Subject: [PATCH] feat(game/result): modify share image filename (#49)

---
 app/_game/components/ShareDialog.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/_game/components/ShareDialog.tsx b/app/_game/components/ShareDialog.tsx
index 1fa6ed3..9e7a936 100644
--- a/app/_game/components/ShareDialog.tsx
+++ b/app/_game/components/ShareDialog.tsx
@@ -4,6 +4,9 @@ import { usePostHog } from 'posthog-js/react'
 import { useEffect, useRef, useState } from 'react'
 import { useOnClickOutside } from 'usehooks-ts'
 
+import { useSceneProps } from '~/stores/SceneProps.store'
+
+import { useUser } from '../hooks/useUser'
 import { BorderWithoutCorner } from './BorderWithoutCorner'
 
 function ShareDialogButton({
@@ -57,6 +60,9 @@ export function ShareDialog({
   const dialogRef = useRef<HTMLDivElement>(null)
   useOnClickOutside(dialogRef, onClose)
 
+  const { user } = useUser()
+  const { sceneProps } = useSceneProps()
+
   return (
     <motion.div
       className="fixed"
@@ -97,8 +103,7 @@ export function ShareDialog({
           <a
             ref={downloadImageRef}
             href={shareLink + '/opengraph-image'}
-            // TODO: Change image file name
-            download="isthat.ai_share_image.png"
+            download={`${user?.name} Test #${sceneProps['MENU'].testId} Result.png`}
             className="hidden"
           />
           <ShareDialogButton