aboutsummaryrefslogtreecommitdiff
path: root/features/streamsGUI/index.js
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2021-11-23 23:01:10 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2021-11-23 23:01:10 +0800
commitd36dbde865aec68f7fd564977cdf8e9c5912edbe (patch)
tree41bb451cd1f8407a094a834a1cb1db301ff92bf7 /features/streamsGUI/index.js
parentce112c714b740c0e9e958f2016091bd3f01d7ba6 (diff)
downloadSoopyV2-d36dbde865aec68f7fd564977cdf8e9c5912edbe.tar.gz
SoopyV2-d36dbde865aec68f7fd564977cdf8e9c5912edbe.tar.bz2
SoopyV2-d36dbde865aec68f7fd564977cdf8e9c5912edbe.zip
- Finish streamgui
- some more information in settings menus - random fixes
Diffstat (limited to 'features/streamsGUI/index.js')
-rw-r--r--features/streamsGUI/index.js37
1 files changed, 31 insertions, 6 deletions
diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js
index aaf5ab7..b62bdcd 100644
--- a/features/streamsGUI/index.js
+++ b/features/streamsGUI/index.js
@@ -8,6 +8,8 @@ import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownEl
import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement";
import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement";
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
+import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow";
+import BoxWithText from "../../../guimanager/GuiElement/BoxWithText";
class StreamsGui extends Feature {
constructor() {
@@ -75,12 +77,34 @@ class StreamPage extends GuiPage {
this.openSidebarPage(sidebar)
- /*
- TODO: finish this
+ sidebar.addChild(new SoopyTextElement().setText("§0"+data.user_name).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1))
- - Open stream in browser button
- - show live chat
- */
+ let title = new SoopyMarkdownElement().setText("§0"+data.title).setLocation(0.1, 0.15, 0.8, 0.1)
+ sidebar.addChild(title)
+
+ let image = new SoopyImageElement().setImage(data.image).setLocation(0.1, 0.15+title.getHeight(), 0.8, 0.4).loadHeightFromImage()
+ sidebar.addChild(image)
+
+ let button = new ButtonWithArrow().setText("§0Watch on Twitch").setLocation(0.1, 0.15+image.location.size.y.get()+title.getHeight(), 0.8, 0.1)
+ sidebar.addChild(button)
+
+ button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ java.awt.Desktop.getDesktop().browse(
+ new java.net.URI("https://twitch.tv/" + data.user_login)
+ );
+ }))
+
+ let language
+ if(data.language){
+ language = new BoxWithText().setText("§0Language: "+data.language).setLocation(0.3, 0.25+image.location.size.y.get()+title.getHeight(), 0.4, 0.1)
+
+ sidebar.addChild(language)
+ }
+
+ image.onImageHeightChange(()=>{
+ button.location.location.y.set(0.15+image.location.size.y.get()+title.getHeight())
+ if(language) language.location.location.y.set(0.25+image.location.size.y.get()+title.getHeight())
+ }, this)
}
onOpen(){
@@ -124,7 +148,8 @@ class StreamElement extends SoopyBoxElement {
this.channelElement.setText((twitch ? "§0"+stream.user_name : "§0"+stream.channelTitle) + (twitch?"&7 - " + stream.viewer_count + " viewer"+(stream.viewer_count!==1?"s":""):""))
- this.channelImg.setImage(twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url)
+ this.streamData.image = twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url
+ this.channelImg.setImage(this.streamData.image)
return this
}