OpenConceptLab/ocl_issues#2485 | Copy project#13
Conversation
paynejd
left a comment
There was a problem hiding this comment.
Two blockers below (UX inconsistency, broken indentation) plus a label rename:
Rename "Copy" → "Create similar". "Copy" implies a full duplicate. "Create similar" describes the actual behavior (config-only seed). Apply to:
- Button text + tooltip in
Controls.jsxandMapProjects.jsx - i18n keys:
map_project.copy_project→map_project.create_similar(en/es/zh); dropcommon.copy - URL param:
?copyFrom=→?templateFrom=(cheap to change now, expensive once URLs are bookmarked)
|
|
||
| const onCopyClick = event => { | ||
| event.preventDefault() | ||
| event.stopPropagation() |
There was a problem hiding this comment.
Should open in the same tab to match the listing-page button.
| event.stopPropagation() | |
| history.push(`/map-projects/new?copyFrom=${encodeURIComponent(project.url)}`) |
| <Button size='small' color='primary' variant='contained' sx={{textTransform: 'none', margin: '0 4px'}} href={`#${project.url}`}> | ||
| {t('common.open')} | ||
| </Button> | ||
| <Button size='small' color='error' variant='text' sx={{marginLeft: '8px', textTransform: 'none'}} onClick={() => setDeleteProject(project)}> | ||
| <Tooltip title={t('map_project.copy_project')}> | ||
| <Button size='small' variant='contained' color='secondary' sx={{margin: '0 4px', textTransform: 'none'}} onClick={event => onCopyClick(event, project)}> | ||
| {t('common.copy')} | ||
| </Button> | ||
| </Tooltip> | ||
| <Button size='small' color='error' variant='text' sx={{margin: '0 4px', textTransform: 'none'}} onClick={() => setDeleteProject(project)}> | ||
| {t('common.delete')} | ||
| </Button> |
There was a problem hiding this comment.
Fix indentation inconsistency.
| <Button size='small' color='primary' variant='contained' sx={{textTransform: 'none', margin: '0 4px'}} href={`#${project.url}`}> | |
| {t('common.open')} | |
| </Button> | |
| <Button size='small' color='error' variant='text' sx={{marginLeft: '8px', textTransform: 'none'}} onClick={() => setDeleteProject(project)}> | |
| <Tooltip title={t('map_project.copy_project')}> | |
| <Button size='small' variant='contained' color='secondary' sx={{margin: '0 4px', textTransform: 'none'}} onClick={event => onCopyClick(event, project)}> | |
| {t('common.copy')} | |
| </Button> | |
| </Tooltip> | |
| <Button size='small' color='error' variant='text' sx={{margin: '0 4px', textTransform: 'none'}} onClick={() => setDeleteProject(project)}> | |
| {t('common.delete')} | |
| </Button> | |
| <Button size='small' color='primary' variant='contained' sx={{margin: '0 4px', textTransform: 'none'}} href={`#${project.url}`}> | |
| {t('common.open')} | |
| </Button> | |
| <Tooltip title={t('map_project.copy_project')}> | |
| <Button size='small' variant='contained' color='secondary' sx={{margin: '0 4px', textTransform: 'none'}} onClick={event => onCopyClick(event, project)}> | |
| {t('common.copy')} | |
| </Button> | |
| </Tooltip> | |
| <Button size='small' color='error' variant='text' sx={{margin: '0 4px', textTransform: 'none'}} onClick={() => setDeleteProject(project)}> | |
| {t('common.delete')} | |
| </Button> |
| } | ||
| if(copyFromProjectURL) { | ||
| copyFromProject() | ||
| } |
There was a problem hiding this comment.
copyFromProjectURL is read inside this effect but missing from deps. If mount-only is intentional, add // eslint-disable-next-line react-hooks/exhaustive-deps with a one-line reason.
| } | ||
|
|
||
| const fetchAndSetProject = () => { | ||
| setLoadingProject(true) |
There was a problem hiding this comment.
Prefill name with "Copy of {original name}" so users don't land on a blank field. Requires adding name to the /configurations/ API response.
Linked Issue
Ref OpenConceptLab/ocl_issues#2485