-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Create releases tab in the marketplace app info page (#25965)
- Loading branch information
Showing
14 changed files
with
209 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Accordion } from '@rocket.chat/fuselage'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import { useEndpointData } from '../../../hooks/useEndpointData'; | ||
import { AsyncStatePhase } from '../../../lib/asyncState/AsyncStatePhase'; | ||
import AccordionLoading from './AccordionLoading'; | ||
import ReleaseItem from './ReleaseItem'; | ||
|
||
type release = { | ||
version: string; | ||
createdDate: string; | ||
detailedChangelog: { | ||
raw: string; | ||
rendered: string; | ||
}; | ||
}; | ||
|
||
const AppReleases = ({ id }: { id: string }): JSX.Element => { | ||
const { value, phase, error } = useEndpointData(`/apps/${id}/versions`); | ||
|
||
const [releases, setReleases] = useState([] as release[]); | ||
|
||
const isLoading = phase === AsyncStatePhase.LOADING; | ||
const isSuccess = phase === AsyncStatePhase.RESOLVED; | ||
const didFail = phase === AsyncStatePhase.REJECTED || error; | ||
|
||
useEffect(() => { | ||
if (isSuccess && value?.apps) { | ||
const { apps } = value; | ||
|
||
setReleases( | ||
apps.map((app) => ({ | ||
version: app.version, | ||
createdDate: app.createdDate, | ||
detailedChangelog: app.detailedChangelog, | ||
})), | ||
); | ||
} | ||
}, [isSuccess, value]); | ||
|
||
return ( | ||
<> | ||
<Accordion width='100%' alignSelf='center'> | ||
{didFail && error} | ||
{isLoading && <AccordionLoading />} | ||
{isSuccess && releases.length && releases.map((release) => <ReleaseItem release={release} key={release.version} />)} | ||
</Accordion> | ||
</> | ||
); | ||
}; | ||
|
||
export default AppReleases; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.