diff options
author | Michael Muré <batolettre@gmail.com> | 2021-02-09 10:04:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 10:04:26 +0100 |
commit | 3b08731aaa1ebe37fa12b8fd4068f2271f7eb307 (patch) | |
tree | bbe36e6a1291d363998bb7008bb6eec203eee0b7 /webui/src | |
parent | ef7a0f1b11c8e44a44f1ec23a68cab2adefad36c (diff) | |
parent | 3d86c1cc783adf448c38a51a3bcbbdf9621dc70d (diff) | |
download | git-bug-3b08731aaa1ebe37fa12b8fd4068f2271f7eb307.tar.gz |
Merge pull request #559 from claudioantonio/webui_543_ifloggedin
Webui 543 ifloggedin
Diffstat (limited to 'webui/src')
-rw-r--r-- | webui/src/components/BugTitleForm/BugTitleForm.tsx | 39 | ||||
-rw-r--r-- | webui/src/pages/list/ListQuery.tsx | 16 |
2 files changed, 35 insertions, 20 deletions
diff --git a/webui/src/components/BugTitleForm/BugTitleForm.tsx b/webui/src/components/BugTitleForm/BugTitleForm.tsx index 16441c93..c47eab31 100644 --- a/webui/src/components/BugTitleForm/BugTitleForm.tsx +++ b/webui/src/components/BugTitleForm/BugTitleForm.tsx @@ -9,6 +9,7 @@ import { } from '@material-ui/core'; import { TimelineDocument } from '../../pages/bug/TimelineQuery.generated'; +import IfLoggedIn from '../IfLoggedIn/IfLoggedIn'; import Author from 'src/components/Author'; import Date from 'src/components/Date'; import { BugFragment } from 'src/pages/bug/Bug.generated'; @@ -156,23 +157,27 @@ function BugTitleForm({ bug }: Props) { <span className={classes.readOnlyTitle}>{bug.title}</span> <span className={classes.readOnlyId}>{bug.humanId}</span> </div> - <div className={classes.editButtonContainer}> - <Button - size="small" - variant="contained" - onClick={() => setbugTitleEdition(!bugTitleEdition)} - > - Edit - </Button> - <Button - className={classes.greenButton} - size="small" - variant="contained" - href="/new" - > - New issue - </Button> - </div> + <IfLoggedIn> + {() => ( + <div className={classes.editButtonContainer}> + <Button + size="small" + variant="contained" + onClick={() => setbugTitleEdition(!bugTitleEdition)} + > + Edit + </Button> + <Button + className={classes.greenButton} + size="small" + variant="contained" + href="/new" + > + New issue + </Button> + </div> + )} + </IfLoggedIn> </div> ); } diff --git a/webui/src/pages/list/ListQuery.tsx b/webui/src/pages/list/ListQuery.tsx index 424ffac0..87c21e3c 100644 --- a/webui/src/pages/list/ListQuery.tsx +++ b/webui/src/pages/list/ListQuery.tsx @@ -12,6 +12,8 @@ import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft'; import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight'; import Skeleton from '@material-ui/lab/Skeleton'; +import IfLoggedIn from 'src/components/IfLoggedIn/IfLoggedIn'; + import FilterToolbar from './FilterToolbar'; import List from './List'; import { useListBugsQuery } from './ListQuery.generated'; @@ -310,9 +312,17 @@ function ListQuery() { </button> </form> </div> - <Button className={classes.greenButton} variant="contained" href="/new"> - New issue - </Button> + <IfLoggedIn> + {() => ( + <Button + className={classes.greenButton} + variant="contained" + href="/new" + > + New issue + </Button> + )} + </IfLoggedIn> </header> <FilterToolbar query={query} queryLocation={queryLocation} /> {content} |