-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CastIt.Server.ClientApp] Do not load the pages until we are connecte…
…d to the hub. Bug fixes and improvements
- Loading branch information
Showing
26 changed files
with
360 additions
and
176 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
REACT_APP_BASE_HUB_URL=http://localhost:62003/castithub | ||
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 |
---|---|---|
@@ -1 +0,0 @@ | ||
REACT_APP_BASE_HUB_URL=http://192.168.1.104:9696/castithub | ||
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
78 changes: 78 additions & 0 deletions
78
CastIt.Server/ClientApp/src/components/dialogs/add_subtitles_dialog.tsx
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,78 @@ | ||
import React, { useState } from 'react'; | ||
import { Dialog, DialogContent, DialogTitle, Grid, DialogActions, Button, TextField, FormGroup } from '@material-ui/core'; | ||
import translations from '../../services/translations'; | ||
|
||
interface Props { | ||
isOpen: boolean; | ||
onClose(path: string | null): void; | ||
} | ||
|
||
interface State { | ||
path: string; | ||
isPathValid: boolean; | ||
isPathDirty: boolean; | ||
} | ||
|
||
const initialState: State = { | ||
path: '', | ||
isPathValid: false, | ||
isPathDirty: false, | ||
}; | ||
|
||
function AddSubtitlesDialog(props: Props) { | ||
const [state, setState] = useState(initialState); | ||
|
||
const handlePathChange = (event: React.ChangeEvent<HTMLInputElement>): void => { | ||
const newVal = event.target.value; | ||
const newState = { ...state }; | ||
newState.path = newVal; | ||
newState.isPathDirty = true; | ||
newState.isPathValid = newVal !== '' && newVal !== null && newVal.length > 1; | ||
|
||
setState(newState); | ||
}; | ||
|
||
const handleClose = (saveChanges: boolean): void => { | ||
const path = saveChanges ? state.path : null; | ||
props.onClose(path); | ||
setState(initialState); | ||
}; | ||
|
||
const showError = !state.isPathValid && state.isPathDirty; | ||
if (!props.isOpen) { | ||
return null; | ||
} | ||
return ( | ||
<Dialog open={props.isOpen} onClose={() => handleClose(false)} maxWidth="sm" fullWidth> | ||
<DialogTitle>{translations.subtitles}</DialogTitle> | ||
<DialogContent> | ||
<Grid container alignItems="stretch" justifyContent="center" > | ||
<FormGroup row style={{ width: '100%' }}> | ||
<TextField | ||
required | ||
autoFocus | ||
margin="dense" | ||
label={translations.path} | ||
type="text" | ||
fullWidth | ||
onChange={handlePathChange} | ||
value={state.path} | ||
error={showError} | ||
helperText={showError ? translations.fieldIsNotValid : ''} | ||
/> | ||
</FormGroup> | ||
</Grid> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={() => handleClose(false)} color="primary"> | ||
{translations.cancel} | ||
</Button> | ||
<Button variant="contained" onClick={() => handleClose(true)} color="primary" disabled={!state.isPathValid}> | ||
{translations.ok} | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
} | ||
|
||
export default AddSubtitlesDialog; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Container, Grid, CircularProgress, Typography } from '@material-ui/core'; | ||
|
||
interface Props { | ||
message?: string; | ||
} | ||
|
||
function Loading(props: Props) { | ||
return ( | ||
<Container> | ||
<Grid | ||
container | ||
justifyContent="center" | ||
alignItems="center" | ||
direction="column" | ||
style={{ minHeight: '100vh', textAlign: 'center' }} | ||
> | ||
<Grid item xs={12}> | ||
<CircularProgress /> | ||
{props.message ? <Typography>{props.message}</Typography> : null} | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
); | ||
} | ||
|
||
export default Loading; |
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,39 @@ | ||
import { makeStyles, createStyles, Container, Grid, Typography } from '@material-ui/core'; | ||
import { Info } from '@material-ui/icons'; | ||
import translations from '../services/translations'; | ||
|
||
const useStyles = makeStyles((theme) => | ||
createStyles({ | ||
root: { | ||
flex: 'auto', | ||
height: '100%', | ||
}, | ||
nothingFound: { | ||
textAlign: 'center', | ||
height: '100%', | ||
}, | ||
}) | ||
); | ||
|
||
interface Props { | ||
icon?: JSX.Element; | ||
text?: string; | ||
children?: JSX.Element | JSX.Element[]; | ||
} | ||
|
||
function NothingFound(props: Props) { | ||
const classes = useStyles(); | ||
return ( | ||
<Container className={classes.root}> | ||
<Grid container className={classes.nothingFound} justifyContent="center" alignItems="center"> | ||
<Grid item xs={12}> | ||
{props.icon ?? <Info fontSize="large" />} | ||
<Typography>{props.text ?? translations.nothingFound}</Typography> | ||
{props.children} | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
); | ||
} | ||
|
||
export default NothingFound; |
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
Oops, something went wrong.