Skip to content

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

feat: sort by title without grouping

ammarahm-ed8565bd77144f
diff --git a/apps/mobile/src/components/sheets/sort/index.js b/apps/mobile/src/components/sheets/sort/index.js
index d3154611d..7698d8614 100644
--- a/apps/mobile/src/components/sheets/sort/index.js
+++ b/apps/mobile/src/components/sheets/sort/index.js
@@ -64,10 +64,10 @@ const Sort = ({ type, screen }) => {
<Button
title={
groupOptions.sortDirection === 'asc'
- ? groupOptions.groupBy === 'abc'
+ ? groupOptions.groupBy === 'abc' || groupOptions.sortBy === 'title'
? 'A - Z'
: 'Old - New'
- : groupOptions.groupBy === 'abc'
+ : groupOptions.groupBy === 'abc' || groupOptions.sortBy === 'title'
? 'Z - A'
: 'New - Old'
}
@@ -114,32 +114,34 @@ const Sort = ({ type, screen }) => {
iconSize={SIZE.md}
/>
) : (
- Object.keys(SORT).map((item, index) => (
- <Button
- key={item}
- type={groupOptions.sortBy === item ? 'grayBg' : 'gray'}
- title={SORT[item]}
- height={40}
- iconPosition="left"
- icon={groupOptions.sortBy === item ? 'check' : null}
- style={{
- marginRight: 10,
- paddingHorizontal: 8
- }}
- buttonType={{
- text: groupOptions.sortBy === item ? colors.accent : colors.icon
- }}
- fontSize={SIZE.sm}
- onPress={async () => {
- let _groupOptions = {
- ...groupOptions,
- sortBy: type === 'trash' ? 'dateDeleted' : item
- };
- await updateGroupOptions(_groupOptions);
- }}
- iconSize={SIZE.md}
- />
- ))
+ Object.keys(SORT).map((item, index) =>
+ item === 'title' && groupOptions.groupBy !== 'none' ? null : (
+ <Button
+ key={item}
+ type={groupOptions.sortBy === item ? 'grayBg' : 'gray'}
+ title={SORT[item]}
+ height={40}
+ iconPosition="left"
+ icon={groupOptions.sortBy === item ? 'check' : null}
+ style={{
+ marginRight: 10,
+ paddingHorizontal: 8
+ }}
+ buttonType={{
+ text: groupOptions.sortBy === item ? colors.accent : colors.icon
+ }}
+ fontSize={SIZE.sm}
+ onPress={async () => {
+ let _groupOptions = {
+ ...groupOptions,
+ sortBy: type === 'trash' ? 'dateDeleted' : item
+ };
+ await updateGroupOptions(_groupOptions);
+ }}
+ iconSize={SIZE.md}
+ />
+ )
+ )
)}
</View>
diff --git a/apps/mobile/src/utils/constants.js b/apps/mobile/src/utils/constants.js
index a0ff09606..05d06c40b 100644
--- a/apps/mobile/src/utils/constants.js
+++ b/apps/mobile/src/utils/constants.js
@@ -19,8 +19,8 @@ export const GROUP = {
export const SORT = {
dateEdited: 'Date edited',
- dateCreated: 'Date created'
- //title:"Title",
+ dateCreated: 'Date created',
+ title: 'Title'
};
export const itemSkus = [