41 lines
868 B
JavaScript
41 lines
868 B
JavaScript
export const formatPrice = p => {
|
|
if (isNaN(p)) {
|
|
return 'Po dogovoru'
|
|
}
|
|
|
|
return p.toLocaleString('bs') + ' KM'
|
|
}
|
|
|
|
export const formatFilterNumber = num => {
|
|
if (isNaN(num) || num == null) {
|
|
return ''
|
|
}
|
|
return num
|
|
}
|
|
|
|
export const galleryImageUrl = img =>
|
|
img && img.replace('upload/', 'upload/w_500/')
|
|
|
|
export const listingImageUrl = img =>
|
|
img && img.replace('upload/', 'upload/w_205/')
|
|
|
|
export const defaultContactMessage = (url) => {
|
|
return `Pozdrav,
|
|
|
|
Našao/Našla sam vaš oglas na portalu Kivi za sljedeću nekretninu:
|
|
|
|
${url}
|
|
|
|
Želim da me kontaktirate kako bih dobio/dobila više informacija.
|
|
|
|
S poštovanjem
|
|
`
|
|
}
|
|
|
|
export const listingUrl = (id) => {
|
|
// TODO: fix this once removing hardcoded values
|
|
return `http://localhost:8080/?listingId=${id}`
|
|
}
|
|
|
|
export const isMobile = () => window.matchMedia("(max-width: 768px)").matches
|