Skip to content

Commit 9e5d2cd

Browse files
authoredApr 17, 2024
Merge pull request #422 from m2ms/stagingcandidate
Implemented #1389 and #1403
2 parents 1b8268b + 2a657e7 commit 9e5d2cd

13 files changed

+601
-57
lines changed
 

‎js/components/preview/tags/details/tagDetailRow.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ const TagDetailRow = memo(({ tag, moleculesToEditIds, moleculesToEdit }) => {
162162
isEdit={true}
163163
isTagEditor={true}
164164
></TagView>
165+
165166
{/* category */}
166167
<Tooltip title={dispatch(getCategoryById(tag.category))?.category}>
167168
<Typography className={classes.text} variant="body2" noWrap>
168169
{dispatch(getCategoryById(tag.category))?.category}
169170
</Typography>
170171
</Tooltip>
172+
171173
{/* select hits button */}
172174
<Tooltip title="Select hits">
173175
<Button
@@ -182,6 +184,7 @@ const TagDetailRow = memo(({ tag, moleculesToEditIds, moleculesToEdit }) => {
182184
{hasSelectedMolecule() ? 'Unselect hits' : 'Select hits'}
183185
</Button>
184186
</Tooltip>
187+
185188
{/* discourse button */}
186189
<Tooltip title="Discourse link">
187190
{/* Tooltip should not have disabled element as a direct child */}
@@ -213,18 +216,23 @@ const TagDetailRow = memo(({ tag, moleculesToEditIds, moleculesToEdit }) => {
213216
</Fab>
214217
</>
215218
</Tooltip>
219+
216220
{/* user */}
217221
<Typography className={classes.text} variant="body2">
218222
{tag.user_id}
219223
</Typography>
224+
220225
{/* date */}
221226
<Typography className={classes.text} variant="body2" noWrap>
222227
{navigator.language
223228
? new Date(tag.create_date).toLocaleDateString(navigator.language)
224229
: new Date(tag.create_date).toLocaleDateString()}
225230
</Typography>
231+
{/* </TableCell> */}
232+
226233
{/* edit button */}
227-
<IconButton
234+
<div></div>
235+
{/* <IconButton
228236
variant="contained"
229237
className={classes.editButton}
230238
size="small"
@@ -235,7 +243,7 @@ const TagDetailRow = memo(({ tag, moleculesToEditIds, moleculesToEdit }) => {
235243
<Tooltip title="Edit" className={classes.editButtonIcon}>
236244
<Edit />
237245
</Tooltip>
238-
</IconButton>
246+
</IconButton> */}
239247
</>
240248
);
241249
});

‎js/components/preview/tags/details/tagDetails.js

+27-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import {
4444
import { selectAllTags, clearAllTags } from '../redux/dispatchActions';
4545
import { Button } from '../../../common/Inputs/Button';
4646
import { LoadingContext } from '../../../loading';
47+
import { EditTagsModal } from '../modal/editTagsModal';
48+
import { DJANGO_CONTEXT } from '../../../../utils/djangoContext';
4749

4850
export const heightOfBody = '172px';
4951
export const defaultHeaderPadding = 15;
@@ -169,6 +171,7 @@ const TagDetails = memo(() => {
169171

170172
const [tagList, setTagList] = useState([]);
171173
const [selectAll, setSelectAll] = useState(true);
174+
const [showEditTagsModal, setShowEditTagsModal] = useState(false);
172175
const [searchString, setSearchString] = useState(null);
173176

174177
tagDetailView = tagDetailView?.tagDetailView === undefined ? tagDetailView : tagDetailView.tagDetailView;
@@ -337,6 +340,10 @@ const TagDetails = memo(() => {
337340
setSelectAll(!selectAll);
338341
};
339342

343+
const handleEditTagsButton = () => {
344+
setShowEditTagsModal(!showEditTagsModal);
345+
};
346+
340347
return (
341348
<Panel
342349
ref={ref}
@@ -439,9 +446,25 @@ const TagDetails = memo(() => {
439446
Select all tags
440447
</Button>
441448
</Grid>
449+
{DJANGO_CONTEXT.pk && ([
450+
<Grid item>
451+
<Button
452+
onClick={() => handleEditTagsButton()}
453+
disabled={false}
454+
color="inherit"
455+
variant="text"
456+
size="small"
457+
data-id="editTagsButton"
458+
className={classes.contColButton}
459+
>
460+
Edit tags
461+
</Button>
462+
</Grid>,
463+
<EditTagsModal open={showEditTagsModal} setOpenDialog={setShowEditTagsModal} anchorEl={ref?.current} />
464+
])}
442465
</Grid>
443466
</div>
444-
<div ref={elementRef} className={classes.containerExpanded} style={{ height: tagDetailView ? '80%' : '87%' }}>
467+
<div ref={elementRef} className={classes.containerExpanded} style={{ height: tagDetailView ? '89%' : '93%' }}>
445468
{tagDetailView ? (
446469
<>
447470
<div className={classes.container} id="tagName">
@@ -581,7 +604,7 @@ const TagDetails = memo(() => {
581604
</Tooltip>
582605
</IconButton>
583606
</div>
584-
<div />
607+
<div></div>
585608

586609
{filteredTagList &&
587610
filteredTagList.map((tag, idx) => {
@@ -604,9 +627,9 @@ const TagDetails = memo(() => {
604627
</div>
605628
)}
606629
</div>
607-
<div style={{ paddingBottom: resizableLayout === true ? '17px' : '0px' }}>
630+
{/* <div style={{ paddingBottom: resizableLayout === true ? '17px' : '0px' }}>
608631
<NewTagDetailRow moleculesToEditIds={moleculesToEditIds} moleculesToEdit={moleculesToEdit} />
609-
</div>
632+
</div> */}
610633
</Panel>
611634
);
612635
});

0 commit comments

Comments
 (0)