0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-29 22:53:05 +00:00
VueTube/NUXT/pages/mods/updates.vue

106 lines
2.6 KiB
Vue
Raw Normal View History

2022-03-07 14:36:23 +00:00
<template>
<div class="py-2">
<v-list-item v-for="(item, index) in commits" :key="index" class="my-1">
2022-04-04 00:39:48 +00:00
<v-card flat class="card my-2 background" :class="$vuetify.theme.dark ? 'lighten-1' : 'darken-1'">
2022-03-21 23:47:11 +00:00
<v-card-title style="padding: 0 0.25em 0 0.75em">
2022-03-15 20:18:27 +00:00
{{ item.author ? item.author.login : item.commit.author.name }}
2022-04-04 00:39:48 +00:00
<span class="subtitle background--text" :class="$vuetify.theme.dark ? 'text--lighten-4' : 'text--darken-4'"
v-text="`• ${item.sha.substring(0, 7)}`" />
2022-03-11 13:31:01 +00:00
<v-spacer />
2022-04-04 00:39:48 +00:00
<v-chip v-if="index == 0" class="tags" color="orange" style="
2022-03-31 22:25:31 +00:00
border-radius: 0.5rem;
border: 2px var(--v-orange-base);
2022-04-04 00:39:48 +00:00
">
2022-03-31 22:25:31 +00:00
Latest
</v-chip>
2022-04-04 00:39:48 +00:00
<v-chip v-if="item.sha == installedVersion" class="tags" color="green" style="
2022-03-31 22:25:31 +00:00
border-radius: 0.5rem;
border: 2px var(--v-green-base);
2022-04-04 00:39:48 +00:00
">
Installed
</v-chip>
2022-03-07 14:36:23 +00:00
</v-card-title>
2022-03-21 23:47:11 +00:00
<div style="margin-left: 1em">
2022-04-04 00:39:48 +00:00
<div class="date background--text" :class="$vuetify.theme.dark ? 'text--lighten-4' : 'text--darken-4'"
v-text="new Date(item.commit.committer.date).toLocaleString()" />
2022-03-07 19:09:58 +00:00
{{ item.commit.message }}
2022-03-07 19:07:24 +00:00
</div>
2022-03-07 14:36:23 +00:00
<v-card-actions>
<v-spacer />
2022-03-31 22:25:31 +00:00
<v-btn @click="openExternal(item)" class="background">
<v-icon class="btn-icon">mdi-github</v-icon>View
</v-btn>
<v-btn disabled @click="install(item)">
<v-icon class="btn-icon">mdi-download</v-icon>Install
</v-btn>
2022-03-07 14:36:23 +00:00
</v-card-actions>
</v-card>
</v-list-item>
</div>
</template>
<style scoped>
2022-04-04 00:39:48 +00:00
.card {
width: 100%;
}
.subtitle {
margin: 0.4em;
font-size: 0.75em;
transform: translateY(5%);
}
.date {
transform: translateY(-40%);
}
.btn-icon {
margin-right: 0.25em;
}
.tags {
margin-left: 0.5em;
}
2022-03-07 14:36:23 +00:00
</style>
<script>
2022-04-04 00:39:48 +00:00
import {
Browser
} from "@capacitor/browser";
2022-03-07 14:36:23 +00:00
2022-04-04 00:39:48 +00:00
export default {
data() {
return {
commits: new Array(),
installedVersion: process.env.appVersion,
};
2022-03-11 16:39:52 +00:00
},
2022-04-04 00:39:48 +00:00
async mounted() {
const commits = await this.$vuetube.commits;
if (commits[0].sha) {
//If Commit Valid
this.commits = commits;
} else {
console.log(commits);
}
},
methods: {
async openExternal(item) {
await Browser.open({
url: item.html_url
});
},
2022-03-11 16:39:52 +00:00
2022-04-04 00:39:48 +00:00
install(item) {
this.$vuetube.getRuns(item, (data) => {
console.log(data);
});
},
2022-03-21 23:47:11 +00:00
},
2022-04-04 00:39:48 +00:00
};
2022-03-07 14:36:23 +00:00
</script>