Skip to content

Commit

Permalink
Confetti changes
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Sep 10, 2023
1 parent 135c7f5 commit 5da4b30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion website/src/apps/BroadcastApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export default {
}
},
broadcastKey(newCode) {
console.log(newCode);
this.$socket.client.emit("prod-broadcast-join", newCode);
}
},
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/broadcast/roots/ChampionsOverlay.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<ConfettiOverlay v-if="winner" :theme="winner?.theme" :active="active" :animation-active="animationActive"/>
<ConfettiOverlay v-if="winner" :theme="winner?.theme"/>
</template>

<script>
Expand All @@ -9,7 +9,7 @@ import { ReactiveArray, ReactiveRoot, ReactiveThing } from "@/utils/reactive";
export default {
components: { ConfettiOverlay },
props: ["broadcast", "stingerText", "active", "animationActive"],
props: ["broadcast", "stingerText"],
name: "ChampionsOverlay",
data: () => ({
confettiStarted: false,
Expand Down Expand Up @@ -44,7 +44,7 @@ export default {
winner: {
deep: true,
handler(winner) {
console.log("winner change", this.$parent);
console.log("winner", winner);
this.$parent.updateTheme(winner?.theme);
this.$parent.updateText(this.winner ? (this.stingerText || "Winners") : null);
this.$parent.setTextVisibility(this.stingerTextVal);
Expand Down
30 changes: 15 additions & 15 deletions website/src/components/broadcast/roots/ConfettiOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Vue from "vue";
Vue.use(VueConfetti);
export default {
props: ["themeId", "theme", "active", "animationActive"],
props: ["themeId", "theme"],
name: "ConfettiOverlay",
data: () => ({
confettiStarted: false,
Expand All @@ -18,11 +18,14 @@ export default {
minor: true
}
}),
beforeDestroy() {
this.stopConfetti();
},
methods: {
startOrUpdateConfetti() {
if (this.confettiDisabled) return;
console.log("start confetti");
if (!this.confettiStarted) {
console.log("start confetti");
this.$confetti.start({
particles: [
{
Expand All @@ -42,24 +45,22 @@ export default {
defaultColors: this.confettiColors
});
}
},
stopConfetti() {
console.log("stopping confetti");
this.confettiStarted = false;
this.$confetti.stop();
}
},
watch: {
confettiColors: {
handler() {
if (this.confettiColors.length === 0) return;
console.log("confetti color change", this.confettiColors);
if (this.confettiColors.length === 0) return this.stopConfetti();
this.startOrUpdateConfetti();
},
immediate: true
},
animationActive: {
handler(isActive) {
console.log("active", isActive);
if (!isActive) return;
if (this.confettiColors.length === 0) return;
this.startOrUpdateConfetti();
},
immediate: true
immediate: true,
deep: true
}
},
computed: {
Expand All @@ -86,8 +87,7 @@ export default {
sockets: {
stop_confetti() {
console.log("confetti stop");
this.confettiStarted = false;
this.$confetti.stop();
this.stopConfetti();
},
disable_confetti() {
this.confettiDisabled = true;
Expand Down

0 comments on commit 5da4b30

Please sign in to comment.