From b3f20ed1cb9cde7ac5f1fee43125ead6c85985f9 Mon Sep 17 00:00:00 2001 From: xilliam <78660109+realxilliam@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:25:31 +0300 Subject: [PATCH] WIP things cause im installing linux lol --- src/Start.jsx | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Start.jsx b/src/Start.jsx index 711399f..977c4f3 100644 --- a/src/Start.jsx +++ b/src/Start.jsx @@ -3,8 +3,6 @@ import ReactPlayer from 'react-player' import React, { useState } from 'react'; import json from "./confs/playlists.json" -var stream = null; -var sidebar_playlists = [] var json_playlists = json {/* test source --> "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8" */} @@ -12,45 +10,57 @@ var json_playlists = json export default function Start() { var [stream, setStream] = useState("https://yletv.akamaized.net/hls/live/622365/yletv1fin/index.m3u8") - + console.log("new run") return (
{/* debug buttons */} {/* setStream(stream="https://yletv.akamaized.net/hls/live/622365/yletv1fin/index.m3u8")} /> setStream(stream="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8")} /> */} - + {/* */}
) } -function SimpleButton(props) { - return ( - - ) -} - -function Sidebar({ playlists }) { - for (var prop in playlists) { +function Sidebar({ json_playlists }) { + for (var prop in json_playlists) { //console.log("Prop: " + prop) //console.log("Key:" + prop); var id = prop - var name = playlists[prop]["name"] - var propstream = playlists[prop]["stream"] + var name = json_playlists[prop]["name"] + var propstream = json_playlists[prop]["stream"] //console.log(propstream) //console.log("Value:" + value); + setPlaylistsFunc(args={ "id": id, "name": "'"+name+"'", "stream": "'" + propstream + "'" }) } + + console.log(setPlaylistsFunc(query = "return")) return (
- {/* Not working yet, expected behaviour */} + {/* Not working yet, expected behaviour {channels.map(channel => )} + */}
); } + +// !!IMPORTANT!! This is a standard JS function, dont use props.args, just use args +function setPlaylistsFunc({props}) { + const [playlists, setPlaylists] = useState([]) + + if({props.query}="return"){ + return( + playlists + ) + } else{ + setPlaylists([...playlists, {props.args} ]) + } +} + function NewChannel({ props }) { return (

{props.id}