Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

change && to conditional

ammarahm-ed78c67070ceed
diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.js
index 31264932f..9648acdcf 100644
--- a/apps/mobile/share/index.js
+++ b/apps/mobile/share/index.js
@@ -472,7 +472,7 @@ const NotesnookShare = ({quicknote = false}) => {
</TouchableOpacity>
)}
- {showSearch && (
+ {showSearch ? (
<Search
quicknote={quicknote}
getKeyboardHeight={() => keyboardHeight.current}
@@ -481,7 +481,7 @@ const NotesnookShare = ({quicknote = false}) => {
animate(1, 0);
}}
/>
- )}
+ ) : null}
<AnimatedKAV
enabled={!floating }
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index 156e2f0e7..22ea6812f 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -862,7 +862,7 @@ export const ActionSheetComponent = ({
/>
) : null}
- {note.type === 'note' && (
+ {note.type === 'note' ? (
<Button
onPress={async () => {
close();
@@ -883,7 +883,7 @@ export const ActionSheetComponent = ({
paddingHorizontal: 12
}}
/>
- )}
+ ) : null}
</View>
</View>
)}
diff --git a/apps/mobile/src/components/Dialog/DialogHeader.js b/apps/mobile/src/components/Dialog/DialogHeader.js
index 8bf8f3fe6..f93f00b7a 100644
--- a/apps/mobile/src/components/Dialog/DialogHeader.js
+++ b/apps/mobile/src/components/Dialog/DialogHeader.js
@@ -42,9 +42,9 @@ const DialogHeader = ({
}}>
<Heading size={SIZE.xl}>
{title}{' '}
- {titlePart && (
+ {titlePart ? (
<Text style={{color: colors.accent}}>{titlePart}</Text>
- )}
+ ) : null}
</Heading>
{button ? (
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.js
index 286de1c78..eb9039e6f 100644
--- a/apps/mobile/src/components/Dialog/index.js
+++ b/apps/mobile/src/components/Dialog/index.js
@@ -106,7 +106,7 @@ export const Dialog = ({context = 'global'}) => {
/>
<Seperator half />
- {dialogInfo.input && (
+ {dialogInfo.input ? (
<View
style={{
paddingHorizontal: 12
@@ -125,7 +125,7 @@ export const Dialog = ({context = 'global'}) => {
placeholder={dialogInfo.inputPlaceholder}
/>
</View>
- )}
+ ) : null}
<DialogButtons
onPressNegative={onNegativePress}
diff --git a/apps/mobile/src/components/Header/HeaderRightMenu.js b/apps/mobile/src/components/Header/HeaderRightMenu.js
index 8533dbb32..4e41e18dc 100644
--- a/apps/mobile/src/components/Header/HeaderRightMenu.js
+++ b/apps/mobile/src/components/Header/HeaderRightMenu.js
@@ -18,7 +18,7 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {
const menuRef = useRef();
return (
<View style={styles.rightBtnContainer}>
- {currentScreen !== 'Settings' && (
+ {currentScreen !== 'Settings' ? (
<ActionIcon
onPress={async () => {
Navigation.navigate('Search', {
@@ -30,7 +30,7 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {
color={colors.pri}
customStyle={styles.rightBtn}
/>
- )}
+ ) : null}
{deviceMode !== 'mobile' ? (
<Button
@@ -49,7 +49,7 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {
/>
) : null}
- {rightButtons && (
+ {rightButtons ? (
<Menu
ref={menuRef}
animationDuration={200}
@@ -85,7 +85,7 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {
</MenuItem>
))}
</Menu>
- )}
+ ) : null}
</View>
);
};
diff --git a/apps/mobile/src/components/Header/title.js b/apps/mobile/src/components/Header/title.js
index 72b8659e2..ac44fd2f8 100644
--- a/apps/mobile/src/components/Header/title.js
+++ b/apps/mobile/src/components/Header/title.js
@@ -69,12 +69,12 @@ export const Title = ({heading, headerColor, screen, notebook}) => {
flexWrap: 'wrap'
}}
color={headerColor}>
- {notebook && (
+ {notebook ? (
<Paragraph numberOfLines={1} size={SIZE.xs + 2}>
{notebook?.title}
{'\n'}
</Paragraph>
- )}
+ ) : null}
<Heading color={colors.accent}>
{heading.slice(0, 1) === '#' ? '#' : null}
</Heading>
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index ed18d3224..871fbef38 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -105,7 +105,7 @@ const NoteItem = ({item, isTrash, tags}) => {
flexGrow: 1,
flexShrink: 1
}}>
- {!compactMode && (
+ {!compactMode ? (
<View
style={{
flexDirection: 'row',
@@ -137,7 +137,7 @@ const NoteItem = ({item, isTrash, tags}) => {
/>
))}
</View>
- )}
+ ) : null}
<Heading
numberOfLines={1}
diff --git a/apps/mobile/src/components/Premium/group.js b/apps/mobile/src/components/Premium/group.js
index 944baeb25..560b805c7 100644
--- a/apps/mobile/src/components/Premium/group.js
+++ b/apps/mobile/src/components/Premium/group.js
@@ -19,12 +19,12 @@ export const Group = ({item, index}) => {
backgroundColor: index % 2 !== 0 ? colors.bg : colors.nav,
paddingVertical: 40
}}>
- {item?.pro && (
+ {item?.pro ? (
<ProTag
size={SIZE.sm}
background={index % 2 === 0 ? colors.bg : colors.nav}
/>
- )}
+ ) : null}
<Heading>{item.title}</Heading>
<Paragraph size={SIZE.md}>{item.detail}</Paragraph>
diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.js
index 6cc1b0c3e..7862bbf13 100644
--- a/apps/mobile/src/components/SelectionHeader/index.js
+++ b/apps/mobile/src/components/SelectionHeader/index.js
@@ -161,7 +161,7 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {
/>
)}
- {type === 'topic' && (
+ {type === 'topic' ? (
<ActionIcon
onPress={async () => {
if (selectedItemsList.length > 0) {
@@ -189,7 +189,7 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {
name="minus"
size={SIZE.xl}
/>
- )}
+ ) : null}
{screen === 'Favorites' ? (
<ActionIcon
diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.js
index c85cbce0a..dc58ac238 100644
--- a/apps/mobile/src/components/SelectionWrapper/index.js
+++ b/apps/mobile/src/components/SelectionWrapper/index.js
@@ -67,9 +67,9 @@ const SelectionWrapper = ({
paddingHorizontal: 12,
paddingVertical:compactMode ? 8 : 12,
}}>
- {actionStrip && (
+ {actionStrip ? (
<ActionStrip note={item} setActionStrip={setActionStrip} />
- )}
+ ) : null}
{item.type === 'note' ? <Filler background={background} item={item} /> : null}
<SelectionIcon
diff --git a/apps/mobile/src/components/SelectionWrapper/selection.js b/apps/mobile/src/components/SelectionWrapper/selection.js
index 30b241129..06af69da1 100644
--- a/apps/mobile/src/components/SelectionWrapper/selection.js
+++ b/apps/mobile/src/components/SelectionWrapper/selection.js
@@ -40,7 +40,7 @@ export const SelectionIcon = ({setActionStrip, item}) => {
};
return (
- selectionMode && (
+ selectionMode ? (
<View
style={{
display: 'flex',
@@ -70,6 +70,6 @@ export const SelectionIcon = ({setActionStrip, item}) => {
/>
</TouchableOpacity>
</View>
- )
+ ) : null
);
};
diff --git a/apps/mobile/src/components/SimpleList/header.js b/apps/mobile/src/components/SimpleList/header.js
index db8f92c3d..3004e6962 100644
--- a/apps/mobile/src/components/SimpleList/header.js
+++ b/apps/mobile/src/components/SimpleList/header.js
@@ -40,9 +40,9 @@ export const Header = React.memo(
justifyContent: 'center',
alignItems: 'center'
}}>
- {messageCard && (
+ {messageCard ? (
<Card color={COLORS_NOTE[color?.toLowerCase()] || colors.accent} />
- )}
+ ) : null}
</View>
) : (
<View
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index b327fdc19..a11252b58 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -23,7 +23,7 @@ let renderItems = {
};
const RenderItem = ({item, index}) => {
- const Item = renderItems[item.itemType || item.type];
+ const Item = renderItems[item.itemType || item.type] || <View/>
return (
<Item item={item} tags={item.tags ? [...item.tags] : []} index={index} />
diff --git a/apps/mobile/src/components/SimpleList/notebookheader.js b/apps/mobile/src/components/SimpleList/notebookheader.js
index d1e39a752..e02d81521 100644
--- a/apps/mobile/src/components/SimpleList/notebookheader.js
+++ b/apps/mobile/src/components/SimpleList/notebookheader.js
@@ -89,11 +89,11 @@ export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {
</View>
</View>
- {notebook.description && (
+ {notebook.description ? (
<Paragraph size={SIZE.md} color={colors.pri}>
{notebook.description}
</Paragraph>
- )}
+ ) : null}
<Paragraph
style={{