Skip to content

Commit febf2c3

Browse files
feat(whatsnew): add a GitHub link to the full changes
Below the release notes, the dialog now shows a "View the details on GitHub" link so users can read the full commit content/diffs. It points to the compare view (every commit since the user's last build) when a real range is available, or the current commit when we fell back to recent history. Served as `githubUrl` from /version/whats-new (built from GITHUB_REPO).
1 parent 6e832e0 commit febf2c3

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

apps/api/src/routes/version.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ export const versionRoutes: FastifyPluginAsync = async (app) => {
4040

4141
// Notes for seen..current; if `seen` is unreachable (force-push/rebase), fall back to the
4242
// most recent commits so the user still sees something meaningful.
43-
const log = (await getChangelog(seen, local.sha)) ?? (await getRecentChangelog(20));
43+
const ranged = await getChangelog(seen, local.sha);
44+
const log = ranged ?? (await getRecentChangelog(20));
4445
if (!log) {
4546
await prisma.user.update({ where: { id: req.user!.id }, data: { lastSeenVersion: local.sha } });
4647
return { show: false };
4748
}
48-
return { show: true, version: local.shortSha, entries: log.entries, count: log.count };
49+
// A link to the full detail on GitHub: the compare view (every commit + diff since the user's
50+
// last build) when we have a real range, else the current commit when we fell back.
51+
const repo = app.ctx.env.GITHUB_REPO;
52+
const githubUrl = repo
53+
? ranged
54+
? `https://github.com/${repo}/compare/${seen}...${local.sha}`
55+
: `https://github.com/${repo}/commit/${local.sha}`
56+
: null;
57+
return { show: true, version: local.shortSha, entries: log.entries, count: log.count, githubUrl };
4958
});
5059

5160
// POST /version/whats-new/seen — dismiss the dialog for the current build.

apps/web/src/components/WhatsNew.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
import { useEffect, useState } from 'react';
1313
import { createPortal } from 'react-dom';
14-
import { X } from 'lucide-react';
14+
import { X, ExternalLink } from 'lucide-react';
1515
import { api } from '@/lib/api';
1616
import { useAuth } from '@/lib/auth';
1717
import { useT } from '@/lib/i18n';
@@ -26,6 +26,7 @@ interface WhatsNew {
2626
version?: string;
2727
entries?: ChangelogEntry[];
2828
count?: number;
29+
githubUrl?: string | null;
2930
}
3031

3132
export function WhatsNew() {
@@ -93,7 +94,19 @@ export function WhatsNew() {
9394
{extra > 0 && <li className="border-t border-white/[0.05] py-2.5 text-xs italic text-zinc-500">{t('whatsnew.more', { count: extra })}</li>}
9495
</ul>
9596

96-
<div className="border-t border-white/[0.07] px-6 py-3.5 text-right">
97+
<div className="flex items-center justify-between gap-3 border-t border-white/[0.07] px-6 py-3.5">
98+
{data.githubUrl ? (
99+
<a
100+
href={data.githubUrl}
101+
target="_blank"
102+
rel="noreferrer"
103+
className="inline-flex items-center gap-1.5 text-xs text-violet-300 transition hover:text-violet-200"
104+
>
105+
{t('whatsnew.viewOnGithub')} <ExternalLink size={13} />
106+
</a>
107+
) : (
108+
<span />
109+
)}
97110
<button className="btn-primary" onClick={dismiss}>
98111
{t('whatsnew.gotIt')}
99112
</button>

apps/web/src/lib/i18n.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ const fr: Dict = {
551551
'whatsnew.version': 'Version {version}',
552552
'whatsnew.changes': '{count} changement(s)',
553553
'whatsnew.more': '+{count} autres changements',
554+
'whatsnew.viewOnGithub': 'Voir le détail sur GitHub',
554555
'whatsnew.gotIt': 'J’ai compris',
555556
'whatsnew.dismiss': 'Fermer',
556557
// shared spaces
@@ -1148,6 +1149,7 @@ const en: Dict = {
11481149
'whatsnew.version': 'Version {version}',
11491150
'whatsnew.changes': '{count} change(s)',
11501151
'whatsnew.more': '+{count} more changes',
1152+
'whatsnew.viewOnGithub': 'View the details on GitHub',
11511153
'whatsnew.gotIt': 'Got it',
11521154
'whatsnew.dismiss': 'Close',
11531155
// shared spaces

0 commit comments

Comments
 (0)