Skip to content

Commit

Permalink
Manuscript UID Display (#4421)
Browse files Browse the repository at this point in the history
* style and first iteration ok

* post merge update

* linting

* clean up
  • Loading branch information
lctrt authored Oct 25, 2024
1 parent d7c4b09 commit a9a176d
Show file tree
Hide file tree
Showing 17 changed files with 282 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ export const parseContentfulGraphQlTeam = (

return {
id: item.sys.id ?? '',
grantId: item.grantId ?? undefined,
teamId: item.teamId ?? undefined,
displayName: item.displayName ?? '',
inactiveSince: item.inactiveSince ?? undefined,
projectTitle: item.projectTitle ?? '',
Expand All @@ -326,6 +328,7 @@ export const parseContentfulGraphQlTeam = (
manuscripts: cleanArray(item.linkedFrom?.manuscriptsCollection?.items).map(
(manuscript): TeamDataObject['manuscripts'][number] => ({
id: manuscript.sys.id,
count: manuscript.count || 1,
title: manuscript.title || '',
status: manuscriptMapStatus(manuscript.status) || undefined,
versions: parseGraphqlManuscriptVersion(
Expand Down
4 changes: 4 additions & 0 deletions apps/crn-server/test/fixtures/teams.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ export const getContentfulGraphqlManuscripts = (): NonNullable<
items: [
{
sys: { id: '1' },
count: 1,
title: 'Manuscript 1',
status: 'Compliant',
versionsCollection: getContentfulGraphqlManuscriptVersions(),
},
{
sys: { id: '2' },
count: 2,
title: 'Manuscript 2',
versionsCollection: getContentfulGraphqlManuscriptVersions(),
},
Expand Down Expand Up @@ -211,6 +213,7 @@ export const getTeamDataObject = (): TeamDataObject => ({
manuscripts: [
{
id: '1',
count: 1,
title: 'Manuscript 1',
status: 'Compliant',
versions: [
Expand Down Expand Up @@ -244,6 +247,7 @@ export const getTeamDataObject = (): TeamDataObject => ({
},
{
id: '2',
count: 2,
title: 'Manuscript 2',
versions: [
{
Expand Down
2 changes: 2 additions & 0 deletions apps/storybook/src/TeamProfilePage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default {

const props = (): Omit<ComponentProps<typeof TeamProfilePage>, 'children'> => ({
id: '42',
teamId: 'TI1',
grantId: '000123',
displayName: 'Ramirez, T',
projectTitle:
'Molecular actions of PD-associated pathological proteins using in vitro human pluripotent steam cell brain organoids.',
Expand Down
6 changes: 3 additions & 3 deletions packages/contentful/src/crn/autogenerated-gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const documents = {
types.FetchResearchTagsDocument,
'\n query FetchResearchTagsById($id: String!) {\n researchTags(id: $id) {\n ...ResearchTagsContent\n }\n }\n \n':
types.FetchResearchTagsByIdDocument,
'\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n':
'\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n teamId\n grantId\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n':
types.FetchTeamByIdDocument,
'\n query FetchTeams(\n $limit: Int\n $skip: Int\n $order: [TeamsOrder]\n $where: TeamsFilter\n ) {\n teamsCollection(limit: $limit, skip: $skip, order: $order, where: $where) {\n total\n items {\n sys {\n id\n }\n displayName\n inactiveSince\n projectTitle\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n linkedFrom {\n teamMembershipCollection(limit: 100) {\n items {\n role\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n':
types.FetchTeamsDocument,
Expand Down Expand Up @@ -431,8 +431,8 @@ export function gql(
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(
source: '\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n',
): (typeof documents)['\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n'];
source: '\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n teamId\n grantId\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n',
): (typeof documents)['\n query FetchTeamById($id: String!) {\n teams(id: $id) {\n sys {\n id\n publishedAt\n }\n displayName\n teamId\n grantId\n inactiveSince\n projectSummary\n projectTitle\n proposal {\n sys {\n id\n }\n }\n toolsCollection {\n items {\n name\n description\n url\n }\n }\n researchTagsCollection(limit: 20) {\n items {\n sys {\n id\n }\n name\n }\n }\n supplementGrant {\n title\n description\n startDate\n endDate\n proposal {\n sys {\n id\n }\n }\n }\n linkedFrom {\n manuscriptsCollection(limit: 20, order: sys_firstPublishedAt_DESC) {\n items {\n ...ManuscriptsContent\n }\n }\n teamMembershipCollection(limit: 100) {\n items {\n role\n inactiveSinceDate\n linkedFrom {\n usersCollection(limit: 1) {\n items {\n sys {\n id\n }\n onboarded\n firstName\n nickname\n lastName\n email\n alumniSinceDate\n avatar {\n url\n }\n labsCollection(limit: 5) {\n items {\n sys {\n id\n }\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n'];
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
9 changes: 8 additions & 1 deletion packages/contentful/src/crn/autogenerated-gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19134,7 +19134,12 @@ export type FetchTeamByIdQuery = {
teams?: Maybe<
Pick<
Teams,
'displayName' | 'inactiveSince' | 'projectSummary' | 'projectTitle'
| 'displayName'
| 'teamId'
| 'grantId'
| 'inactiveSince'
| 'projectSummary'
| 'projectTitle'
> & {
sys: Pick<Sys, 'id' | 'publishedAt'>;
proposal?: Maybe<{ sys: Pick<Sys, 'id'> }>;
Expand Down Expand Up @@ -34052,6 +34057,8 @@ export const FetchTeamByIdDocument = {
},
},
{ kind: 'Field', name: { kind: 'Name', value: 'displayName' } },
{ kind: 'Field', name: { kind: 'Name', value: 'teamId' } },
{ kind: 'Field', name: { kind: 'Name', value: 'grantId' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'inactiveSince' },
Expand Down
2 changes: 2 additions & 0 deletions packages/contentful/src/crn/queries/teams.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const FETCH_TEAM_BY_ID = gql`
publishedAt
}
displayName
teamId
grantId
inactiveSince
projectSummary
projectTitle
Expand Down
2 changes: 2 additions & 0 deletions packages/fixtures/src/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const teamTool = (id: number): TeamTool => ({

const listTeamResponseItem: Omit<TeamResponse, 'id'> = {
displayName: 'Abu-Remaileh, M',
teamId: 'AR1',
grantId: '000123',
projectTitle:
'Mapping the LRRK2 signalling pathway and its interplay with other Parkinson’s disease components',
tags: [],
Expand Down
4 changes: 3 additions & 1 deletion packages/model/src/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface TeamMember {

export type TeamManuscript = Pick<
ManuscriptResponse,
'id' | 'title' | 'versions' | 'status'
'id' | 'title' | 'versions' | 'status' | 'count'
>;

export type TeamSupplementGrant = {
Expand All @@ -61,6 +61,8 @@ export type TeamSupplementGrant = {

export type TeamDataObject = Omit<TeamCreateRequest, 'applicationNumber'> & {
id: string;
teamId?: string;
grantId?: string;
tags: Pick<ResearchTagDataObject, 'id' | 'name'>[];
members: TeamMember[];
lastModifiedDate: string;
Expand Down
12 changes: 9 additions & 3 deletions packages/react-components/src/atoms/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const styles = css({
borderRadius: `${6 / perRem}em`,
});

const grayStyles = css({
const modernStyles = css({
borderRadius: `${24 / perRem}em`,
height: `${24 / perRem}em`,
margin: 0,
Expand All @@ -32,7 +32,8 @@ export type AccentVariant =
| 'neutral'
| 'success'
| 'warning'
| 'gray';
| 'gray'
| 'blue';

export const accents: Record<AccentVariant, CSSObject> = {
default: {
Expand Down Expand Up @@ -75,6 +76,11 @@ export const accents: Record<AccentVariant, CSSObject> = {
backgroundColor: colors.silver.rgb,
border: 'transparent',
},
blue: {
color: colors.info500.rgb,
backgroundColor: colors.info100.rgb,
border: 'transparent',
},
};

type PillProps = {
Expand All @@ -93,7 +99,7 @@ const Pill: React.FC<PillProps> = ({
styles,
components?.Pill?.styles,
accents[accent],
...(accent === 'gray' ? [grayStyles] : []),
...(accent === 'gray' || accent === 'blue' ? [modernStyles] : []),
]}
>
<Ellipsis>{small ? <small>{children}</small> : children}</Ellipsis>
Expand Down
15 changes: 13 additions & 2 deletions packages/react-components/src/organisms/ManuscriptCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import ManuscriptVersionCard from './ManuscriptVersionCard';

type ManuscriptCardProps = Pick<
TeamManuscript,
'id' | 'title' | 'versions' | 'status'
'id' | 'title' | 'versions' | 'status' | 'count'
> & {
teamId: string;
teamIdCode: string;
grantId: string;
isComplianceReviewer: boolean;
};

Expand Down Expand Up @@ -72,8 +74,11 @@ const ManuscriptCard: React.FC<ManuscriptCardProps> = ({
id,
title,
versions,
count,
status,
teamId,
teamIdCode,
grantId,
isComplianceReviewer,
}) => {
const [expanded, setExpanded] = useState(false);
Expand Down Expand Up @@ -145,7 +150,13 @@ const ManuscriptCard: React.FC<ManuscriptCardProps> = ({
{expanded && (
<div>
{versions.map((version, index) => (
<ManuscriptVersionCard {...version} key={index} />
<ManuscriptVersionCard
key={index}
version={version}
teamId={teamIdCode}
grantId={grantId}
manuscriptCount={count}
/>
))}
</div>
)}
Expand Down
Loading

0 comments on commit a9a176d

Please sign in to comment.