mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
improve multi-select ux
This commit is contained in:
@@ -122,8 +122,15 @@ export const SelectionHeader = ({navigation}) => {
|
|||||||
{currentScreen === 'trash' || currentScreen === 'notebooks' ? null : (
|
{currentScreen === 'trash' || currentScreen === 'notebooks' ? null : (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
|
let favCount = 0;
|
||||||
|
let unFavCount = 0;
|
||||||
if (selectedItemsList.length > 0) {
|
if (selectedItemsList.length > 0) {
|
||||||
selectedItemsList.forEach(async item => {
|
selectedItemsList.forEach(async item => {
|
||||||
|
if (item.favorite) {
|
||||||
|
favCount += 1;
|
||||||
|
} else {
|
||||||
|
unFavCount += 1;
|
||||||
|
}
|
||||||
await db.notes.note(item.id).favorite();
|
await db.notes.note(item.id).favorite();
|
||||||
dispatch({type: ACTIONS.NOTES});
|
dispatch({type: ACTIONS.NOTES});
|
||||||
dispatch({type: ACTIONS.FAVORITES});
|
dispatch({type: ACTIONS.FAVORITES});
|
||||||
@@ -133,7 +140,13 @@ export const SelectionHeader = ({navigation}) => {
|
|||||||
|
|
||||||
dispatch({type: ACTIONS.CLEAR_SELECTION});
|
dispatch({type: ACTIONS.CLEAR_SELECTION});
|
||||||
|
|
||||||
ToastEvent.show('Notes added to favorites', 'success');
|
ToastEvent.show(
|
||||||
|
favCount +
|
||||||
|
' notes added to favorites &' +
|
||||||
|
unFavCount +
|
||||||
|
'removed',
|
||||||
|
'success',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<Icon
|
<Icon
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ export const Folders = ({navigation}) => {
|
|||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
let isFocused = useIsFocused();
|
let isFocused = useIsFocused();
|
||||||
|
|
||||||
///
|
|
||||||
|
|
||||||
const handleBackPress = () => {
|
const handleBackPress = () => {
|
||||||
alert('here');
|
alert('here');
|
||||||
return true;
|
return true;
|
||||||
@@ -143,20 +141,20 @@ export const Folders = ({navigation}) => {
|
|||||||
<NotebookItem
|
<NotebookItem
|
||||||
hideMore={params.hideMore}
|
hideMore={params.hideMore}
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: selectionMode ? w - 74 : '100%',
|
backgroundColor: Platform.ios
|
||||||
|
? hexToRGBA(colors.accent + '19')
|
||||||
|
: hexToRGBA(colors.shade),
|
||||||
|
width: '100%',
|
||||||
|
paddingHorizontal: 12,
|
||||||
|
paddingTop: 20,
|
||||||
|
paddingRight: 18,
|
||||||
|
marginBottom: 10,
|
||||||
|
marginTop: 20,
|
||||||
|
borderBottomWidth: 0,
|
||||||
marginHorizontal: 0,
|
marginHorizontal: 0,
|
||||||
}}
|
}}
|
||||||
isMove={params.isMove}
|
isMove={params.isMove}
|
||||||
onLongPress={() => {
|
onLongPress={() => {}}
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.SELECTION_MODE,
|
|
||||||
enabled: !selectionMode,
|
|
||||||
});
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.SELECTED_ITEMS,
|
|
||||||
item: item,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
noteToMove={params.note}
|
noteToMove={params.note}
|
||||||
item={item}
|
item={item}
|
||||||
pinned={true}
|
pinned={true}
|
||||||
|
|||||||
Reference in New Issue
Block a user