@@ -7,7 +7,7 @@ import { GlassView } from 'expo-glass-effect';
77import { LinearGradient } from 'expo-linear-gradient' ;
88import { useRouter } from 'expo-router' ;
99import React , { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
10- import { ActivityIndicator , Alert , Animated , Image , Keyboard , RefreshControl , ScrollView , StyleSheet , Text , TouchableOpacity , View } from 'react-native' ;
10+ import { ActivityIndicator , Alert , Animated , Dimensions , Image , Keyboard , RefreshControl , ScrollView , StyleSheet , Text , TouchableOpacity , View } from 'react-native' ;
1111import { SafeAreaView , useSafeAreaInsets } from 'react-native-safe-area-context' ;
1212
1313import { OfflineIndicator } from '../../components/OfflineIndicator' ;
@@ -16,6 +16,11 @@ import { useNetworkStatus } from '../../hooks/useNetworkStatus';
1616import { type Folder , type FolderCounts , useApiService } from '../../services/api' ;
1717import { useTheme } from '../../theme' ;
1818
19+ // Calculate folder grid item width
20+ // Container has paddingHorizontal: 16 (32px total) and gap: 12
21+ const SCREEN_WIDTH = Dimensions . get ( 'window' ) . width ;
22+ const FOLDER_GRID_ITEM_WIDTH = ( SCREEN_WIDTH - 32 - 12 ) / 2 ;
23+
1924// Special views configuration matching web app
2025const SPECIAL_VIEWS = [
2126 {
@@ -28,6 +33,11 @@ const SPECIAL_VIEWS = [
2833 label : 'Starred' ,
2934 icon : 'star' as const ,
3035 } ,
36+ {
37+ id : 'public' ,
38+ label : 'Public' ,
39+ icon : 'globe' as const ,
40+ } ,
3141 {
3242 id : 'archived' ,
3343 label : 'Archived' ,
@@ -62,6 +72,7 @@ export default function HomeScreen() {
6272 const [ counts , setCounts ] = useState ( {
6373 all : 0 ,
6474 starred : 0 ,
75+ public : 0 ,
6576 archived : 0 ,
6677 trash : 0 ,
6778 } ) ;
@@ -159,6 +170,7 @@ export default function HomeScreen() {
159170 const newCounts = {
160171 all : noteCounts . all || 0 ,
161172 starred : noteCounts . starred || 0 ,
173+ public : noteCounts . public || 0 ,
162174 archived : noteCounts . archived || 0 ,
163175 trash : noteCounts . trash || 0 ,
164176 } ;
@@ -170,7 +182,7 @@ export default function HomeScreen() {
170182 } catch ( error ) {
171183 if ( __DEV__ ) console . error ( 'Failed to load folders data:' , error ) ;
172184 setAllFolders ( [ ] ) ;
173- setCounts ( { all : 0 , starred : 0 , archived : 0 , trash : 0 } ) ;
185+ setCounts ( { all : 0 , starred : 0 , public : 0 , archived : 0 , trash : 0 } ) ;
174186 } finally {
175187 if ( ! isRefresh ) {
176188 setLoading ( false ) ;
@@ -262,7 +274,7 @@ export default function HomeScreen() {
262274 setRefreshing ( true ) ;
263275 // Clear current data to force fresh load
264276 setAllFolders ( [ ] ) ;
265- setCounts ( { all : 0 , starred : 0 , archived : 0 , trash : 0 } ) ;
277+ setCounts ( { all : 0 , starred : 0 , public : 0 , archived : 0 , trash : 0 } ) ;
266278 await loadFoldersData ( true , true ) ; // isRefresh=true, forceRefresh=true
267279 } finally {
268280 setRefreshing ( false ) ;
@@ -930,7 +942,7 @@ const styles = StyleSheet.create({
930942 backgroundColor : 'rgba(0, 0, 0, 0.01)' ,
931943 } ,
932944 glassCreateFolderGrid : {
933- width : '48%' ,
945+ width : FOLDER_GRID_ITEM_WIDTH ,
934946 borderRadius : FOLDER_CARD . BORDER_RADIUS ,
935947 overflow : 'hidden' ,
936948 backgroundColor : 'rgba(0, 0, 0, 0.01)' ,
@@ -954,7 +966,7 @@ const styles = StyleSheet.create({
954966 paddingRight : 12 ,
955967 } ,
956968 folderItemGrid : {
957- width : '48%' ,
969+ width : FOLDER_GRID_ITEM_WIDTH ,
958970 padding : 16 ,
959971 minHeight : 100 ,
960972 borderWidth : 1 ,
0 commit comments