fix: redirect to latest tag release notes (#1970)

* fix: redirect to latest tag release notes

* chore: some refactoring is updated

---------

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
Yash Joshi 2023-02-03 21:51:18 +05:30 committed by GitHub
parent 0832bce955
commit 6cd341a887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -0,0 +1 @@
export const githubReleaseURL = 'https://github.com/SigNoz/signoz/releases';

View File

@ -1,15 +1,14 @@
import { WarningFilled } from '@ant-design/icons';
import { Button, Card, Form, Space, Typography } from 'antd';
import React from 'react';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
import AppReducer from 'types/reducer/app';
import { githubReleaseURL } from './constant';
import { InputComponent } from './styles';
const { Title } = Typography;
function Version(): JSX.Element {
const [form] = Form.useForm();
const { t } = useTranslation();
@ -24,11 +23,19 @@ function Version(): JSX.Element {
const isLatestVersion = currentVersion === latestVersion;
const isError = isCurrentVersionError || isLatestVersionError;
const latestVersionUrl = useMemo(
() =>
isLatestVersionError
? githubReleaseURL
: `${githubReleaseURL}/tag/${latestVersion}`,
[isLatestVersionError, latestVersion],
);
return (
<Card>
<Title ellipsis level={4}>
<Typography.Title ellipsis level={4}>
{t('version')}
</Title>
</Typography.Title>
<Form
wrapperCol={{
@ -55,11 +62,7 @@ function Version(): JSX.Element {
value={isLatestVersionError ? t('n_a').toString() : latestVersion}
placeholder={t('latest_version')}
/>
<Button
href="https://github.com/SigNoz/signoz/releases"
target="_blank"
type="link"
>
<Button href={latestVersionUrl} target="_blank" type="link">
{t('release_notes')}
</Button>
</Form.Item>