mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-07-06 11:30:46 +00:00
more progress on updateServer
This commit is contained in:
parent
0d63363853
commit
a1e1c7d261
11 changed files with 141 additions and 43 deletions
|
|
@ -34,7 +34,7 @@
|
||||||
<profile-picture
|
<profile-picture
|
||||||
class="avatar"
|
class="avatar"
|
||||||
size="90px"
|
size="90px"
|
||||||
:url="tempImage"
|
:url="avatar + 'default'"
|
||||||
/>
|
/>
|
||||||
<!-- <div class="button">
|
<!-- <div class="button">
|
||||||
Browse Avatar Coming Soon!
|
Browse Avatar Coming Soon!
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
<profile-picture
|
<profile-picture
|
||||||
class="avatar"
|
class="avatar"
|
||||||
size="100px"
|
size="100px"
|
||||||
:url="tempImage"
|
:url="avatar + server.avatar"
|
||||||
/>
|
/>
|
||||||
<div class="server-name">
|
<div class="server-name">
|
||||||
{{ server.name }}
|
{{ server.name }}
|
||||||
|
|
@ -142,7 +142,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tab: 0,
|
tab: 0,
|
||||||
tempImage: config.domain + "/avatars/noob",
|
avatar: config.domain + "/avatars/",
|
||||||
serverName: "",
|
serverName: "",
|
||||||
serverNameError: null,
|
serverNameError: null,
|
||||||
inviteCode: "",
|
inviteCode: "",
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export default {
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: rgba(0, 0, 0, 0.541);
|
background: rgba(0, 0, 0, 0.541);
|
||||||
z-index: 1119111;
|
z-index: 1119999999999999111;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.inner {
|
.inner {
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,12 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
avatarChangeEvent(e) {
|
avatarChangeEvent(e) {
|
||||||
|
if (!this.googleDriveLinked) {
|
||||||
|
return this.$store.dispatch("setPopoutVisibility", {
|
||||||
|
name: "GDLinkMenu",
|
||||||
|
visibility: true
|
||||||
|
});
|
||||||
|
}
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
const _this = this;
|
const _this = this;
|
||||||
const maxSize = 2092000;
|
const maxSize = 2092000;
|
||||||
|
|
@ -114,6 +120,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
googleDriveLinked() {
|
||||||
|
return this.$store.getters['settingsModule/settings'].GDriveLinked
|
||||||
|
},
|
||||||
server() {
|
server() {
|
||||||
const serverID = this.$store.state.popoutsModule.serverSettings.serverID;
|
const serverID = this.$store.state.popoutsModule.serverSettings.serverID;
|
||||||
return this.$store.getters["servers/servers"][serverID];
|
return this.$store.getters["servers/servers"][serverID];
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,18 @@
|
||||||
<div class="settings-darken-background">
|
<div class="settings-darken-background">
|
||||||
<div class="settings-box">
|
<div class="settings-box">
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div
|
<div class="tab"
|
||||||
v-for="(tab, index) in tabs"
|
v-for="(tab, index) in tabs"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{tab: true, selected: currentTab === index}"
|
:class="{selected: currentTab === index}"
|
||||||
@click="currentTab = index"
|
@click="currentTab = index">
|
||||||
>
|
|
||||||
<div class="material-icons">{{tab.icon}}</div>
|
<div class="material-icons">{{tab.icon}}</div>
|
||||||
<div class="tab-name">{{tab.name}}</div>
|
<div class="tab-name">{{tab.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab warn" @click="logout">
|
||||||
|
<div class="material-icons">exit_to_app</div>
|
||||||
|
<div class="tab-name">Logout</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
|
@ -73,6 +76,10 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
logout() {
|
||||||
|
this.$store.dispatch("logout");
|
||||||
|
window.location.href = "/";
|
||||||
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$store.dispatch("setPopoutVisibility", {
|
this.$store.dispatch("setPopoutVisibility", {
|
||||||
name: "settings",
|
name: "settings",
|
||||||
|
|
@ -112,6 +119,7 @@ export default {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.panel {
|
.panel {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -139,9 +147,18 @@ export default {
|
||||||
background: rgb(61, 61, 61) !important;
|
background: rgb(61, 61, 61) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tab:hover {
|
.tab:hover {
|
||||||
background: rgba(61, 61, 61, 0.616);
|
background: rgba(61, 61, 61, 0.616);
|
||||||
}
|
}
|
||||||
|
.tab.warn{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
color: #f54949;
|
||||||
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
@ -218,6 +235,9 @@ export default {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
.tab.warn{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.tab {
|
.tab {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,48 @@
|
||||||
<div class="edit-profile">
|
<div class="edit-profile">
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="outer-input">
|
<form>
|
||||||
<div class="title">Username</div>
|
<div class="outer-input">
|
||||||
<div class="user-tag">
|
<div class="title">Username</div>
|
||||||
<input type="text" class="username" value="Fishie" />
|
<div class="user-tag">
|
||||||
<input type="text" class="tag" value="#awr3" />
|
<input type="text" class="username" :default-value.prop="user.username" @input="inputEvent('username', $event)"/>
|
||||||
|
|
||||||
|
<input type="text" class="tag" :default-value.prop="user.tag" @input="inputEvent('tag', $event)"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="outer-input">
|
||||||
<div class="outer-input">
|
<div class="title">Email</div>
|
||||||
<div class="title">Email</div>
|
<input type="email" autocomplete="off" :default-value.prop="user.email" @input="inputEvent('email', $event)"/>
|
||||||
<input type="text" value="Fishie" />
|
</div>
|
||||||
</div>
|
<div class="outer-input">
|
||||||
<div class="outer-input">
|
<div class="title">Current Password</div>
|
||||||
<div class="title">Current Password</div>
|
<input type="password" autocomplete="new-password" @input="inputEvent('password', $event)" />
|
||||||
<input type="password" value="fsfsdf" />
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="change-avatar">
|
<div class="change-avatar">
|
||||||
<div class="change-avatar-container">
|
<div class="change-avatar-container">
|
||||||
<profile-picture
|
<profile-picture
|
||||||
class="avatar"
|
class="avatar"
|
||||||
:url="avatar"
|
:url="update.avatar || avatar"
|
||||||
:admin="user.admin"
|
:admin="user.admin"
|
||||||
size="100px"
|
size="100px"
|
||||||
emote-size="30px"
|
emote-size="30px"
|
||||||
animation-padding="5px"
|
animation-padding="5px"
|
||||||
/>
|
/>
|
||||||
<div class="button">Change Avatar</div>
|
<div class="button" @click="$refs.avatarBrowser.click()">Change Avatar</div>
|
||||||
|
<input
|
||||||
|
ref="avatarBrowser"
|
||||||
|
type="file"
|
||||||
|
accept=".jpeg, .jpg, .png, .gif"
|
||||||
|
class="hidden"
|
||||||
|
@change="avatarChangeEvent"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="button save-button">Update</div>
|
<div class="button save-button" :class="{disabled: requestSent}" @click="updateProfile" v-if="changed">{{requestSent ? 'Saving...' : 'Update'}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -41,15 +51,69 @@
|
||||||
import ProfilePicture from "@/components/ProfilePictureTemplate.vue";
|
import ProfilePicture from "@/components/ProfilePictureTemplate.vue";
|
||||||
import userService from "@/services/userService.js";
|
import userService from "@/services/userService.js";
|
||||||
import config from "@/config.js";
|
import config from "@/config.js";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ProfilePicture },
|
components: { ProfilePicture },
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
requestSent: false,
|
||||||
|
changed: false,
|
||||||
|
update: {}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
inputEvent(name, event) {
|
||||||
|
this.$set(this.update, name, event.target.value)
|
||||||
|
},
|
||||||
|
avatarChangeEvent(event) {
|
||||||
|
if (!this.googleDriveLinked) {
|
||||||
|
return this.$store.dispatch("setPopoutVisibility", {
|
||||||
|
name: "GDLinkMenu",
|
||||||
|
visibility: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const file = event.target.files[0];
|
||||||
|
const _this = this;
|
||||||
|
const maxSize = 2092000;
|
||||||
|
if (file.size > maxSize) {
|
||||||
|
return this.$store.dispatch('setGenericMessage', "Image is larger than 2MB")
|
||||||
|
}
|
||||||
|
event.target.value = "";
|
||||||
|
const allowedFormats = [".png", ".jpeg", ".gif", ".jpg"];
|
||||||
|
if (!allowedFormats.includes(path.extname(file.name).toLowerCase())) {
|
||||||
|
return this.$store.dispatch('setGenericMessage', "That file format is not allowed!");
|
||||||
|
}
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
|
||||||
|
reader.onload = function () {
|
||||||
|
_this.$set(_this.update, 'avatar', reader.result);
|
||||||
|
};
|
||||||
|
reader.onerror = function (error) {
|
||||||
|
return this.$store.dispatch('setGenericMessage', "Something went wrong. Try again later.")
|
||||||
|
console.log('Error: ', error);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
async updateProfile() {
|
||||||
|
if (this.requestSent) return;
|
||||||
|
this.requestSent = true;
|
||||||
|
const {ok, result, error} = await userService.update(this.update)
|
||||||
|
this.requestSent = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
update(obj) {
|
||||||
|
if ( Object.keys(obj).length === 0 ){
|
||||||
|
return this.changed = false
|
||||||
|
}
|
||||||
|
this.changed = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {},
|
|
||||||
async mounted() {},
|
|
||||||
computed: {
|
computed: {
|
||||||
|
googleDriveLinked() {
|
||||||
|
return this.$store.getters['settingsModule/settings'].GDriveLinked
|
||||||
|
},
|
||||||
avatar() {
|
avatar() {
|
||||||
return config.domain + "/avatars/" + this.$store.getters.user.avatar;
|
return config.domain + "/avatars/" + this.$store.getters.user.avatar;
|
||||||
},
|
},
|
||||||
|
|
@ -67,7 +131,6 @@ export default {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-bottom: 40px;
|
|
||||||
}
|
}
|
||||||
.inner-content {
|
.inner-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -95,18 +158,22 @@ export default {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.button {
|
.button {
|
||||||
background: rgb(0, 119, 255);
|
background: #5394fc;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
.disabled {
|
||||||
|
background: grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 340px;
|
width: 340px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -141,14 +208,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.save-button {
|
.save-button {
|
||||||
position: absolute;
|
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
align-self: initial;
|
align-self: initial;
|
||||||
display: block;
|
display: block;
|
||||||
padding: 10px 0px 10px 0px;
|
padding: 10px 0px 10px 0px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,6 @@ export default {
|
||||||
return (this.alert.show = true);
|
return (this.alert.show = true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
logout() {
|
|
||||||
this.$store.dispatch("logout");
|
|
||||||
window.location.href = "/";
|
|
||||||
},
|
|
||||||
changePassword() {
|
changePassword() {
|
||||||
this.alert.content = "Not implemented yet.";
|
this.alert.content = "Not implemented yet.";
|
||||||
return (this.alert.show = true);
|
return (this.alert.show = true);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ const RegisterPage = () => import(/* webpackChunkName: "RegisterPage" */ "../src
|
||||||
export const router = new VueRouter({
|
export const router = new VueRouter({
|
||||||
mode: "history",
|
mode: "history",
|
||||||
routes: [
|
routes: [
|
||||||
|
{ name: "404", path: '*', beforeEnter(to, from, next) {
|
||||||
|
return window.location.href = "/404"
|
||||||
|
} },
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
name: "HomePage",
|
name: "HomePage",
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ export default {
|
||||||
get (uniqueID) {
|
get (uniqueID) {
|
||||||
return wrapper(instance().get(`user/${uniqueID}`))
|
return wrapper(instance().get(`user/${uniqueID}`))
|
||||||
},
|
},
|
||||||
|
update (data) {
|
||||||
|
return wrapper(instance().patch(`user`, data))
|
||||||
|
},
|
||||||
getSurvey() {
|
getSurvey() {
|
||||||
return wrapper(instance().get('/user/survey'));
|
return wrapper(instance().get('/user/survey'));
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ const config = [
|
||||||
date: "27/07/2019",
|
date: "27/07/2019",
|
||||||
headColor: "rgba(15, 65, 70, 0.77)",
|
headColor: "rgba(15, 65, 70, 0.77)",
|
||||||
new: [
|
new: [
|
||||||
|
"You can now enable desktop notifications by going in the settings.",
|
||||||
"We have re-added syntax highlighting and also improved the performance of message formatting. (Thanks to Bree!)",
|
"We have re-added syntax highlighting and also improved the performance of message formatting. (Thanks to Bree!)",
|
||||||
"Profile Setting has been re-designed. You can now edit your username, email and password!"
|
"Profile Setting has been re-designed. You can now edit your username, email and password!"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ function replace_custom_emoji(state, silent) {
|
||||||
state.posMax = idEnd
|
state.posMax = idEnd
|
||||||
|
|
||||||
let token = state.push('custom_emoji', 'img', 0);
|
let token = state.push('custom_emoji', 'img', 0);
|
||||||
token.attrs = [[ 'src', `${config.domain}/files/${emojiID}` ], [ 'alt', emojiName ]]
|
token.attrs = [[ 'src', `${config.domain}/media/${emojiID}` ], [ 'alt', emojiName ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
state.pos = idEnd + 1
|
state.pos = idEnd + 1
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<profile-picture
|
<profile-picture
|
||||||
class="avatar"
|
class="avatar"
|
||||||
size="100px"
|
size="100px"
|
||||||
:url="tempImage"
|
:url="domain + server.avatar"
|
||||||
/>
|
/>
|
||||||
<div class="server-name">
|
<div class="server-name">
|
||||||
{{ server.name }}
|
{{ server.name }}
|
||||||
|
|
@ -69,7 +69,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
isDay: true,
|
isDay: true,
|
||||||
server: null,
|
server: null,
|
||||||
tempImage: config.domain + "/avatars/noob",
|
domain: config.domain + "/avatars/",
|
||||||
loggedIn: localStorage.getItem('hauthid'),
|
loggedIn: localStorage.getItem('hauthid'),
|
||||||
errorMsg: ""
|
errorMsg: ""
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue