Feature/127 archive UI rework (#131)

* Archives have their own page.  Delete/etc buttons are moved into ArchivePage.

* Alternatives for an Archive are displayed in the ArchivePage.

* ArchiveDownloader returns the location.

* Removing color from Details button.

* Making Archive screenshot and title a link.

* Preserving next_download when updating a Channel.

* Removing button icons from Archive page.
This commit is contained in:
lrnselfreliance 2022-05-16 17:56:55 -06:00 • committed by Roland
parent 2314c3462f
commit 0765890b8b
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
12 changed files with 238 additions and 99 deletions

View file

@ -3,6 +3,7 @@ import {
fetchDomains,
filesSearch,
getAPIStatus,
getArchive,
getDownloaders,
getFiles,
getHotspotStatus,
@ -152,6 +153,28 @@ export const useArchives = ({defaultLimit = 20}) => {
};
}
export const useArchive = (archiveId) => {
const [archive, setArchive] = useState(null);
const [alternatives, setAlternatives] = useState(null);
const fetchArchive = async () => {
try {
const [a, alt] = await getArchive(archiveId);
setArchive(a);
setAlternatives(alt);
} catch (e) {
console.error(e);
setArchive(undefined);
}
}
useEffect(() => {
fetchArchive();
}, [archiveId]);
return [archive, alternatives];
}
export const useVersion = () => {
const [version, setVersion] = useState('');