Skip to content
Snippets Groups Projects
Commit a851c33a authored by Jure's avatar Jure
Browse files

feat: use Heading consistently

parent b3aa898d
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 34 deletions
...@@ -81,7 +81,7 @@ const AdminPage = ({ children, history, match }) => { ...@@ -81,7 +81,7 @@ const AdminPage = ({ children, history, match }) => {
// Get the current user every 5 seconds (this includes authorization info) // Get the current user every 5 seconds (this includes authorization info)
const { loading, error, data } = useQuery(GET_CURRENT_USER, { const { loading, error, data } = useQuery(GET_CURRENT_USER, {
pollInterval: 5000, pollInterval: 30000,
notifyOnNetworkStatusChange: true, notifyOnNetworkStatusChange: true,
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
// TODO: useCallback used because of bug: https://github.com/apollographql/apollo-client/issues/6301 // TODO: useCallback used because of bug: https://github.com/apollographql/apollo-client/issues/6301
...@@ -133,7 +133,7 @@ const AdminPage = ({ children, history, match }) => { ...@@ -133,7 +133,7 @@ const AdminPage = ({ children, history, match }) => {
} }
if (currentUser && currentUser.admin) { if (currentUser && currentUser.admin) {
links.push({ link: '/journal/admin/teams', name: 'Teams', icon: 'grid' }) // links.push({ link: '/journal/admin/teams', name: 'Teams', icon: 'grid' })
links.push({ link: formBuilderLink, name: 'Forms', icon: 'check-square' }) links.push({ link: formBuilderLink, name: 'Forms', icon: 'check-square' })
links.push({ link: '/journal/admin/users', name: 'Users', icon: 'users' }) links.push({ link: '/journal/admin/users', name: 'Users', icon: 'users' })
links.push({ links.push({
......
...@@ -33,7 +33,6 @@ const OwnerItem = ({ version, journals, deleteManuscript }) => { ...@@ -33,7 +33,6 @@ const OwnerItem = ({ version, journals, deleteManuscript }) => {
<div> <div>
{' '} {' '}
<StatusBadge minimal status={version.status} /> <StatusBadge minimal status={version.status} />
{JSON.stringify(version._currentRoles)}
<VersionTitle version={version} /> <VersionTitle version={version} />
</div> </div>
{actions} {actions}
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
Table, Table,
Header, Header,
Content, Content,
PageHeading, Heading,
Carets, Carets,
CaretUp, CaretUp,
CaretDown, CaretDown,
...@@ -106,7 +106,7 @@ const Manuscripts = () => { ...@@ -106,7 +106,7 @@ const Manuscripts = () => {
return ( return (
<Container> <Container>
<PageHeading level={1}>Manuscripts</PageHeading> <Heading>Manuscripts</Heading>
<Content> <Content>
<Table> <Table>
<Header> <Header>
......
...@@ -13,7 +13,7 @@ export { ...@@ -13,7 +13,7 @@ export {
Table, Table,
Header, Header,
Content, Content,
PageHeading, Heading,
Carets, Carets,
CaretUp, CaretUp,
CaretDown, CaretDown,
......
...@@ -99,10 +99,6 @@ const query = gql` ...@@ -99,10 +99,6 @@ const query = gql`
} }
} }
teams {
${teamFields}
}
manuscript(id: $id) { manuscript(id: $id) {
${fragmentFields} ${fragmentFields}
} }
...@@ -114,7 +110,37 @@ const ReviewersPage = ({ match, history }) => { ...@@ -114,7 +110,37 @@ const ReviewersPage = ({ match, history }) => {
variables: { id: match.params.version }, variables: { id: match.params.version },
}) })
const [addReviewer] = useMutation(addReviewerMutation) const [addReviewer] = useMutation(addReviewerMutation, {
update: (cache, { data: { addReviewer } }) => {
cache.modify({
id: cache.identify({
__typename: addReviewer.object.objectType,
id: addReviewer.object.objectId,
}),
fields: {
teams(existingTeamRefs = []) {
const newTeamRef = cache.writeFragment({
data: addReviewer,
fragment: gql`
fragment NewTeam on Team {
id
role
members {
id
user {
id
}
}
}
`,
})
return [...existingTeamRefs, newTeamRef]
},
},
})
},
})
const [removeReviewer] = useMutation(removeReviewerMutation) const [removeReviewer] = useMutation(removeReviewerMutation)
if (loading) { if (loading) {
...@@ -122,14 +148,9 @@ const ReviewersPage = ({ match, history }) => { ...@@ -122,14 +148,9 @@ const ReviewersPage = ({ match, history }) => {
} }
if (error) return error if (error) return error
const { manuscript, teams, users } = data const { manuscript, users } = data
const reviewersTeam = const reviewersTeam =
teams.find( manuscript.teams.find(team => team.role === 'reviewer') || {}
team =>
team.role === 'reviewer' &&
team.object.objectId === manuscript.id &&
team.object.objectType === 'Manuscript',
) || {}
const reviewers = reviewersTeam.members || [] const reviewers = reviewersTeam.members || []
return ( return (
......
...@@ -28,6 +28,7 @@ const ReviewerInput = ({ ...@@ -28,6 +28,7 @@ const ReviewerInput = ({
}) => ( }) => (
<Select <Select
{...field} {...field}
aria-label="Invite reviewers"
getOptionLabel={option => option.defaultIdentity?.name} getOptionLabel={option => option.defaultIdentity?.name}
getOptionValue={option => option.id} getOptionValue={option => option.id}
onChange={user => { onChange={user => {
......
...@@ -72,7 +72,7 @@ const Reviewers = ({ ...@@ -72,7 +72,7 @@ const Reviewers = ({
<Title>Reviewer status</Title> <Title>Reviewer status</Title>
</SectionHeader> </SectionHeader>
<SectionRow> <SectionRow>
{reviewers && ( {reviewers && reviewers.length ? (
<ReviewersList> <ReviewersList>
{reviewers.map(reviewer => ( {reviewers.map(reviewer => (
<Reviewer> <Reviewer>
...@@ -96,6 +96,8 @@ const Reviewers = ({ ...@@ -96,6 +96,8 @@ const Reviewers = ({
</Reviewer> </Reviewer>
))} ))}
</ReviewersList> </ReviewersList>
) : (
<p>No reviewers have been invited yet</p>
)} )}
</SectionRow> </SectionRow>
</SectionContent> </SectionContent>
......
import React from 'react' import React from 'react'
import { ApolloConsumer } from '@apollo/client' import { ApolloConsumer } from '@apollo/client'
import config from 'config' import config from 'config'
import { Container, Content, UploadContainer, PageHeading } from '../style' import { Container, Content, UploadContainer, Heading } from '../style'
import UploadManuscript from './UploadManuscript' import UploadManuscript from './UploadManuscript'
import useCurrentUser from '../../../../hooks/useCurrentUser' import useCurrentUser from '../../../../hooks/useCurrentUser'
...@@ -17,7 +17,7 @@ const Dashboard = props => { ...@@ -17,7 +17,7 @@ const Dashboard = props => {
return ( return (
<Container> <Container>
<PageHeading level={1}>New submission</PageHeading> <Heading>New submission</Heading>
<Content> <Content>
<UploadContainer> <UploadContainer>
<ApolloConsumer> <ApolloConsumer>
......
import styled from 'styled-components' import styled from 'styled-components'
import { th, grid } from '@pubsweet/ui-toolkit' import { th, grid } from '@pubsweet/ui-toolkit'
export { Container, Content, PageHeading } from '../../shared' export { Container, Content, Heading } from '../../shared'
export const Heading1 = styled.h1` export const Heading1 = styled.h1`
margin: 0 0 calc(${th('gridUnit')} * 3); margin: 0 0 calc(${th('gridUnit')} * 3);
...@@ -34,6 +34,7 @@ export const SubNote = styled.span` ...@@ -34,6 +34,7 @@ export const SubNote = styled.span`
` `
export const UploadContainer = styled.div` export const UploadContainer = styled.div`
margin-top: ${grid(2)};
padding: ${grid(3)}; padding: ${grid(3)};
text-align: center; text-align: center;
` `
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
Container, Container,
Table, Table,
Header, Header,
PageHeading, Heading,
Content, Content,
Spinner, Spinner,
Pagination, Pagination,
...@@ -98,7 +98,7 @@ const UsersManager = () => { ...@@ -98,7 +98,7 @@ const UsersManager = () => {
return ( return (
<Container> <Container>
<PageHeading level={1}>Users</PageHeading> <Heading>Users</Heading>
<Content> <Content>
<Table> <Table>
<Header> <Header>
......
...@@ -14,7 +14,7 @@ export { ...@@ -14,7 +14,7 @@ export {
Table, Table,
Header, Header,
Content, Content,
PageHeading, Heading,
Carets, Carets,
CaretUp, CaretUp,
CaretDown, CaretDown,
......
...@@ -3,7 +3,7 @@ import { grid, th } from '@pubsweet/ui-toolkit' ...@@ -3,7 +3,7 @@ import { grid, th } from '@pubsweet/ui-toolkit'
export const Section = styled.div` export const Section = styled.div`
padding: ${grid(2)} ${grid(3)}; padding: ${grid(2)} ${grid(3)};
margin-top: ${grid(3)}; margin-top: ${grid(2)};
&:not(:last-of-type) { &:not(:last-of-type) {
margin-bottom: ${grid(6)}; margin-bottom: ${grid(6)};
} }
......
import styled from 'styled-components' import styled from 'styled-components'
import { Heading } from '@pubsweet/ui'
import { th, grid } from '@pubsweet/ui-toolkit' import { th, grid } from '@pubsweet/ui-toolkit'
export const Table = styled.table` export const Table = styled.table`
margin-top: ${grid(2)};
width: 100%; width: 100%;
border-radius: ${th('borderRadius')}; border-radius: ${th('borderRadius')};
border-collapse: collapse; border-collapse: collapse;
...@@ -13,11 +13,6 @@ export const Table = styled.table` ...@@ -13,11 +13,6 @@ export const Table = styled.table`
} }
` `
export const PageHeading = styled(Heading)`
color: ${th('colorText')};
margin-bottom: 1rem;
`
export const Header = styled.thead` export const Header = styled.thead`
text-align: left; text-align: left;
font-variant: all-small-caps; font-variant: all-small-caps;
......
import { css } from 'styled-components' import { css } from 'styled-components'
import { th } from '@pubsweet/ui-toolkit' import { th, grid } from '@pubsweet/ui-toolkit'
export default { export default {
// TODO // TODO
...@@ -31,7 +31,6 @@ export default { ...@@ -31,7 +31,6 @@ export default {
} }
}}; }};
outline: 0; outline: 0;
padding: 0 0 0 2px;
transition: ${th('transitionDuration')} ${th('transitionTimingFunction')}; transition: ${th('transitionDuration')} ${th('transitionTimingFunction')};
&:focus { &:focus {
...@@ -44,4 +43,8 @@ export default { ...@@ -44,4 +43,8 @@ export default {
line-height: ${th('lineHeightBaseSmall')}; line-height: ${th('lineHeightBaseSmall')};
} }
`, `,
Label: css`
margin-bottom: ${grid(1)};
`,
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment