add download links

This commit is contained in:
Sudhanshu Gautam 2021-01-10 20:36:13 +05:30
parent 9f4d64e1c0
commit f3133a38a0
3 changed files with 25 additions and 21 deletions

View file

@ -5,10 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta name="description" content="A simple OpenWrt firmware selector using autocompletion." />
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
@ -24,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>OpenWrt Firmware Selector Wizard</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View file

@ -11,7 +11,7 @@ const config = {
default_version: '19.07.5', default_version: '19.07.5',
// Image download URL (optional) // Image download URL (optional)
image_url: 'https://downloads.openwrt.org/releases/{version}/{target}', image_url: 'https://downloads.openwrt.org/releases/{version}/targets/{target}',
// Info link URL (optional) // Info link URL (optional)
info_url: 'https://openwrt.org/start?do=search&id=toh&q={title}', info_url: 'https://openwrt.org/start?do=search&id=toh&q={title}',

View file

@ -172,21 +172,28 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{profile.images?.map((i) => ( {profile.images?.map((i) => {
<TableRow> const downloadURL = `${config.image_url
<TableCell> .replace('{target}', profile.target)
<Button endIcon={<CloudDownload />} variant="contained" color="primary"> .replace('{version}', profile.version_number)}/${i.name}`;
{i.type} return (
</Button> <TableRow>
</TableCell> <TableCell>
<TableCell> <Link href={downloadURL} target="_blank">
<Box p={1}> <Button endIcon={<CloudDownload />} variant="contained" color="primary">
<Typography>{t(`tr-${getHelpKey(i.type)}`)}</Typography> {i.type}
<Typography variant="caption">sha256sum: {i.sha256}</Typography> </Button>
</Box> </Link>
</TableCell> </TableCell>
</TableRow> <TableCell>
))} <Box p={1}>
<Typography>{t(`tr-${getHelpKey(i.type)}`)}</Typography>
<Typography variant="caption">sha256sum: {i.sha256}</Typography>
</Box>
</TableCell>
</TableRow>
);
})}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>