More features

This commit is contained in:
Troplo 2021-01-21 00:08:04 +11:00
parent 068e931a7d
commit e1369dfab5
11 changed files with 318 additions and 275 deletions

3
assets/css/kaverti.css Normal file
View file

@ -0,0 +1,3 @@
.large-icon {
font-size: 60px;
}

View file

@ -1,242 +1,3 @@
body { /*
padding-bottom: 30px!important; Soon
position: relative!important; */
min-height: 100%!important;
}
a {
transition: background 0.2s, color 0.2s!important;
}
a:hover,
a:focus {
text-decoration: none!important;
}
#wrapper {
padding-left: 0!important;
transition: all 0.5s ease!important;
position: relative!important;
}
#sidebar-wrapper {
z-index: 1000!important;
position: fixed!important;
left: 250px!important;
width: 0!important;
height: 100%!important;
margin-left: -250px!important;
overflow-y: auto!important;
overflow-x: hidden!important;
background: #222!important;
transition: all 0.5s ease!important;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px!important;
}
.sidebar-brand {
position: absolute!important;
top: 0!important;
width: 250px!important;
text-align: center!important;
padding: 20px 0!important;
}
.sidebar-brand h2 {
margin: 0!important;
font-weight: 600!important;
font-size: 24px!important;
color: #fff!important;
}
.sidebar-nav {
position: absolute!important;
top: 75px!important;
width: 250px!important;
margin: 0!important;
padding: 0!important;
list-style: none!important;
}
.sidebar-nav > li {
text-indent: 10px!important;
line-height: 42px!important;
}
.sidebar-nav > li a {
display: block!important;
text-decoration: none!important;
color: #757575!important;
font-weight: 600!important;
font-size: 18px!important;
}
.sidebar-nav > li > a:hover,
.sidebar-nav > li.active > a {
text-decoration: none!important;
color: #fff!important;
background: #F8BE12!important;
}
.sidebar-nav > li > a i.fa {
font-size: 24px!important;
width: 60px!important;
}
#navbar-wrapper {
width: 100%!important;
position: absolute!important;
z-index: 2!important;
}
#wrapper.toggled #navbar-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
#navbar-wrapper .navbar {
border-width: 0 0 0 0!important;
background-color: #eee!important;
font-size: 24px!important;
margin-bottom: 0!important;
border-radius: 0!important;
}
#navbar-wrapper .navbar a {
color: #757575!important;
}
#navbar-wrapper .navbar a:hover {
color: #F8BE12!important;
}
#content-wrapper {
width: 100%!important;
position: absolute!important;
padding: 15px!important;
top: 100px!important;
}
#wrapper.toggled #content-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
@media (min-width: 992px) {
#wrapper {
padding-left: 250px!important;
}
#wrapper.toggled {
padding-left: 60px!important;
}
#sidebar-wrapper {
width: 250px!important;
}
#wrapper.toggled #sidebar-wrapper {
width: 60px!important;
}
#wrapper.toggled #navbar-wrapper {
position: absolute!important;
margin-right: -190px!important;
}
#wrapper.toggled #content-wrapper {
position: absolute!important;
margin-right: -190px!important;
}
#navbar-wrapper {
position: relative!important;
}
#wrapper.toggled {
padding-left: 60px!important;
}
#content-wrapper {
position: relative!important;
top: 0!important;
}
#wrapper.toggled #navbar-wrapper,
#wrapper.toggled #content-wrapper {
position: relative!important;
margin-right: 60px!important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
#wrapper {
padding-left: 60px!important;
}
#sidebar-wrapper {
width: 60px!important;
}
#wrapper.toggled #navbar-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
#wrapper.toggled #content-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
#navbar-wrapper {
position: relative!important;
}
#wrapper.toggled {
padding-left: 250px!important;
}
#content-wrapper {
position: relative!important;
top: 0!important;
}
#wrapper.toggled #navbar-wrapper,
#wrapper.toggled #content-wrapper {
position: relative!important;
margin-right: 250px!important;
}
}
@media (max-width: 767px) {
#wrapper {
padding-left: 0!important;
}
#sidebar-wrapper {
width: 0!important;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px!important;
}
#wrapper.toggled #navbar-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
#wrapper.toggled #content-wrapper {
position: absolute!important;
margin-right: -250px!important;
}
#navbar-wrapper {
position: relative!important;
}
#wrapper.toggled {
padding-left: 250px!important;
}
#content-wrapper {
position: relative!important;
top: 0!important;
}
#wrapper.toggled #navbar-wrapper,
#wrapper.toggled #content-wrapper {
position: relative!important;
margin-right: 250px!important;
}
}

View file

@ -3,9 +3,7 @@
</style> </style>
<style> <style>
@import 'https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css'; @import 'https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css';
.large-icon { @import '../assets/css/kaverti.css';
font-size: 60px;
}
</style> </style>
<template> <template>
<div id="app"> <div id="app">
@ -54,6 +52,8 @@ export default {
this.$store.commit('setKoins', res.data.koins) this.$store.commit('setKoins', res.data.koins)
this.$store.commit('setID', res.data.id) this.$store.commit('setID', res.data.id)
this.$store.commit('setBot', res.data.bot) this.$store.commit('setBot', res.data.bot)
this.$store.commit('setDescription', res.data.description)
this.$store.commit('setExecutive', res.data.executive)
}).catch(() => { }).catch(() => {
this.$buefy.snackbar.open({message:this.$t('errors.down'), type: 'is-warning'}) this.$buefy.snackbar.open({message:this.$t('errors.down'), type: 'is-warning'})
}) })

View file

@ -96,7 +96,7 @@
<b-button <b-button
class='button is-info' class='button is-info'
:loading='settings.general.description.loading' :loading='settings.general.description.loading'
@click='fakeUser()' @click='saveDesc()'
> >
{{$t('settings.general.saveDesc')}} {{$t('settings.general.saveDesc')}}
</b-button> </b-button>
@ -107,7 +107,7 @@
<b-button <b-button
class='button is-info' class='button is-info'
:loading='settings.general.preferences.loading' :loading='settings.general.preferences.loading'
@click='fakeUser()' @click='savePref()'
> >
{{$t('settings.general.savePref')}} {{$t('settings.general.savePref')}}
</b-button> </b-button>
@ -447,6 +447,46 @@ export default {
}, },
}, },
methods: { methods: {
savePref() {
this.preferences.error = ''
this.preferences.loading = true
this.axios
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'users/preferences', {
developerMode: this.preferences.developerMode
})
.then(() => {
this.preferences.loading = false
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo')
.then(res => {
this.$store.commit('setUsername', res.data.username)
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setDevMode', res.data.developerMode)
})
})
.catch(e => {
this.preferences.loading = false
AjaxErrorHandler(this.$store)(e)
})
},
saveDesc() {
this.description.error = ''
this.description.loading = true
this.axios
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'users/preferences', {
description: this.description.value
})
.then(() => {
this.description.loading = false
})
.catch(e => {
this.description.loading = false
AjaxErrorHandler(this.$store)(e)
})
},
getBannerId() { getBannerId() {
if(localStorage.getItem(this.$store.state.client.bannerId)) { if(localStorage.getItem(this.$store.state.client.bannerId)) {
this.showBanner = false this.showBanner = false
@ -469,13 +509,10 @@ export default {
agree: this.register.agree agree: this.register.agree
}).then((res) => { }).then((res) => {
this.register.loading = false this.register.loading = false
this.$store.commit('setUsername', res.data.username) this.registerModal = false
this.$store.commit('setAvatar', res.data.avatar)
this.$store.commit('setID', res.data.id)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setToken', res.data.token) this.$store.commit('setToken', res.data.token)
localStorage.setItem('token', JSON.stringify(res.data.token));
this.getInfo()
this.$buefy.snackbar.open({message:this.$t('errors.registered'), type: 'is-info'}) this.$buefy.snackbar.open({message:this.$t('errors.registered'), type: 'is-info'})
}).catch(e => { }).catch(e => {
this.register.loading = false this.register.loading = false
@ -566,13 +603,43 @@ export default {
this.$store.commit('fakeUser') this.$store.commit('fakeUser')
this.$buefy.snackbar.open(`WARNING: You have fake authenticated, you do not have authenticated API access. Use for debug purposes only.`) this.$buefy.snackbar.open(`WARNING: You have fake authenticated, you do not have authenticated API access. Use for debug purposes only.`)
Object.assign(axios.defaults, {headers: {Authorization: this.$store.state.user.token}}) Object.assign(axios.defaults, {headers: {Authorization: this.$store.state.user.token}})
},
getInfo() {
Object.assign(axios.defaults, {headers: {Authorization: this.$store.state.user.token}})
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
.then(res => {
this.$store.commit('setSettings', res.data)
this.$store.commit('setVersion', res.data.latestCanaryVersion)
this.$store.commit('setAPIVersion', res.data.latestAPIVersion)
}).catch(() => {
this.$buefy.snackbar.open({message:this.$t('errors.down'), type: 'is-info'})
})
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo')
.then(res => {
this.$store.commit('setUsername', res.data.username)
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setKoins', res.data.koins)
this.$store.commit('setID', res.data.id)
this.$store.commit('setBot', res.data.bot)
this.$store.commit('setDescription', res.data.description)
this.$store.commit('setExecutive', res.data.executive)
this.settings.general.description.value = res.data.description
this.loading = false
}).catch(() => {
this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'})
this.loading = false
})
} }
}, },
mounted() { mounted() {
Object.assign(axios.defaults, {headers: {Authorization: this.$store.state.user.token}})
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state') this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
.then(res => { .then(res => {
this.$store.commit('setSettings', res.data) this.$store.commit('setSettings', res.data)
this.$store.commit('setVersion', res.data.latestCanaryVersion) this.$store.commit('setVersion', res.data.latestCanaryVersion)
this.$store.commit('setAPIVersion', res.data.latestAPIVersion)
}).catch(() => { }).catch(() => {
this.$buefy.snackbar.open({message:this.$t('errors.down'), type: 'is-info'}) this.$buefy.snackbar.open({message:this.$t('errors.down'), type: 'is-info'})
}) })
@ -585,12 +652,9 @@ export default {
this.$store.commit('setKoins', res.data.koins) this.$store.commit('setKoins', res.data.koins)
this.$store.commit('setID', res.data.id) this.$store.commit('setID', res.data.id)
this.$store.commit('setBot', res.data.bot) this.$store.commit('setBot', res.data.bot)
if(localStorage.getItem('usernameCache')) { this.$store.commit('setDescription', res.data.description)
localStorage.removeItem('usernameCache') this.$store.commit('setExecutive', res.data.executive)
localStorage.setItem('usernameCache', JSON.stringify(res.data.username)); this.settings.general.description.value = res.data.description
} else {
localStorage.setItem('usernameCache', JSON.stringify(res.data.username));
}
this.loading = false this.loading = false
}).catch(() => { }).catch(() => {
this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'}) this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'})

View file

@ -2,7 +2,7 @@
<div class="is-vcentered has-text-centered columns"> <div class="is-vcentered has-text-centered columns">
<div class="column is-vcentered has-text-centered" v-if="!connection"> <div class="column is-vcentered has-text-centered" v-if="!connection">
<i class="far fa-times-square large-icon"></i> <i class="far fa-times-square large-icon"></i>
<h1 class="subtitle">{{$t('generic.noItemsStart')}} {{type}} {{$t('generic.noItemsEnd')}}</h1> <h1 class="subtitle is-centered">{{$t('generic.noItemsStart')}} {{type}} {{$t('generic.noItemsEnd')}}</h1>
</div> </div>
<div class="column is-vcentered" v-if="connection"> <div class="column is-vcentered" v-if="connection">
<i class="far fa-times-square large-icon"></i> <i class="far fa-times-square large-icon"></i>

View file

@ -63,6 +63,12 @@ const routes = [
}, },
{ {
path: '/forums', path: '/forums',
redirect: '/forums/ALL',
name: 'Forums',
component: route('Forums')
},
{
path: '/forums/:category',
name: 'Forums', name: 'Forums',
component: route('Forums') component: route('Forums')
}, },

View file

@ -31,6 +31,14 @@ export default new Vuex.Store({
errors: null, errors: null,
modal: false modal: false
}, },
banned: {
banned: false,
message: "Not banned",
readOnlyMode: false,
ipBanned: false,
disableLogin: false,
expiry: "2020-01-01T00:00:00.000Z"
},
user: { user: {
id: 0, id: 0,
username: '', username: '',
@ -44,7 +52,8 @@ export default new Vuex.Store({
emailVerified: false, emailVerified: false,
modeler: false, modeler: false,
developerMode: false, developerMode: false,
executive: false executive: false,
description: ''
} }
}, },
mutations: { mutations: {
@ -59,6 +68,9 @@ export default new Vuex.Store({
setVersion(state, value) { setVersion(state, value) {
state.client.latestClientVersion = value state.client.latestClientVersion = value
}, },
setAPIVersion(state, value) {
state.client.latestAPIVersion = value
},
turnOffDebug(state) { turnOffDebug(state) {
state.debug = false state.debug = false
}, },
@ -86,6 +98,14 @@ export default new Vuex.Store({
setToken (state, value) { setToken (state, value) {
state.user.token = value state.user.token = value
}, },
setBanned (state, value) {
state.banned.message = value
state.banned.banned = value
state.banned.readOnlyMode = value
state.banned.disableLogin = value
state.banned.ipBanned = value
state.banned.expiry = value
},
setAvatar (state, value) { setAvatar (state, value) {
state.user.avatar = value state.user.avatar = value
}, },
@ -109,6 +129,12 @@ export default new Vuex.Store({
}, },
setAdmin (state, value) { setAdmin (state, value) {
state.user.admin = value state.user.admin = value
},
setExecutive (state, value) {
state.user.executive = value
},
setDescription (state, value) {
state.user.description = value
} }
}, },
actions: { actions: {

View file

@ -1,6 +1,6 @@
<template> <template>
<main> <main class="columns">
<div> <div class="column is-5">
<h1 class="title" v-if="createType === 0"> <h1 class="title" v-if="createType === 0">
Uploading a hat Uploading a hat
</h1> </h1>
@ -52,10 +52,18 @@
</a> </a>
</b-upload> </b-upload>
</b-field> </b-field>
<b-button v-if="createType === 0" @click="submitItem" :loading="loading">Submit</b-button> <div class="buttons">
<b-button v-if="createType === 1" @click="submitItem" :loading="loading">Submit</b-button> <b-button v-if="createType === 0" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 2" @click="submitItem" :loading="loading">Submit</b-button> <b-button v-if="createType === 1" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 3" @click="submitItem" :loading="loading">Submit</b-button> <b-button v-if="createType === 2" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 3" @click="submitItem" :loading="loading">Submit</b-button>
<b-button v-if="createType === 0" @click="previewItem" :loading="loadingPreview">Preview</b-button>
</div>
</div>
<div class="column is-5">
<h1 class="title">Preview Image</h1>
<img :src="'https://cdn.kaverti.com/marketplace/previews/' + preview" v-if="preview">
<h1 class="subtitle" v-if="!preview">Press preview to preview the hat as if it were uploaded on the Marketplace.</h1>
</div> </div>
</main> </main>
</template> </template>
@ -70,6 +78,8 @@ export default {
createType: 0, createType: 0,
stage: 1, stage: 1,
loading: false, loading: false,
loadingPreview: false,
preview: '',
item: { item: {
file: '', file: '',
fileObj: '', fileObj: '',
@ -86,6 +96,21 @@ export default {
} }
}, },
methods: { methods: {
previewItem() {
this.loadingPreview = true
const data = new FormData();
data.append('image', this.item.file);
data.append('fileObj', this.item.fileObj);
this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/preview/' + this.createType, data)
.then((res) => {
this.loadingPreview = false
this.preview = res.data.image
}).catch((e) => {
this.loadingPreview = false
AjaxErrorHandler(this.$store)(e)
})
},
submitItem() { submitItem() {
this.loading = true this.loading = true
const data = new FormData(); const data = new FormData();
@ -100,8 +125,9 @@ export default {
data.append('limited', this.item.limited); data.append('limited', this.item.limited);
data.append('quantityAllowed', this.item.quantity); data.append('quantityAllowed', this.item.quantity);
this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/upload/' + this.createType, data) this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/upload/' + this.createType, data)
.then(() => { .then((res) => {
this.loading = false this.loading = false
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/rerender/' + res.data.id)
}).catch((e) => { }).catch((e) => {
this.loading = false this.loading = false
AjaxErrorHandler(this.$store)(e) AjaxErrorHandler(this.$store)(e)

View file

@ -1,5 +1,153 @@
<template> <template>
<main> <main class="section">
<div class="columns is-multiline has-text-centered">
<div class="column is-2" v-if="!loadingCategory && categories.length">
<b-button class="is-info">Create thread</b-button>
<br><br>
<div class="box">
<router-link
:to='"/forums/ALL"'
>
<p class="subtitle is-link">All</p>
</router-link>
<router-link
v-for='(category, $index) in categories'
:key='"category-link-" + $index'
:to='"/forums/" + category.value'
>
<p class="subtitle is-link">{{category.name}}</p>
</router-link>
</div>
</div>
<div class="column is-2" v-if="loadingCategory">
<div class="box">
<p><b-skeleton></b-skeleton></p>
<p><b-skeleton></b-skeleton></p>
<p><b-skeleton></b-skeleton></p>
<p><b-skeleton></b-skeleton></p>
</div>
</div>
<div class="column is-2" v-if="!loadingCategory && !categories.length">
<div class="box">
<NoItems connection="true"></NoItems>
</div>
</div>
<div class="column box" v-if="!threads.length && !loadingThreads">
<NoItems type="forum threads"></NoItems>
</div>
<div class="column column is-9">
<div class="box content">
<article class="media" v-for='(thread) in threads' :key='"thread-" + thread.id'>
<figure class="media-left">
<p class="image is-64x64">
<img :src="'https://cdn.kaverti.com/user/avatars/headshot/' + thread.User.picture + '.png'">
</p>
By
{{thread.User.username}}
</figure>
<div class="media-content">
<div class="content">
<p>
<strong>{{thread.name}}</strong>
<br>
{{thread.Posts[0].plainText}}
</p>
</div>
<nav class="level is-mobile">
<div class="level-left">
<p>Created at:</p>
</div>
</nav>
</div>
<div class="media-right">
<button class="delete"></button>
</div>
</article>
</div>
</div>
</div>
</main> </main>
</template> </template>
<script>
import AjaxErrorHandler from "../../assets/js/errorHandler";
import NoItems from "../components/NoItems"
export default {
name: 'Forums',
props: ['username'],
components: {
NoItems
},
data() {
return {
categories: [],
loadingCategory: true,
loadingThreads: true,
threads: [],
selectedCategory: 'ALL'
}
},
methods: {
getThreads (initial) {
if(this.nextURL === null && !initial) return
let URL = process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'forums/category/' + this.selectedCategory
if(!initial) {
URL = this.nextURL || URL
}
this.loadingThreads = true
this.axios
.get(URL)
.then(res => {
this.loadingThreads = false
if(initial) {
this.threads = res.data.Threads
} else {
this.threads.push(...res.data.Threads)
}
this.nextURL = res.data.meta.nextURL
this.nextThreadsCount = res.data.meta.nextThreadsCount
})
.catch((e) => {
this.loadingThreads = false
AjaxErrorHandler(this.$store)(e)
})
},
},
watch: {
selectedCategory (newValue) {
this.$router.push('/forums/' + newValue.toLowerCase());
},
$route () {
this.selectedCategory = this.$route.path.split('/')[2].toUpperCase()
this.newThreads = 0
this.getThreads(true)
}
},
mounted() {
this.axios
.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + 'forums/category')
.then(res => {
this.categories = res.data
this.loadingCategory = false
})
.catch(e => {
this.loadingCategory = false
let invalidId = e.response.data.errors.find(error => {
return error.name === 'accountDoesNotExist'
})
if (invalidId) {
this.$store.commit('set404Page', true)
} else {
AjaxErrorHandler(this.$store)(e)
}
})
this.getThreads(true)
}
}
</script>

View file

@ -1,8 +1,11 @@
<template> <template>
<main> <main>
<div class="columns"> <div class="columns">
<div class="column" v-if="!awards.length">
<NoItems type="awards"></NoItems>
</div>
<div class="column is-4" v-for='(award) in awards' :key='"award-" + award.id'> <div class="column is-4" v-for='(award) in awards' :key='"award-" + award.id'>
<div class="box"> <div class="box" v-if="awards.length">
<b-tag v-if="award.Award.rarity === 'Common'">{{award.Award.rarity}}</b-tag> <b-tag v-if="award.Award.rarity === 'Common'">{{award.Award.rarity}}</b-tag>
<b-tag v-if="award.Award.rarity === 'Uncommon'">{{award.Award.rarity}}</b-tag> <b-tag v-if="award.Award.rarity === 'Uncommon'">{{award.Award.rarity}}</b-tag>
<b-tag v-if="award.Award.rarity === 'Rare'" class="is-warning">{{award.Award.rarity}}</b-tag> <b-tag v-if="award.Award.rarity === 'Rare'" class="is-warning">{{award.Award.rarity}}</b-tag>
@ -17,10 +20,13 @@
</template> </template>
<script> <script>
import AjaxErrorHandler from "../../assets/js/errorHandler"; import AjaxErrorHandler from "../../assets/js/errorHandler";
import NoItems from "../components/NoItems"
export default { export default {
name: 'UserAwards', name: 'UserAwards',
props: ['username'], props: ['username'],
components: {
NoItems
},
data() { data() {
return { return {
awards: [] awards: []

View file

@ -2,8 +2,7 @@
<main> <main>
<div class="columns is-multiline"> <div class="columns is-multiline">
<div class="column" v-if="!inventory.length"> <div class="column" v-if="!inventory.length">
<i class="far fa-times-square large-icon"></i> <NoItems type="inventory items"></NoItems>
<h1 class="subtitle">{{$t('user.inventoryTab.noItems')}}</h1>
</div> </div>
<div class="column is-4" v-for='(item) in inventory' :key='"item-" + item.id'> <div class="column is-4" v-for='(item) in inventory' :key='"item-" + item.id'>
<h1 class="subtitle">{{item.Item.name}}</h1> <h1 class="subtitle">{{item.Item.name}}</h1>
@ -19,10 +18,14 @@
</template> </template>
<script> <script>
import AjaxErrorHandler from "../../assets/js/errorHandler"; import AjaxErrorHandler from "../../assets/js/errorHandler";
import NoItems from "../components/NoItems"
export default { export default {
name: 'UserInventory', name: 'UserInventory',
props: ['username'], props: ['username'],
components: {
NoItems
},
data() { data() {
return { return {
inventory: [] inventory: []