Skip to content

Commit 5f8ab14

Browse files
committed
fix(mobile): add folder path toggle in notes list
1 parent 9053dda commit 5f8ab14

File tree

3 files changed

+48
-16
lines changed

3 files changed

+48
-16
lines changed

apps/mobile/v1/src/screens/FolderNotes/components/NotesList/NoteListItem.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface NoteListItemProps {
3535
isDeleting?: boolean;
3636
isArchiving?: boolean;
3737
closeSwipeables?: number; // Increment this to close all swipeables
38+
showFolderPaths?: boolean;
3839
}
3940

4041
const NoteListItemComponent: React.FC<NoteListItemProps> = ({
@@ -57,6 +58,7 @@ const NoteListItemComponent: React.FC<NoteListItemProps> = ({
5758
isDeleting = false,
5859
isArchiving = false,
5960
closeSwipeables = 0,
61+
showFolderPaths = true,
6062
}) => {
6163
const swipeableRef = useRef<Swipeable>(null);
6264

@@ -296,7 +298,7 @@ const NoteListItemComponent: React.FC<NoteListItemProps> = ({
296298
>
297299
{enhancedData?.preview || ''}
298300
</Text>
299-
{!folderId && folderPath && (
301+
{!folderId && folderPath && showFolderPaths && (
300302
<View style={styles.noteListFolderInfo}>
301303
<View style={[styles.noteListFolderDot, { backgroundColor: noteFolder?.color || '#6b7280' }]} />
302304
<Text style={[styles.noteListFolderPath, { color: mutedForegroundColor }]} numberOfLines={1}>

apps/mobile/v1/src/screens/FolderNotes/components/NotesList/NotesHeader.tsx

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ interface NotesHeaderProps {
1616
onCreateNotePress: () => void;
1717
onEmptyTrashPress: () => void;
1818
createNoteButtonRef?: React.RefObject<View>;
19+
showFolderPaths: boolean;
20+
onToggleFolderPaths: () => void;
1921
}
2022

2123
export const NotesHeader: React.FC<NotesHeaderProps> = ({
@@ -28,6 +30,8 @@ export const NotesHeader: React.FC<NotesHeaderProps> = ({
2830
onCreateNotePress,
2931
onEmptyTrashPress,
3032
createNoteButtonRef,
33+
showFolderPaths,
34+
onToggleFolderPaths,
3135
}) => {
3236
const theme = useTheme();
3337

@@ -38,19 +42,37 @@ export const NotesHeader: React.FC<NotesHeaderProps> = ({
3842
NOTES ({String(filteredNotesCount || 0)})
3943
{viewType !== 'public' && filteredNotesCount !== totalNotesCount && ` (${totalNotesCount} total)`}
4044
</Text>
41-
<GlassView glassEffectStyle="regular" style={[styles.squareButtonGlass, { backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.01)' : 'rgba(0, 0, 0, 0.01)' }]}>
42-
<TouchableOpacity
43-
style={styles.squareButton}
44-
onPress={onFilterPress}
45-
activeOpacity={0.7}
46-
>
47-
<Ionicons
48-
name={hasActiveFilters ? "funnel" : "funnel-outline"}
49-
size={16}
50-
color={hasActiveFilters ? theme.colors.primary : theme.colors.foreground}
51-
/>
52-
</TouchableOpacity>
53-
</GlassView>
45+
<View style={styles.headerButtons}>
46+
{/* Folder path toggle - only show in views without a specific folder */}
47+
{(viewType === 'all' || viewType === 'starred' || viewType === 'archived') && (
48+
<GlassView glassEffectStyle="regular" style={[styles.squareButtonGlass, { backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.01)' : 'rgba(0, 0, 0, 0.01)', marginRight: 8 }]}>
49+
<TouchableOpacity
50+
style={styles.squareButton}
51+
onPress={onToggleFolderPaths}
52+
activeOpacity={0.7}
53+
>
54+
<Ionicons
55+
name={showFolderPaths ? "folder" : "folder-outline"}
56+
size={16}
57+
color={showFolderPaths ? theme.colors.primary : theme.colors.foreground}
58+
/>
59+
</TouchableOpacity>
60+
</GlassView>
61+
)}
62+
<GlassView glassEffectStyle="regular" style={[styles.squareButtonGlass, { backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.01)' : 'rgba(0, 0, 0, 0.01)' }]}>
63+
<TouchableOpacity
64+
style={styles.squareButton}
65+
onPress={onFilterPress}
66+
activeOpacity={0.7}
67+
>
68+
<Ionicons
69+
name={hasActiveFilters ? "funnel" : "funnel-outline"}
70+
size={16}
71+
color={hasActiveFilters ? theme.colors.primary : theme.colors.foreground}
72+
/>
73+
</TouchableOpacity>
74+
</GlassView>
75+
</View>
5476
</View>
5577

5678
{/* Create Note Button / Empty Trash Button - Full width to match note list */}
@@ -107,6 +129,10 @@ const styles = StyleSheet.create({
107129
fontWeight: '500',
108130
letterSpacing: 0.8,
109131
},
132+
headerButtons: {
133+
flexDirection: 'row',
134+
alignItems: 'center',
135+
},
110136
squareButtonGlass: {
111137
borderRadius: GLASS_BUTTON.BORDER_RADIUS,
112138
overflow: 'hidden',

apps/mobile/v1/src/screens/FolderNotes/components/NotesList/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
6565
const [archivingNoteId, setArchivingNoteId] = useState<string | null>(null);
6666
const [closeSwipeables, setCloseSwipeables] = useState(0);
6767
const [showLoading, setShowLoading] = useState(false);
68+
const [showFolderPaths, setShowFolderPaths] = useState(false);
6869

6970
// Performance tracking
7071
const screenFocusTime = useRef<number>(0);
@@ -650,9 +651,10 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
650651
isDeleting={deletingNoteId === note.id}
651652
isArchiving={archivingNoteId === note.id}
652653
closeSwipeables={closeSwipeables}
654+
showFolderPaths={showFolderPaths}
653655
/>
654656
);
655-
}, [filteredNotes.length, folderId, handleNotePress, handleNoteLongPress, handleDeleteNote, handleArchiveNote, folderPathsMap, foldersMap, skeletonOpacity, notesEnhancedDataCache, foregroundColor, mutedForegroundColor, mutedColor, borderColor, backgroundColor, deletingNoteId, archivingNoteId, closeSwipeables]);
657+
}, [filteredNotes.length, folderId, handleNotePress, handleNoteLongPress, handleDeleteNote, handleArchiveNote, folderPathsMap, foldersMap, skeletonOpacity, notesEnhancedDataCache, foregroundColor, mutedForegroundColor, mutedColor, borderColor, backgroundColor, deletingNoteId, archivingNoteId, closeSwipeables, showFolderPaths]);
656658

657659
// Render list header (subfolders and create note button)
658660
const renderListHeader = useCallback(() => {
@@ -686,10 +688,12 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
686688
onCreateNotePress={() => createFileSheetRef.current?.present()}
687689
onEmptyTrashPress={handleEmptyTrash}
688690
createNoteButtonRef={createNoteButtonRef}
691+
showFolderPaths={showFolderPaths}
692+
onToggleFolderPaths={() => setShowFolderPaths(prev => !prev)}
689693
/>
690694
</>
691695
);
692-
}, [loading, notes.length, renderHeader, viewType, subfolders, viewMode, filteredNotes.length, hasActiveFilters, handleEmptyTrash, filterSortSheetRef]);
696+
}, [loading, notes.length, renderHeader, viewType, subfolders, viewMode, filteredNotes.length, hasActiveFilters, handleEmptyTrash, filterSortSheetRef, showFolderPaths]);
693697

694698
// Render empty state
695699
const renderEmptyComponent = useCallback(() => {

0 commit comments

Comments
 (0)