jellyfin-archive / jellyfin-react-client

Next Generation Client for Jellyfin
https://jellyfin.org
Mozilla Public License 2.0
86 stars 29 forks source link

implemented a basic server connection-Screen. #4

Closed fruhnow closed 5 years ago

fruhnow commented 5 years ago

CAUTION: Im blatantly new to react native / redux so there is probably something to comment on which I am really thankful for!

I added a (basic) server-connection-page which is served as the new default page.

After clicking on connect, a request to

/system/info

of the given IP+Port is sent using the ApiClient. A reference for the ApiClient is added for that.

created with help of @Matt07211

Screenshot Screenshot

EraYaN commented 5 years ago

Neat, could you cleanup the login page and the login reducer code so it doens't include the server anymore?

fruhnow commented 5 years ago

Will do (probably this weekend :-) )

Matt07211 commented 5 years ago

Is it meant to forward you to the login page once you hit enter? Cause currently it doesn't happen on my end

fruhnow commented 5 years ago

Is it meant to forward you to the login page once you hit enter? Cause currently it doesn't happen on my end

@Matt07211 No, its not as im not familiar with how routing works with react native. It just grabs the ServerInfo on the ButtonClick.

could you cleanup the login page and the login reducer code so it doens't include the server anymore?

@EraYaN after checking my changes i am not sure anymore if this PR is the right place to do changes to Login-Stuff. (Additionally, i couldnt test it as i cant route to the LoginPage atm.) Correct me if im wrong :-)

Matt07211 commented 5 years ago

I spent a few hours attempting various things, before I came to the realisation that we have an example of how to do it already.

https://github.com/EraYaN/jellyfin-webng/blob/c7ac73c5d4c2a588bb4aff52ee694e07ba6e621d/jellyfinclient/src/components/EntryComponent.js#L30

Matt07211 commented 5 years ago
$ git diff
diff --git a/jellyfinclient/src/components/EntryComponent.js b/jellyfinclient/src/components/EntryComponent.js
index 232805e..3b915f2 100644
--- a/jellyfinclient/src/components/EntryComponent.js
+++ b/jellyfinclient/src/components/EntryComponent.js
@@ -8,6 +8,7 @@ import {
 } from 'react-native';
 import styles from './Style'
 import { Formik } from 'formik';
+import {Link} from '../utilities/routing/index';

 export default class EntryComponent extends Component {
@@ -62,10 +63,12 @@ export default class EntryComponent extends Component {
                                     </View>
                                 </View>
                                 <View style={styles.loginInput}>
-                                    <Button style={[styles.button]}
-                                        title={this.state.connectButtonMessage}
-                                        onPress={handleSubmit}
-                                    />
+                                    <Link to={'/login'}>
+                                       <Button style={[styles.button]}
+                                            title={this.state.connectButtonMessage}
+                                            onPress={handleSubmit}
+                                        />
+                                    </Link>
                                 </View>
                             </View>
                         )}
DeveloperOl commented 5 years ago

@fruhnow when I try to run your branch, I get a Module not found: Can't resolve 'events.js' in 'C:\Users\SurfOl\Desktop\Jellyfin\jellyfin-webng\jellyfinclient\node_modules\jellyfin-apiclient\src' error. This seems to be related to https://github.com/jellyfin/jellyfin-apiclient-javascript/commit/a99b272ca448a410f52711e73646ebce8d6fef1c How do you work around that?

grafixeyehero commented 5 years ago

@fruhnow when I try to run your branch, I get a Module not found: Can't resolve 'events.js' in 'C:\Users\SurfOl\Desktop\Jellyfin\jellyfin-webng\jellyfinclient\node_modules\jellyfin-apiclient\src' error. This seems to be related to jellyfin/jellyfin-apiclient-javascript@a99b272 How do you work around that?

worked for me by yarn add events.js