Compare commits
3 Commits
luggage-li
...
luggage-li
| Author | SHA1 | Date | |
|---|---|---|---|
| fb54db0619 | |||
| a93fec97dc | |||
| 86976d5c26 |
@@ -3,6 +3,10 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- '**/*.js'
|
||||||
|
- '**/*.json'
|
||||||
|
- '.gitea/workflows/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-android:
|
build-android:
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- '**/*.js'
|
||||||
|
- '**/*.json'
|
||||||
|
- '.gitea/workflows/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
|
|||||||
60
TODO.md
60
TODO.md
@@ -1,52 +1,14 @@
|
|||||||
# TODO - Luggage List
|
# TODO - Luggage List
|
||||||
|
|
||||||
## Stage
|
This file was intentionally nuked.
|
||||||
Improving & Fixing Bugs (V3)
|
|
||||||
|
|
||||||
## V2 Changes Requested
|
All pending tasks now live as Gitea issues:
|
||||||
- [x] Trip can be selected from everywhere (global trip picker)
|
- https://gitea.reversed.dev/space/luggage-list/issues/1
|
||||||
- [x] Fixed trip switching behavior for web by removing aggressive auto-reselect
|
- https://gitea.reversed.dev/space/luggage-list/issues/2
|
||||||
- [x] Removed trip image crop (gallery pick without editing)
|
- https://gitea.reversed.dev/space/luggage-list/issues/3
|
||||||
- [x] Item updates now happen in a modal
|
- https://gitea.reversed.dev/space/luggage-list/issues/4
|
||||||
- [x] Redesigned item cards
|
- https://gitea.reversed.dev/space/luggage-list/issues/5
|
||||||
- [x] Moved top nav to bottom and made it mobile-friendly
|
- https://gitea.reversed.dev/space/luggage-list/issues/6
|
||||||
- [x] Removed top title block
|
- https://gitea.reversed.dev/space/luggage-list/issues/7
|
||||||
- [x] Reworked check-up flow to yes/no checklist
|
- https://gitea.reversed.dev/space/luggage-list/issues/8
|
||||||
- [x] “No” now opens update modal for check-up-only changes
|
- https://gitea.reversed.dev/space/luggage-list/issues/9
|
||||||
- [x] Added optional toggle to also sync fix into trip item list
|
|
||||||
- [x] Removed JSON export feature
|
|
||||||
- [x] Improved keyboard behavior with KeyboardAvoidingView + scroll-safe forms
|
|
||||||
- [x] Full UI redesign (dark-first minimalist with accent colors)
|
|
||||||
- [x] Set new icon from `https://cdn.reversed.dev/pictures/yesnt.png`
|
|
||||||
|
|
||||||
## Validation
|
|
||||||
- [x] `npm install`
|
|
||||||
- [x] `npx expo export --platform web`
|
|
||||||
|
|
||||||
## Progress Log
|
|
||||||
- [x] V1 prototype complete and shipped
|
|
||||||
- [x] CI adjusted (no `eas init` in workflows)
|
|
||||||
- [x] V2 redesign + behavior fixes implemented
|
|
||||||
- [x] Removed legacy template src folder
|
|
||||||
- [x] Rebuilt app into modular `src/` structure (tabs/components/modals/styles/utils)
|
|
||||||
- [x] Fixed status-bar overlap with top spacing
|
|
||||||
- [x] Replaced trip date text inputs with calendar modal picker
|
|
||||||
- [x] Improved keyboard focus scrolling to focused input (not scroll-to-end)
|
|
||||||
- [x] Reworked bottom nav to real icons + labels
|
|
||||||
- [x] Clarified history as selected-trip check-up history
|
|
||||||
- [x] Increased safe top inset to avoid status-bar overlap
|
|
||||||
- [x] Added check-up stats (correct/bad/pending) and persisted per snapshot
|
|
||||||
- [x] Extra UI polish pass (spacing, cards, hierarchy)
|
|
||||||
- [x] Centered and enlarged edit/check-up modals to fully overlay nav
|
|
||||||
- [x] Fixed modal keyboard glitching (stable centered keyboard-aware layout)
|
|
||||||
- [x] Added trip view editing in modal (name/location/date/image)
|
|
||||||
- [x] Added trip archive/unarchive flow with archived section
|
|
||||||
- [x] Added item filters + bulk pack/unpack actions
|
|
||||||
|
|
||||||
## Next Improvements (Requested)
|
|
||||||
- [x] Edit trip directly in the trip view modal (name/location/dates/image)
|
|
||||||
- [x] Add archive flow for trips (hide from active list without deleting history)
|
|
||||||
- [ ] Enhance check-up modal UX (progress bar + back/skip controls)
|
|
||||||
- [x] Add bulk item actions and filters (pack all/unpack all + status/category chips)
|
|
||||||
- [ ] Add image optimization controls before save (compress/crop)
|
|
||||||
- [ ] Add JSON export/import backup + restore flow
|
|
||||||
|
|||||||
152
src/AppRoot.js
152
src/AppRoot.js
@@ -1,11 +1,12 @@
|
|||||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Alert, KeyboardAvoidingView, Platform, SafeAreaView, ScrollView, StatusBar as RNStatusBar, Text, View } from 'react-native';
|
import { KeyboardAvoidingView, Platform, SafeAreaView, ScrollView, StatusBar as RNStatusBar, Text, View } from 'react-native';
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
import * as ImagePicker from 'expo-image-picker';
|
import * as ImagePicker from 'expo-image-picker';
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import BottomTab from './components/BottomTab';
|
import BottomTab from './components/BottomTab';
|
||||||
import TripPicker from './components/TripPicker';
|
import TripPicker from './components/TripPicker';
|
||||||
import DatePickerModal from './components/DatePickerModal';
|
import DatePickerModal from './components/DatePickerModal';
|
||||||
|
import AppDialogModal from './components/AppDialogModal';
|
||||||
import ItemModal from './modals/ItemModal';
|
import ItemModal from './modals/ItemModal';
|
||||||
import CheckupFlowModal from './modals/CheckupFlowModal';
|
import CheckupFlowModal from './modals/CheckupFlowModal';
|
||||||
import TripsTab from './tabs/TripsTab';
|
import TripsTab from './tabs/TripsTab';
|
||||||
@@ -80,6 +81,7 @@ export default function AppRoot() {
|
|||||||
const [checkupNoForm, setCheckupNoForm] = useState(emptyCheckupNoForm());
|
const [checkupNoForm, setCheckupNoForm] = useState(emptyCheckupNoForm());
|
||||||
|
|
||||||
const [selectedCheckupId, setSelectedCheckupId] = useState(null);
|
const [selectedCheckupId, setSelectedCheckupId] = useState(null);
|
||||||
|
const [dialogState, setDialogState] = useState({ visible: false, title: '', message: '', buttons: [] });
|
||||||
|
|
||||||
const topInset = Platform.OS === 'android' ? (RNStatusBar.currentHeight || 0) + 10 : 0;
|
const topInset = Platform.OS === 'android' ? (RNStatusBar.currentHeight || 0) + 10 : 0;
|
||||||
|
|
||||||
@@ -116,6 +118,38 @@ export default function AppRoot() {
|
|||||||
return checkupSession[checkupFlowIndex] || null;
|
return checkupSession[checkupFlowIndex] || null;
|
||||||
}, [checkupFlowVisible, checkupFlowIndex, checkupSession]);
|
}, [checkupFlowVisible, checkupFlowIndex, checkupSession]);
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
setDialogState((prev) => ({ ...prev, visible: false }));
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAlert(title, message) {
|
||||||
|
setDialogState({
|
||||||
|
visible: true,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
buttons: [{ text: 'OK', tone: 'primary', onPress: closeDialog }],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showConfirm({ title, message, confirmText = 'Confirm', onConfirm, tone = 'danger' }) {
|
||||||
|
setDialogState({
|
||||||
|
visible: true,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
buttons: [
|
||||||
|
{ text: 'Cancel', tone: 'neutral', onPress: closeDialog },
|
||||||
|
{
|
||||||
|
text: confirmText,
|
||||||
|
tone,
|
||||||
|
onPress: () => {
|
||||||
|
closeDialog();
|
||||||
|
if (typeof onConfirm === 'function') onConfirm();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -125,7 +159,7 @@ export default function AppRoot() {
|
|||||||
setData({ ...emptyData, ...parsed });
|
setData({ ...emptyData, ...parsed });
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Alert.alert('Error', 'Could not load local data.');
|
showAlert('Error', 'Could not load local data.');
|
||||||
} finally {
|
} finally {
|
||||||
setLoaded(true);
|
setLoaded(true);
|
||||||
}
|
}
|
||||||
@@ -135,7 +169,7 @@ export default function AppRoot() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loaded) return;
|
if (!loaded) return;
|
||||||
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(data)).catch(() => {
|
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(data)).catch(() => {
|
||||||
Alert.alert('Error', 'Could not save local data.');
|
showAlert('Error', 'Could not save local data.');
|
||||||
});
|
});
|
||||||
}, [data, loaded]);
|
}, [data, loaded]);
|
||||||
|
|
||||||
@@ -180,7 +214,7 @@ export default function AppRoot() {
|
|||||||
async function pickImage(onPicked) {
|
async function pickImage(onPicked) {
|
||||||
const perm = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
const perm = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
||||||
if (!perm.granted) {
|
if (!perm.granted) {
|
||||||
Alert.alert('Permission needed', 'Allow gallery access to select images.');
|
showAlert('Permission needed', 'Allow gallery access to select images.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +232,7 @@ export default function AppRoot() {
|
|||||||
async function takeImage(onPicked) {
|
async function takeImage(onPicked) {
|
||||||
const perm = await ImagePicker.requestCameraPermissionsAsync();
|
const perm = await ImagePicker.requestCameraPermissionsAsync();
|
||||||
if (!perm.granted) {
|
if (!perm.granted) {
|
||||||
Alert.alert('Permission needed', 'Allow camera access to take photos.');
|
showAlert('Permission needed', 'Allow camera access to take photos.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +248,7 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function createTrip() {
|
function createTrip() {
|
||||||
if (!tripForm.name.trim()) {
|
if (!tripForm.name.trim()) {
|
||||||
Alert.alert('Missing name', 'Trip name is required.');
|
showAlert('Missing name', 'Trip name is required.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,12 +256,12 @@ export default function AppRoot() {
|
|||||||
const end = parseYMD(tripForm.endDate);
|
const end = parseYMD(tripForm.endDate);
|
||||||
|
|
||||||
if (!start || !end) {
|
if (!start || !end) {
|
||||||
Alert.alert('Invalid dates', 'Please select valid trip dates.');
|
showAlert('Invalid dates', 'Please select valid trip dates.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
Alert.alert('Invalid dates', 'Start date cannot be after end date.');
|
showAlert('Invalid dates', 'Start date cannot be after end date.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +317,7 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function saveTripEdits(tripId, patch) {
|
function saveTripEdits(tripId, patch) {
|
||||||
if (!patch.name.trim()) {
|
if (!patch.name.trim()) {
|
||||||
Alert.alert('Missing name', 'Trip name is required.');
|
showAlert('Missing name', 'Trip name is required.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,12 +325,12 @@ export default function AppRoot() {
|
|||||||
const end = parseYMD(patch.endDate);
|
const end = parseYMD(patch.endDate);
|
||||||
|
|
||||||
if (!start || !end) {
|
if (!start || !end) {
|
||||||
Alert.alert('Invalid dates', 'Please select valid trip dates.');
|
showAlert('Invalid dates', 'Please select valid trip dates.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
Alert.alert('Invalid dates', 'Start date cannot be after end date.');
|
showAlert('Invalid dates', 'Start date cannot be after end date.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,30 +372,29 @@ export default function AppRoot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteTrip(tripId) {
|
function deleteTrip(tripId) {
|
||||||
Alert.alert('Delete trip?', 'Trip items and check-up history will also be deleted.', [
|
showConfirm({
|
||||||
{ text: 'Cancel', style: 'cancel' },
|
title: 'Delete trip?',
|
||||||
{
|
message: 'Trip items and check-up history will also be deleted.',
|
||||||
text: 'Delete',
|
confirmText: 'Delete',
|
||||||
style: 'destructive',
|
tone: 'danger',
|
||||||
onPress: () => {
|
onConfirm: () => {
|
||||||
setData((prev) => {
|
setData((prev) => {
|
||||||
const trips = prev.trips.filter((trip) => trip.id !== tripId);
|
const trips = prev.trips.filter((trip) => trip.id !== tripId);
|
||||||
const itemsByTrip = { ...prev.itemsByTrip };
|
const itemsByTrip = { ...prev.itemsByTrip };
|
||||||
const checkupsByTrip = { ...prev.checkupsByTrip };
|
const checkupsByTrip = { ...prev.checkupsByTrip };
|
||||||
delete itemsByTrip[tripId];
|
delete itemsByTrip[tripId];
|
||||||
delete checkupsByTrip[tripId];
|
delete checkupsByTrip[tripId];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
trips,
|
trips,
|
||||||
itemsByTrip,
|
itemsByTrip,
|
||||||
checkupsByTrip,
|
checkupsByTrip,
|
||||||
defaultTemplateTripId: prev.defaultTemplateTripId === tripId ? null : prev.defaultTemplateTripId,
|
defaultTemplateTripId: prev.defaultTemplateTripId === tripId ? null : prev.defaultTemplateTripId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function openAddItemModal() {
|
function openAddItemModal() {
|
||||||
@@ -385,12 +418,12 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function saveItemFromModal() {
|
function saveItemFromModal() {
|
||||||
if (!selectedTripId) {
|
if (!selectedTripId) {
|
||||||
Alert.alert('No trip selected', 'Please select or create a trip first.');
|
showAlert('No trip selected', 'Please select or create a trip first.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemForm.name.trim()) {
|
if (!itemForm.name.trim()) {
|
||||||
Alert.alert('Missing name', 'Item name is required.');
|
showAlert('Missing name', 'Item name is required.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,17 +524,26 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function deleteCheckup(checkupId) {
|
function deleteCheckup(checkupId) {
|
||||||
if (!selectedTripId) return;
|
if (!selectedTripId) return;
|
||||||
setData((prev) => {
|
|
||||||
const existing = prev.checkupsByTrip[selectedTripId] || [];
|
showConfirm({
|
||||||
return {
|
title: 'Delete check-up?',
|
||||||
...prev,
|
message: 'This snapshot will be removed from history.',
|
||||||
checkupsByTrip: {
|
confirmText: 'Delete',
|
||||||
...prev.checkupsByTrip,
|
tone: 'danger',
|
||||||
[selectedTripId]: existing.filter((checkup) => checkup.id !== checkupId),
|
onConfirm: () => {
|
||||||
},
|
setData((prev) => {
|
||||||
};
|
const existing = prev.checkupsByTrip[selectedTripId] || [];
|
||||||
|
return {
|
||||||
|
...prev,
|
||||||
|
checkupsByTrip: {
|
||||||
|
...prev.checkupsByTrip,
|
||||||
|
[selectedTripId]: existing.filter((checkup) => checkup.id !== checkupId),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
setSelectedCheckupId((prev) => (prev === checkupId ? null : prev));
|
||||||
|
},
|
||||||
});
|
});
|
||||||
setSelectedCheckupId((prev) => (prev === checkupId ? null : prev));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFreshCheckupSession() {
|
function createFreshCheckupSession() {
|
||||||
@@ -514,11 +556,11 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function startCheckupFlow() {
|
function startCheckupFlow() {
|
||||||
if (!selectedTripId) {
|
if (!selectedTripId) {
|
||||||
Alert.alert('No trip selected', 'Please select a trip first.');
|
showAlert('No trip selected', 'Please select a trip first.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!selectedTripItems.length) {
|
if (!selectedTripItems.length) {
|
||||||
Alert.alert('No items', 'Add items before starting a check-up.');
|
showAlert('No items', 'Add items before starting a check-up.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,18 +657,18 @@ export default function AppRoot() {
|
|||||||
|
|
||||||
function saveCheckupSnapshot(sessionToSave) {
|
function saveCheckupSnapshot(sessionToSave) {
|
||||||
if (!selectedTripId) {
|
if (!selectedTripId) {
|
||||||
Alert.alert('No trip selected', 'Please select a trip first.');
|
showAlert('No trip selected', 'Please select a trip first.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sessionToSave.length) {
|
if (!sessionToSave.length) {
|
||||||
Alert.alert('No items', 'Add items before creating a check-up.');
|
showAlert('No items', 'Add items before creating a check-up.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pending = sessionToSave.filter((entry) => !entry.confirmed).length;
|
const pending = sessionToSave.filter((entry) => !entry.confirmed).length;
|
||||||
if (pending > 0) {
|
if (pending > 0) {
|
||||||
Alert.alert('Incomplete', `Please confirm all items first (${pending} remaining).`);
|
showAlert('Incomplete', `Please confirm all items first (${pending} remaining).`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,7 +711,7 @@ export default function AppRoot() {
|
|||||||
const ok = saveCheckupSnapshot(checkupSession);
|
const ok = saveCheckupSnapshot(checkupSession);
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
|
||||||
Alert.alert('Saved', 'Check-up snapshot saved.');
|
showAlert('Saved', 'Check-up snapshot saved.');
|
||||||
closeCheckupFlow();
|
closeCheckupFlow();
|
||||||
createFreshCheckupSession();
|
createFreshCheckupSession();
|
||||||
}
|
}
|
||||||
@@ -809,6 +851,14 @@ export default function AppRoot() {
|
|||||||
onSaveNo={saveCurrentCheckupNo}
|
onSaveNo={saveCurrentCheckupNo}
|
||||||
onFinish={finishCheckupFlow}
|
onFinish={finishCheckupFlow}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AppDialogModal
|
||||||
|
visible={dialogState.visible}
|
||||||
|
title={dialogState.title}
|
||||||
|
message={dialogState.message}
|
||||||
|
buttons={dialogState.buttons}
|
||||||
|
onClose={closeDialog}
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
40
src/components/AppDialogModal.js
Normal file
40
src/components/AppDialogModal.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Pressable, Text, View } from 'react-native';
|
||||||
|
import { styles } from '../styles';
|
||||||
|
|
||||||
|
export default function AppDialogModal({ visible, title, message, buttons = [], onClose }) {
|
||||||
|
if (!visible) return null;
|
||||||
|
|
||||||
|
const safeButtons = buttons.length ? buttons : [{ text: 'OK' }];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal visible={visible} transparent animationType="fade" onRequestClose={onClose}>
|
||||||
|
<View style={styles.dialogBackdrop}>
|
||||||
|
<View style={styles.dialogCard}>
|
||||||
|
<Text style={styles.dialogTitle}>{title || 'Notice'}</Text>
|
||||||
|
{!!message ? <Text style={styles.dialogMessage}>{message}</Text> : null}
|
||||||
|
|
||||||
|
<View style={styles.dialogButtonsRow}>
|
||||||
|
{safeButtons.map((button, idx) => {
|
||||||
|
const tone = button.tone || (button.style === 'destructive' ? 'danger' : button.style === 'cancel' ? 'neutral' : 'primary');
|
||||||
|
return (
|
||||||
|
<Pressable
|
||||||
|
key={`${button.text}-${idx}`}
|
||||||
|
style={[
|
||||||
|
styles.dialogBtn,
|
||||||
|
tone === 'primary' ? styles.dialogBtnPrimary : null,
|
||||||
|
tone === 'danger' ? styles.dialogBtnDanger : null,
|
||||||
|
tone === 'neutral' ? styles.dialogBtnNeutral : null,
|
||||||
|
]}
|
||||||
|
onPress={button.onPress}
|
||||||
|
>
|
||||||
|
<Text style={styles.dialogBtnText}>{button.text || 'OK'}</Text>
|
||||||
|
</Pressable>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -484,6 +484,59 @@ export const styles = StyleSheet.create({
|
|||||||
backgroundColor: 'rgba(2,6,23,0.72)',
|
backgroundColor: 'rgba(2,6,23,0.72)',
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
},
|
},
|
||||||
|
dialogBackdrop: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: 'rgba(2,6,23,0.72)',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingHorizontal: 18,
|
||||||
|
},
|
||||||
|
dialogCard: {
|
||||||
|
width: '100%',
|
||||||
|
backgroundColor: '#0f172a',
|
||||||
|
borderRadius: 16,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: '#1e293b',
|
||||||
|
padding: 14,
|
||||||
|
gap: 12,
|
||||||
|
},
|
||||||
|
dialogTitle: {
|
||||||
|
color: '#f8fafc',
|
||||||
|
fontWeight: '700',
|
||||||
|
fontSize: 17,
|
||||||
|
},
|
||||||
|
dialogMessage: {
|
||||||
|
color: '#cbd5e1',
|
||||||
|
lineHeight: 20,
|
||||||
|
},
|
||||||
|
dialogButtonsRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
gap: 8,
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
},
|
||||||
|
dialogBtn: {
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingVertical: 9,
|
||||||
|
paddingHorizontal: 14,
|
||||||
|
borderWidth: 1,
|
||||||
|
},
|
||||||
|
dialogBtnPrimary: {
|
||||||
|
backgroundColor: '#2563eb',
|
||||||
|
borderColor: '#2563eb',
|
||||||
|
},
|
||||||
|
dialogBtnDanger: {
|
||||||
|
backgroundColor: '#7f1d1d',
|
||||||
|
borderColor: '#991b1b',
|
||||||
|
},
|
||||||
|
dialogBtnNeutral: {
|
||||||
|
backgroundColor: '#1e293b',
|
||||||
|
borderColor: '#334155',
|
||||||
|
},
|
||||||
|
dialogBtnText: {
|
||||||
|
color: '#f8fafc',
|
||||||
|
fontWeight: '700',
|
||||||
|
},
|
||||||
modalKeyboardWrap: {
|
modalKeyboardWrap: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|||||||
@@ -1,25 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Alert, Pressable, Text, View } from 'react-native';
|
import { Pressable, Text, View } from 'react-native';
|
||||||
import { styles } from '../styles';
|
import { styles } from '../styles';
|
||||||
|
|
||||||
export default function HistoryTab({
|
export default function HistoryTab({ selectedTrip, selectedTripCheckups, selectedCheckupId, setSelectedCheckupId, onDeleteCheckup }) {
|
||||||
selectedTrip,
|
|
||||||
selectedTripCheckups,
|
|
||||||
selectedCheckupId,
|
|
||||||
setSelectedCheckupId,
|
|
||||||
onDeleteCheckup,
|
|
||||||
}) {
|
|
||||||
function askDelete(checkup) {
|
|
||||||
Alert.alert('Delete check-up?', 'This snapshot will be removed from history.', [
|
|
||||||
{ text: 'Cancel', style: 'cancel' },
|
|
||||||
{
|
|
||||||
text: 'Delete',
|
|
||||||
style: 'destructive',
|
|
||||||
onPress: () => onDeleteCheckup(checkup.id),
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.section}>
|
<View style={styles.section}>
|
||||||
<Text style={styles.sectionTitle}>History</Text>
|
<Text style={styles.sectionTitle}>History</Text>
|
||||||
@@ -32,7 +15,7 @@ export default function HistoryTab({
|
|||||||
<View key={checkup.id} style={styles.cardSoft}>
|
<View key={checkup.id} style={styles.cardSoft}>
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={() => setSelectedCheckupId((prev) => (prev === checkup.id ? null : checkup.id))}
|
onPress={() => setSelectedCheckupId((prev) => (prev === checkup.id ? null : checkup.id))}
|
||||||
onLongPress={() => askDelete(checkup)}
|
onLongPress={() => onDeleteCheckup(checkup.id)}
|
||||||
delayLongPress={280}
|
delayLongPress={280}
|
||||||
>
|
>
|
||||||
<Text style={styles.cardTitle}>{new Date(checkup.createdAt).toLocaleString()}</Text>
|
<Text style={styles.cardTitle}>{new Date(checkup.createdAt).toLocaleString()}</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user