diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2025-11-06 22:49:47 +0000 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-07 10:46:51 +0100 |
| commit | e51cdd89afc08274ca622e18b8127feca29e90a3 (patch) | |
| tree | 1e016c9bb977f8db4e7c61ad5fe1b3be311b6fef /src/frontend/app/components/StopGalleryItem.tsx | |
| parent | 43ea6cc94b6c1f2bfaf3f8787991d3283765da0b (diff) | |
Add gallery components and improve search functionality
Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com>
Diffstat (limited to 'src/frontend/app/components/StopGalleryItem.tsx')
| -rw-r--r-- | src/frontend/app/components/StopGalleryItem.tsx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/frontend/app/components/StopGalleryItem.tsx b/src/frontend/app/components/StopGalleryItem.tsx new file mode 100644 index 0000000..24d92a2 --- /dev/null +++ b/src/frontend/app/components/StopGalleryItem.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { Link } from "react-router"; +import { type Stop } from "../data/StopDataProvider"; +import LineIcon from "./LineIcon"; +import { useApp } from "../AppContext"; +import StopDataProvider from "../data/StopDataProvider"; + +interface StopGalleryItemProps { + stop: Stop; +} + +const StopGalleryItem: React.FC<StopGalleryItemProps> = ({ stop }) => { + const { region } = useApp(); + + return ( + <div className="gallery-item"> + <Link className="gallery-item-link" to={`/estimates/${stop.stopId}`}> + <div className="gallery-item-header"> + {stop.favourite && <span className="favourite-icon">★</span>} + <span className="gallery-item-code">({stop.stopId})</span> + </div> + <div className="gallery-item-name"> + {StopDataProvider.getDisplayName(region, stop)} + </div> + <div className="gallery-item-lines"> + {stop.lines?.slice(0, 3).map((line) => ( + <LineIcon key={line} line={line} region={region} /> + ))} + {stop.lines && stop.lines.length > 3 && ( + <span className="more-lines">+{stop.lines.length - 3}</span> + )} + </div> + </Link> + </div> + ); +}; + +export default StopGalleryItem; |
