From 42e8da47f7542034e324e0458c728a91c15ee12b Mon Sep 17 00:00:00 2001 From: Misode Date: Wed, 7 Jun 2023 19:44:38 +0200 Subject: [PATCH] Special support for obsolete tags --- src/app/components/Badge.tsx | 10 ++++++++-- src/app/components/Octicon.tsx | 1 + src/app/components/versions/VersionDetail.tsx | 2 +- src/locales/en.json | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/components/Badge.tsx b/src/app/components/Badge.tsx index c70b1db4..979ce720 100644 --- a/src/app/components/Badge.tsx +++ b/src/app/components/Badge.tsx @@ -1,4 +1,5 @@ import { hashString } from '../Utils.js' +import { useLocale } from '../contexts/Locale.jsx' import { Octicon } from './index.js' interface Props { @@ -7,9 +8,14 @@ interface Props { onClick?: (e: MouseEvent) => unknown, } export function Badge({ label, active, onClick }: Props) { - const color = label === 'breaking' ? 5 : hashString(label) % 360 - return
+ const { locale } = useLocale() + const color = { + breaking: 5, + obsolete: 340, + }[label] ?? (hashString(label) % 360) + return
{label === 'breaking' && Octicon.alert} + {label === 'obsolete' && Octicon.circle_slash} {label}
} diff --git a/src/app/components/Octicon.tsx b/src/app/components/Octicon.tsx index a997264b..1e0ef8bf 100644 --- a/src/app/components/Octicon.tsx +++ b/src/app/components/Octicon.tsx @@ -9,6 +9,7 @@ export const Octicon = { chevron_left: , chevron_right: , chevron_up: , + circle_slash: , clippy: , code: , codescan_checkmark: , diff --git a/src/app/components/versions/VersionDetail.tsx b/src/app/components/versions/VersionDetail.tsx index 38ef42ed..662a18c9 100644 --- a/src/app/components/versions/VersionDetail.tsx +++ b/src/app/components/versions/VersionDetail.tsx @@ -28,7 +28,7 @@ export function VersionDetail({ id, version }: Props) { const { value: changes } = useAsync(fetchChangelogs, []) const filteredChangelogs = useMemo(() => - changes?.filter(c => c.version === id || c.group === id), + changes?.filter(c => c.version === id || (c.group === id && !c.tags.includes('obsolete'))), [id, changes]) const articleLink = version && getArticleLink(version.id) diff --git a/src/locales/en.json b/src/locales/en.json index 139fe1ad..664ca374 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -10,6 +10,7 @@ "atlas": "Atlas", "back": "Back", "block_definition": "Blockstate", + "change.obsolete": "This change has been replaced by a later change in this release cycle", "changelog": "Technical changelog", "changelog.search": "Search changes", "changelog.no_results": "No documented changes",