webui: minor code fixes

This commit is contained in:
Michael Muré 2021-03-19 17:04:59 +01:00
parent 0b3acaa321
commit 07e1c45cd7
5 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ function BugTitleForm({ bug }: Props) {
function isFormValid() { function isFormValid() {
if (issueTitleInput) { if (issueTitleInput) {
return issueTitleInput.value.length > 0 ? true : false; return issueTitleInput.value.length > 0;
} else { } else {
return false; return false;
} }

View File

@ -11,7 +11,7 @@ const useStyles = makeStyles({
const PreTag = (props: React.HTMLProps<HTMLPreElement>) => { const PreTag = (props: React.HTMLProps<HTMLPreElement>) => {
const classes = useStyles(); const classes = useStyles();
return <pre className={classes.tag} {...props}></pre>; return <pre className={classes.tag} {...props} />;
}; };
export default PreTag; export default PreTag;

View File

@ -46,7 +46,7 @@ function Header() {
<img src="/logo.svg" className={classes.logo} alt="git-bug" /> <img src="/logo.svg" className={classes.logo} alt="git-bug" />
git-bug git-bug
</Link> </Link>
<div className={classes.filler}></div> <div className={classes.filler} />
<div className={classes.lightSwitch}> <div className={classes.lightSwitch}>
<LightSwitch /> <LightSwitch />
</div> </div>

View File

@ -40,7 +40,7 @@ function CountingFilter({ query, children, ...props }: CountingFilterProps) {
variables: { query }, variables: { query },
}); });
var prefix; let prefix;
if (loading) prefix = '...'; if (loading) prefix = '...';
else if (error || !data?.repository) prefix = '???'; else if (error || !data?.repository) prefix = '???';
// TODO: better prefixes & error handling // TODO: better prefixes & error handling

View File

@ -86,7 +86,7 @@ function NewBugPage() {
} }
function isFormValid() { function isFormValid() {
return issueTitle.length > 0 && issueComment.length > 0 ? true : false; return issueTitle.length > 0;
} }
if (loading) return <div>Loading...</div>; if (loading) return <div>Loading...</div>;
@ -119,14 +119,14 @@ function NewBugPage() {
className={classes.greenButton} className={classes.greenButton}
variant="contained" variant="contained"
type="submit" type="submit"
disabled={isFormValid() ? false : true} disabled={!isFormValid()}
> >
Submit new issue Submit new issue
</Button> </Button>
</div> </div>
</form> </form>
</Paper> </Paper>
<div className={classes.rightSidebar}></div> <div className={classes.rightSidebar} />
</div> </div>
</main> </main>
); );