2 Commits

Author SHA1 Message Date
Ichitux 411d6604a9 Merge pull request 'fix(mobile): align background, API config, and search bar with PWA' (#22) from fix/mobile-background-api-searchbar into main
Build & Push Docker Images / Detect Changes (push) Successful in 9s
Build & Push Docker Images / Backend Tests (push) Has been skipped
Build & Push Docker Images / Frontend Tests (push) Has been skipped
Build & Push Docker Images / Build Backend (push) Has been skipped
Build & Push Docker Images / Build Frontend (push) Has been skipped
Build & Push Docker Images / Deploy (push) Has been skipped
Reviewed-on: #22
2026-07-08 13:52:11 +00:00
Antoni Nuñez Romeu d6db48b695 fix(mobile): align background, API config, and search bar with PWA
Run Tests on Branches / Detect Changes (push) Successful in 11s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m46s
- Add background image matching PWA (bg.png with opacity + overlay)
- Fix production API URL to farmacias.hacecalor.net
- Replace raw fetch calls in alerts.tsx with configured api service
- Constrain SearchBar max-width to 420px to prevent horizontal clipping
2026-07-08 14:23:58 +02:00
6 changed files with 35 additions and 11 deletions
+5 -9
View File
@@ -3,6 +3,7 @@ import { View, Text, StyleSheet, FlatList, TouchableOpacity, Alert, useWindowDim
import { Ionicons } from '@expo/vector-icons'; import { Ionicons } from '@expo/vector-icons';
import { colors, spacing, borderRadius, shadows } from '../../constants/theme'; import { colors, spacing, borderRadius, shadows } from '../../constants/theme';
import { LoadingSpinner } from '../../components/LoadingSpinner'; import { LoadingSpinner } from '../../components/LoadingSpinner';
import api from '../../services/api';
const TABLET_MIN_WIDTH = 768; const TABLET_MIN_WIDTH = 768;
@@ -33,9 +34,8 @@ export default function AlertsScreen() {
setIsLoading(true); setIsLoading(true);
setError(null); setError(null);
try { try {
const res = await fetch('/api/notifications/mine', { credentials: 'include' }); const res = await api.get('/notifications/mine');
if (!res.ok) throw new Error(`HTTP ${res.status}`); const data = res.data;
const data = await res.json();
const merged = [ const merged = [
...(data.pharmacy || []), ...(data.pharmacy || []),
...(data.global || []), ...(data.global || []),
@@ -63,13 +63,9 @@ export default function AlertsScreen() {
onPress: async () => { onPress: async () => {
setDeletingId(key); setDeletingId(key);
try { try {
const res = await fetch('/api/notifications/mine', { await api.delete('/notifications/mine', {
method: 'DELETE', data: { scope: item.scope, id: item.id },
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ scope: item.scope, id: item.id }),
}); });
if (!res.ok && res.status !== 204) throw new Error(`HTTP ${res.status}`);
setItems(prev => prev.filter(i => !(i.scope === item.scope && i.id === item.id))); setItems(prev => prev.filter(i => !(i.scope === item.scope && i.id === item.id)));
} catch (err: any) { } catch (err: any) {
Alert.alert('Error', err.message || 'No se pudo eliminar'); Alert.alert('Error', err.message || 'No se pudo eliminar');
+4 -1
View File
@@ -100,7 +100,10 @@ const styles = StyleSheet.create({
searchContainer: { searchContainer: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
paddingRight: spacing.lg, paddingHorizontal: spacing.lg,
maxWidth: 480,
alignSelf: 'center',
width: '100%',
}, },
searchContainerTablet: { searchContainerTablet: {
maxWidth: 700, maxWidth: 700,
+22
View File
@@ -1,6 +1,7 @@
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import { Stack } from 'expo-router'; import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import { ImageBackground, StyleSheet, View } from 'react-native';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
@@ -36,6 +37,13 @@ export default function RootLayout() {
return ( return (
<GestureHandlerRootView style={{ flex: 1 }}> <GestureHandlerRootView style={{ flex: 1 }}>
<ImageBackground
source={require('../assets/bg.png')}
style={bgStyles.background}
resizeMode="cover"
imageStyle={bgStyles.backgroundImage}
>
<View style={bgStyles.overlay} />
<SafeAreaProvider> <SafeAreaProvider>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<Stack <Stack
@@ -79,6 +87,20 @@ export default function RootLayout() {
<StatusBar style="auto" /> <StatusBar style="auto" />
</QueryClientProvider> </QueryClientProvider>
</SafeAreaProvider> </SafeAreaProvider>
</ImageBackground>
</GestureHandlerRootView> </GestureHandlerRootView>
); );
} }
const bgStyles = StyleSheet.create({
background: {
flex: 1,
},
backgroundImage: {
opacity: 0.5,
},
overlay: {
...StyleSheet.absoluteFillObject,
backgroundColor: 'rgba(255, 252, 245, 0.48)',
},
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

@@ -69,6 +69,9 @@ const styles = StyleSheet.create({
paddingVertical: spacing.sm + 2, paddingVertical: spacing.sm + 2,
marginHorizontal: spacing.lg, marginHorizontal: spacing.lg,
marginVertical: spacing.sm, marginVertical: spacing.sm,
maxWidth: 420,
alignSelf: 'center',
width: '100%',
shadowColor: '#000', shadowColor: '#000',
shadowOffset: { width: 0, height: 2 }, shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.06, shadowOpacity: 0.06,
+1 -1
View File
@@ -5,7 +5,7 @@ const ENV = {
API_BASE_URL: 'http://localhost:3001/api', API_BASE_URL: 'http://localhost:3001/api',
}, },
production: { production: {
API_BASE_URL: 'https://your-production-api.com/api', API_BASE_URL: 'https://farmacias.hacecalor.net/api',
}, },
}; };