From e3f7d0db4889bded92b08b352735795dde08057e Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Wed, 8 Jan 2020 20:00:05 +0200 Subject: [PATCH 1/9] Add groups context menu --- src/components/vault/GroupsList.js | 76 +++++++++++++++++++++++++++++- src/components/vault/Vault.js | 1 + 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index bf2e06f..ffc5bbc 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -1,9 +1,19 @@ -import React, { useState } from 'react'; +import React, { useContext, useState } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; -import { Tree as BaseTree, Button, Tag, Intent, Alignment } from '@blueprintjs/core'; +import { + Tree as BaseTree, + Button, + Tag, + Intent, + Alignment, + ContextMenu, + Menu, + MenuItem +} from '@blueprintjs/core'; import { GroupFacade } from './props'; import { useGroups } from './hooks/vault'; +import { VaultContext } from './Vault'; import { PaneContainer, PaneHeader, PaneContent, PaneFooter } from './Pane'; import { getThemeProp } from '../../utils'; @@ -31,6 +41,8 @@ const Tree = styled(BaseTree)` `; const GroupsList = () => { + const { vault } = useContext(VaultContext); + const [contextMenuOpen, setContextMenuVisibility] = useState(false); const { groups, selectedGroupID, @@ -38,6 +50,7 @@ const GroupsList = () => { expandedGroups, handleCollapseGroup, handleExpandGroup, + handleModifyGroup, filters, onGroupFilterTermChange, onGroupFilterSortModeChange, @@ -46,6 +59,64 @@ const GroupsList = () => { trashID } = useGroups(); + const renderGroupsMenu = (items, parentNode) => ( + <> + + + + + + + 0}> + + {renderGroupsMenu(group.childNodes, group)} + + + + + + + + + ); + + const showContextMenu = (node, nodePath, evt) => { + evt.preventDefault(); + const groupFacade = vault.groups.find(group => group.id === node.id); + setContextMenuVisibility(true); + ContextMenu.show( + + {/* + {renderGroupsMenu(groups)} + */} + {}} /> + {}} /> + {}} /> + , + { left: evt.clientX, top: evt.clientY }, + () => { + setContextMenuVisibility(false); + } + ); + }; + return ( { onSelectGroup(group.id)} + onNodeContextMenu={showContextMenu} onNodeExpand={handleExpandGroup} onNodeCollapse={handleCollapseGroup} /> diff --git a/src/components/vault/Vault.js b/src/components/vault/Vault.js index 3852eb6..5d01fb9 100644 --- a/src/components/vault/Vault.js +++ b/src/components/vault/Vault.js @@ -53,6 +53,7 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { handleCollapseGroup: group => { setExpandedGroups(expandedGroups.filter(id => id !== group.id)); }, + onGroupFilterTermChange: term => { dispatchGroupFilters({ type: 'set-term', From cc6171f2f8dc42fed75a70e65748860f68aa2f4c Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Wed, 8 Jan 2020 20:57:04 +0200 Subject: [PATCH 2/9] Add more helpers/menus for group addition/editing --- src/components/vault/GroupsList.js | 39 ++++++++++++++++++----------- src/components/vault/Pane.js | 10 ++++++-- src/components/vault/hooks/vault.js | 3 ++- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index ffc5bbc..482edb9 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react'; +import React, { useState } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; import { @@ -9,11 +9,11 @@ import { Alignment, ContextMenu, Menu, - MenuItem + MenuItem, + MenuDivider } from '@blueprintjs/core'; import { GroupFacade } from './props'; import { useGroups } from './hooks/vault'; -import { VaultContext } from './Vault'; import { PaneContainer, PaneHeader, PaneContent, PaneFooter } from './Pane'; import { getThemeProp } from '../../utils'; @@ -41,10 +41,10 @@ const Tree = styled(BaseTree)` `; const GroupsList = () => { - const { vault } = useContext(VaultContext); const [contextMenuOpen, setContextMenuVisibility] = useState(false); const { groups, + groupsRaw, selectedGroupID, onSelectGroup, expandedGroups, @@ -59,7 +59,12 @@ const GroupsList = () => { trashID } = useGroups(); - const renderGroupsMenu = (items, parentNode) => ( + const handleMove = parentID => node => { + // @todo move group + // onMoveEntryToGroup(entry.id, parentID); + }; + + const renderGroupsMenu = (items, parentNode, selectedGroupID) => ( <> { key={parentNode.id} icon={parentNode.icon} onClick={handleMove(parentNode.id)} - disabled={entry.parentID === parentNode.id} + disabled={selectedGroupID === parentNode.id} /> @@ -80,7 +85,7 @@ const GroupsList = () => { icon={group.icon} onClick={handleMove(group.id)} > - {renderGroupsMenu(group.childNodes, group)} + {renderGroupsMenu(group.childNodes, group, selectedGroupID)} @@ -89,7 +94,7 @@ const GroupsList = () => { key={group.id} icon={group.icon} onClick={handleMove(group.id)} - disabled={entry.parentID === group.id} + disabled={selectedGroupID === group.id} /> @@ -99,16 +104,19 @@ const GroupsList = () => { const showContextMenu = (node, nodePath, evt) => { evt.preventDefault(); - const groupFacade = vault.groups.find(group => group.id === node.id); + const groupFacade = groupsRaw.find(group => group.id === node.id); setContextMenuVisibility(true); ContextMenu.show( - {/* - {renderGroupsMenu(groups)} - */} + + {}} /> - {}} /> - {}} /> + {}} /> + + + {renderGroupsMenu(groups, null, node.id)} + + {}} /> , { left: evt.clientX, top: evt.clientY }, () => { @@ -123,10 +131,11 @@ const GroupsList = () => { title="Groups" count={groups.length} filter={filters} + onAddItem={() => {}} onTermChange={term => onGroupFilterTermChange(term)} onSortModeChange={sortMode => onGroupFilterSortModeChange(sortMode)} /> - + console.log(args)}> onSelectGroup(group.id)} diff --git a/src/components/vault/Pane.js b/src/components/vault/Pane.js index a917b73..43b9c6c 100644 --- a/src/components/vault/Pane.js +++ b/src/components/vault/Pane.js @@ -14,6 +14,8 @@ import { } from '@blueprintjs/core'; import { getThemeProp } from '../../utils'; +const NOOP = () => {}; + const createScrollShadow = color => css` /* Show shadow on scroll: https://gist.github.com/tbmiller/6675197 */ background: linear-gradient(${color} 30%, hsla(0, 0%, 100%, 0)), @@ -89,8 +91,9 @@ export const PaneHeader = ({ count, title, filter = null, - onTermChange = () => {}, - onSortModeChange = () => {} + onAddItem = NOOP, + onTermChange = NOOP, + onSortModeChange = NOOP }) => { const [filterInputVisible, toggleFilter] = useState(false); const inputRef = useRef(null); @@ -161,6 +164,9 @@ export const PaneHeader = ({ + + + + + + + ); }; From 2fa87c26b38693451e73f1e0abe35a15811f6965 Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Mon, 13 Jan 2020 21:02:18 +0200 Subject: [PATCH 5/9] Add group creation / renaming --- package-lock.json | 6 ++-- package.json | 1 + src/components/vault/GroupsList.js | 43 +++++++++++++++++++++++--- src/components/vault/Vault.js | 21 ++++++++++--- src/components/vault/hooks/vault.js | 4 +++ src/components/vault/reducers/vault.js | 18 +++++++++++ stories/vault.js | 13 +++++++- 7 files changed, 94 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31d592f..9a53c12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17719,9 +17719,9 @@ "dev": true }, "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", "dev": true }, "v8-compile-cache": { diff --git a/package.json b/package.json index d171659..e6b6fbd 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "style-loader": "^0.23.1", "styled-components": "^4.3.2", "terser-webpack-plugin": "^1.4.1", + "uuid": "^3.3.3", "webpack": "^4.39.3", "webpack-cli": "^3.3.7" }, diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index 750897b..926b944 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; import { @@ -7,6 +7,7 @@ import { Classes, ContextMenu, Dialog, + InputGroup, Intent, Menu, MenuDivider, @@ -19,6 +20,8 @@ import { useGroups } from './hooks/vault'; import { PaneContainer, PaneHeader, PaneContent, PaneFooter } from './Pane'; import { getThemeProp } from '../../utils'; +const KEYCODE_ENTER = 13; + const Tree = styled(BaseTree)` .node { &[class*='node-selected'] { @@ -45,11 +48,15 @@ const Tree = styled(BaseTree)` const GroupsList = () => { const [contextMenuOpen, setContextMenuVisibility] = useState(false); const [groupEditID, setGroupEditID] = useState(null); + const [parentGroupID, setParentGroupID] = useState(null); const [newGroupName, setNewGroupName] = useState(''); + const groupTitleInputRef = useRef(null); const { groups, groupsRaw, selectedGroupID, + onCreateGroup, + onRenameGroup, onSelectGroup, expandedGroups, handleCollapseGroup, @@ -63,14 +70,22 @@ const GroupsList = () => { trashID } = useGroups(); + useEffect(() => { + if (groupTitleInputRef && groupTitleInputRef.current) { + groupTitleInputRef.current.focus(); + } + }, [groupTitleInputRef.current]); + const closeEditDialog = () => { setGroupEditID(null); setNewGroupName(''); + setParentGroupID(null); }; - const editGroup = groupFacade => { + const editGroup = (groupFacade, parentID = null) => { setGroupEditID(groupFacade ? groupFacade.id : -1); setNewGroupName(groupFacade ? groupFacade.title : ''); + setParentGroupID(parentID); }; const handleMove = parentID => node => { @@ -124,7 +139,7 @@ const GroupsList = () => { - {}} /> + editGroup(null, groupFacade.id)} /> editGroup(groupFacade)} /> @@ -139,6 +154,15 @@ const GroupsList = () => { ); }; + const submitGroupChange = () => { + if (groupEditID !== null && groupEditID !== -1) { + onRenameGroup(groupEditID, newGroupName); + } else { + onCreateGroup(parentGroupID, newGroupName); + } + closeEditDialog(); + }; + return ( <> @@ -184,11 +208,22 @@ const GroupsList = () => { >

Enter group title:

+ setNewGroupName(evt.target.value)} + value={newGroupName} + inputRef={groupTitleInputRef} + onKeyDown={evt => { + if (evt.keyCode === KEYCODE_ENTER) { + submitGroupChange(); + } + }} + />
-
diff --git a/src/components/vault/Vault.js b/src/components/vault/Vault.js index 5d01fb9..1e05f8d 100644 --- a/src/components/vault/Vault.js +++ b/src/components/vault/Vault.js @@ -1,7 +1,7 @@ import React, { useReducer, useState, useEffect, useRef } from 'react'; import { clone } from 'ramda'; import PropTypes from 'prop-types'; -import { createEntryFacade } from '@buttercup/facades'; +import { createEntryFacade, createGroupFacade } from '@buttercup/facades'; import { VaultFacade } from './props'; import { entryReducer } from './reducers/entry'; import { vaultReducer, filterReducer, defaultFilter } from './reducers/vault'; @@ -23,11 +23,9 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { useEffect(() => { if (initRef.current === false) { - console.log('Init call. Do not call onUpdate'); initRef.current = true; return; } - console.log('Debug: Running on Update function. Yay!'); onUpdate(vault); }, [vault]); @@ -53,7 +51,15 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { handleCollapseGroup: group => { setExpandedGroups(expandedGroups.filter(id => id !== group.id)); }, - + onCreateGroup: (parentID, groupTitle) => { + const parentGroupID = parentID ? parentID : undefined; + const group = createGroupFacade(null, parentGroupID); + group.title = groupTitle; + dispatch({ + type: 'create-group', + payload: group + }); + }, onGroupFilterTermChange: term => { dispatchGroupFilters({ type: 'set-term', @@ -90,6 +96,13 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { }); } }, + onRenameGroup: (groupID, title) => { + dispatch({ + type: 'rename-group', + groupID, + title + }); + }, onAddEntry: type => { const facade = createEntryFacade(null, { type }); facade.parentID = selectedGroupID; diff --git a/src/components/vault/hooks/vault.js b/src/components/vault/hooks/vault.js index 1102745..d7ddd09 100644 --- a/src/components/vault/hooks/vault.js +++ b/src/components/vault/hooks/vault.js @@ -59,8 +59,10 @@ export function useCurrentEntries() { export function useGroups() { const { vault, + onCreateGroup, onSelectGroup, onMoveEntryToGroup, + onRenameGroup, selectedGroupID, expandedGroups, handleCollapseGroup, @@ -87,8 +89,10 @@ export function useGroups() { ), groupsRaw: vault.groups, filters: groupFilters, + onCreateGroup, onGroupFilterTermChange, onGroupFilterSortModeChange, + onRenameGroup, onSelectGroup, selectedGroupID, expandedGroups, diff --git a/src/components/vault/reducers/vault.js b/src/components/vault/reducers/vault.js index aeebcf0..86c29f8 100644 --- a/src/components/vault/reducers/vault.js +++ b/src/components/vault/reducers/vault.js @@ -38,6 +38,24 @@ export function vaultReducer(state, action) { ...state, entries: state.entries.filter(entry => entry.id !== action.entryID) }; + case 'create-group': + return { + ...state, + groups: [...state.groups, action.payload] + }; + case 'rename-group': + return { + ...state, + groups: state.groups.map(group => { + if (group.id === action.groupID) { + return { + ...group, + title: action.title + }; + } + return group; + }) + }; } } diff --git a/stories/vault.js b/stories/vault.js index 13ef7cd..98ee595 100644 --- a/stories/vault.js +++ b/stories/vault.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import styled from 'styled-components'; +import uuid from 'uuid/v4'; import { Archive, Entry } from 'buttercup'; import { FIELD_VALUE_TYPE_OTP } from '@buttercup/facades'; import { ThemeProvider } from 'styled-components'; @@ -47,6 +48,16 @@ function createArchive() { return archive; } +function normaliseFacade(vault) { + // Set UUIDs for new groups, or else we get collisions + vault.groups.forEach(group => { + if (!group.id) { + group.id = uuid(); + } + }); + return vault; +} + const View = styled.div` height: calc(100vh - 1rem); width: 100%; @@ -66,7 +77,7 @@ export default class VaultStory extends Component { this.setState({ facade: vault })} + onUpdate={vault => this.setState({ facade: normaliseFacade(vault) })} > From 6bc99c7d9fafca6ea1b6e4942200e21794b4982d Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Mon, 13 Jan 2020 21:23:08 +0200 Subject: [PATCH 6/9] Add groups moving --- src/components/vault/GroupsList.js | 13 +++++++------ src/components/vault/Vault.js | 7 +++++++ src/components/vault/hooks/vault.js | 2 ++ src/components/vault/reducers/vault.js | 13 +++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index 926b944..c35295b 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -56,6 +56,7 @@ const GroupsList = () => { groupsRaw, selectedGroupID, onCreateGroup, + onMoveGroup, onRenameGroup, onSelectGroup, expandedGroups, @@ -88,9 +89,8 @@ const GroupsList = () => { setParentGroupID(parentID); }; - const handleMove = parentID => node => { - // @todo move group - // onMoveEntryToGroup(entry.id, parentID); + const moveGroupToGroup = (groupID, parentID) => { + onMoveGroup(groupID, parentID); }; const renderGroupsMenu = (items, parentNode, selectedGroupID) => ( @@ -100,7 +100,7 @@ const GroupsList = () => { text={`Move to ${parentNode.label}`} key={parentNode.id} icon={parentNode.icon} - onClick={handleMove(parentNode.id)} + onClick={() => moveGroupToGroup(selectedGroupID, parentNode.id)} disabled={selectedGroupID === parentNode.id} /> @@ -112,7 +112,8 @@ const GroupsList = () => { text={group.label} key={group.id} icon={group.icon} - onClick={handleMove(group.id)} + onClick={() => moveGroupToGroup(selectedGroupID, group.id)} + disabled={selectedGroupID === group.id} > {renderGroupsMenu(group.childNodes, group, selectedGroupID)} @@ -122,7 +123,7 @@ const GroupsList = () => { text={group.label} key={group.id} icon={group.icon} - onClick={handleMove(group.id)} + onClick={() => moveGroupToGroup(selectedGroupID, group.id)} disabled={selectedGroupID === group.id} /> diff --git a/src/components/vault/Vault.js b/src/components/vault/Vault.js index 1e05f8d..7aea645 100644 --- a/src/components/vault/Vault.js +++ b/src/components/vault/Vault.js @@ -96,6 +96,13 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { }); } }, + onMoveGroup: (groupID, parentID) => { + dispatch({ + type: 'move-group', + groupID, + parentID + }); + }, onRenameGroup: (groupID, title) => { dispatch({ type: 'rename-group', diff --git a/src/components/vault/hooks/vault.js b/src/components/vault/hooks/vault.js index d7ddd09..6c9c216 100644 --- a/src/components/vault/hooks/vault.js +++ b/src/components/vault/hooks/vault.js @@ -62,6 +62,7 @@ export function useGroups() { onCreateGroup, onSelectGroup, onMoveEntryToGroup, + onMoveGroup, onRenameGroup, selectedGroupID, expandedGroups, @@ -92,6 +93,7 @@ export function useGroups() { onCreateGroup, onGroupFilterTermChange, onGroupFilterSortModeChange, + onMoveGroup, onRenameGroup, onSelectGroup, selectedGroupID, diff --git a/src/components/vault/reducers/vault.js b/src/components/vault/reducers/vault.js index 86c29f8..5e3631c 100644 --- a/src/components/vault/reducers/vault.js +++ b/src/components/vault/reducers/vault.js @@ -56,6 +56,19 @@ export function vaultReducer(state, action) { return group; }) }; + case 'move-group': + return { + ...state, + groups: state.groups.map(group => { + if (group.id === action.groupID) { + return { + ...group, + parentID: action.parentID + }; + } + return group; + }) + }; } } From 93e67f0f986134e5da70b35400d005502b7edcb7 Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Mon, 13 Jan 2020 21:34:19 +0200 Subject: [PATCH 7/9] Add move group to trash feature --- src/components/vault/GroupsList.js | 7 ++++++- src/components/vault/hooks/vault.js | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index c35295b..aa1b9ed 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -57,6 +57,7 @@ const GroupsList = () => { selectedGroupID, onCreateGroup, onMoveGroup, + onMoveGroupToTrash, onRenameGroup, onSelectGroup, expandedGroups, @@ -93,6 +94,10 @@ const GroupsList = () => { onMoveGroup(groupID, parentID); }; + const moveToTrash = groupID => { + onMoveGroupToTrash(groupID); + }; + const renderGroupsMenu = (items, parentNode, selectedGroupID) => ( <> @@ -146,7 +151,7 @@ const GroupsList = () => { {renderGroupsMenu(groups, null, node.id)} - {}} /> + moveToTrash(selectedGroupID)} />
, { left: evt.clientX, top: evt.clientY }, () => { diff --git a/src/components/vault/hooks/vault.js b/src/components/vault/hooks/vault.js index 6c9c216..c7d646d 100644 --- a/src/components/vault/hooks/vault.js +++ b/src/components/vault/hooks/vault.js @@ -94,6 +94,13 @@ export function useGroups() { onGroupFilterTermChange, onGroupFilterSortModeChange, onMoveGroup, + onMoveGroupToTrash: groupID => { + if (!trashID) { + console.error('No trash group found'); + return; + } + return onMoveGroup(groupID, trashID); + }, onRenameGroup, onSelectGroup, selectedGroupID, From 2cb3c3e8a27eae609253ef974f45da8c8abcaa1c Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Tue, 14 Jan 2020 19:25:04 +0200 Subject: [PATCH 8/9] Prepare empty-trash --- src/components/vault/GroupsList.js | 15 ++++++++++----- src/components/vault/Vault.js | 7 +++++++ src/components/vault/hooks/vault.js | 20 +++++++++++++++++++- src/components/vault/reducers/vault.js | 6 ++++++ src/components/vault/utils/groups.js | 21 +++++++++++++++++++++ 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index aa1b9ed..605a2f4 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -46,7 +46,7 @@ const Tree = styled(BaseTree)` `; const GroupsList = () => { - const [contextMenuOpen, setContextMenuVisibility] = useState(false); + const [groupsContextOpen, setGroupsContextOpen] = useState(false); const [groupEditID, setGroupEditID] = useState(null); const [parentGroupID, setParentGroupID] = useState(null); const [newGroupName, setNewGroupName] = useState(''); @@ -54,6 +54,7 @@ const GroupsList = () => { const { groups, groupsRaw, + // emptyTrash, selectedGroupID, onCreateGroup, onMoveGroup, @@ -84,6 +85,10 @@ const GroupsList = () => { setParentGroupID(null); }; + const confirmEmptyTrash = () => { + // @todo empty trash + }; + const editGroup = (groupFacade, parentID = null) => { setGroupEditID(groupFacade ? groupFacade.id : -1); setNewGroupName(groupFacade ? groupFacade.title : ''); @@ -137,10 +142,10 @@ const GroupsList = () => { ); - const showContextMenu = (node, nodePath, evt) => { + const showGroupContextMenu = (node, nodePath, evt) => { evt.preventDefault(); const groupFacade = groupsRaw.find(group => group.id === node.id); - setContextMenuVisibility(true); + setGroupsContextOpen(true); ContextMenu.show( @@ -155,7 +160,7 @@ const GroupsList = () => { , { left: evt.clientX, top: evt.clientY }, () => { - setContextMenuVisibility(false); + setGroupsContextOpen(false); } ); }; @@ -184,7 +189,7 @@ const GroupsList = () => { onSelectGroup(group.id)} - onNodeContextMenu={showContextMenu} + onNodeContextMenu={showGroupContextMenu} onNodeExpand={handleExpandGroup} onNodeCollapse={handleCollapseGroup} /> diff --git a/src/components/vault/Vault.js b/src/components/vault/Vault.js index 7aea645..d543d7a 100644 --- a/src/components/vault/Vault.js +++ b/src/components/vault/Vault.js @@ -41,6 +41,13 @@ export const VaultProvider = ({ onUpdate, vault: vaultSource, children }) => { entriesFilters, // Actions + batchDeleteItems: ({ groupIDs = [], entryIDs = [] }) => { + dispatch({ + type: 'batch-delete', + groups: groupIDs, + entries: entryIDs + }); + }, onSelectGroup: groupID => { setSelectedGroupID(groupID); setSelectedEntryID(null); diff --git a/src/components/vault/hooks/vault.js b/src/components/vault/hooks/vault.js index c7d646d..ae96005 100644 --- a/src/components/vault/hooks/vault.js +++ b/src/components/vault/hooks/vault.js @@ -1,6 +1,13 @@ import { useContext } from 'react'; import { VaultContext } from '../Vault'; -import { filterNestedGroups, getNestedGroups, isTrashGroup, sortGroups } from '../utils/groups'; +import { + filterNestedGroups, + getAllEntriesInGroup, + getAllGroupsInGroup, + getNestedGroups, + isTrashGroup, + sortGroups +} from '../utils/groups'; import { filterEntries, sortEntries } from '../utils/entries'; export function useCurrentEntry() { @@ -59,6 +66,7 @@ export function useCurrentEntries() { export function useGroups() { const { vault, + batchDeleteItems, onCreateGroup, onSelectGroup, onMoveEntryToGroup, @@ -78,6 +86,15 @@ export function useGroups() { const trashSelected = selectedGroupID === trashID; const trashCount = vault.entries.filter(entry => entry.parentID === trashID).length; const onMoveEntryToTrash = entryID => onMoveEntryToGroup(entryID, trashID); + const emptyTrash = () => { + if (!trashID) return; + const trashEntries = getAllEntriesInGroup(vault, trashID); + const trashGroups = getAllGroupsInGroup(vault, trashID); + batchDeleteItems({ + groupIDs: trashGroups.map(group => group.id), + entryIDs: trashEntries.map(entry => entry.id) + }); + }; return { groups: filterNestedGroups( @@ -89,6 +106,7 @@ export function useGroups() { groupFilters.term ), groupsRaw: vault.groups, + emptyTrash, filters: groupFilters, onCreateGroup, onGroupFilterTermChange, diff --git a/src/components/vault/reducers/vault.js b/src/components/vault/reducers/vault.js index 5e3631c..6d63345 100644 --- a/src/components/vault/reducers/vault.js +++ b/src/components/vault/reducers/vault.js @@ -69,6 +69,12 @@ export function vaultReducer(state, action) { return group; }) }; + case 'batch-delete': + return { + ...state, + groups: state.groups.filter(group => action.groups.includes(group.id) === false), + entries: state.entries.filter(entry => action.entries.includes(entry.id) === false) + }; } } diff --git a/src/components/vault/utils/groups.js b/src/components/vault/utils/groups.js index d4bc323..5280f6e 100644 --- a/src/components/vault/utils/groups.js +++ b/src/components/vault/utils/groups.js @@ -2,6 +2,27 @@ import { sortBy, prop, compose, toLower, reverse } from 'ramda'; export const isTrashGroup = group => group.attributes && group.attributes.bc_group_role === 'trash'; +export const getAllEntriesInGroup = (facade, groupID) => { + const allGroups = [ + ...getAllGroupsInGroup(facade, groupID), + facade.groups.find(group => group.id === groupID) + ]; + return allGroups.reduce((output, group) => { + return [...output, ...facade.entries.filter(entry => entry.parentID === group.id)]; + }, []); +}; + +export const getAllGroupsInGroup = (facade, groupID) => { + const targetIDs = [groupID]; + return facade.groups.reduce((output, nextGroup) => { + if (targetIDs.includes(nextGroup.id)) { + output.push(nextGroup); + targetIDs.push(nextGroup.id); + } + return output; + }, []); +}; + export const getNestedGroups = (groups = [], selectedGroupID, expandedGroups, parentID = '0') => { return groups .filter(group => group.parentID === parentID && group.attributes.bc_group_role !== 'trash') From 84ef2ba3c2cdeca4e919e94e01fc23cf6cbf6b72 Mon Sep 17 00:00:00 2001 From: Perry Mitchell Date: Thu, 16 Jan 2020 21:18:23 +0200 Subject: [PATCH 9/9] Remove commented code --- package-lock.json | 132 ++++++++++++++--------------- src/components/vault/GroupsList.js | 1 - 2 files changed, 66 insertions(+), 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a53c12..87f7dba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8451,28 +8451,28 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true, "optional": true }, "aproba": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, "optional": true, @@ -8483,14 +8483,14 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true, "optional": true }, "brace-expansion": { "version": "1.1.11", - "resolved": false, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "optional": true, @@ -8501,42 +8501,42 @@ }, "chownr": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true, "optional": true }, "concat-map": { "version": "0.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true, "optional": true }, "console-control-strings": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true, "optional": true }, "core-util-is": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "2.6.9", - "resolved": false, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "optional": true, @@ -8546,28 +8546,28 @@ }, "deep-extend": { "version": "0.6.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "dev": true, "optional": true, @@ -8577,14 +8577,14 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, @@ -8601,7 +8601,7 @@ }, "glob": { "version": "7.1.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "optional": true, @@ -8616,14 +8616,14 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.24", - "resolved": false, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "optional": true, @@ -8633,7 +8633,7 @@ }, "ignore-walk": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "dev": true, "optional": true, @@ -8643,7 +8643,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, @@ -8654,21 +8654,21 @@ }, "inherits": { "version": "2.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true, "optional": true }, "ini": { "version": "1.3.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "optional": true, @@ -8678,14 +8678,14 @@ }, "isarray": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "optional": true, @@ -8695,14 +8695,14 @@ }, "minimist": { "version": "0.0.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true, "optional": true }, "minipass": { "version": "2.3.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, "optional": true, @@ -8713,7 +8713,7 @@ }, "minizlib": { "version": "1.2.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", "dev": true, "optional": true, @@ -8723,7 +8723,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "optional": true, @@ -8733,14 +8733,14 @@ }, "ms": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "needle": { "version": "2.2.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.4.tgz", "integrity": "sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==", "dev": true, "optional": true, @@ -8752,7 +8752,7 @@ }, "node-pre-gyp": { "version": "0.10.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz", "integrity": "sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A==", "dev": true, "optional": true, @@ -8771,7 +8771,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, @@ -8782,14 +8782,14 @@ }, "npm-bundled": { "version": "1.0.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.5.tgz", "integrity": "sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.2.0.tgz", "integrity": "sha512-7Mni4Z8Xkx0/oegoqlcao/JpPCPEMtUvsmB0q7mgvlMinykJLSRTYuFqoQLYgGY8biuxIeiHO+QNJKbCfljewQ==", "dev": true, "optional": true, @@ -8800,7 +8800,7 @@ }, "npmlog": { "version": "4.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, @@ -8813,21 +8813,21 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "optional": true, @@ -8837,21 +8837,21 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, @@ -8862,21 +8862,21 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true, "optional": true }, "rc": { "version": "1.2.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "optional": true, @@ -8889,7 +8889,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true @@ -8898,7 +8898,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "optional": true, @@ -8914,7 +8914,7 @@ }, "rimraf": { "version": "2.6.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "optional": true, @@ -8924,49 +8924,49 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, "optional": true }, "safer-buffer": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.6.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "optional": true, @@ -8978,7 +8978,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, @@ -8988,7 +8988,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "optional": true, @@ -8998,14 +8998,14 @@ }, "strip-json-comments": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", "dev": true, "optional": true, @@ -9021,14 +9021,14 @@ }, "util-deprecate": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "optional": true, @@ -9038,14 +9038,14 @@ }, "wrappy": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true, "optional": true }, "yallist": { "version": "3.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "dev": true, "optional": true diff --git a/src/components/vault/GroupsList.js b/src/components/vault/GroupsList.js index 605a2f4..0dee298 100644 --- a/src/components/vault/GroupsList.js +++ b/src/components/vault/GroupsList.js @@ -54,7 +54,6 @@ const GroupsList = () => { const { groups, groupsRaw, - // emptyTrash, selectedGroupID, onCreateGroup, onMoveGroup,