change publish and issue

This commit is contained in:
yanyongyu
2021-03-05 16:27:43 +08:00
parent 4ed5b06db0
commit 611049681a
16 changed files with 821 additions and 289 deletions

View File

@ -0,0 +1,221 @@
<template>
<v-card flat class="adapters">
<v-row>
<v-col cols="12" sm="4">
<v-text-field
v-model="filterText"
dense
rounded
outlined
clearable
hide-details
label="Filter Adapter"
>
<template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner">
<v-icon small>fa-filter</v-icon>
</div>
</template>
</v-text-field>
</v-col>
<v-col cols="12" sm="4">
<v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Adapter
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">Adapter Information</span>
</v-card-title>
<v-card-text>
<v-form ref="newAdapterForm" v-model="valid" lazy-validation>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="newAdapter.name"
label="协议名称"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newAdapter.desc"
label="协议介绍"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newAdapter.id"
label="PyPI 项目名"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newAdapter.link"
label="协议 import 包名"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newAdapter.repo"
label="仓库/主页链接"
required
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false">
Close
</v-btn>
<v-btn
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishAdapter();
"
>
Publish
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
<v-col cols="12" sm="4">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
<hr />
<v-row>
<v-col
cols="12"
sm="6"
v-for="(adapter, index) in displayAdapters"
:key="index"
>
<PublishCard
:name="adapter.name"
:desc="adapter.desc"
:id="adapter.id"
:author="adapter.author"
:link="adapter.repo"
></PublishCard>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
</v-card>
</template>
<script>
import PublishCard from "./PublishCard.vue";
import adapters from "../public/adapters.json";
export default {
name: "Adapters",
components: {
PublishCard
},
data() {
return {
adapters: adapters,
filterText: "",
page: 1,
dialog: false,
valid: false,
newAdapter: {
name: null,
desc: null,
id: null,
link: null,
repo: null
}
};
},
computed: {
pageNum() {
return Math.ceil(this.filteredAdapters.length / 10);
},
filteredAdapters() {
return this.adapters.filter(adapter => {
return (
adapter.id.indexOf(this.filterText || "") != -1 ||
adapter.name.indexOf(this.filterText || "") != -1 ||
adapter.desc.indexOf(this.filterText || "") != -1 ||
adapter.author.indexOf(this.filterText || "") != -1
);
});
},
displayAdapters() {
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10);
},
publishPlugin() {
if (!this.$refs.newAdapterForm.validate()) {
return;
}
const title = encodeURIComponent(
`Adapter: ${this.newAdapter.name}`
).replace(/%2B/gi, "+");
const body = encodeURIComponent(
`
**协议名称:**
${this.newAdapter.name}
**协议功能:**
${this.newAdapter.desc}
**PyPI 项目名:**
${this.newAdapter.link}
**协议 import 包名:**
${this.newAdapter.id}
**协议项目仓库/主页链接:**
${this.newAdapter.repo}
<!-- DO NOT EDIT ! -->
<!--
- id: ${this.newAdapter.id}
- link: ${this.newAdapter.link}
- name: ${this.newAdapter.name}
- desc: ${this.newAdapter.desc}
- repo: ${this.newAdapter.repo}
-->
`.trim()
).replace(/%2B/gi, "+");
window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter`
);
}
}
};
</script>

View File

@ -0,0 +1,190 @@
<template>
<v-card flat class="bots">
<v-row>
<v-col cols="12" sm="4">
<v-text-field
v-model="filterText"
dense
rounded
outlined
clearable
hide-details
label="Filter Bot"
>
<template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner">
<v-icon small>fa-filter</v-icon>
</div>
</template>
</v-text-field>
</v-col>
<v-col cols="12" sm="4">
<v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Bot
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">Bot Information</span>
</v-card-title>
<v-card-text>
<v-form ref="newBotForm" v-model="valid" lazy-validation>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="newBot.name"
label="机器人名称"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newBot.desc"
label="机器人介绍"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newBot.repo"
label="仓库/主页链接"
required
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false">
Close
</v-btn>
<v-btn
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishBot();
"
>
Publish
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
<v-col cols="12" sm="4">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
<hr />
<v-row>
<v-col cols="12" sm="6" v-for="(bot, index) in displayBots" :key="index">
<PublishCard
:name="bot.name"
:desc="bot.desc"
:author="bot.author"
:link="bot.repo"
></PublishCard>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
</v-card>
</template>
<script>
import PublishCard from "./PublishCard.vue";
import bots from "../public/bots.json";
export default {
name: "Bots",
components: {
PublishCard
},
data() {
return {
bots: bots,
filterText: "",
page: 1,
dialog: false,
valid: false,
newBot: {
name: null,
desc: null,
repo: null
}
};
},
computed: {
pageNum() {
return Math.ceil(this.filteredBots.length / 10);
},
filteredBots() {
return this.bots.filter(bot => {
return (
bot.id.indexOf(this.filterText || "") != -1 ||
bot.name.indexOf(this.filterText || "") != -1 ||
bot.desc.indexOf(this.filterText || "") != -1 ||
bot.author.indexOf(this.filterText || "") != -1
);
});
},
displayBots() {
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10);
},
publishBot() {
if (!this.$refs.newBotForm.validate()) {
return;
}
const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace(
/%2B/gi,
"+"
);
const body = encodeURIComponent(
`
**机器人名称:**
${this.newBot.name}
**机器人功能:**
${this.newBot.desc}
**机器人项目仓库/主页链接:**
${this.newBot.repo}
<!-- DO NOT EDIT ! -->
<!--
- name: ${this.newBot.name}
- desc: ${this.newBot.desc}
- repo: ${this.newBot.repo}
-->
`.trim()
).replace(/%2B/gi, "+");
window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot`
);
}
}
};
</script>

View File

@ -0,0 +1,223 @@
<template>
<v-card flat class="plugins">
<v-row>
<v-col cols="12" sm="4">
<v-text-field
v-model="filterText"
dense
rounded
outlined
clearable
hide-details
label="Filter Plugin"
>
<template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner">
<v-icon small>fa-filter</v-icon>
</div>
</template>
</v-text-field>
</v-col>
<v-col cols="12" sm="4">
<v-dialog v-model="dialog" max-width="600px">
<template v-slot:activator="{ on, attrs }">
<v-btn dark block color="primary" v-bind="attrs" v-on="on"
>Publish Your Plugin
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">Plugin Information</span>
</v-card-title>
<v-card-text>
<v-form ref="newPluginForm" v-model="valid" lazy-validation>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="newPlugin.name"
label="插件名称"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newPlugin.desc"
label="插件介绍"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newPlugin.id"
label="PyPI 项目名"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newPlugin.link"
label="插件 import 包名"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="newPlugin.repo"
label="仓库/主页链接"
required
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false">
Close
</v-btn>
<v-btn
:disabled="!valid"
color="blue darken-1"
text
@click="
dialog = false;
publishPlugin();
"
>
Publish
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
<v-col cols="12" sm="4">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
<hr />
<v-row>
<v-col
cols="12"
sm="6"
v-for="(plugin, index) in displayPlugins"
:key="index"
>
<PublishCard
:name="plugin.name"
:desc="plugin.desc"
:id="plugin.id"
:author="plugin.author"
:link="plugin.repo"
text="copy nb install command"
:command="`nb plugin install ${plugin.id}`"
></PublishCard>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
</v-card>
</template>
<script>
import PublishCard from "./PublishCard.vue";
import plugins from "../public/plugins.json";
export default {
name: "Plugins",
components: {
PublishCard
},
data() {
return {
plugins: plugins,
filterText: "",
page: 1,
dialog: false,
valid: false,
newPlugin: {
name: null,
desc: null,
id: null,
link: null,
repo: null
}
};
},
computed: {
pageNum() {
return Math.ceil(this.filteredPlugins.length / 10);
},
filteredPlugins() {
return this.plugins.filter(plugin => {
return (
plugin.id.indexOf(this.filterText || "") != -1 ||
plugin.name.indexOf(this.filterText || "") != -1 ||
plugin.desc.indexOf(this.filterText || "") != -1 ||
plugin.author.indexOf(this.filterText || "") != -1
);
});
},
displayPlugins() {
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10);
},
publishPlugin() {
if (!this.$refs.newPluginForm.validate()) {
return;
}
const title = encodeURIComponent(
`Plugin: ${this.newPlugin.name}`
).replace(/%2B/gi, "+");
const body = encodeURIComponent(
`
**插件名称:**
${this.newPlugin.name}
**插件功能:**
${this.newPlugin.desc}
**PyPI 项目名:**
${this.newPlugin.link}
**插件 import 包名:**
${this.newPlugin.id}
**插件项目仓库/主页链接:**
${this.newPlugin.repo}
<!-- DO NOT EDIT ! -->
<!--
- id: ${this.newPlugin.id}
- link: ${this.newPlugin.link}
- name: ${this.newPlugin.name}
- desc: ${this.newPlugin.desc}
- repo: ${this.newPlugin.repo}
-->
`.trim()
).replace(/%2B/gi, "+");
window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin`
);
}
}
};
</script>

View File

@ -1,165 +0,0 @@
<template>
<div class="plugins">
<v-app>
<v-main>
<v-row>
<v-col cols="12" sm="4">
<v-text-field
v-model="filterText"
dense
rounded
outlined
clearable
hide-details
label="Filter Plugin"
>
<template v-slot:prepend-inner>
<div class="v-input__icon v-input__icon--prepend-inner">
<v-icon small>fa-filter</v-icon>
</div>
</template>
</v-text-field>
</v-col>
<v-col cols="12" sm="4">
<v-btn
block
color="primary"
target="_blank"
rel="noopener noreferrer"
href="https://github.com/nonebot/nonebot2/issues/new?labels=Plugin&template=plugin-publish.md&title=Plugin%3A+blabla+的插件"
>Publish Your Plugin
</v-btn>
</v-col>
<v-col cols="12" sm="4">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
<hr />
<v-row>
<v-col
cols="12"
sm="6"
v-for="(plugin, index) in displayPlugins"
: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-text>
<v-icon x-small>fa-fingerprint</v-icon>
{{ plugin.id }}
<v-icon x-small class="ml-2">fa-user</v-icon>
{{ plugin.author }}
</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-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination>
</v-col>
</v-row>
</v-main>
</v-app>
</div>
</template>
<script>
import copy from "copy-to-clipboard";
import plugins from "../public/plugins.json";
export default {
name: "Plugins",
data() {
return {
plugins: plugins,
snackbar: false,
filterText: "",
page: 1
};
},
computed: {
pageNum() {
return Math.ceil(this.filteredPlugins.length / 10);
},
filteredPlugins() {
return this.plugins.filter(plugin => {
return (
plugin.id.indexOf(this.filterText) != -1 ||
plugin.name.indexOf(this.filterText) != -1 ||
plugin.desc.indexOf(this.filterText) != -1 ||
plugin.author.indexOf(this.filterText) != -1
);
});
},
displayPlugins() {
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10);
}
},
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;
}
}
};
</script>
<style>
.v-application--wrap {
min-height: 0 !important;
}
</style>
<style scoped>
.repo-link {
text-decoration: none !important;
display: inline-block;
}
.repo-link:hover i {
color: #ea5252;
}
</style>

View File

@ -0,0 +1,84 @@
<template>
<v-card>
<v-card-title>
{{ name }}
<v-spacer></v-spacer>
<a
class="repo-link"
v-if="repoLink(link)"
rel="noopener noreferrer"
target="_blank"
:title="link"
:href="repoLink(link)"
>
<v-icon>fab fa-github</v-icon>
</a>
</v-card-title>
<v-card-text>{{ desc }}</v-card-text>
<v-card-text>
<template v-if="id">
<v-icon x-small>fa-fingerprint</v-icon>
{{ id }}
</template>
<v-icon x-small class="ml-2">fa-user</v-icon>
{{ author }}
</v-card-text>
<v-card-actions v-if="showCommand">
<v-btn block depressed class="btn-copy" @click="copyCommand()">
{{ text }}
<v-icon right small>fa-copy</v-icon>
</v-btn>
<v-snackbar v-model="snackbar">Copied!</v-snackbar>
</v-card-actions>
</v-card>
</template>
<script>
import copy from "copy-to-clipboard";
export default {
props: {
name: String,
desc: String,
id: String,
author: String,
link: String,
text: String,
command: String
},
data() {
return {
snackbar: false
};
},
computed: {
showCommand() {
return this.text && this.command;
}
},
methods: {
repoLink(repo) {
if (repo) {
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`;
}
return null;
},
copyCommand() {
copy(this.command, {
format: "text/plain"
});
this.snackbar = true;
}
}
};
</script>
<style scoped>
.repo-link {
text-decoration: none !important;
display: inline-block;
}
.repo-link:hover i {
color: #ea5252;
}
</style>

View File

@ -0,0 +1,70 @@
<template>
<div class="store">
<v-app>
<v-main>
<v-card>
<v-toolbar dense flat>
<v-tabs v-model="tab" centered>
<v-tab v-for="(name, index) in tabs" :key="index">{{
name
}}</v-tab>
</v-tabs>
</v-toolbar>
<v-tabs-items class="sub-item" v-model="tab">
<v-tab-item>
<Adapter></Adapter>
</v-tab-item>
<v-tab-item>
<Plugin></Plugin>
</v-tab-item>
<v-tab-item>
<Bot></Bot>
</v-tab-item>
</v-tabs-items>
</v-card>
</v-main>
</v-app>
</div>
</template>
<script>
import Adapter from "./Adapter.vue";
import Plugin from "./Plugin.vue";
import Bot from "./Bot.vue";
export default {
name: "Store",
components: {
Adapter,
Plugin,
Bot
},
data() {
return {
tab: 1,
tabs: {
0: "协议",
1: "插件",
2: "机器人"
}
};
},
computed: {},
methods: {}
};
</script>
<style>
.v-application--wrap {
min-height: 0 !important;
}
</style>
<style scoped>
.store {
margin: 0 -20px;
}
.sub-item {
padding: 0 10px;
}
</style>

View File

@ -82,7 +82,7 @@ module.exports = context => ({
{ text: "指南", link: "/guide/" },
{ text: "进阶", link: "/advanced/" },
{ text: "API", link: "/api/" },
{ text: "插件广场", link: "/plugin-store" },
{ text: "商店", link: "/store" },
{ text: "更新日志", link: "/changelog" }
],
sidebarDepth: 2,

View File

@ -0,0 +1 @@
[]