Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PORTALS-3308 - What's in Portals Component (GoalsV2) #1399

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

afwillia
Copy link
Contributor

@afwillia afwillia commented Nov 20, 2024

PORTALS-3308 This PR modifies the Goals component by creating cards for each panel, surrounded by a box.

@afwillia afwillia changed the title Portals 3308 - What's in Portals Component (GoalsV2) [Portals 3308](https://sagebionetworks.jira.com/browse/PORTALS-3308) - What's in Portals Component (GoalsV2) Nov 22, 2024
@afwillia afwillia changed the title [Portals 3308](https://sagebionetworks.jira.com/browse/PORTALS-3308) - What's in Portals Component (GoalsV2) PORTALS-3308 - What's in Portals Component (GoalsV2) Nov 22, 2024
@afwillia afwillia marked this pull request as ready for review December 2, 2024 18:03
@nickgros nickgros added the chromatic Deploys the latest commit on this PR to Chromatic and runs snapshot tests label Dec 4, 2024
Copy link
Collaborator

@nickgros nickgros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had some questions and suggestions, let me know if you have any questions!

Comment on lines +159 to +181
<Link
href="https://eliteportal.synapse.org/Explore/Data"
target="_blank"
rel="noopener noreferrer"
fontFamily="Lato"
fontSize="18"
fontStyle="semi-bold"
>
<Button
variant="contained"
sx={{
backgroundColor: '#5BA998',
border: '1px solid white',
boxShadow: 'none',
'&:hover': {
backgroundColor: darken('#5BA998', 0.05),
boxShadow: 'none',
},
}}
>
Start Exploring Data
</Button>
</Link>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to apply the relevant Link props to the Button component. Also, the font/size changes probably shouldn't be necessary to apply to the button

Suggested change
<Link
href="https://eliteportal.synapse.org/Explore/Data"
target="_blank"
rel="noopener noreferrer"
fontFamily="Lato"
fontSize="18"
fontStyle="semi-bold"
>
<Button
variant="contained"
sx={{
backgroundColor: '#5BA998',
border: '1px solid white',
boxShadow: 'none',
'&:hover': {
backgroundColor: darken('#5BA998', 0.05),
boxShadow: 'none',
},
}}
>
Start Exploring Data
</Button>
</Link>
<Button
href="https://eliteportal.synapse.org/Explore/Data" // <-- this should probably be a prop for reusability
target="_blank"
rel="noopener noreferrer"
variant="contained"
sx={{
backgroundColor: '#5BA998',
border: '1px solid white',
boxShadow: 'none',
'&:hover': {
backgroundColor: darken('#5BA998', 0.05),
boxShadow: 'none',
},
}}
>
Start Exploring Data
</Button>

Comment on lines +185 to +211
{queryResultBundle?.queryResult!.queryResults.rows.map((el, index) => {
const values = el.values as string[]
if (values.some(value => value === null)) {
// We cast values above assuming there are no null values, emit a warning just in case.
console.warn('Row has null value(s) when no nulls expected')
}
const tableId =
tableIdColumnIndex > -1 ? values[tableIdColumnIndex] : undefined
let countSql
if (countSqlColumnIndex > -1 && values[countSqlColumnIndex]) {
countSql = values[countSqlColumnIndex]
} else if (tableId) {
countSql = `SELECT * FROM ${tableId}`
}
const title = values[titleColumnIndex]
const summary = values[summaryColumnIndex]
const link = values[linkColumnIndex]
// assume that we recieve assets in order of rows and there is an asset for each item
// can revisit if this isn't the case.
const asset = assets?.[index] ?? ''
const goalsV2DataProps: GoalsV2DataProps = {
countSql,
title,
summary,
link,
asset,
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of logic in the returned JSX. Suggest creating an array of goalsV2DataProps outside of the return and then calling goalsV2DataPropsArray.map here

padding-right: 25px;
}

.GoalsV2 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of duplicate styling between GoalsV1 and GoalsV2, and it's a bit confusing because there is a lot of styling happening both here and in the component file. Can you either:

  • Refactor to share styles with GoalsV1 and minimize the duplicates, and put style overrides here instead of in the component
  • Remove most/all of these styles and for GoalsV2 just use MUI builtin components and sx styles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromatic Deploys the latest commit on this PR to Chromatic and runs snapshot tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants