From 131ecfee89bf3f2a5f96ef9be963f97e357fd930 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Thu, 8 Jun 2023 16:12:09 +0500 Subject: [PATCH] mobile: improved compactness of notebook compact mode --- .../components/list-items/notebook/index.js | 183 +++++++++++------- .../list-items/selection-wrapper/index.js | 11 +- 2 files changed, 117 insertions(+), 77 deletions(-) diff --git a/apps/mobile/app/components/list-items/notebook/index.js b/apps/mobile/app/components/list-items/notebook/index.js index 8c68e7b2f..ea24465f0 100644 --- a/apps/mobile/app/components/list-items/notebook/index.js +++ b/apps/mobile/app/components/list-items/notebook/index.js @@ -64,15 +64,28 @@ export const NotebookItem = ({ flexShrink: 1 }} > - - {item.title} - + {compactMode ? ( + + {item.title} + + ) : ( + + {item.title} + + )} + {isTopic || !item.description || compactMode ? null : ( )} - - {isTrash ? ( - <> + {!compactMode ? ( + + {isTrash ? ( + <> + + {"Deleted on " + + new Date(item.dateDeleted).toISOString().slice(0, 10)} + + + {item.itemType[0].toUpperCase() + item.itemType.slice(1)} + + + ) : ( - {"Deleted on " + - new Date(item.dateDeleted).toISOString().slice(0, 10)} + {getFormattedDate(item[dateBy], "date")} - - {item.itemType[0].toUpperCase() + item.itemType.slice(1)} - - - ) : ( + )} - {getFormattedDate(item[dateBy], "date")} + {item && totalNotes > 1 + ? totalNotes + " notes" + : totalNotes === 1 + ? totalNotes + " note" + : "0 notes"} - )} - - {item && totalNotes > 1 - ? totalNotes + " notes" - : totalNotes === 1 - ? totalNotes + " note" - : "0 notes"} - - {item.pinned ? ( - - ) : null} - + {item.pinned ? ( + + ) : null} + + ) : null} - showActionSheet(item)} - customStyle={{ - justifyContent: "center", - height: 35, - width: 35, - borderRadius: 100, + + > + + {item && totalNotes > 1 + ? totalNotes + " notes" + : totalNotes === 1 + ? totalNotes + " note" + : "0 notes"} + + showActionSheet(item)} + customStyle={{ + justifyContent: "center", + height: 35, + width: 35, + borderRadius: 100, + alignItems: "center" + }} + /> + ); }; diff --git a/apps/mobile/app/components/list-items/selection-wrapper/index.js b/apps/mobile/app/components/list-items/selection-wrapper/index.js index 60fb7aa7a..cd3d6afc4 100644 --- a/apps/mobile/app/components/list-items/selection-wrapper/index.js +++ b/apps/mobile/app/components/list-items/selection-wrapper/index.js @@ -42,11 +42,16 @@ const SelectionWrapper = ({ const notesListMode = useSettingStore( (state) => state.settings.notesListMode ); - const listMode = item.type === "notebook" ? notebooksListMode : notesListMode; + const listMode = + item.type === "notebook" || item.itemType === "notebook" + ? notebooksListMode + : notesListMode; const compactMode = - (item.type === "notebook" || item.type === "note") && + (item.type === "notebook" || + item.itemType === "notebook" || + item.itemType === "note" || + item.type === "note") && listMode === "compact"; - if (item.id !== itemId.current) { itemId.current = item.id; }