Ship Expo Router screens, seeded stores, and polished UX so auth, shop, checkout, prescriptions, loyalty, family, and account processes work end-to-end offline. Co-authored-by: Cursor <cursoragent@cursor.com>
143 lines
3.5 KiB
TypeScript
143 lines
3.5 KiB
TypeScript
export type Branch = {
|
||
id: string;
|
||
slug: string;
|
||
name: string;
|
||
area: string;
|
||
phone: string;
|
||
hours: string;
|
||
is24h: boolean;
|
||
lat: number;
|
||
lng: number;
|
||
pickupAvailable: boolean;
|
||
mapsUrl: string;
|
||
};
|
||
|
||
/** Verified from gishenpharmacy.wordpress.com contact page + public listings. */
|
||
export const branches: Branch[] = [
|
||
{
|
||
id: "bole",
|
||
slug: "bole",
|
||
name: "Bole Branch",
|
||
area: "Bole, Addis Ababa",
|
||
phone: "+251930033290",
|
||
hours: "Open 24 hours",
|
||
is24h: true,
|
||
lat: 8.9806,
|
||
lng: 38.799,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Bole%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "cmc",
|
||
slug: "cmc-michael",
|
||
name: "CMC Michael Branch",
|
||
area: "CMC Michael, Addis Ababa",
|
||
phone: "+251930102175",
|
||
hours: "Open 24 hours",
|
||
is24h: true,
|
||
lat: 9.0227,
|
||
lng: 38.826,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20CMC%20Michael%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "jemo",
|
||
slug: "jemo",
|
||
name: "Jemo Branch",
|
||
area: "Jemo, Addis Ababa",
|
||
phone: "+251930033292",
|
||
hours: "Open 24 hours",
|
||
is24h: true,
|
||
lat: 8.963,
|
||
lng: 38.72,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Jemo%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "stadium",
|
||
slug: "stadium",
|
||
name: "Stadium Branch",
|
||
area: "Stadium, Addis Ababa",
|
||
phone: "+251930033291",
|
||
hours: "8:00 AM – 8:00 PM",
|
||
is24h: false,
|
||
lat: 9.012,
|
||
lng: 38.763,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Stadium%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "mexico",
|
||
slug: "mexico",
|
||
name: "Mexico Branch",
|
||
area: "Mexico Square, Addis Ababa",
|
||
phone: "+251935998678",
|
||
hours: "8:00 AM – 9:00 PM",
|
||
is24h: false,
|
||
lat: 9.01,
|
||
lng: 38.745,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Mexico%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "golagol",
|
||
slug: "golagol",
|
||
name: "Golagol Branch",
|
||
area: "Golagol, Addis Ababa",
|
||
phone: "+251930076930",
|
||
hours: "8:00 AM – 8:00 PM",
|
||
is24h: false,
|
||
lat: 9.03,
|
||
lng: 38.75,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Golagol%20Addis%20Ababa",
|
||
},
|
||
{
|
||
id: "hayahulet",
|
||
slug: "hayahulet",
|
||
name: "Hayahulet Branch",
|
||
area: "Hayahulet, Addis Ababa",
|
||
phone: "+251930033292",
|
||
hours: "8:00 AM – 8:00 PM",
|
||
is24h: false,
|
||
lat: 9.02,
|
||
lng: 38.79,
|
||
pickupAvailable: true,
|
||
mapsUrl:
|
||
"https://www.google.com/maps/search/?api=1&query=Gishen%20Pharmacy%20Hayahulet%20Addis%20Ababa",
|
||
},
|
||
];
|
||
|
||
export function getBranchById(id: string) {
|
||
return branches.find((b) => b.id === id);
|
||
}
|
||
|
||
export function distanceKm(
|
||
lat1: number,
|
||
lng1: number,
|
||
lat2: number,
|
||
lng2: number,
|
||
) {
|
||
const toRad = (v: number) => (v * Math.PI) / 180;
|
||
const R = 6371;
|
||
const dLat = toRad(lat2 - lat1);
|
||
const dLng = toRad(lng2 - lng1);
|
||
const a =
|
||
Math.sin(dLat / 2) ** 2 +
|
||
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLng / 2) ** 2;
|
||
return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||
}
|
||
|
||
export function nearestBranches(lat: number, lng: number, limit = 3) {
|
||
return [...branches]
|
||
.map((b) => ({ ...b, distance: distanceKm(lat, lng, b.lat, b.lng) }))
|
||
.sort((a, b) => a.distance - b.distance)
|
||
.slice(0, limit);
|
||
}
|