update tab nhật ký (Lọc, Ngôn ngữ,...)

This commit is contained in:
2025-12-07 20:23:10 +07:00
parent 0672f8adf9
commit e405a0bcfa
17 changed files with 851 additions and 332 deletions

View File

@@ -9,31 +9,33 @@ import {
ScrollView,
} from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { TripStatus, TRIP_STATUS_CONFIG } from "./types";
import { TripStatus } from "./types";
import { useI18n } from "@/hooks/use-i18n";
interface StatusDropdownProps {
value: TripStatus | null;
onChange: (status: TripStatus | null) => void;
onChange: (value: TripStatus | null) => void;
}
const STATUS_OPTIONS: Array<{ value: TripStatus | null; label: string }> = [
{ value: null, label: "Vui lòng chọn" },
{ value: "created", label: "Đã khởi tạo" },
{ value: "pending", label: "Chờ duyệt" },
{ value: "approved", label: "Đã duyệt" },
{ value: "in-progress", label: "Đang hoạt động" },
{ value: "completed", label: "Hoàn thành" },
{ value: "cancelled", label: "Đã hủy" },
];
export default function StatusDropdown({
value,
onChange,
}: StatusDropdownProps) {
const { t } = useI18n();
const [isOpen, setIsOpen] = useState(false);
const STATUS_OPTIONS: Array<{ value: TripStatus | null; label: string }> = [
{ value: null, label: t("diary.statusDropdown.placeholder") },
{ value: 0, label: t("diary.statusDropdown.created") },
{ value: 1, label: t("diary.statusDropdown.pending") },
{ value: 2, label: t("diary.statusDropdown.approved") },
{ value: 3, label: t("diary.statusDropdown.active") },
{ value: 4, label: t("diary.statusDropdown.completed") },
{ value: 5, label: t("diary.statusDropdown.cancelled") },
];
const selectedLabel =
STATUS_OPTIONS.find((opt) => opt.value === value)?.label || "Vui lòng chọn";
STATUS_OPTIONS.find((opt) => opt.value === value)?.label || t("diary.statusDropdown.placeholder");
const handleSelect = (status: TripStatus | null) => {
onChange(status);
@@ -42,7 +44,7 @@ export default function StatusDropdown({
return (
<View style={styles.container}>
<Text style={styles.label}>Trạng thái</Text>
<Text style={styles.label}>{t("diary.statusDropdown.label")}</Text>
<TouchableOpacity
style={styles.selector}
onPress={() => setIsOpen(true)}