From d4e8d803d455835cfe3f1ff783a13a461d6b44f8 Mon Sep 17 00:00:00 2001 From: mattyatea Date: Sun, 4 Oct 2026 21:50:01 +0000 Subject: [PATCH] enhance(frontend): invite readers to view their Stats --- .../frontend/src/pages/user/activity.weekly-stats.vue | 10 ++++++---- .../frontend/test/unit/weekly-stats-sharing.test.ts | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/pages/user/activity.weekly-stats.vue b/packages/frontend/src/pages/user/activity.weekly-stats.vue index d8e9106a14..d5aa66b8de 100644 --- a/packages/frontend/src/pages/user/activity.weekly-stats.vue +++ b/packages/frontend/src/pages/user/activity.weekly-stats.vue @@ -143,6 +143,8 @@ const weekLabel = computed(() => { }); const statsUrl = `${url}/:my/stats`; +const statsInvitation = 'あなたも、自分のStatsを見てみませんか?'; +const statsLink = `[${statsInvitation}](${statsUrl})`; const metrics = computed(() => { if (stats.value == null) return []; @@ -201,7 +203,7 @@ async function shareStats(): Promise { const file = new File([blob], 'weekly-stats.png', { type: 'image/png' }); const shareDataWithFile: ShareData = { title: 'Weekly Stats', - text: shareText.value, + text: `${shareText.value}\n\n${statsInvitation}`, url: statsUrl, files: [file], }; @@ -213,7 +215,7 @@ async function shareStats(): Promise { const shareData: ShareData = { title: 'Weekly Stats', - text: shareText.value, + text: `${shareText.value}\n\n${statsInvitation}`, url: statsUrl, }; @@ -222,7 +224,7 @@ async function shareStats(): Promise { return; } - copyToClipboard(`${shareText.value}\n\n${statsUrl}`); + copyToClipboard(`${shareText.value}\n\n${statsLink}`); } async function shareWithNote(): Promise { @@ -240,7 +242,7 @@ async function shareWithNote(): Promise { const driveFile = await os.promiseDialog(filePromise); await os.post({ - initialText: `${shareText.value}\n\n${statsUrl}`, + initialText: `${shareText.value}\n\n${statsLink}`, initialFiles: [driveFile], }); } finally { diff --git a/packages/frontend/test/unit/weekly-stats-sharing.test.ts b/packages/frontend/test/unit/weekly-stats-sharing.test.ts index 9d2766af9e..025fc0245c 100644 --- a/packages/frontend/test/unit/weekly-stats-sharing.test.ts +++ b/packages/frontend/test/unit/weekly-stats-sharing.test.ts @@ -40,8 +40,9 @@ test.each(['共有', 'ノートで共有'])('uses the current-account Stats link if (button === '共有') { await waitFor(() => expect(fixture.share).toHaveBeenCalledOnce()); expect(fixture.share.mock.calls[0][0].url).toBe(`${url}/:my/stats`); + expect(fixture.share.mock.calls[0][0].text).toContain('\n\nあなたも、自分のStatsを見てみませんか?'); } else { await waitFor(() => expect(fixture.post).toHaveBeenCalledOnce()); - expect(fixture.post.mock.calls[0][0].initialText).toContain(`${url}/:my/stats`); + expect(fixture.post.mock.calls[0][0].initialText).toContain(`\n\n[あなたも、自分のStatsを見てみませんか?](${url}/:my/stats)`); } });