2020-10-21 00:55:23 +08:00
|
|
|
<template>
|
2020-11-01 18:21:31 +08:00
|
|
|
<div class="plugins">
|
|
|
|
<!-- TODO: Search and New -->
|
|
|
|
<hr />
|
|
|
|
<v-app>
|
|
|
|
<v-main>
|
|
|
|
<v-row>
|
|
|
|
<v-col
|
|
|
|
cols="12"
|
|
|
|
sm="6"
|
|
|
|
v-for="(plugin, index) in plugins"
|
|
|
|
:key="index"
|
|
|
|
>
|
|
|
|
<v-card>
|
|
|
|
<v-card-title>
|
|
|
|
{{ plugin.name }}
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
<a
|
|
|
|
class="repo-link"
|
|
|
|
v-if="repoLink(plugin.repo)"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
:title="plugin.repo"
|
|
|
|
:href="repoLink(plugin.repo)"
|
|
|
|
>
|
|
|
|
<v-icon>fab fa-github</v-icon>
|
|
|
|
</a>
|
|
|
|
</v-card-title>
|
|
|
|
<v-card-text>{{ plugin.desc }}</v-card-text>
|
|
|
|
<v-card-actions>
|
|
|
|
<v-btn
|
|
|
|
block
|
|
|
|
depressed
|
|
|
|
class="btn-copy"
|
|
|
|
@click="copyCommand(plugin)"
|
|
|
|
>
|
|
|
|
copy nb-cli command
|
|
|
|
<v-icon right small>fa-copy</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
<v-snackbar v-model="snackbar">Copied!</v-snackbar>
|
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</v-main>
|
|
|
|
</v-app>
|
|
|
|
</div>
|
2020-10-21 00:55:23 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-11-01 18:21:31 +08:00
|
|
|
import copy from "copy-to-clipboard";
|
2020-10-21 00:55:23 +08:00
|
|
|
import plugins from "../public/plugins.json";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "Plugins",
|
|
|
|
data() {
|
|
|
|
return {
|
2020-11-01 18:21:31 +08:00
|
|
|
plugins: plugins,
|
|
|
|
snackbar: false
|
2020-10-21 00:55:23 +08:00
|
|
|
};
|
2020-11-01 18:21:31 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
repoLink(repo) {
|
|
|
|
if (repo) {
|
|
|
|
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
copyCommand(plugin) {
|
|
|
|
copy(`nb plugin install ${plugin.id}`, {
|
|
|
|
format: "text/plain"
|
|
|
|
});
|
|
|
|
this.snackbar = true;
|
|
|
|
}
|
2020-10-21 00:55:23 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.v-application--wrap {
|
|
|
|
min-height: 0 !important;
|
|
|
|
}
|
|
|
|
</style>
|
2020-11-01 18:21:31 +08:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.repo-link {
|
|
|
|
text-decoration: none !important;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.repo-link:hover i {
|
|
|
|
color: #ea5252;
|
|
|
|
}
|
|
|
|
</style>
|