Merge pull request #625 from GlancingMind/upstream-minor-bugfixes

Minor bugfixes
This commit is contained in:
Michael Muré 2021-04-10 09:52:17 +02:00 committed by GitHub
commit c71d26d513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 15 deletions

View File

@ -79,6 +79,10 @@ function BugTitleForm({ bug }: Props) {
function submitNewTitle() { function submitNewTitle() {
if (!isFormValid()) return; if (!isFormValid()) return;
if (bug.title === issueTitleInput.value) {
cancelChange();
return;
}
setTitle({ setTitle({
variables: { variables: {
input: { input: {
@ -107,7 +111,7 @@ function BugTitleForm({ bug }: Props) {
function editableBugTitle() { function editableBugTitle() {
return ( return (
<form className={classes.headerTitle} onSubmit={submitNewTitle}> <form className={classes.headerTitle}>
<BugTitleInput <BugTitleInput
inputRef={(node) => { inputRef={(node) => {
issueTitleInput = node; issueTitleInput = node;
@ -124,7 +128,7 @@ function BugTitleForm({ bug }: Props) {
className={classes.saveButton} className={classes.saveButton}
size="small" size="small"
variant="contained" variant="contained"
type="submit" onClick={() => submitNewTitle()}
disabled={issueTitle.length === 0} disabled={issueTitle.length === 0}
> >
Save Save

View File

@ -67,14 +67,14 @@ const DisabledTabWithTooltip = (props: TabProps) => {
function Header() { function Header() {
const classes = useStyles(); const classes = useStyles();
const location = useLocation(); const location = useLocation();
const [selectedTab, setTab] = React.useState(location.pathname);
const handleTabClick = ( // Prevents error of invalid tab selection in <Tabs>
event: React.ChangeEvent<{}>, // Will return a valid tab path or false if path is unkown.
newTabValue: string function highlightTab() {
) => { const validTabs = ['/', '/code', '/pulls', '/settings'];
setTab(newTabValue); const tab = validTabs.find((tabPath) => tabPath === location.pathname);
}; return tab === undefined ? false : tab;
}
return ( return (
<> <>
@ -92,12 +92,7 @@ function Header() {
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<div className={classes.offset} /> <div className={classes.offset} />
<Tabs <Tabs centered value={highlightTab()} aria-label="nav tabs">
centered
value={selectedTab}
onChange={handleTabClick}
aria-label="nav tabs"
>
<DisabledTabWithTooltip label="Code" value="/code" {...a11yProps(1)} /> <DisabledTabWithTooltip label="Code" value="/code" {...a11yProps(1)} />
<Tab label="Bugs" value="/" component={Link} to="/" {...a11yProps(2)} /> <Tab label="Bugs" value="/" component={Link} to="/" {...a11yProps(2)} />
<DisabledTabWithTooltip <DisabledTabWithTooltip