-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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!
<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> |
There was a problem hiding this comment.
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
<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> |
{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, | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
PORTALS-3308 This PR modifies the Goals component by creating cards for each panel, surrounded by a box.