fix: menu on android

This commit is contained in:
2026-06-27 19:38:05 +07:00
parent 796487ef76
commit 3bc7c8a160
5 changed files with 128 additions and 137 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
<meta name="twitter:title" content="Travel Planner - Lên kế hoạch chuyến đi của bạn" />
<meta name="twitter:description" content="Khám phá những hành trình tuyệt vời và chia sẻ khoảnh khắc đẹp với cộng đồng du lịch." />
<meta name="twitter:image" content="https://yotrip.labz.io.vn/background.avif" />
<script type="module" crossorigin src="/assets/index--uaaEHqB.js"></script>
<script type="module" crossorigin src="/assets/index-eQcX5WJf.js"></script>
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Cyuzqnbw.js">
<link rel="modulepreload" crossorigin href="/assets/vendor-others-VIU5qAPG.js">
<link rel="modulepreload" crossorigin href="/assets/vendor-editor-DOXkNaRS.js">
@@ -82,6 +82,11 @@ export const MapProfileDropdown: React.FC<MapProfileDropdownProps> = ({
<div
className="fixed bottom-0 left-0 right-0 sm:absolute sm:bottom-auto sm:top-14 sm:right-0 sm:left-auto z-[999999] w-full sm:w-64 bg-slate-900 border-t sm:border border-slate-800 rounded-t-3xl sm:rounded-2xl p-3 sm:p-2 shadow-2xl animate-in slide-in-from-bottom sm:slide-in-from-top-2 duration-300 text-xs text-slate-200"
style={{
maxHeight: '80vh',
overflowY: 'auto',
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4)'
}}
>
<div className="w-12 h-1 bg-slate-700 rounded-full mx-auto mb-3 sm:hidden" />
+15 -10
View File
@@ -1,10 +1,7 @@
import React, { useEffect, useState, useRef } from 'react';
<<<<<<< Updated upstream
=======
import { io, Socket } from 'socket.io-client';
import { Capacitor } from '@capacitor/core';
import { BACKEND_URL } from '@/utils/backendEndpoint';
>>>>>>> Stashed changes
import {
Compass,
Users,
@@ -607,12 +604,17 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
const res = await fetch('/api/v1/connections', { headers: getHeaders() });
if (res.ok) {
const data = await res.json();
setConnections(data.connections || []);
setReceivedRequests(data.receivedRequests || []);
setSentRequests(data.sentRequests || []);
// Defensive Array.isArray guards — API may return objects or null on error
setConnections(Array.isArray(data.connections) ? data.connections : []);
setReceivedRequests(Array.isArray(data.receivedRequests) ? data.receivedRequests : []);
setSentRequests(Array.isArray(data.sentRequests) ? data.sentRequests : []);
}
} catch (err) {
console.error('Lỗi khi tải danh sách kết nối:', err);
// Ensure state is always a clean array even on network failures
setConnections([]);
setReceivedRequests([]);
setSentRequests([]);
}
};
@@ -621,10 +623,12 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
const res = await fetch('/api/v1/users/me/photos', { headers: getHeaders() });
if (res.ok) {
const data = await res.json();
setPhotos(data || []);
// Defensive guard — API may return { photos: [] } or null
setPhotos(Array.isArray(data) ? data : (Array.isArray(data?.photos) ? data.photos : []));
}
} catch (err) {
console.error('Lỗi tải ảnh cá nhân:', err);
setPhotos([]);
}
};
@@ -647,7 +651,8 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
const res = await fetch(`/api/v1/users?q=${encodeURIComponent(searchQuery)}`, { headers: getHeaders() });
if (res.ok) {
const data = await res.json();
setSearchResults(data || []);
// Defensive guard — search endpoint may return { users: [] } or plain array
setSearchResults(Array.isArray(data) ? data : (Array.isArray(data?.users) ? data.users : []));
}
} catch (err) {
console.error('Lỗi tìm kiếm thành viên:', err);
@@ -964,7 +969,7 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
</button>
<a
href={`${import.meta.env.VITE_BACKEND_URL || 'https://yotrip.labz.io.vn'}/downloads/yotrip-latest.apk`}
href={`${BACKEND_URL}/downloads/yotrip-latest.apk`}
download="yotrip.apk"
className="w-full py-3 px-4 bg-slate-800 hover:bg-slate-700 text-slate-200 rounded-2xl font-bold flex items-center justify-center gap-2 shadow-md active:scale-95 transition-all text-xs text-center"
>
@@ -1224,7 +1229,7 @@ export const MemberDashboard: React.FC<MemberDashboardProps> = ({
</button>
<a
href={`${import.meta.env.VITE_BACKEND_URL || 'https://yotrip.labz.io.vn'}/downloads/yotrip-latest.apk`}
href={`${BACKEND_URL}/downloads/yotrip-latest.apk`}
download="yotrip.apk"
className="w-full py-2.5 px-4 bg-slate-800 hover:bg-slate-700 text-slate-200 rounded-xl font-bold flex items-center justify-center gap-2 shadow-md active:scale-95 transition-all duration-150 text-xs"
>