-
Notifications
You must be signed in to change notification settings - Fork 310
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
[WV-659] & [WV-660] VoterPositionEntryAndDisplay && VoterPositionEditNameAndPhotoModal #4228
Merged
DaleMcGrew
merged 8 commits into
wevote:develop
from
itcreativeusa:wv-659-open-modal-on-input-click
Feb 6, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c3b5204
[WV-659] & [WV-660] VoterPositionEntryAndDisplay: Open modal when you…
itcreativeusa da48629
[WV-659] & [WV-660] Apply fixes and improve accessibility in Activity…
itcreativeusa 4e11c04
[WV-659] VoterPositionEntryAndDisplay modal when you click "What's yo…
itcreativeusa 1c69086
fix dropdown height and radiogroup
itcreativeusa bbbacae
[WV-660]Enhance VoterPositionEditNameAndPhotoModal
itcreativeusa 7c193c7
remove useState
itcreativeusa b6972a1
[WV-659] & [WV-660] add two modals [TEAM REVIEW]
itcreativeusa 4b4b844
[WV-659] & [WV-660] add 2 modals [TEAM REVIEW]
itcreativeusa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
src/js/components/Activity/ActivityPostPublicDropdown.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Select, MenuItem, FormControl, Typography } from '@mui/material'; | ||
import { withStyles } from '@mui/styles'; | ||
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; | ||
import DesignTokenColors from '../../common/components/Style/DesignTokenColors'; | ||
|
||
const ActivityPostPublicDropdown = (props) => { | ||
const { visibilityIsPublic, onVisibilityChange, classes } = props; | ||
|
||
const handleVisibilityChange = (event) => { | ||
const { value } = event.target; | ||
onVisibilityChange(value === 'Public'); | ||
}; | ||
|
||
return ( | ||
<FormControl className={classes.formControl} aria-labelledby="opinion-visibility-label"> | ||
<div className={classes.container}> | ||
<Typography | ||
id="opinion-visibility-label" | ||
className={classes.label} | ||
component="label" | ||
> | ||
Opinion visible to: | ||
</Typography> | ||
<Select | ||
value={visibilityIsPublic ? 'Public' : 'Friends Only'} | ||
onChange={handleVisibilityChange} | ||
className={classes.selectVisibility} | ||
disableUnderline | ||
IconComponent={ArrowDropDownIcon} | ||
aria-label="Select visibility for your opinion" | ||
MenuProps={{ | ||
classes: { paper: classes.menuPaper }, | ||
}} | ||
> | ||
<MenuItem value="Public" className={classes.menuItem}> | ||
Public | ||
</MenuItem> | ||
<MenuItem value="Friends Only" className={classes.menuItem}> | ||
My friends | ||
</MenuItem> | ||
</Select> | ||
</div> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
ActivityPostPublicDropdown.propTypes = { | ||
visibilityIsPublic: PropTypes.bool.isRequired, | ||
onVisibilityChange: PropTypes.func.isRequired, | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
const styles = (theme) => ({ | ||
formControl: { | ||
width: '100%', | ||
}, | ||
container: { | ||
alignItems: 'center', | ||
display: 'flex', | ||
}, | ||
label: { | ||
color: DesignTokenColors.neutralUI900, | ||
fontFamily: 'Poppins', | ||
fontSize: '13px', | ||
fontWeight: '400', | ||
lineHeight: '19.5px', | ||
marginRight: '8px', | ||
[theme.breakpoints.down('md')]: { | ||
display: 'none', | ||
}, | ||
}, | ||
selectVisibility: { | ||
border: 'none', | ||
boxShadow: 'none', | ||
color: DesignTokenColors.neutralUI900, | ||
fontSize: '16px', | ||
fontWeight: '400', | ||
lineHeight: '21.82px', | ||
outline: 'none', | ||
padding: 0, | ||
'&:focus': { | ||
outline: 'none', | ||
boxShadow: 'none', | ||
}, | ||
'& .MuiOutlinedInput-notchedOutline': { | ||
border: 'none', | ||
}, | ||
[theme.breakpoints.down('sm')]: { | ||
padding: 0, | ||
}, | ||
[theme.breakpoints.down('xs')]: { | ||
padding: '0 32px 0 0', | ||
fontSize: '14px', | ||
}, | ||
}, | ||
menuItem: { | ||
color: DesignTokenColors.neutralUI900, | ||
fontSize: '16px', | ||
fontWeight: '400', | ||
lineHeight: '21.82px', | ||
padding: '10px', | ||
[theme.breakpoints.down('xs')]: { | ||
fontSize: '14px', | ||
}, | ||
}, | ||
menuPaper: { | ||
'& .MuiMenu-list': { | ||
padding: 0, | ||
}, | ||
}, | ||
outlinedInputRoot: { | ||
padding: 0, | ||
'& .MuiSelect-select': { | ||
padding: '0 !important', | ||
}, | ||
}, | ||
}); | ||
|
||
export default withStyles(styles)(ActivityPostPublicDropdown); |
114 changes: 114 additions & 0 deletions
114
src/js/components/PositionItem/VoterPositionEditNameAndPhotoModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { Dialog, DialogTitle, DialogContent, IconButton } from '@mui/material'; | ||
import { withStyles } from '@mui/styles'; | ||
import PropTypes from 'prop-types'; | ||
import { Close as CloseIcon } from '@mui/icons-material'; | ||
import VoterStore from '../../stores/VoterStore'; | ||
import SettingsProfilePicture from '../Settings/SettingsProfilePicture'; | ||
import SettingsWidgetFirstLastName from '../Settings/SettingsWidgetFirstLastName'; | ||
import SettingsWidgetOrganizationWebsite from '../Settings/SettingsWidgetOrganizationWebsite'; | ||
import SettingsWidgetOrganizationDescription from '../Settings/SettingsWidgetOrganizationDescription'; | ||
import SettingsWidgetAccountType from '../Settings/SettingsWidgetAccountType'; | ||
import DesignTokenColors from '../../common/components/Style/DesignTokenColors'; | ||
|
||
const VoterPositionEditNameAndPhotoModal = ({ show, toggleModal, classes }) => { | ||
const [voter, setVoter] = useState(null); | ||
|
||
useEffect(() => { | ||
if (show) { | ||
// Fetch voter data when modal is displayed | ||
const voterData = VoterStore.getVoter(); | ||
setVoter(voterData); | ||
} | ||
}, [show]); | ||
|
||
if (!voter) { | ||
return null; // Prevent rendering until voter data is available | ||
} | ||
|
||
return ( | ||
<Dialog open={show} onClose={toggleModal} maxWidth="sm" fullWidth> | ||
<DialogTitle> | ||
Edit Profile | ||
<IconButton | ||
aria-label="close" | ||
className={classes.closeButton} | ||
onClick={toggleModal} | ||
> | ||
<CloseIcon /> | ||
</IconButton> | ||
</DialogTitle> | ||
<DialogContent className={classes.modalContent}> | ||
<p> | ||
We are serious about protecting your information. We are a non-profit and will never sell your data. | ||
{' '} | ||
<a | ||
href="/frequently-asked-questions" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className={classes.a} | ||
> | ||
Frequently Asked Questions. | ||
</a> | ||
</p> | ||
<div> | ||
{/* Profile picture */} | ||
<SettingsProfilePicture | ||
voterPhotoUrl={voter.voter_photo_url_medium} | ||
externalUniqueId="edit-profile-modal" | ||
/> | ||
|
||
{/* First and last name */} | ||
<SettingsWidgetFirstLastName | ||
firstName={voter.first_name} | ||
lastName={voter.last_name} | ||
externalUniqueId="edit-profile-modal" | ||
/> | ||
|
||
{/* Website */} | ||
<SettingsWidgetOrganizationWebsite | ||
organizationWebsite={voter.linked_organization_website} | ||
externalUniqueId="edit-profile-modal" | ||
/> | ||
|
||
{/* Organization description */} | ||
<SettingsWidgetOrganizationDescription | ||
organizationDescription={voter.linked_organization_description} | ||
externalUniqueId="edit-profile-modal" | ||
/> | ||
|
||
{/* Account type */} | ||
<SettingsWidgetAccountType | ||
accountType={voter.account_type} | ||
externalUniqueId="edit-profile-modal" | ||
closeEditFormOnChoice | ||
showEditToggleOption | ||
/> | ||
</div> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
VoterPositionEditNameAndPhotoModal.propTypes = { | ||
show: PropTypes.bool.isRequired, | ||
toggleModal: PropTypes.func.isRequired, | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
const styles = { | ||
modalContent: { | ||
padding: '20px', | ||
}, | ||
a: { | ||
color: DesignTokenColors.primary500, | ||
}, | ||
closeButton: { | ||
color: DesignTokenColors.neutral100, | ||
position: 'absolute', | ||
right: '8px', | ||
top: '8px', | ||
}, | ||
}; | ||
|
||
export default withStyles(styles)(VoterPositionEditNameAndPhotoModal); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.