Skip to content

Commit

Permalink
fix(crisp): fix crisp location
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Mar 27, 2020
1 parent ce03946 commit 23803bf
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
46 changes: 43 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,15 @@ export default {
watch: {
'$route': [
'randomizeLogo',
'logRouteEvent'
'logRouteEvent',
'crispOpacityChanger'
],
'dark': ['onDarkChange']
},
beforeMount() {
this.routes = this.$router.options.routes.filter(el => !el.meta.hide);
this.$store.dispatch("data/fetch", false)
this.$store.dispatch("data/fetch", false);
this.crispOpacityChanger(this.$route)
},
created () {
// this.randomizeLogo();
Expand Down Expand Up @@ -447,7 +449,34 @@ export default {
window.$crisp.push(["on", "chat:initiated", function () {
// resolve safe-area
try {
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a").style.setProperty("bottom", "calc(max(env(safe-area-inset-bottom), 14px))", "important")
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a").style.setProperty("bottom", "calc(max(env(safe-area-inset-bottom), 14px))", "important");
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a > span:nth-child(2)").style.setProperty("box-shadow", "0 0 5px rgba(0, 0, 0, .4)", "important")
} catch (e) {
Console.error("failed to change crisp chat box bottom: ", e)
}
}])
Console.debug("(after init) dark status", this.dark, this.$vuetify.theme.dark);
// report current version
this.$ga.event(
'runtime',
'appInited',
'version',
config.version
);
// push crisp session
window.$crisp.push(["set", "session:data", [[
["loggedIn", this.$store.getters["auth/loggedIn"]],
["username", this.$store.getters["auth/username"]],
["language", this.$store.getters["settings/language"]],
["dark", this.$store.getters["settings/dark"]],
]]]);
window.$crisp.push(["on", "chat:initiated", function () {
// resolve safe-area
try {
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a").style.setProperty("bottom", "calc(max(env(safe-area-inset-bottom), 14px))", "important");
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a > span:nth-child(2)").style.setProperty("box-shadow", "0 0 5px rgba(0, 0, 0, .4)", "important")
} catch (e) {
Console.error("failed to change crisp chat box bottom: ", e)
Expand Down Expand Up @@ -513,6 +542,17 @@ export default {
} else if (newValue.name === "StatsByItem_Selected") {
this.$ga.event('result', 'fetch_' + this.$store.getters['dataSource/source'], newValue.params.itemId, 1)
}
},
crispOpacityChanger (newRoute) {
document.querySelector("div.crisp-client").style.setProperty("transition", "all 275ms cubic-bezier(0.165, 0.84, 0.44, 1)", "important");
if (newRoute.name === "home") {
document.querySelector("div.crisp-client").style.setProperty("opacity", 1, "important");
// document.querySelector("div.crisp-client").style.setProperty("transform", "translateY(0px)", "important")
} else {
document.querySelector("div.crisp-client").style.setProperty("opacity", 0, "important");
// document.querySelector("div.crisp-client").style.setProperty("transform", "translateY(32px)", "important")
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/utils/Console.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as Sentry from "@sentry/browser";

class Console {
static debug (...content) {
this._render("debug", ...content)
Expand All @@ -7,9 +9,13 @@ class Console {
}
static warn (...content) {
this._render("warn", ...content);
const contents = [...content];
Sentry.captureMessage(contents.join(" | "), "warning")
}
static error (...content) {
this._render("error", ...content);
const contents = [...content];
Sentry.captureMessage(contents.join(" | "), "error")
}
static log (...content) {
this._render("log", ...content)
Expand Down
42 changes: 26 additions & 16 deletions src/views/About/Contribute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,32 @@
<p class="subtitle-1 pl-0">
{{ $t('contribute.contribute_0') }}
<br>
{{ $t('contribute.qq_group') }}
747099627
<br>
<v-chip
small
href="https://discord.gg/raQjSpq"
target="_blank"
>
<v-icon
left
small
>
mdi-discord
</v-icon>
Discord
</v-chip>
<ul class="ml-2">
<li>
<v-icon
small
>
mdi-penguin
</v-icon>
{{ $t('contribute.qq_group') }}747099627
</li>
<li>
<v-chip
link
small
href="https://discord.gg/raQjSpq"
target="_blank"
>
<v-icon
left
small
>
mdi-discord
</v-icon>
Discord
</v-chip>
</li>
</ul>
</p>

<ul class="ml-4">
Expand Down

0 comments on commit 23803bf

Please sign in to comment.