diff --git a/src/components/modal/ReleaseNotes.tsx b/src/components/modal/ReleaseNotes.tsx index a4ec97c..2db7f46 100644 --- a/src/components/modal/ReleaseNotes.tsx +++ b/src/components/modal/ReleaseNotes.tsx @@ -1,25 +1,34 @@ import React, { useEffect, useState } from 'react'; +import { Divider } from 'rsuite'; import settings from 'electron-settings'; import { shell } from 'electron'; import axios from 'axios'; import { InfoModal } from './Modal'; import { StyledButton } from '../shared/styled'; import { ConfigPanel } from '../settings/styled'; +import CenterLoader from '../loader/CenterLoader'; const ReleaseNotes = () => { const [show, setShow] = useState(Boolean(settings.getSync('autoUpdateNotice'))); const [releaseDetails, setReleaseDetails] = useState(); + const [isLoading, setIsLoading] = useState(false); useEffect(() => { + setIsLoading(true); const fetchReleaseNotes = async () => { const { data } = await axios.get( - 'https://api.github.com/repos/jeffvli/sonixd/releases/latest' + 'https://api.github.com/repos/jeffvli/sonixd/releases?per_page=4' ); - setReleaseDetails({ tag: data.tag_name, notes: data.body }); + setReleaseDetails( + data.map((release: any) => { + return { tag: release.tag_name, notes: release.body }; + }) + ); }; fetchReleaseNotes(); + setIsLoading(false); }, []); if (!show) { @@ -35,18 +44,29 @@ const ReleaseNotes = () => { }} > -

- {releaseDetails?.tag} - shell.openExternal('https://github.com/jeffvli/sonixd/releases/latest')} - appearance="primary" - size="sm" - style={{ marginLeft: '10px' }} - > - View on GitHub - -

-

{releaseDetails?.notes}

+ {isLoading && } + + {releaseDetails?.map((release: { tag: string; notes: string }) => { + return ( + <> +

+ {release?.tag} + + shell.openExternal(`https://github.com/jeffvli/sonixd/releases/${release.tag}`) + } + appearance="primary" + size="sm" + style={{ marginLeft: '10px' }} + > + View on GitHub + +

+

{release?.notes}

+ + + ); + })}
);