Skip to content

Commit f580693

Browse files
committed
Merge branch 'TheKodeToad-vue-3'
2 parents 062f0d1 + e313a91 commit f580693

17 files changed

Lines changed: 359 additions & 488 deletions

dashboard/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"source-map-loader": "^4.0.1",
2828
"tailwindcss": "^1.9.6",
2929
"ts-loader": "^9.4.3",
30-
"vue-loader": "^15.10.1",
30+
"vue-loader": "^17.4.2",
3131
"vue-style-loader": "^4.1.3",
3232
"vue-template-compiler": "^2.7.14",
3333
"webpack": "^5.94.0",
@@ -37,19 +37,19 @@
3737
},
3838
"dependencies": {
3939
"@fastify/static": "^7.0.1",
40-
"@highlightjs/vue-plugin": "^1.0.2",
4140
"fastify": "^4.26.2",
4241
"highlight.js": "^11.8.0",
4342
"humanize-duration": "^3.27.0",
4443
"js-yaml": "^4.1.0",
4544
"marked": "^5.1.0",
4645
"modern-css-reset": "^1.4.0",
4746
"moment": "^2.29.4",
48-
"vue": "^2.7.14",
49-
"vue-material-design-icons": "^4.1.0",
50-
"vue-router": "^3.6.5",
51-
"vue2-ace-editor": "^0.0.15",
52-
"vuex": "^3.6.2"
47+
"vue": "^3.5.13",
48+
"vue-material-design-icons": "^5.3.1",
49+
"vue-router": "^4.5.0",
50+
"vue3-ace-editor": "^2.2.4",
51+
"vue3-highlightjs": "^1.0.5",
52+
"vuex": "^4.1.0"
5353
},
5454
"browserslist": [
5555
"last 2 Chrome versions"

dashboard/src/auth.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ export const loginCallbackGuard: NavigationGuard = async (to, from, next) => {
2121
} else {
2222
window.location.href = `/?error=noAccess`;
2323
}
24+
return next();
2425
};
2526

2627
export const authRedirectGuard: NavigationGuard = async (to, form, next) => {
2728
if (await isAuthenticated()) return next("/dashboard");
2829
window.location.href = `${process.env.API_URL}/auth/login`;
30+
return next();
2931
};

dashboard/src/components/Expandable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
7373
.inline-code,
7474
code:not([class]),
75-
>>> code:not([class]) {
75+
:deep(code:not([class])) {
7676
@apply bg-gray-900;
7777
}
7878
79-
.codeblock {
79+
:deep(.codeblock) {
8080
box-shadow: none;
8181
}
8282
</style>

dashboard/src/components/Tab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
}
1717
18-
a {
18+
:deep(a) {
1919
@apply block;
2020
@apply py-2;
2121
@apply px-4;

dashboard/src/components/dashboard/GuildAccess.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default {
175175
expiresAt: null,
176176
});
177177
178-
this.$set(perm, "permissions", new Set(perm.permissions));
178+
perm.permissions = new Set(perm.permissions);
179179
},
180180
181181
onTreeUpdate(targetPermissions) {

dashboard/src/components/dashboard/GuildConfigEditor.vue

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
</div>
2020
</div>
2121

22-
<AceEditor class="rounded shadow-lg border border-gray-700 mt-4"
23-
v-model="editableConfig"
22+
<v-ace-editor class="rounded shadow-lg border border-gray-700 mt-4"
23+
v-model:value="editableConfig"
2424
@init="editorInit"
2525
lang="yaml"
2626
theme="tomorrow_night"
27-
:height="editorHeight"
28-
ref="aceEditor" />
27+
ref="aceEditor"
28+
v-options="{
29+
useSoftTabs: true,
30+
tabSize: 2
31+
}"
32+
:style="{
33+
width: editorWidth + 'px',
34+
height: editorHeight + 'px',
35+
}" />
2936
</div>
3037
</template>
3138

@@ -34,14 +41,19 @@
3441
import {ApiError} from "../../api";
3542
import { GuildState } from "../../store/types";
3643
37-
import AceEditor from "vue2-ace-editor";
44+
import { VAceEditor } from "vue3-ace-editor";
45+
46+
import "ace-builds/src-noconflict/ext-language_tools";
47+
import 'ace-builds/src-noconflict/ext-searchbox';
48+
import "ace-builds/src-noconflict/mode-yaml";
49+
import "ace-builds/src-noconflict/theme-tomorrow_night";
3850
3951
let editorKeybindListener;
4052
let windowResizeListener;
4153
4254
export default {
4355
components: {
44-
AceEditor,
56+
VAceEditor,
4557
},
4658
async mounted() {
4759
try {
@@ -101,16 +113,6 @@
101113
},
102114
methods: {
103115
editorInit() {
104-
require("brace/ext/language_tools");
105-
require('brace/ext/searchbox');
106-
require("brace/mode/yaml");
107-
require("brace/theme/tomorrow_night");
108-
109-
this.$refs.aceEditor.editor.setOptions({
110-
useSoftTabs: true,
111-
tabSize: 2
112-
});
113-
114116
// Add Ctrl+S/Cmd+S save shortcut
115117
const isMac = /mac/i.test(navigator.platform);
116118
const modKeyPressed = (ev: KeyboardEvent) => (isMac ? ev.metaKey : ev.ctrlKey);
@@ -131,7 +133,7 @@
131133
132134
if (shortcutModifierPressed(ev) && ev.key === "f") {
133135
ev.preventDefault();
134-
this.$refs.aceEditor.editor.execCommand("find");
136+
this.$refs.aceEditor.getAceInstance().execCommand("find");
135137
return;
136138
}
137139
};
@@ -171,7 +173,7 @@
171173
this.editorHeight = newHeight;
172174
173175
this.$nextTick(() => {
174-
this.$refs.aceEditor.editor.resize();
176+
this.$refs.aceEditor.getAceInstance().resize();
175177
});
176178
},
177179
async save() {

dashboard/src/components/docs/DocsLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<!-- Sidebar -->
3232
<nav class="docs-sidebar px-4 pt-2 pb-3 mr-8 mb-4 border border-gray-700 rounded bg-gray-800 shadow-md flex-full lg:flex-none lg:block" v-bind:class="{ closed: !mobileMenuOpen }">
3333
<div role="none" v-for="(group, index) in menu">
34-
<h1 class="font-bold" :aria-owns="'menu-group-' + index" :class="{'mt-4': index !== 0}">{{ group.label }}</h1>
34+
<h1 class="font-bold" :aria-owns="'menu-group-' + index" :class="{'mt-4': typeof index === 'number' && index !== 0}">{{ group.label }}</h1>
3535
<ul v-bind:id="'menu-group-' + index" role="group" class="list-none pl-2">
3636
<li role="none" v-for="item in group.items">
3737
<router-link role="menuitem" :to="item.to" class="text-gray-300 hover:text-gray-500" v-on:click.native="onChooseMenuItem()">{{ item.label }}</router-link>

dashboard/src/components/docs/Moderation.vue

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,32 @@
8181
<h3>Summary Example</h3>
8282
<p>
8383
Employing what we have learnt so far, we can write a configuration that:
84-
<ul>
85-
<li>Alerts members of their warns in a channel, instead of DMs.</li>
86-
<li>Alerts members of kicks and bans in their DMs.</li>
87-
<li>Makes use of multi-line strings to prepare a tidy message.</li>
88-
<li>Includes the remaining ban time if a ban was temporary.</li>
89-
</ul>
90-
<CodeBlock code-lang="yaml" trim="start">
91-
plugins:
92-
mod_actions:
93-
config:
94-
dm_on_warn: false
95-
message_on_warn: true
96-
message_channel: "PRETEND-CHANNEL-ID"
84+
</p>
9785

98-
dm_on_kick: true
86+
<ul>
87+
<li>Alerts members of their warns in a channel, instead of DMs.</li>
88+
<li>Alerts members of kicks and bans in their DMs.</li>
89+
<li>Makes use of multi-line strings to prepare a tidy message.</li>
90+
<li>Includes the remaining ban time if a ban was temporary.</li>
91+
</ul>
92+
<CodeBlock code-lang="yaml" trim="start">
93+
plugins:
94+
mod_actions:
95+
config:
96+
dm_on_warn: false
97+
message_on_warn: true
98+
message_channel: "PRETEND-CHANNEL-ID"
9999

100-
dm_on_ban: true
101-
tempban_message: |-
102-
Dear {user.username},
100+
dm_on_kick: true
103101

104-
As a result of {reason}, you have been banned from {guildName}
105-
for {banTime}. We welcome you back provided you do not do this
106-
again.
107-
</CodeBlock>
108-
</p>
102+
dm_on_ban: true
103+
tempban_message: |-
104+
Dear {user.username},
105+
106+
As a result of {reason}, you have been banned from {guildName}
107+
for {banTime}. We welcome you back provided you do not do this
108+
again.
109+
</CodeBlock>
109110

110111
<h2>Alerts</h2>
111112
<p>

dashboard/src/components/docs/Plugin.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
class="command mb-4"
5050
v-bind:ref="getCommandSlug(command)" v-bind:class="{target: targetCommandId === getCommandSlug(command)}">
5151
<h4 class="text-xl font-semibold mb-0">
52-
<span v-for="(trigger, index) in getTriggers(command)"> <span class="text-gray-600" v-if="index > 0">/</span> !{{ trigger }} </span>
52+
<span v-for="(trigger, index) in getTriggers(command)"> <span class="text-gray-600" v-if="typeof index === 'number' && index > 0">/</span> !{{ trigger }} </span>
5353
</h4>
5454
<MarkdownBlock v-if="command.description"
5555
:content="command.description"
@@ -88,7 +88,7 @@
8888
<div v-if="command.signature">
8989
<h5 class="font-semibold mb-2">Signatures:</h5>
9090
<ul class="list-none">
91-
<li v-for="(signature, index) in getCommandSignatures(command)" v-bind:class="{'mt-8': index !== 0}">
91+
<li v-for="(signature, index) in getCommandSignatures(command)" v-bind:class="{'mt-8': typeof index === 'number' && index !== 0}">
9292
<code class="inline-code bg-gray-900">
9393
!{{ getTriggers(command)[0] }}
9494
<span v-for="paramInfo in getSignatureParameters(signature)">{{ renderParameterOrOption(paramInfo.name, paramInfo.param) }} </span>

dashboard/src/directives/trim-indents.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import Vue from "vue";
1+
import { Directive } from "vue";
22

3-
Vue.directive("trim-indents", {
4-
bind(el, binding) {
3+
export const trimIndents: Directive = {
4+
beforeMount(el, binding) {
55
const withoutStartEndWhitespace = el.innerHTML.replace(/(^\n+|\n+$)/g, "");
66

77
const mode = binding.value != null ? binding.value : "start";
@@ -22,4 +22,4 @@ Vue.directive("trim-indents", {
2222
.map((line) => line.slice(spacesToTrim))
2323
.join("\n");
2424
},
25-
});
25+
};

0 commit comments

Comments
 (0)