[
{
"model": "db.service",
"pk": 1,
"fields": {
"catagory_name": "New host",
"service_name": "<ul><li>Trip planning</li><li>Host shop</li></ul>"
}
},
{
"model": "db.service",
"pk": 2,
"fields": {
"catagory_name": "TOURING HOSTS",
"service_name": "Tour of location"
}
and it has another 5 written like the second activity. This is shown on the front end as a drop down of the activities (service_name). However the tech lead wants me to show trip planning as a bulleted activity, like this
- Trip Planning
- Host Shop
All as one selection.
In the front end code, the previous intern has used regex to seek the li and ul tags and replace them with || for some reason. He wants me to get rod of those which is easy enough, but I was wondering if I should keep the code to seek the tags and somehow make them into bullet points.
I have tried replacing the || with & but get &&, I then try replacing && with & but that doesn't work and there are still || in the code, so I tried replaceAll. However this still doesn't get me bullet points. Front end is react. I tried putting the code in brackets with li tags and that didn't work neither.
code listing the activities in the drop down
{pricing &&
targetValue &&
pricing.map((service, index) => {
if (targetValue === service.service_info.service_name) {
return service.service_info.service_name.includes(
"<li>"
) ? (
<Grid item className={classes.headlineText}>
{handleServiceName(service.service_info.service_name)}
</Grid>
) : (
<Grid item className={classes.headlineText}>
{service.service_info.service_name}
</Grid>
);
}
})}
</Grid>
Code handling regex
const regex = /<[^>]+>/g;
const split_string = string;
const new_str = string.replace(regex, " | ");
return new_str;
};```