{
setQuery(event.target.value);
setIsOpen(true);
}}
onFocus={() => setIsOpen(true)}
placeholder="Example: 701, Subarna, Dhaka..."
className="w-full rounded-2xl border border-slate-200 bg-slate-50 py-4 pl-12 pr-4 text-base outline-none transition focus:border-slate-400 focus:bg-white"
/>
{isOpen && (
{filteredTrains.length === 0 ? (
No train found
) : (
filteredTrains.map((train) => (
))
)}
)}
Train list preview
{TRAINS.slice(0, 20).map((train) => (
))}
Dropdown e full list searchable ache. Ei preview section optional.
{!selectedTrain && !loading && !error && (
Select a train
Train select korle ekhanei live location show korbe.
)}
{loading && (
Fetching live location...
Backend API theke latest data ashtese.
)}
{error && !loading && (
Something went wrong
{error}
)}
{selectedTrain && location && !loading && !error && (
Selected train
{selectedTrain.code} - {selectedTrain.name}
{selectedTrain.route}
Current location
{location.currentLocation}
Next station
{location.nextStation}
Last updated: {location.lastUpdated}
)}