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,12 +172,18 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{profile.images?.map((i) => ( {profile.images?.map((i) => {
const downloadURL = `${config.image_url
.replace('{target}', profile.target)
.replace('{version}', profile.version_number)}/${i.name}`;
return (
<TableRow> <TableRow>
<TableCell> <TableCell>
<Link href={downloadURL} target="_blank">
<Button endIcon={<CloudDownload />} variant="contained" color="primary"> <Button endIcon={<CloudDownload />} variant="contained" color="primary">
{i.type} {i.type}
</Button> </Button>
</Link>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Box p={1}> <Box p={1}>
@ -186,7 +192,8 @@ const ProfileDetails: FunctionComponent<Props> = ({ selectedVersion, selectedPro
</Box> </Box>
</TableCell> </TableCell>
</TableRow> </TableRow>
))} );
})}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>