Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #381 from orbiting/edit-icon
Browse files Browse the repository at this point in the history
add edit icon to Article-ActionBar
  • Loading branch information
patte committed Jan 2, 2020
2 parents 1afa474 + ad723ae commit 28f3407
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
4 changes: 4 additions & 0 deletions components/ActionBar/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ArticleActionBar extends Component {
linkedDiscussion,
ownDiscussion,
documentId,
repoId,
isEditor,
dossierUrl,
estimatedReadingMinutes,
estimatedConsumptionMinutes,
Expand Down Expand Up @@ -84,6 +86,8 @@ class ArticleActionBar extends Component {
showShare={!grandSharing}
fontSize={fontSize}
documentId={documentId}
repoId={repoId}
isEditor={isEditor}
bookmarked={!!userBookmark}
estimatedReadingMinutes={estimatedReadingMinutes}
estimatedConsumptionMinutes={estimatedConsumptionMinutes}
Expand Down
21 changes: 21 additions & 0 deletions components/ActionBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { colors } from '@project-r/styleguide'

import { shouldIgnoreClick } from '../Link/utils'

import { PUBLIKATOR_BASE_URL } from '../../lib/constants'

const styles = {
buttonGroup: css({
'@media print': {
Expand Down Expand Up @@ -69,6 +71,8 @@ class ActionBar extends Component {
showBookmark,
showShare,
documentId,
repoId,
isEditor,
bookmarked,
inNativeApp,
animate,
Expand Down Expand Up @@ -160,6 +164,17 @@ class ActionBar extends Component {
}
]

const editorIcons = [
repoId &&
PUBLIKATOR_BASE_URL && {
icon: 'edit',
href: `${PUBLIKATOR_BASE_URL}/repo/${repoId}/tree`,
title: t('feed/actionbar/edit'),
size: 23,
target: '_blank'
}
]

const displayConsumptionMinutes =
estimatedConsumptionMinutes > estimatedReadingMinutes
? estimatedConsumptionMinutes
Expand Down Expand Up @@ -197,6 +212,12 @@ class ActionBar extends Component {
{displayConsumptionMinutes > 1 && (
<ReadingTime minutes={displayConsumptionMinutes} />
)}
{isEditor &&
editorIcons
.filter(Boolean)
.map((props, i) => (
<IconLink key={props.icon} fill={colors.social} {...props} />
))}
</span>
</Fragment>
)
Expand Down
5 changes: 4 additions & 1 deletion components/Article/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ class ArticlePage extends Component {
inNativeIOSApp,
inIOS,
router,
isMember
isMember,
isEditor
},
state
) {
Expand Down Expand Up @@ -427,6 +428,8 @@ class ArticlePage extends Component {
inNativeApp={inNativeApp}
inIOS={inIOS}
documentId={article.id}
repoId={article.repoId}
isEditor={isEditor}
userBookmark={article.userBookmark}
showBookmark={isMember}
estimatedReadingMinutes={meta.estimatedReadingMinutes}
Expand Down
4 changes: 3 additions & 1 deletion components/IconLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import KeyIcon from 'react-icons/lib/fa/key'
import VideoIcon from './Icons/Video'
import MarkdownIcon from './Icons/Markdown'
import EtiquetteIcon from './Icons/Etiquette'
import EditIcon from 'react-icons/lib/fa/edit'

const DEFAULT_SIZE = 24
const DEFAULT_PADDING = 5
Expand Down Expand Up @@ -137,7 +138,8 @@ const ICONS = {
time: TimeIcon,
video: VideoIcon,
etiquette: EtiquetteIcon,
fontSize: FontSizeIcon
fontSize: FontSizeIcon,
edit: EditIcon
}

const IconLink = ({
Expand Down
2 changes: 2 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const CDN_FRONTEND_BASE_URL =
export const RENDER_FRONTEND_BASE_URL =
ENV.RENDER_FRONTEND_BASE_URL || PUBLIC_BASE_URL

export const PUBLIKATOR_BASE_URL = ENV.PUBLIKATOR_BASE_URL

export const PIWIK_URL_BASE = ENV.PIWIK_URL_BASE
export const PIWIK_SITE_ID = ENV.PIWIK_SITE_ID

Expand Down
4 changes: 4 additions & 0 deletions lib/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,10 @@
"key": "feed/actionbar/readingTime/other",
"value": "ungefähr {minutes} Minuten"
},
{
"key": "feed/actionbar/edit",
"value": "Im Publikator bearbeiten"
},
{
"key": "format/feed/title/1",
"value": "Ein Beitrag"
Expand Down

0 comments on commit 28f3407

Please sign in to comment.