aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-01 20:32:18 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-01 20:32:18 +0530
commit1e5743b1596276307f3028d5767488a7ffe11c4c (patch)
tree1ce431f39f7a88eeed04557094ce35de3448e72c
parentfd5ed8aa4f159c8e1c0476915432e0a97a239a91 (diff)
showing emails/phones as mailto: and tel: links
-rw-r--r--src/classes/client.js4
-rw-r--r--src/components/tables/client-table.js15
2 files changed, 12 insertions, 7 deletions
diff --git a/src/classes/client.js b/src/classes/client.js
index 6785c90..842c5e5 100644
--- a/src/classes/client.js
+++ b/src/classes/client.js
@@ -67,6 +67,6 @@ export const getAllClients = (ok, fail) => {
export const editClient = (client, ok, fail) => {
axios.put(`/client/${client.Id}`, client)
- .then(res => ok())
- .catch(err => fail())
+ .then(res => ok(res))
+ .catch(err => fail(err))
}
diff --git a/src/components/tables/client-table.js b/src/components/tables/client-table.js
index d3b5c25..eb13308 100644
--- a/src/components/tables/client-table.js
+++ b/src/components/tables/client-table.js
@@ -50,15 +50,20 @@ const ClientTable = (props) => {
<p className={"heading"}><strong>Contact: </strong>{i.Contact.Name}</p>
<p>
Phone Number{i.Contact.Phones.length === 1 ? '' : 's'}:
- {i.Contact.Phones.map((j, id) => ` ${j}${id + 1 === i.Contact.Phones.length ? '' : ','}`)}
+ {i.Contact.Phones.map((j, id) => <a key={`${j}-${id}`} href={`tel:${j}`}>{` ${j}${id + 1 === i.Contact.Phones.length ? '' : ','}`}</a>)}
<br/>
Email Address{i.Contact.Emails.length === 1 ? '' : 'es'}:
- {i.Contact.Emails.map((j, id) => ` ${j}${id + 1 === i.Contact.Emails.length ? '' : ','}`)}
+ {i.Contact.Emails.map((j, id) => <a key={`${j}-${id}`} href={`mailto:${j}`}>{` ${j}${id + 1 === i.Contact.Emails.length ? '' : ','}`}</a>)}
<br/>
- {i.Contact.Website.length > 0 && <a href={
- `${(i.Contact.Website.startsWith("https://")
+ {i.Contact.Website.length > 0 &&
+ <a
+ href={`${(i.Contact.Website.startsWith("https://")
|| i.Contact.Website.startsWith("http://"))
- ? i.Contact.Website : 'https://' + i.Contact.Website}`}>{i.Contact.Website}</a>
+ ? i.Contact.Website : 'https://' + i.Contact.Website}`}
+ target="noreferrer noopener"
+ >
+ {i.Contact.Website}
+ </a>
}
</p>