installation done

This commit is contained in:
Aria Moradi 2020-12-25 03:08:08 +03:30
parent f16bead363
commit 5ddc087a6d
3 changed files with 20 additions and 9 deletions

View File

@ -207,6 +207,7 @@ class Main {
app.get("/api/v1/extensions/install/:apkName") { ctx ->
val apkName = ctx.pathParam("apkName")
println(apkName)
ctx.status(
downloadApk(apkName)
)

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
@ -36,16 +36,24 @@ interface IProps {
extension: IExtension
}
export default function ExtensionCard({
export default function ExtensionCard(props: IProps) {
const {
extension: {
name, lang, versionName, iconUrl,
name, lang, versionName, iconUrl, installed, apkName,
},
}: IProps) {
} = props;
const [installedState, setInstalledState] = useState<string>((installed ? 'installed' : 'install'));
const classes = useStyles();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const bull = <span className={classes.bullet}></span>;
const langPress = lang === 'all' ? 'All' : lang.toUpperCase();
function install() {
setInstalledState('installing');
fetch(`http://127.0.0.1:4567/api/v1/extensions/install/${apkName}`).then(() => {
setInstalledState('installed');
});
}
return (
<Card>
<CardContent className={classes.root}>
@ -68,7 +76,7 @@ export default function ExtensionCard({
</div>
</div>
<Button variant="outlined">install</Button>
<Button variant="outlined" onClick={() => install()}>{installedState}</Button>
</CardContent>
</Card>
);

View File

@ -3,4 +3,6 @@ interface IExtension {
lang: string
versionName: string
iconUrl: string
installed: boolean
apkName: string
}