Skip to content

Commit 3194a85

Browse files
committed
fix(mobile): streamline themes and improve UI polish
1 parent eb0467f commit 3194a85

File tree

11 files changed

+85
-324
lines changed

11 files changed

+85
-324
lines changed

apps/mobile/v1/src/components/settings/UsageBottomSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function UsageBottomSheet({ sheetRef, snapPoints }: UsageBottomSheetProps
5757
{...props}
5858
disappearsOnIndex={-1}
5959
appearsOnIndex={0}
60+
opacity={0.3}
6061
/>
6162
),
6263
[]

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const CreateFolderSheet = forwardRef<BottomSheetModal, CreateFolderSheetP
3030
{...props}
3131
disappearsOnIndex={-1}
3232
appearsOnIndex={0}
33+
opacity={0.3}
3334
/>
3435
),
3536
[]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const FilterSortSheet = forwardRef<BottomSheetModal, FilterSortSheetProps
3838
{...props}
3939
disappearsOnIndex={-1}
4040
appearsOnIndex={0}
41-
opacity={0.5}
41+
opacity={0.3}
4242
pressBehavior="close"
4343
/>
4444
),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const NoteActionsSheet = forwardRef<NoteActionsSheetRef, NoteActionsSheet
5050
{...props}
5151
disappearsOnIndex={-1}
5252
appearsOnIndex={0}
53+
opacity={0.3}
5354
/>
5455
),
5556
[]

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface NotesHeaderProps {
1414
onFilterPress: () => void;
1515
onCreateNotePress: () => void;
1616
onEmptyTrashPress: () => void;
17+
createNoteButtonRef?: React.RefObject<View>;
1718
}
1819

1920
export const NotesHeader: React.FC<NotesHeaderProps> = ({
@@ -25,6 +26,7 @@ export const NotesHeader: React.FC<NotesHeaderProps> = ({
2526
onFilterPress,
2627
onCreateNotePress,
2728
onEmptyTrashPress,
29+
createNoteButtonRef,
2830
}) => {
2931
const theme = useTheme();
3032

@@ -68,7 +70,7 @@ export const NotesHeader: React.FC<NotesHeaderProps> = ({
6870
</View>
6971
)
7072
) : (
71-
<View style={styles.buttonWrapper}>
73+
<View style={styles.buttonWrapper} ref={createNoteButtonRef} collapsable={false}>
7274
<Pressable
7375
style={[styles.createNoteButton, { backgroundColor: theme.isDark ? theme.colors.card : theme.colors.secondary, borderColor: theme.colors.border, flexDirection: 'row', alignItems: 'center' }]}
7476
onPress={onCreateNotePress}

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

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useFocusEffect } from '@react-navigation/native';
1010
import { FlashList, type FlashList as FlashListType } from '@shopify/flash-list';
1111
import * as Haptics from 'expo-haptics';
1212
import { useRouter } from 'expo-router';
13+
import { SquarePen } from 'lucide-react-native';
1314

1415
import { type Folder, type Note, useApiService } from '@/src/services/api';
1516
import { useTheme } from '@/src/theme';
@@ -27,8 +28,6 @@ import { useNotesFiltering } from './useNotesFiltering';
2728
import { useNotesLoader } from './useNotesLoader';
2829

2930
// Constants for FAB scroll behavior
30-
const FAB_SCROLL_THRESHOLD_START = 280; // Start showing FAB when scrolled past this
31-
const FAB_SCROLL_THRESHOLD_END = 320; // Fully visible at this scroll position
3231
const FAB_ANIMATION_DISTANCE = 20; // Distance to slide up during animation
3332

3433
interface RouteParams {
@@ -101,24 +100,62 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
101100
const filterSortSheetRef = useRef<BottomSheetModal>(null);
102101
const noteActionsSheetRef = useRef<NoteActionsSheetRef>(null);
103102
const flatListRef = useRef<FlashListType<Note>>(null);
103+
const createNoteButtonRef = useRef<View>(null);
104104

105105
// Scroll tracking for animated divider (use parent's scrollY if provided)
106106
const localScrollY = useRef(new Animated.Value(0)).current;
107107
const scrollY = parentScrollY || localScrollY;
108108

109-
// Calculate FAB visibility based on scroll position
110-
// Show FAB when scrolled past the header
111-
const fabOpacity = scrollY.interpolate({
112-
inputRange: [FAB_SCROLL_THRESHOLD_START, FAB_SCROLL_THRESHOLD_END],
113-
outputRange: [0, 1],
114-
extrapolate: 'clamp',
115-
});
109+
// Track if create note button is off screen
110+
const [createNoteButtonY, setCreateNoteButtonY] = useState(0);
111+
const [isCreateNoteButtonOffScreen, setIsCreateNoteButtonOffScreen] = useState(false);
116112

117-
const fabTranslateY = scrollY.interpolate({
118-
inputRange: [FAB_SCROLL_THRESHOLD_START, FAB_SCROLL_THRESHOLD_END],
119-
outputRange: [FAB_ANIMATION_DISTANCE, 0],
120-
extrapolate: 'clamp',
121-
});
113+
// Calculate FAB visibility based on whether Create Note button is off screen
114+
const fabOpacity = useRef(new Animated.Value(0)).current;
115+
const fabTranslateY = useRef(new Animated.Value(FAB_ANIMATION_DISTANCE)).current;
116+
117+
// Update FAB visibility when button goes off screen
118+
useEffect(() => {
119+
Animated.parallel([
120+
Animated.timing(fabOpacity, {
121+
toValue: isCreateNoteButtonOffScreen ? 1 : 0,
122+
duration: 200,
123+
useNativeDriver: true,
124+
}),
125+
Animated.timing(fabTranslateY, {
126+
toValue: isCreateNoteButtonOffScreen ? 0 : FAB_ANIMATION_DISTANCE,
127+
duration: 200,
128+
useNativeDriver: true,
129+
}),
130+
]).start();
131+
}, [isCreateNoteButtonOffScreen]);
132+
133+
// Measure create note button position on mount and layout changes
134+
useEffect(() => {
135+
if (createNoteButtonRef.current) {
136+
createNoteButtonRef.current.measureInWindow((x, y, width, height) => {
137+
setCreateNoteButtonY(y + height);
138+
});
139+
}
140+
}, [notes.length, subfolders.length]);
141+
142+
// Check if button is off screen based on scroll position
143+
useEffect(() => {
144+
const listenerId = scrollY.addListener(({ value }) => {
145+
if (createNoteButtonY > 0) {
146+
// Button is off screen when its bottom position is above the top of the screen
147+
// Add a small buffer (50px) to trigger slightly before it's completely gone
148+
const isOffScreen = value > createNoteButtonY - 100;
149+
if (isOffScreen !== isCreateNoteButtonOffScreen) {
150+
setIsCreateNoteButtonOffScreen(isOffScreen);
151+
}
152+
}
153+
});
154+
155+
return () => {
156+
scrollY.removeListener(listenerId);
157+
};
158+
}, [scrollY, createNoteButtonY, isCreateNoteButtonOffScreen]);
122159

123160
// Track last optimistic update to prevent immediate reload from overwriting it
124161
const lastOptimisticUpdateRef = useRef<number>(0);
@@ -620,6 +657,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
620657
onFilterPress={() => filterSortSheetRef.current?.present()}
621658
onCreateNotePress={() => navigation?.navigate('CreateNote', { folderId: route?.params?.folderId })}
622659
onEmptyTrashPress={handleEmptyTrash}
660+
createNoteButtonRef={createNoteButtonRef}
623661
/>
624662
</>
625663
);
@@ -722,7 +760,7 @@ export default function NotesList({ navigation, route, renderHeader, scrollY: pa
722760
onPress={() => navigation?.navigate('CreateNote', { folderId: route?.params?.folderId })}
723761
android_ripple={{ color: 'rgba(255, 255, 255, 0.3)', radius: 20 }}
724762
>
725-
<Ionicons name="add" size={20} color={theme.colors.primaryForeground} />
763+
<SquarePen size={20} color={theme.colors.primaryForeground} />
726764
</Pressable>
727765
</Animated.View>
728766
)}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default function FolderNotesScreen({ folderId, folderName, viewType }: Fo
6464
{...props}
6565
disappearsOnIndex={-1}
6666
appearsOnIndex={0}
67+
opacity={0.3}
6768
/>
6869
),
6970
[]

apps/mobile/v1/src/screens/Home/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export default function HomeScreen() {
9090
{...props}
9191
disappearsOnIndex={-1}
9292
appearsOnIndex={0}
93+
opacity={0.3}
9394
/>
9495
),
9596
[]

apps/mobile/v1/src/screens/Settings/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,20 @@ export default function SettingsScreen({ onLogout }: Props) {
7777
const usageSnapPoints = useMemo(() => ['50%'], []);
7878
const cachePreferenceSnapPoints = useMemo(() => ['45%'], []);
7979

80-
// Backdrop component
80+
// Backdrop component with theme-aware styling
8181
const renderBackdrop = useCallback(
8282
(props: BottomSheetBackdropProps) => (
8383
<BottomSheetBackdrop
8484
{...props}
8585
disappearsOnIndex={-1}
8686
appearsOnIndex={0}
87+
opacity={0.3}
88+
style={{
89+
backgroundColor: theme.isDark ? '#000000' : '#000000',
90+
}}
8791
/>
8892
),
89-
[]
93+
[theme.isDark]
9094
);
9195

9296

apps/mobile/v1/src/theme/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ export const theme = {
2929
ring: '#b5b5b5',
3030
},
3131
dark: {
32-
background: '#252525',
32+
background: '#0a0a0a',
3333
foreground: '#fcfcfc',
34-
card: '#353535',
34+
card: '#1a1a1a',
3535
cardForeground: '#fcfcfc',
3636
primary: '#ebebeb',
37-
primaryForeground: '#353535',
38-
secondary: '#454545',
37+
primaryForeground: '#1a1a1a',
38+
secondary: '#2a2a2a',
3939
secondaryForeground: '#fcfcfc',
40-
muted: '#454545',
40+
muted: '#2a2a2a',
4141
mutedForeground: '#b5b5b5',
42-
accent: '#454545',
42+
accent: '#2a2a2a',
4343
accentForeground: '#fcfcfc',
4444
destructive: '#b91c1c',
4545
destructiveForeground: '#fcfcfc',

0 commit comments

Comments
 (0)