IFRCGo/go-frontend

[PROD] Contact list styling

mmusori opened this issue · 4 comments

Issue

On the specific emergency page under contacts, the 3rd column has a different formatting to the other columns. see image below
image

Steps to reproduce

Please check : https://go.ifrc.org/emergencies/6479
to see the problem.

If applicable, add screenshots to help explain your problem.

Expected behaviour

The 3rd column should have the same format as the second column.

Somehow the frontend seems to "restructure" the data. E.g this is in Admin:
kép
And from that, on frontpage there is I F R C ... C A R, as if all capital letter would gain a space before it. ???

tovari commented

@frozenhelium, would you mind to check this issue?

@batpad has found this: https://github.com/IFRCGo/go-frontend/blame/develop/src/root/components/contact-row.js#L15 – that is the root cause.
I suppose it was copied from another part of code, because "separate(" can be found in 3 places:

views/field-report.js:            <p className='form__label'>{separate(d.ctype)}</p>
components/admin-area-elements.js:                <td>{separate(o.ctype)}</td>
components/contact-row.js:      <td>{separate(contact.ctype)}</td>

So it seems to be an unintentional effect.

separate:

export const separateUppercaseWords = (x) => {
  if (typeof x !== 'string') {
    return nope;
  }
  return x.replace(/([A-Z])/g, ' $1').trim();
};

Deployed to Prod.
Now it is nice, without surplus spaces: https://go.ifrc.org/emergencies/6479