Skip to content

Conversation

@evanrbowers
Copy link
Contributor

Changes

@aws-amplify-us-west-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1013.d20k671nqqv4kl.amplifyapp.com

@JamieRuderman
Copy link
Member

@codex can you assist with review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad9c8e96a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 27 to 31
setLoading(true)
const result = await graphQLAdminPartner(partnerId)
if (result !== 'ERROR' && result?.data?.data?.admin?.partners?.[0]) {
setPartner(result.data.data.admin.partners[0])
}

Choose a reason for hiding this comment

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

P2 Badge Clear stale partner when admin lookup fails

If graphQLAdminPartner returns ERROR or no partner for a new partnerId, partner is left unchanged, so navigating from a valid partner to an invalid/deleted ID keeps showing the previous partner and the “Partner not found” branch never triggers. Consider setting partner to null when starting the fetch or when no results are returned to avoid stale data.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 31 to 35
setLoading(true)
const result = await graphQLAdminUser(userId)
if (result !== 'ERROR' && result?.data?.data?.admin?.users?.items?.[0]) {
setUser(result.data.data.admin.users.items[0])
}

Choose a reason for hiding this comment

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

P2 Badge Clear stale user when admin lookup fails

If the admin user lookup fails or returns no items, user is never cleared, so switching from a valid user to an invalid/deleted ID keeps rendering the previous user and skips the “User not found” state. Resetting user to null on fetch start or when no results are returned prevents showing stale details.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

@JamieRuderman JamieRuderman left a comment

Choose a reason for hiding this comment

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

It's nice an cleanly implemented - I just have some comments. Let me know if you wanna discuss. Thanks!

Comment on lines 18 to 30
const useStyles = makeStyles(({ palette }) => ({
list: {
position: 'static',
'& .MuiListItemIcon-root': { color: palette.grayDark.main },
'& .MuiListItemText-primary': { color: palette.grayDarkest.main },
'& .MuiListItemButton-root:hover .MuiListItemText-primary': { color: palette.black.main },
'& .Mui-selected, & .Mui-selected:hover': {
backgroundColor: palette.primaryLighter.main,
'& .MuiListItemIcon-root': { color: palette.grayDarker.main },
'& .MuiListItemText-primary': { color: palette.black.main, fontWeight: 500 },
},
},
}))
Copy link
Member

Choose a reason for hiding this comment

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

This is the old way we were styling, trying to convert to the sx prop styles for all future work. With AI now might be simple to convert all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +35 to +37
const handleBack = () => {
history.push('/admin/partners')
}
Copy link
Member

Choose a reason for hiding this comment

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

Back buttons maybe should use "useMobileBack" hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


const fetchPartner = async () => {
setLoading(true)
const result = await graphQLAdminPartner(partnerId)
Copy link
Member

Choose a reason for hiding this comment

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

I would usually create a model class for something like Partner I understand if you think not worth it for an internal tool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

header={
<Gutters>
<Stack direction="row" spacing={1} alignItems="center">
<IconButton
Copy link
Member

Choose a reason for hiding this comment

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

We should have the hamburger menu here too... really I'm not sure removing the normal header is a good idea, but i guess dosen't matter too much for internal tool, but you can't get out of admin mode on mobile currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

put the normal header on admin pages

Comment on lines 37 to 88
const maxPanels = layout.singlePanel ? 1 : (containerWidth >= THREE_PANEL_WIDTH ? 3 : 2)

useEffect(() => {
const updateWidth = () => {
if (containerRef.current) {
setContainerWidth(containerRef.current.offsetWidth)
}
}

updateWidth()

const resizeObserver = new ResizeObserver(updateWidth)
if (containerRef.current) {
resizeObserver.observe(containerRef.current)
}

return () => resizeObserver.disconnect()
}, [])

const onLeftMove = useCallback((event: MouseEvent) => {
const fullWidth = containerRef.current?.offsetWidth || 1000
leftHandleRef.current += event.clientX - leftMoveRef.current
leftMoveRef.current = event.clientX
if (leftHandleRef.current > MIN_WIDTH && leftHandleRef.current < fullWidth - MIN_WIDTH - rightWidth) {
setLeftWidth(leftHandleRef.current)
}
}, [rightWidth])

const onLeftUp = useCallback((event: MouseEvent) => {
setLeftGrab(false)
event.preventDefault()
window.removeEventListener('mousemove', onLeftMove)
window.removeEventListener('mouseup', onLeftUp)
}, [onLeftMove])

const onLeftDown = (event: React.MouseEvent) => {
setLeftGrab(true)
leftMoveRef.current = event.clientX
leftHandleRef.current = leftPrimaryRef.current?.offsetWidth || leftWidth
event.preventDefault()
window.addEventListener('mousemove', onLeftMove)
window.addEventListener('mouseup', onLeftUp)
}

const onRightMove = useCallback((event: MouseEvent) => {
const fullWidth = containerRef.current?.offsetWidth || 1000
rightHandleRef.current -= event.clientX - rightMoveRef.current
rightMoveRef.current = event.clientX
if (rightHandleRef.current > MIN_WIDTH && rightHandleRef.current < fullWidth - MIN_WIDTH - leftWidth) {
setRightWidth(rightHandleRef.current)
}
}, [leftWidth])
Copy link
Member

Choose a reason for hiding this comment

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

Seems like the panel width stuff is duplicated here - we would want to re-use the existing logic I would think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

badge={licenseIndicator}
onClick={handleClose}
/>
{adminMode ? (
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we need a new boolean to track admin mode since we already have TestUI mode. We could rename testUI mode to admin mode and trigger that menu's visibility from the admin attribute on the user. And then just always show the admin menu items... maybe under the "more" menu? Having it integrated instead of separated? Maybe there is a reason to do it how you have it. This just seems simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd pref to keep it as its own pages and not nested. It also does not fit well into the multi account of the main page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants