diff --git a/frontend/components/mention/MentionEditButtons.tsx b/frontend/components/mention/MentionEditButtons.tsx
new file mode 100644
index 000000000..277c0ec66
--- /dev/null
+++ b/frontend/components/mention/MentionEditButtons.tsx
@@ -0,0 +1,50 @@
+// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center)
+// SPDX-FileCopyrightText: 2023 Netherlands eScience Center
+//
+// SPDX-License-Identifier: Apache-2.0
+
+import {useSession} from '~/auth'
+import useEditMentionReducer from './useEditMentionReducer'
+
+import IconButton from '@mui/material/IconButton'
+import EditIcon from '@mui/icons-material/Edit'
+import DeleteIcon from '@mui/icons-material/Delete'
+import {MentionItemProps} from '~/types/Mention'
+
+export default function MentionEditButtons({item}: {item:MentionItemProps}) {
+ const {user} = useSession()
+ const {setEditModal,confirmDelete} = useEditMentionReducer()
+ const html = []
+
+ // console.group('MentionEditButtons')
+ // console.log('user...', user)
+ // console.log('item...', item)
+ // console.groupEnd()
+
+ if (user?.role==='rsd_admin') {
+ // items without DOI can be edited by rsd_admin
+ html.push(
+ setEditModal(item)}>
+
+
+ )
+ }
+ // all items can be deleted
+ html.push(
+ confirmDelete(item)}>
+
+
+ )
+
+ return html
+
+}
diff --git a/frontend/components/mention/MentionEditFeatured.tsx b/frontend/components/mention/MentionEditFeatured.tsx
index 607ce9fda..389a671a5 100644
--- a/frontend/components/mention/MentionEditFeatured.tsx
+++ b/frontend/components/mention/MentionEditFeatured.tsx
@@ -7,58 +7,18 @@
//
// SPDX-License-Identifier: Apache-2.0
-import IconButton from '@mui/material/IconButton'
-import EditIcon from '@mui/icons-material/Edit'
-import DeleteIcon from '@mui/icons-material/Delete'
-import {useSession} from '~/auth'
import {MentionTitle} from './MentionItemBase'
import {MentionItemProps} from '~/types/Mention'
-import useEditMentionReducer from './useEditMentionReducer'
import ImageAsBackground from '../layout/ImageAsBackground'
import MentionAuthors from './MentionAuthors'
import MentionPublisherItem from './MentionPublisherItem'
+import MentionEditButtons from './MentionEditButtons'
type MentionListItem = {
item: MentionItemProps
}
export default function MentionEditFeatured({item}: MentionListItem) {
- const {user} = useSession()
- const {setEditModal,confirmDelete} = useEditMentionReducer()
-
- function onEdit() {
- setEditModal(item)
- }
-
- function renderButtons() {
- const html = []
- if (user?.role==='rsd_admin') {
- // manual items without DOI can be edited
- html.push(
-
-
-
- )
- }
- // all items can be deleted
- html.push(
- confirmDelete(item)}>
-
-
- )
-
- return html
- }
-
return (
@@ -82,7 +42,7 @@ export default function MentionEditFeatured({item}: MentionListItem) {
/>
)
diff --git a/frontend/components/mention/MentionEditItem.tsx b/frontend/components/mention/MentionEditItem.tsx
index 092e6b29f..e03bf2ef8 100644
--- a/frontend/components/mention/MentionEditItem.tsx
+++ b/frontend/components/mention/MentionEditItem.tsx
@@ -6,14 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0
-import IconButton from '@mui/material/IconButton'
-import EditIcon from '@mui/icons-material/Edit'
-import DeleteIcon from '@mui/icons-material/Delete'
-// import UpdateIcon from '@mui/icons-material/Update'
-import {useSession} from '~/auth'
import MentionItemBase from './MentionItemBase'
import {MentionItemProps} from '~/types/Mention'
-import useEditMentionReducer from './useEditMentionReducer'
+import MentionEditButtons from './MentionEditButtons'
type MentionListItem = {
pos: number
@@ -21,50 +16,13 @@ type MentionListItem = {
}
export default function MentionEditItem({item, pos}: MentionListItem) {
- const {user} = useSession()
- // use context methods to pass btn action
- // const {onUpdate, confirmDelete, setEditModal} = useContext(EditMentionContext)
- const {setEditModal,confirmDelete} = useEditMentionReducer()
-
- function onEdit() {
- setEditModal(item)
- }
-
- function renderButtons() {
- const html = []
-
- if (user?.role==='rsd_admin') {
- // items without DOI can be edited by rsd_admin
- html.push(
-
-
-
- )
- }
- // all items can be deleted
- html.push(
- confirmDelete(item)}>
-
-
- )
-
- return html
- }
-
return (
+ }
role="list"
/>
)