Context menu to each history entry (#171)

- added entry-menu
- added subsection in entry-menu with the location of the history entry and the action to remove an entry from history
- added uploadAll functionality
- show uploadAll Button in history only if the user is logged in
- added deleteNote api call

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-06-09 22:35:09 +02:00 committed by GitHub
parent 107a8eeaaf
commit 72a161ea16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 238 additions and 110 deletions

View file

@ -0,0 +1,59 @@
import React from 'react'
import { Dropdown } from 'react-bootstrap'
import { Trans } from 'react-i18next'
import { ForkAwesomeIcon } from '../../../../common/fork-awesome/fork-awesome-icon'
import { ShowIf } from '../../../../common/show-if/show-if'
import { HistoryEntryOrigin } from '../history'
import './entry-menu.scss'
export interface EntryMenuProps {
id: string;
location: HistoryEntryOrigin
isDark: boolean;
onRemove: () => void
onDelete: () => void
className?: string
}
const EntryMenu: React.FC<EntryMenuProps> = ({ id, location, isDark, onRemove, onDelete, className }) => {
return (
<Dropdown className={className || ''}>
<Dropdown.Toggle size="sm" variant={isDark ? 'secondary' : 'light'} id={`dropdown-card-${id}`} className='history-menu d-flex align-items-center'>
<ForkAwesomeIcon icon="ellipsis-h" className='history-menu'/>
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Header>
<Trans i18nKey="landing.history.menu.recentNotes"/>
</Dropdown.Header>
<ShowIf condition={location === HistoryEntryOrigin.LOCAL}>
<Dropdown.Item disabled>
<ForkAwesomeIcon icon="laptop" fixedWidth={true} className="mx-2"/>
<Trans i18nKey="landing.history.menu.entryLocal"/>
</Dropdown.Item>
</ShowIf>
<ShowIf condition={location === HistoryEntryOrigin.REMOTE}>
<Dropdown.Item disabled>
<ForkAwesomeIcon icon="cloud" fixedWidth={true} className="mx-2"/>
<Trans i18nKey="landing.history.menu.entryRemote"/>
</Dropdown.Item>
</ShowIf>
<Dropdown.Item onClick={onRemove}>
<ForkAwesomeIcon icon="archive" fixedWidth={true} className="mx-2"/>
<Trans i18nKey="landing.history.menu.removeEntry"/>
</Dropdown.Item>
<Dropdown.Divider/>
<Dropdown.Item onClick={onDelete}>
<ForkAwesomeIcon icon="trash" fixedWidth={true} className="mx-2"/>
<Trans i18nKey="landing.history.menu.deleteNote"/>
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
)
}
export { EntryMenu }