Skip to content
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

resolves #965 hide delete button on articles when a workspace is active #974

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion front/src/components/Article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
import { Link} from 'react-router-dom'
import clsx from 'clsx'
import { Modal as GeistModal, Note, Spacer, useModal, useToasts } from '@geist-ui/core'
import { useActiveWorkspace } from '../hooks/workspace.js'

import styles from './articles.module.scss'
import ArticleVersionLinks from './ArticleVersionLinks.jsx'
Expand Down Expand Up @@ -52,6 +53,8 @@ import ArticleSendCopy from './ArticleSendCopy.jsx'
export default function Article ({ article, onArticleUpdated, onArticleDeleted, onArticleCreated }) {
const activeUser = useSelector(state => state.activeUser)
const articleId = useMemo(() => article._id, [article])
const activeWorkspace = useActiveWorkspace()
const activeWorkspaceId = useMemo(() => activeWorkspace?._id, [activeWorkspace])

const {
data: contributorsQueryData,
Expand Down Expand Up @@ -251,7 +254,7 @@ export default function Article ({ article, onArticleUpdated, onArticleDeleted,

<aside className={styles.actionButtons}>

{isArticleOwner &&
{isArticleOwner && !activeWorkspaceId &&
<Button title={t('article.delete.button')} icon={true} onClick={() => setDeleteArticleVisible(true)}>
<Trash/>
</Button>}
Expand Down
Loading