Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Development
[Electron + Angular + TypeScript] Venobo Streaming App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="MayoMayn" data-source="post: 404694" data-attributes="member: 71840"><p>Thanks man!</p><p>[doublepost=1490318187,1490303034][/doublepost]After going through some simplicity with ReactJS, I must say I really enjoy this library, it especially makes Electron development 100 times easier.</p><p>Just gone through in my head what I want to do with the TMDb API, and decided to code some simple parts of it.</p><p>The current component is mostly just for trying out React, so it will most likely be improved a lot before production.</p><p>[PHP]</p><p>import React from 'react'</p><p>import axios from 'axios'</p><p></p><p>export default class TMDb extends React.Component {</p><p></p><p> constructor(props) {</p><p> //super(props)</p><p></p><p> this.tmdb = require(__dirname + '/../config.json').tmdb</p><p></p><p> this.state = {</p><p> api: `${this.tmdb.api}/${props.type}/${props.id}`,</p><p> add: `?api_key=${this.tmdb.key}&language=${props.lang}`</p><p> }</p><p> }</p><p></p><p> setApi(type, id) {</p><p> this.setState({api: `${this.tmdb.api}/${type}/${id}`})</p><p> }</p><p></p><p> setAdd(lang) {</p><p> this.setState({add: `?api_key=${this.tmdb.key}&language=${lang}`})</p><p> }</p><p></p><p> getSimilarMovies() {</p><p> return this.tmdbGet(`/similar${this.state.add}&page=1`).data</p><p> }</p><p></p><p> getDetails() {</p><p> let details = this.tmdbGet(`${this.state.add}`).data</p><p></p><p> return details</p><p> }</p><p></p><p> tmdbGet(extra = '') {</p><p> axios.get(`${this.state.api}${extra}`)</p><p> .then((response) => {</p><p> return response</p><p> })</p><p> }</p><p></p><p>}</p><p></p><p>[/PHP]</p><p>[doublepost=1490362419][/doublepost]Just a preview of the Window Component for all the curious folks</p><p>[PHP]</p><p>import React from 'react'</p><p>const win = window.require('electron').remote.getCurrentWindow()</p><p></p><p>export default class Window extends React.Component {</p><p></p><p> constructor(props) {</p><p> super(props)</p><p></p><p> this.handleClose = this.handleClose.bind(this)</p><p> this.handleMinimize = this.handleMinimize.bind(this)</p><p> this.handleMaximize = this.handleMaximize.bind(this)</p><p> }</p><p></p><p> handleClose() {</p><p> win.close()</p><p> }</p><p></p><p> handleMinimize() {</p><p> win.minimize()</p><p> }</p><p></p><p> handleMaximize() {</p><p> if(!win.isMaximized()) {</p><p> win.maximize()</p><p> } else {</p><p> win.unmaximize()</p><p> }</p><p> }</p><p></p><p> render() {</p><p> return (</p><p> <div className="menu-window"></p><p> <span className="menu-button close" onClick={this.handleClose}></span></p><p> <span className="menu-button minimize" onClick={this.handleMinimize}></span></p><p> {this.props.maximize ? (</p><p> <span className="menu-button maximize" onClick={this.handleMaximize}></span></p><p> ) : (</p><p> <span className="menu-button inactive"></span></p><p> )}</p><p> </div></p><p> )</p><p> }</p><p></p><p>}</p><p>[/PHP]</p><p>There's sadly this thing with renders in ReactJS, that it can only return a single element. So let's say you got five different divs in the renderer, then you'd have to wrap them inside a div so that it only returns a single element. Possibly ruin of CSS styles</p><p>[doublepost=1490388640][/doublepost]<strong>#UPDATES</strong></p><p>Added the below components to the app</p><p><a href="https://devbest.com/threads/es6-js-secure-session-management.82200/" target="_blank">https://devbest.com/threads/es6-js-secure-session-management.82200/</a></p><p>[doublepost=1490560289][/doublepost]I've created a git repo for this project:</p><p><a href="https://github.com/marcus-sa/Primely" target="_blank">https://github.com/marcus-sa/Primely</a></p></blockquote><p></p>
[QUOTE="MayoMayn, post: 404694, member: 71840"] Thanks man! [doublepost=1490318187,1490303034][/doublepost]After going through some simplicity with ReactJS, I must say I really enjoy this library, it especially makes Electron development 100 times easier. Just gone through in my head what I want to do with the TMDb API, and decided to code some simple parts of it. The current component is mostly just for trying out React, so it will most likely be improved a lot before production. [PHP] import React from 'react' import axios from 'axios' export default class TMDb extends React.Component { constructor(props) { //super(props) this.tmdb = require(__dirname + '/../config.json').tmdb this.state = { api: `${this.tmdb.api}/${props.type}/${props.id}`, add: `?api_key=${this.tmdb.key}&language=${props.lang}` } } setApi(type, id) { this.setState({api: `${this.tmdb.api}/${type}/${id}`}) } setAdd(lang) { this.setState({add: `?api_key=${this.tmdb.key}&language=${lang}`}) } getSimilarMovies() { return this.tmdbGet(`/similar${this.state.add}&page=1`).data } getDetails() { let details = this.tmdbGet(`${this.state.add}`).data return details } tmdbGet(extra = '') { axios.get(`${this.state.api}${extra}`) .then((response) => { return response }) } } [/PHP] [doublepost=1490362419][/doublepost]Just a preview of the Window Component for all the curious folks [PHP] import React from 'react' const win = window.require('electron').remote.getCurrentWindow() export default class Window extends React.Component { constructor(props) { super(props) this.handleClose = this.handleClose.bind(this) this.handleMinimize = this.handleMinimize.bind(this) this.handleMaximize = this.handleMaximize.bind(this) } handleClose() { win.close() } handleMinimize() { win.minimize() } handleMaximize() { if(!win.isMaximized()) { win.maximize() } else { win.unmaximize() } } render() { return ( <div className="menu-window"> <span className="menu-button close" onClick={this.handleClose}></span> <span className="menu-button minimize" onClick={this.handleMinimize}></span> {this.props.maximize ? ( <span className="menu-button maximize" onClick={this.handleMaximize}></span> ) : ( <span className="menu-button inactive"></span> )} </div> ) } } [/PHP] There's sadly this thing with renders in ReactJS, that it can only return a single element. So let's say you got five different divs in the renderer, then you'd have to wrap them inside a div so that it only returns a single element. Possibly ruin of CSS styles [doublepost=1490388640][/doublepost][B]#UPDATES[/B] Added the below components to the app [URL]https://devbest.com/threads/es6-js-secure-session-management.82200/[/URL] [doublepost=1490560289][/doublepost]I've created a git repo for this project: [URL]https://github.com/marcus-sa/Primely[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Development
[Electron + Angular + TypeScript] Venobo Streaming App
Top