-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
149 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
website/src/components/broadcast/roots/ChampionsOverlay.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<ConfettiOverlay v-if="winner" :theme="winner?.theme"/> | ||
</template> | ||
|
||
<script> | ||
import ConfettiOverlay from "@/components/broadcast/roots/ConfettiOverlay.vue"; | ||
import { ReactiveArray, ReactiveRoot, ReactiveThing } from "@/utils/reactive"; | ||
export default { | ||
components: { ConfettiOverlay }, | ||
props: ["broadcast", "stingerText"], | ||
name: "ChampionsOverlay", | ||
data: () => ({ | ||
confettiStarted: false, | ||
prodData: { | ||
minor: true | ||
} | ||
}), | ||
mounted() { | ||
console.log(this.stingerText); | ||
this.$parent.updateText(this.stingerText || "Winners"); | ||
}, | ||
computed: { | ||
match() { | ||
if (!this.broadcast?.live_match?.length) return null; | ||
return ReactiveRoot(this.broadcast?.live_match?.[0], { | ||
teams: ReactiveArray("teams", { | ||
theme: ReactiveThing("theme") | ||
}) | ||
}); | ||
}, | ||
winner() { | ||
if (!this.match) return null; | ||
if (!(this.match.first_to && [this.match.score_1, this.match.score_2].some(s => s === this.match.first_to))) return null; | ||
return this.match.teams[this.match.score_1 === this.match.first_to ? 0 : 1]; | ||
} | ||
}, | ||
watch: { | ||
winner: { | ||
deep: true, | ||
handler(winner) { | ||
console.log("winner change", this.$parent); | ||
this.$parent.updateTheme(winner?.theme); | ||
} | ||
} | ||
}, | ||
metaInfo() { | ||
return { | ||
title: `Champions | ${this.broadcast?.code || this.broadcast?.name || ""}` | ||
}; | ||
} | ||
}; | ||
</script> |
67 changes: 67 additions & 0 deletions
67
website/src/components/broadcast/roots/ConfettiOverlay.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script> | ||
import VueConfetti from "vue-confetti"; | ||
import { ReactiveRoot } from "@/utils/reactive"; | ||
import Vue from "vue"; | ||
Vue.use(VueConfetti); | ||
export default { | ||
props: ["themeId", "theme"], | ||
name: "ConfettiOverlay", | ||
data: () => ({ | ||
confettiStarted: false, | ||
noStinger: true, | ||
prodData: { | ||
minor: true | ||
} | ||
}), | ||
watch: { | ||
confettiColors: { | ||
handler() { | ||
if (this.confettiColors.length === 0) return; | ||
if (!this.confettiStarted) { | ||
this.$confetti.start({ | ||
particles: [ | ||
{ | ||
type: "circle" | ||
} | ||
], | ||
defaultColors: this.confettiColors | ||
}); | ||
this.confettiStarted = true; | ||
} else { | ||
this.$confetti.update({ | ||
particles: [ | ||
{ | ||
type: "circle" | ||
} | ||
], | ||
defaultColors: this.confettiColors | ||
}); | ||
} | ||
}, | ||
immediate: true | ||
} | ||
}, | ||
computed: { | ||
themeData() { | ||
return this.theme || ReactiveRoot(this.themeId); | ||
}, | ||
confettiColors() { | ||
return Array.from(new Set( | ||
[this.themeData?.color_theme, this.themeData?.color_logo_background, this.themeData?.color_logo_accent] | ||
.filter( | ||
Boolean | ||
))); | ||
} | ||
}, | ||
metaInfo() { | ||
return { | ||
title: `Confetti | ${this.broadcast?.code || this.broadcast?.name || ""}` | ||
}; | ||
} | ||
}; | ||
</script> | ||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters