checking if theme is already installed

This commit is contained in:
booploops 2022-02-14 00:36:48 -08:00
parent 9be41520d2
commit f655b8f1aa
2 changed files with 19 additions and 4 deletions

View file

@ -39,7 +39,10 @@
</div>
</div>
<div class="col-auto nopadding flex-center">
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">Install</button>
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">
<span v-if="!themesInstalled.includes(openRepo.full_name)">Install</span>
<span v-else>Update</span>
</button>
</div>
</div>
</div>
@ -67,13 +70,25 @@
avatar_url: ''
},
readme: ""
}
},
themesInstalled: []
}
},
mounted() {
this.getRepos();
this.getInstalledThemes();
},
methods: {
getInstalledThemes() {
let self = this
const themes = ipcRenderer.sendSync("get-themes")
// for each theme, get the github_repo property and push it to the themesInstalled array, if not blank
themes.forEach(theme => {
if (theme.github_repo !== "") {
self.themesInstalled.push(theme.github_repo)
}
})
},
showRepo(repo) {
const self = this
const readmeUrl = `https://raw.githubusercontent.com/${repo.full_name}/main/README.md`;