fixed some bugs

This commit is contained in:
supertiger1234 2020-02-26 20:17:57 +00:00
parent 42cdb93fb6
commit ffc29b1ee0
11 changed files with 131 additions and 75 deletions

View file

@ -72,15 +72,30 @@
security security
</div> </div>
</div> </div>
</div> <!-- <div
<div data-name="profile"
data-name="Settings" class="item settings"
class="item material-icons" @click="openSettings"
@click="openSettings" @mouseleave="mouseLeaveEvent"
@mouseleave="mouseLeaveEvent" @mouseenter="localToolTipEvent(`${user.username}:${user.tag}`, $event)"
@mouseenter="localToolTipEvent('Settings', $event)" >
> <div
settings class="status-avatar"
:style="`border: solid 3px ${getStatusColor}`"
>
<img class="avatar" :src="avatarDomain + '/' + user.avatar" />
</div>
</div> -->
<div
data-name="Settings"
class="item material-icons settings"
@click="openSettings"
@mouseleave="mouseLeaveEvent"
@mouseenter="localToolTipEvent('Settings', $event)"
>
settings
</div>
</div> </div>
</div> </div>
</template> </template>
@ -90,6 +105,7 @@ import { bus } from "@/main.js";
import config from "@/config.js"; import config from "@/config.js";
import settingsService from "@/services/settingsService"; import settingsService from "@/services/settingsService";
import { isMobile } from "@/utils/Mobile"; import { isMobile } from "@/utils/Mobile";
import statuses from "@/utils/statuses";
export default { export default {
data() { data() {
return { return {
@ -176,6 +192,10 @@ export default {
} }
}, },
computed: { computed: {
getStatusColor() {
const status = this.$store.getters.user.status || 0;
return statuses[parseInt(status)].color;
},
mobileSize() { mobileSize() {
return ( return (
this.$mq === "mobile" && this.$mq === "mobile" &&
@ -208,7 +228,7 @@ export default {
this.currentTab !== 2) this.currentTab !== 2)
); );
}); });
const mentioned = notifications.find(m => m.mentioned); const mentioned = notificationsFiltered.find(m => m.mentioned);
return { return {
notification: !!notificationsFiltered.length, notification: !!notificationsFiltered.length,
mentioned: !!mentioned mentioned: !!mentioned
@ -256,7 +276,7 @@ export default {
} }
.mobile { .mobile {
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
padding-left: 10px;
width: initial; width: initial;
.item { .item {
width: 40px; width: 40px;
@ -269,12 +289,38 @@ export default {
top: -29px; top: -29px;
} }
} }
.status-avatar {
height: 30px;
width: 30px;
border-radius: 50%;
.avatar {
height: 30px;
width: 30px;
border-radius: 50%;
object-fit: cover;
}
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.settings {
margin-right: 14px;
}
.container { .container {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: auto;
} }
.container {
scrollbar-width: thin;
}
.container::-webkit-scrollbar {
height: 3px;
}
.navigation-items { .navigation-items {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -282,7 +328,6 @@ export default {
height: 100%; height: 100%;
align-self: flex-start; align-self: flex-start;
align-content: center; align-content: center;
flex-shrink: 0;
} }
.item { .item {
font-size: 24px; font-size: 24px;

View file

@ -12,7 +12,7 @@
/> />
<div class="information"> <div class="information">
<div class="username">{{ user.username }}</div> <div class="username">{{ user.username }}</div>
<div class="tag">@{{ user.tag }}</div> <div class="tag">:{{ user.tag }}</div>
</div> </div>
<div <div
class="status-button" class="status-button"

View file

@ -14,7 +14,7 @@
class="tag" class="tag"
v-model="input" v-model="input"
type="text" type="text"
placeholder="pancake@time" placeholder="pancake:time"
/> />
<input <input
class="button" class="button"
@ -62,7 +62,7 @@ export default {
this.success = null; this.success = null;
this.requestSent = true; this.requestSent = true;
const split = this.input.trim().split("@"); const split = this.input.trim().split(":");
// validation // validation
if ( if (
split.length < 2 || split.length < 2 ||

View file

@ -23,7 +23,7 @@
</div> </div>
<div class="item" @click="copyUserTag"> <div class="item" @click="copyUserTag">
<div class="material-icons icon-cat">developer_board</div> <div class="material-icons icon-cat">developer_board</div>
<div class="name">Copy User@Tag</div> <div class="name">Copy User:Tag</div>
</div> </div>
<div class="item" @click="copyID"> <div class="item" @click="copyID">
<div class="material-icons icon-cat">developer_board</div> <div class="material-icons icon-cat">developer_board</div>
@ -79,7 +79,7 @@ export default {
const user = this.$store.getters["members/members"][ const user = this.$store.getters["members/members"][
this.contextDetails.uniqueID this.contextDetails.uniqueID
]; ];
const userTag = user.username + "@" + user.tag; const userTag = user.username + ":" + user.tag;
this.closeMenu(); this.closeMenu();
this.$clipboard(userTag); this.$clipboard(userTag);
}, },
@ -109,9 +109,9 @@ export default {
const mainMenuY = parseInt(mainMenu.style.top, 10); const mainMenuY = parseInt(mainMenu.style.top, 10);
const mainMenuX = parseInt(mainMenu.style.left, 10); const mainMenuX = parseInt(mainMenu.style.left, 10);
rolesMenu.style.top = rolesMenu.style.top = mainMenuY + 120 + "px";
mainMenuY + mainMenu.clientHeight - rolesMenu.clientHeight + "px";
rolesMenu.style.left = mainMenuX - mainMenu.clientWidth - 11 + "px"; rolesMenu.style.left = mainMenuX - mainMenu.clientWidth - 21 + "px";
}); });
}, },
setPosition() { setPosition() {

View file

@ -59,7 +59,7 @@ export default {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
z-index: 99; z-index: 99999999;
display: flex; display: flex;
color: white; color: white;
} }
@ -73,21 +73,28 @@ export default {
padding: 10px; padding: 10px;
overflow: hidden; overflow: hidden;
box-shadow: 0px 0px 20px 5px #151515bd; box-shadow: 0px 0px 20px 5px #151515bd;
background: linear-gradient(#0b4155, #01677e); background: linear-gradient(
to bottom,
rgba(0, 87, 153, 0.8) 0,
rgba(0, 118, 209, 0.8)
);
border-radius: 4px; border-radius: 4px;
backdrop-filter: blur(5px);
} }
.survay-icon .material-icons { .survay-icon .material-icons {
color: white; color: white;
font-size: 120px; font-size: 70px;
} }
.survay-icon { .survay-icon {
margin: auto; margin: auto;
margin-top: 5px; margin-top: 5px;
margin-bottom: 10px;
} }
.text { .text {
margin: auto; margin: auto;
text-align: center; text-align: center;
margin-top: 10px;
} }
.buttons { .buttons {
display: flex; display: flex;
@ -96,21 +103,22 @@ export default {
.button { .button {
padding: 10px; padding: 10px;
margin: 3px; margin: 3px;
background: #014656; background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
transition: 0.3s; transition: 0.3s;
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
} }
.valid { .valid {
background: #014656; background: rgba(0, 0, 0, 0.2);
} }
.valid:hover { .valid:hover {
background: #02303c; background: rgba(0, 0, 0, 0.4);
} }
.warning { .warning {
background: rgba(255, 27, 27, 0.589); background: rgba(255, 67, 67, 0.7);
} }
.warning:hover { .warning:hover {
background: rgb(255, 27, 27); background: rgba(255, 67, 67, 0.9);
} }
</style> </style>

View file

@ -14,7 +14,7 @@
/> />
<div class="uesrname-tag"> <div class="uesrname-tag">
<div class="username">{{ user.username }}</div> <div class="username">{{ user.username }}</div>
<div class="tag">@{{ user.tag }}</div> <div class="tag">:{{ user.tag }}</div>
</div> </div>
<!-- <div class="details"> <!-- <div class="details">
Pancake Male 17-19 United Kingdom Pancake Male 17-19 United Kingdom

View file

@ -133,8 +133,8 @@ export default {
font-size: 15px; font-size: 15px;
position: absolute; position: absolute;
z-index: 115651; z-index: 115651;
top: 5px; top: 10px;
right: 5px; right: 10px;
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; border-radius: 50%;

View file

@ -8,6 +8,9 @@
<theme-template <theme-template
v-for="theme in publicThemes" v-for="theme in publicThemes"
:key="theme.id" :key="theme.id"
:appliedTheme="appliedTheme"
@applyTheme="applyTheme"
@unapplyTheme="unapplyTheme"
:theme="theme" :theme="theme"
/> />
</div> </div>
@ -20,16 +23,48 @@
import themeTemplate from "./themesTemplate"; import themeTemplate from "./themesTemplate";
import exploreService from "@/services/exploreService"; import exploreService from "@/services/exploreService";
import Spinner from "@/components/Spinner"; import Spinner from "@/components/Spinner";
const cssZip = () => import("@/utils/cssZip");
export default { export default {
components: { themeTemplate, Spinner }, components: { themeTemplate, Spinner },
data() { data() {
return { return {
publicThemes: null, publicThemes: null,
params: "?verified=true" params: "?verified=true",
appliedTheme: null
}; };
}, },
methods: { methods: {
async unapplyTheme() {
this.appliedTheme = null;
localStorage.removeItem("appliedThemeId");
document.getElementById("theme").outerHTML = "";
},
async applyTheme(id) {
// get css
const { ok, result } = await exploreService.applyTheme(id);
if (ok) {
const css = result.data.css;
const id = result.data.id;
// save to local storage.
localStorage.setItem("appliedThemeId", id);
const styleEl = document.createElement("style");
styleEl.classList.add("theme-" + id);
styleEl.id = "theme";
cssZip().then(utils => {
styleEl.innerHTML = utils.unzip(css) || css;
const currentStyle = document.getElementById("theme");
if (currentStyle) {
currentStyle.outerHTML = styleEl.outerHTML;
} else {
document.head.innerHTML += styleEl.outerHTML;
}
this.appliedTheme = id;
});
}
},
async getThemesList() { async getThemesList() {
this.publicThemes = null; this.publicThemes = null;
const { ok, result } = await exploreService.getThemes(); const { ok, result } = await exploreService.getThemes();
@ -39,6 +74,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.appliedTheme = localStorage.getItem("appliedThemeId");
this.getThemesList(); this.getThemesList();
} }
}; };

View file

@ -39,45 +39,20 @@
<script> <script>
import config from "@/config.js"; import config from "@/config.js";
import exploreService from "@/services/exploreService";
const cssZip = () => import("@/utils/cssZip");
export default { export default {
props: ["theme"], props: ["theme", "appliedTheme"],
data() { data() {
return { return {
joinClicked: false, bannerDomain: config.domain + "/media/"
bannerDomain: config.domain + "/media/",
appliedTheme: null
}; };
}, },
methods: { methods: {
async applyButton() { async applyButton() {
// get css this.$emit("applyTheme", this.theme.id)
const { ok, result } = await exploreService.applyTheme(this.theme.id); },
if (ok) { unApplyButton() {
const css = result.data.css; this.$emit("unapplyTheme", this.theme.id)
const id = result.data.id;
// save to local storage.
localStorage.setItem("appliedThemeId", id);
const styleEl = document.createElement("style");
styleEl.classList.add("theme-" + id);
styleEl.id = "theme";
cssZip().then(utils => {
styleEl.innerHTML = utils.unzip(css) || css;
const currentStyle = document.getElementById("theme");
if (currentStyle) {
currentStyle.outerHTML = styleEl.outerHTML;
} else {
document.head.innerHTML += styleEl.outerHTML;
}
this.appliedTheme = id;
});
}
}, },
bannerImageClicked() { bannerImageClicked() {
this.$store.dispatch( this.$store.dispatch(
@ -85,16 +60,7 @@ export default {
this.bannerDomain + this.theme.screenshot + "?type=webp" this.bannerDomain + this.theme.screenshot + "?type=webp"
); );
}, },
unApplyButton() { }
this.appliedTheme = null;
localStorage.removeItem("appliedThemeId");
document.getElementById("theme").outerHTML = "";
}
},
mounted() {
this.appliedTheme = localStorage.getItem("appliedThemeId");
},
computed: {}
}; };
</script> </script>

View file

@ -12,7 +12,7 @@
/> />
<div class="information"> <div class="information">
<div class="username">{{ user.username }}</div> <div class="username">{{ user.username }}</div>
<div class="tag">@{{ user.tag }}</div> <div class="tag">:{{ user.tag }}</div>
</div> </div>
<div class="buttons"> <div class="buttons">
<i class="material-icons warn" @click="logOut">exit_to_app</i> <i class="material-icons warn" @click="logOut">exit_to_app</i>

View file

@ -109,6 +109,7 @@ const actions = {
}, },
deleteMessage(context, { channelID, messageID }) { deleteMessage(context, { channelID, messageID }) {
const messages = context.state.messages[channelID]; const messages = context.state.messages[channelID];
if (!messages) return;
messages.find((obj, index) => { messages.find((obj, index) => {
if (obj.messageID === messageID) { if (obj.messageID === messageID) {
context.commit("deleteMessage", { channelID, index }); context.commit("deleteMessage", { channelID, index });