mirror of
https://github.com/zhigang1992/uber-cities.git
synced 2026-04-29 01:34:56 +08:00
add ability to add intire countries as edge cases
This commit is contained in:
@@ -71,7 +71,7 @@ class City extends Component {
|
||||
/>
|
||||
</Wrapper>,
|
||||
<Title>YES 🚗</Title>,
|
||||
<Message>{edgeCases(cities[0].name)}</Message>,
|
||||
<Message>{edgeCases(cities[0])}</Message>,
|
||||
]
|
||||
) : (
|
||||
<Title>NO 😕</Title>
|
||||
|
||||
@@ -2,45 +2,49 @@ const cases = [
|
||||
{
|
||||
type: 'price',
|
||||
message: 'The price for getting an Uber is the same as getting a taxi',
|
||||
name: 'berlin',
|
||||
},
|
||||
{
|
||||
type: 'safety',
|
||||
message:
|
||||
'Be careful getting an Uber in porto because of taxi drivers. Mainly in airports and train stations',
|
||||
name: 'porto',
|
||||
},
|
||||
{
|
||||
type: 'payment',
|
||||
message:
|
||||
'Uber drivers only take payment by cash. If they think you\'ll pay by card then they\'ll cancel the ride',
|
||||
name: 'buenos aires',
|
||||
},
|
||||
{
|
||||
type: 'price',
|
||||
message: 'A ride from Charles de Gaule Airport to Paris is legally set at 50-55€, and 30-35€ from Orly Airport. Beware of frauds.',
|
||||
name: 'paris',
|
||||
},
|
||||
{
|
||||
type: 'safety',
|
||||
message:
|
||||
'Be aware! Some taxi drivers may attack your uber driver.',
|
||||
name: 'istanbul',
|
||||
city: ['berlin'],
|
||||
},
|
||||
{
|
||||
type: 'price',
|
||||
message:
|
||||
'Uber drivers only take payment by cash. If they think you\'ll pay by card then they\'ll cancel the ride',
|
||||
name: 'san salvador',
|
||||
'A ride from Charles de Gaule Airport to Paris is legally set at 50-55€, and 30-35€ from Orly Airport. Beware of frauds.',
|
||||
city: ['paris'],
|
||||
},
|
||||
{
|
||||
type: 'safety',
|
||||
message: 'Be aware! Some taxi drivers may attack your uber driver.',
|
||||
city: ['porto', 'istanbul'],
|
||||
},
|
||||
{
|
||||
type: 'price',
|
||||
message:
|
||||
"Uber drivers only take payment by cash. If they think you'll pay by card then they'll cancel the ride",
|
||||
city: ['san salvador', 'buenos aires'],
|
||||
},
|
||||
{
|
||||
type: 'service',
|
||||
message: 'Only Uber Black is available in Seoul.',
|
||||
name: 'seoul',
|
||||
}
|
||||
city: ['seoul'],
|
||||
},
|
||||
{
|
||||
type: 'service',
|
||||
message: 'It is preferred to take Yandex Taxi',
|
||||
country: ['russia'],
|
||||
},
|
||||
]
|
||||
|
||||
export default city =>
|
||||
city &&
|
||||
(cases.filter(c => c.name.toLowerCase() === city.toLowerCase())[0] || {})
|
||||
.message
|
||||
export default ({
|
||||
name,
|
||||
info: {
|
||||
country: { long_name },
|
||||
},
|
||||
}) => {
|
||||
const match = cases.find(
|
||||
c =>
|
||||
(c.city && c.city.includes(name.toLowerCase())) ||
|
||||
(c.country && c.country.includes(long_name.toLowerCase()))
|
||||
)
|
||||
if (match) {
|
||||
return match.message
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user