Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/frontend/src/pages/user/activity.weekly-stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Expand Down Expand Up @@ -201,7 +203,7 @@ async function shareStats(): Promise<void> {
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],
};
Expand All @@ -213,7 +215,7 @@ async function shareStats(): Promise<void> {

const shareData: ShareData = {
title: 'Weekly Stats',
text: shareText.value,
text: `${shareText.value}\n\n${statsInvitation}`,
url: statsUrl,
};

Expand All @@ -222,7 +224,7 @@ async function shareStats(): Promise<void> {
return;
}

copyToClipboard(`${shareText.value}\n\n${statsUrl}`);
copyToClipboard(`${shareText.value}\n\n${statsLink}`);
}

async function shareWithNote(): Promise<void> {
Expand All @@ -240,7 +242,7 @@ async function shareWithNote(): Promise<void> {
const driveFile = await os.promiseDialog(filePromise);

await os.post({
initialText: `${shareText.value}\n\n${statsUrl}`,
initialText: `${shareText.value}\n\n${statsLink}`,
initialFiles: [driveFile],
});
} finally {
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/test/unit/weekly-stats-sharing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)`);
}
});
Loading