Skip to content

Commit 95cd4f2

Browse files
committed
feat: add Share button to config cards — opens Twitter compose with pre-filled tweet
1 parent 8e99c83 commit 95cd4f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/routes/dashboard/+page.svelte

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@
376376
setTimeout(() => copiedId = '', 2000);
377377
}
378378
379+
function shareConfig(config: Config) {
380+
const url = `https://${getInstallUrl(config)}`;
381+
const text = `Set up my entire Mac dev environment in 5 minutes instead of 5 hours with OpenBoot`;
382+
const hashtags = 'OpenBoot,macOS,DevTools';
383+
const tweetUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}&hashtags=${encodeURIComponent(hashtags)}`;
384+
window.open(tweetUrl, '_blank', 'width=550,height=420');
385+
}
386+
379387
function formatDate(dateStr?: string): string {
380388
if (!dateStr) return '';
381389
const date = new Date(dateStr + 'Z');
@@ -519,6 +527,7 @@
519527
<div class="config-actions" onclick={(e) => e.stopPropagation()}>
520528
<Button variant="secondary" onclick={() => editConfig(config.slug)}>Edit</Button>
521529
<Button variant="secondary" onclick={() => duplicateConfig(config.slug)}>Duplicate</Button>
530+
<Button variant="secondary" onclick={() => shareConfig(config)}>Share</Button>
522531
<Button variant="danger" onclick={() => deleteConfig(config.slug)}>Delete</Button>
523532
</div>
524533
</div>

0 commit comments

Comments
 (0)