muhahahhaa

This commit is contained in:
Bytetrex 2021-04-09 14:01:28 +08:00
parent d45a5bd9d0
commit 73fca4ff51
11 changed files with 647 additions and 609 deletions

View file

@ -20,25 +20,27 @@ export default {
Footer,
},
mounted() {
if (JSON.parse(localStorage.getItem("token"))) {
this.$store.commit("setToken", JSON.parse(localStorage.getItem("token")));
}
if (JSON.parse(localStorage.getItem("wind404"))) {
var wind = JSON.parse(localStorage.getItem("wind404"));
} else {
// eslint-disable-next-line no-redeclare
var wind = false;
const jwt = localStorage.getItem("token");
const wind = localStorage.getItem("wind404");
if (token) {
this.$store.commit("setToken", token);
}
if (wind) {
this.$store.commit("setWind", wind);
Object.assign(axios.defaults, {
headers: { Authorization: this.$store.state.user.token },
});
} else {
this.$store.commit("setWind", wind);
}
if (this.$store.state.debug) {
this.$buefy.snackbar.open({
message: this.$t("errors.devBuild"),
type: "is-warning",
});
}
if (this.$store.state.user.username) {
this.axios
.get(
process.env.VUE_APP_APIENDPOINT +
@ -63,12 +65,14 @@ export default {
type: "is-warning",
});
});
this.axios.get(
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"awards/eligibility"
);
}
},
};
</script>
@ -79,6 +83,6 @@ export default {
</style>
<style lang="css">
@import './assets/css/kaverti.css';
@import "./assets/css/kaverti.css";
@import "https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css";
</style>

View file

@ -5,7 +5,11 @@
}
main {
flex: 1 !important
flex: 1 !important;
}
.container {
max-width: 960px !important;
}
.large-icon {

View file

@ -260,9 +260,6 @@
<b-navbar-item tag="router-link" to="/teams">
{{ $t("navbar.teams") }}
</b-navbar-item>
<b-navbar-item tag="router-link" to="/games">
{{ $t("navbar.games") }}
</b-navbar-item>
<div
v-if="$store.state.debug"
class="navbar-item has-dropdown is-hoverable is-info"
@ -296,18 +293,9 @@
<b-navbar-item tag="router-link" to="/roadmap">{{
$t("navbar.more.roadmap")
}}</b-navbar-item>
<b-navbar-item tag="a" href="soon">{{
$t("navbar.more.documentation")
}}</b-navbar-item>
<b-navbar-item tag="router-link" to="/downloads">{{
$t("navbar.downloads")
}}</b-navbar-item>
<b-navbar-item tag="router-link" to="/stats">{{
$t("navbar.more.stats")
}}</b-navbar-item>
<b-navbar-item tag="router-link" to="/blog">{{
$t("navbar.more.blog")
}}</b-navbar-item>
</div>
</div>
</template>
@ -352,12 +340,6 @@
<b-navbar-item tag="router-link" to="/avatar">{{
$t("navbar.user.avatar")
}}</b-navbar-item>
<b-navbar-item tag="router-link" to="/creations">{{
$t("navbar.user.creations")
}}</b-navbar-item>
<b-navbar-item tag="router-link" to="/downloads">{{
$t("navbar.user.downloads")
}}</b-navbar-item>
<b-navbar-item
tag="router-link"
to="/admin"

View file

@ -1,68 +1,69 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Buefy, {Snackbar} from 'buefy'
import axios from 'axios'
import VueAxios from 'vue-axios'
import i18n from './i18n'
import moment from 'moment'
import VMdEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import enUS from '@kangc/v-md-editor/lib/lang/en-US';
import createHljsTheme from '@kangc/v-md-editor/lib/theme/hljs';
import json from 'highlight.js/lib/languages/json';
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Buefy, { Snackbar } from "buefy";
import axios from "axios";
import VueAxios from "vue-axios";
import i18n from "./i18n";
import moment from "moment";
import VMdEditor from "@kangc/v-md-editor";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import enUS from "@kangc/v-md-editor/lib/lang/en-US";
import createHljsTheme from "@kangc/v-md-editor/lib/theme/hljs";
import json from "highlight.js/lib/languages/json";
const hljsTheme = createHljsTheme();
import io from 'socket.io-client'
import io from "socket.io-client"
import VueSocketIO from "vue-socket.io";
import NProgress from "vue-nprogress";
Vue.use(NProgress)
const nprogress = new NProgress()
Vue.use(NProgress);
const nprogress = new NProgress();
Vue.use(
new VueSocketIO({
debug: true,
connection: io(process.env.VUE_APP_GATEWAYENDPOINT), // options object is Optional
})
);
Vue.use(VMdEditor)
VMdEditor.lang.use('en-US', enUS);
Vue.use(VMdEditor);
Vue.use(VueAxios, axios);
Vue.use(Buefy);
// Axios Headers
const jwtToken = localStorage.getItem("token");
axios.defaults.headers.common["Authorization"] = jwtToken;
Vue.config.productionTip = false;
Vue.prototype.$snackbar = Snackbar;
// BBCode Configuration
VMdEditor.lang.use("en-US", enUS);
hljsTheme.extend((md, hljs) => {
md.set({
html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />).
// This is only for full CommonMark compatibility.
breaks: true, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be
// useful for external highlighters.
linkify: true, // Autoconvert URL-like text to links
html: false,
xhtmlOut: false,
breaks: true,
langPrefix: "language-",
linkify: true,
image: false,
// Enable some language-neutral replacement + quotes beautification
typographer: true,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '\xA0', '\xA0'] for French (including nbsp).
quotes: '“”‘’'
})
md.disable('image')
hljs.registerLanguage('json', json);
quotes: "“”‘’"
});
Vue.use(VueAxios, axios)
Vue.use(Buefy)
Vue.config.productionTip = false
Vue.prototype.$snackbar = Snackbar
Vue.filter('formatDate', function(value) {
md.disable("image");
hljs.registerLanguage("json", json);
});
// Date Format Configuration
Vue.filter("formatDate", function(value) {
if (value) {
return moment(String(value)).format('hh:mm A, DD/MM/YYYY')
return moment(String(value)).format("hh:mm A, DD/MM/YYYY");
}
})
});
new Vue({
nprogress,
router,
store,
i18n,
render: h => h(App)
}).$mount('#app')
}).$mount("#app");

View file

@ -27,12 +27,12 @@
>
<NoItems connection="true"></NoItems>
</div>
<div class="column is-7" v-if="!threads.length && !loadingThreads">
<div class="column is-9" v-if="!threads.length && !loadingThreads">
<div class="box">
<NoItems type="forum threads"></NoItems>
</div>
</div>
<div class="column is-7" v-if="threads.length">
<div class="column is-9" v-if="threads.length">
<div class="content">
<article
class="thread_display box"

View file

@ -27,7 +27,7 @@
</div>
</div>
</div>
<div class="column is-7" v-if="!loading">
<div class="column is-8" v-if="!loading">
<div class="box">
<div class="title">
{{ $t('home.globalWall') }}

View file

@ -16,14 +16,14 @@
</b-menu-list>
</b-menu>
</div>
<div class="column is-7">
<div class="column is-9">
<router-view></router-view>
</div>
</div>
</div>
<div class="container" v-else>
<div class="columns is-centered">
<div class="column is-5">
<div class="column is-6">
<div class="box has-text-centered">
<i class="far fa-times-square large-icon"></i>
<div class="subtitle">{{ $t("generic.notLoggedIn") }}</div>

View file

@ -3,9 +3,10 @@
<section class="section">
<div class="container">
<div class="columns is-centered is-multiline" v-if="!loading">
<div v-if="!teams.length" class="column">
<br />
<NoItems :connection="true" type="users"> </NoItems>
<div class="column is-6" v-if="!teams.length">
<div class="box">
<NoItems :connection="true" type="teams"> </NoItems>
</div>
</div>
<Pagination
class="columns is-multiline"

View file

@ -1,10 +1,16 @@
<template>
<main>
<div class="section column">
<div id="transactions">
<section class="section">
<div class="container" v-if="$store.state.user.username">
<div class="columns is-centered">
<div class="column is-6">
<div class="box">
<h1 class="title">Transaction Log</h1>
<div class="title">Transaction Log</div>
<hr />
<NoItems v-if="!transactions.length" type="transactions"></NoItems>
<b-table
:detail-key='"log-" + transactions.id'
v-else
:detail-key="'log-' + transactions.id"
:data="transactions"
:paginated="isPaginated"
:per-page="perPage"
@ -20,47 +26,73 @@
aria-next-label="Next page"
aria-previous-label="Previous page"
aria-page-label="Page"
aria-current-label="Current page">
<b-table-column field="props.row.text" label="Message" sortable v-slot="props">
>
<b-table-column
field="props.row.text"
label="Message"
sortable
v-slot="props"
>
{{ props.row.text }}
</b-table-column>
<b-table-column field="props.row.priceOfPurchase" label="Price" sortable v-slot="props">
<b-table-column
field="props.row.priceOfPurchase"
label="Price"
sortable
v-slot="props"
>
{{ props.row.priceOfPurchase }}
</b-table-column>
<b-table-column field="props.row.createdAt" label="Date" sortable centered v-slot="props">
<b-table-column
field="props.row.createdAt"
label="Date"
sortable
centered
v-slot="props"
>
<span class="tag is-success">
{{ new Date(props.row.createdAt).toLocaleDateString() }}
</span>
</b-table-column>
</b-table>
</div>
<NoItems v-if="!transactions.length" type="transactions"></NoItems>
</div>
</main>
</div>
</div>
<div class="container" v-else>
<div class="columns is-centered">
<div class="column is-6">
<div class="box has-text-centered">
<i class="far fa-times-square large-icon"></i>
<div class="subtitle">{{ $t("generic.notLoggedIn") }}</div>
</div>
</div>
</div>
</div>
</section>
</div>
</template>
<script>
import AjaxErrorHandler from '.././assets/js/errorHandler';
import NoItems from '../components/NoItems'
import AjaxErrorHandler from ".././assets/js/errorHandler";
import NoItems from "../components/NoItems";
export default {
name: 'Transactions',
name: "Transactions",
components: {
NoItems
NoItems,
},
data() {
return {
search: '',
search: "",
transactions: [],
isPaginated: true,
isPaginationSimple: false,
isPaginationRounded: false,
paginationPosition: 'bottom',
defaultSortDirection: 'desc',
sortIcon: 'arrow-up',
sortIconSize: 'is-small',
paginationPosition: "bottom",
defaultSortDirection: "desc",
sortIcon: "arrow-up",
sortIconSize: "is-small",
currentPage: 1,
perPage: 30,
defaultOpenedDetails: [1],
@ -71,49 +103,53 @@ export default {
limit: 15,
showTeamTab: 0,
tcreateProd: {
username: '',
name: '',
username: "",
name: "",
loading: false,
errors: {
username: '',
name: ''
}
username: "",
name: "",
},
},
roleOptions: [
{ name: 'Admins', value: 'admin' },
{ name: 'transactions', value: 'user' }
{ name: "Admins", value: "admin" },
{ name: "transactions", value: "user" },
],
roleSelected: ['admin', 'user'],
roleSelected: ["admin", "user"],
tableSort: {
column: 'username',
sort: 'desc'
}
}
column: "username",
sort: "desc",
},
};
},
methods: {
fetchData() {
if (this.offset === null) return;
let url = process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `transactions?
let url =
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
`/` +
`transactions?
sort=${this.tableSort.column}
&order=${this.tableSort.sort}
&offset=${this.offset}
`;
if (this.roleSelected.length === 1) {
url += '&role=' + this.roleSelected[0];
url += "&role=" + this.roleSelected[0];
}
if (this.search.length) {
url += '&search=' + encodeURIComponent(this.search.trim());
url += "&search=" + encodeURIComponent(this.search.trim());
}
this.loading = true;
this.axios
.get(url)
.then(res => {
.then((res) => {
this.transactions.push(...res.data);
this.loading = /*loading =*/ false;
@ -125,7 +161,7 @@ export default {
this.offset += this.limit;
}
})
.catch(e => {
.catch((e) => {
AjaxErrorHandler(this.$store)(e);
this.loading = /*loading =*/ false;
});
@ -135,26 +171,35 @@ export default {
this.transactions = [];
this.fetchData();
}
},
},
getNewertransactions() {
this.loadingNewer = true
this.loadingNewer = true;
this.axios
.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'transactions' + '?limit=' + this.newtransactions)
.then(res => {
this.loadingNewer = false
this.newtransactions = 0
.get(
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"transactions" +
"?limit=" +
this.newtransactions
)
.then((res) => {
this.loadingNewer = false;
this.newtransactions = 0;
this.threads.unshift(...res.data.Threads)
this.threads.unshift(...res.data.Threads);
})
.catch((e) => {
this.loadingNewer = false
AjaxErrorHandler(this.$store)(e)
})
this.loadingNewer = false;
AjaxErrorHandler(this.$store)(e);
});
},
mounted() {
if (this.$store.state.user.username) {
this.fetchData();
}
}
},
};
</script>

View file

@ -3,7 +3,7 @@
<section class="section">
<div class="container">
<div class="columns is-centered" v-if="exists">
<div class="column is-3 is-vcentered has-text-centered">
<div class="column is-4 is-vcentered has-text-centered">
<h1 class="title">
{{ user.username }}&nbsp;<Badges
:username="user.username"
@ -95,7 +95,7 @@
{{ $t("user.marketplace") }}:
</div>
</div>
<div class="column is-6 is-vcentered has-text-centered">
<div class="column is-8 is-vcentered has-text-centered">
<h1 class="title">{{ $t("user.more") }} {{ user.username }}</h1>
<div>
<div class="tabs">

View file

@ -3,10 +3,11 @@
<section class="section">
<div class="container">
<div class="columns is-centered is-multiline" v-if="!loading">
<div v-if="!users.length" class="column">
<br />
<div class="column is-6" v-if="!users.length">
<div class="box">
<NoItems :connection="true" type="users"> </NoItems>
</div>
</div>
<Pagination
class="columns is-multiline"
v-if="users.length"