diff --git a/components/AmbulanceCard.jsx b/components/AmbulanceCard.jsx index 8dec416e8..147963fc1 100644 --- a/components/AmbulanceCard.jsx +++ b/components/AmbulanceCard.jsx @@ -2,10 +2,12 @@ import { faPhoneAlt, faLink, faCheckCircle, - faExclamationTriangle + faExclamationTriangle, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { isVerified, parseDateString } from '../lib/utils'; +import { copyToClipboard } from '../lib/utils'; import React from 'react'; const AmbulanceCard = ({ @@ -22,6 +24,23 @@ const AmbulanceCard = ({ <>
+
+

{ + copyToClipboard(` + Name: ${name ? name : 'Ambulance'} + Contact: ${phone1} + `); + alert('Copied!'); + }}> + +

+
@@ -89,17 +108,20 @@ const AmbulanceCard = ({
- { - lastVerifiedOn && + {lastVerifiedOn && (
- {isVerified(verificationStatus) ? "Verified on: " : "Checked on: "} + + {isVerified(verificationStatus) + ? 'Verified on: ' + : 'Checked on: '} + {`${parseDateString(lastVerifiedOn)}`}
- } + )}
diff --git a/components/HelplineCard.jsx b/components/HelplineCard.jsx index 1c956b544..2fcd29946 100644 --- a/components/HelplineCard.jsx +++ b/components/HelplineCard.jsx @@ -5,10 +5,11 @@ import { faPhoneAlt, faCheckCircle, faExclamationTriangle, - faMapMarkerAlt + faMapMarkerAlt, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { isVerified, parseDateString } from '../lib/utils'; +import { isVerified, parseDateString, copyToClipboard } from '../lib/utils'; const HelplineCard = ({ category, @@ -26,6 +27,23 @@ const HelplineCard = ({ }) => { return (
+
+

{ + copyToClipboard(` + Name: ${name ? name : ''} + Contact: ${phone1} + `); + alert('Copied!'); + }}> + +

+
@@ -48,7 +66,6 @@ const HelplineCard = ({ )} -
@@ -92,17 +109,18 @@ const HelplineCard = ({
{description}
- { - lastVerifiedOn && + {lastVerifiedOn && (
- {isVerified(verificationStatus) ? "Verified on: " : "Checked on: "} - - {parseDateString(lastVerifiedOn)} + + {isVerified(verificationStatus) + ? 'Verified on: ' + : 'Checked on: '} + {parseDateString(lastVerifiedOn)}
- } + )}
diff --git a/components/HospitalCard.jsx b/components/HospitalCard.jsx index e649487be..ce978fdfe 100644 --- a/components/HospitalCard.jsx +++ b/components/HospitalCard.jsx @@ -4,10 +4,11 @@ import { faPhoneAlt, faCheckCircle, faExclamationTriangle, - faMapMarkerAlt + faMapMarkerAlt, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { isVerified, parseDateString } from '../lib/utils'; +import { isVerified, parseDateString, copyToClipboard } from '../lib/utils'; const HospitalCard = ({ name, @@ -21,6 +22,23 @@ const HospitalCard = ({ }) => { return (
+
+

{ + copyToClipboard(` + Name: ${name ? name : 'Ambulance'} + Contact: ${phone1} + `); + alert('Copied!'); + }}> + +

+
@@ -66,17 +84,18 @@ const HospitalCard = ({
{pointOfContact}
- { - lastVerifiedOn && + {lastVerifiedOn && (
- {isVerified(verificationStatus) ? "Verified on: " : "Checked on: "} - - {parseDateString(lastVerifiedOn)} + + {isVerified(verificationStatus) + ? 'Verified on: ' + : 'Checked on: '} + {parseDateString(lastVerifiedOn)}
- } + )}
diff --git a/components/MedicinesCard.jsx b/components/MedicinesCard.jsx index 930630694..638c92c67 100644 --- a/components/MedicinesCard.jsx +++ b/components/MedicinesCard.jsx @@ -4,10 +4,11 @@ import { faPhoneAlt, faCheckCircle, faExclamationTriangle, - faEnvelope + faEnvelope, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { isVerified, parseDateString } from '../lib/utils'; +import { isVerified, parseDateString, copyToClipboard } from '../lib/utils'; const MedicinesCard = ({ verificationStatus, @@ -23,6 +24,23 @@ const MedicinesCard = ({ }) => { return (
+
+

{ + copyToClipboard(` + Name: ${name ? name : ''} + Contact: ${phone1} + `); + alert('Copied!'); + }}> + +

+
@@ -44,13 +62,17 @@ const MedicinesCard = ({ )} - {city &&
- {city} -
} + {city && ( +
+ {city} +
+ )}
- {address &&
-
{address}
-
} + {address && ( +
+
{address}
+
+ )}
{phone1 && ( @@ -94,17 +116,18 @@ const MedicinesCard = ({
{description}
- { - lastVerifiedOn && + {lastVerifiedOn && (
- {isVerified(verificationStatus) ? "Verified on: " : "Checked on: "} - - {parseDateString(lastVerifiedOn)} + + {isVerified(verificationStatus) + ? 'Verified on: ' + : 'Checked on: '} + {parseDateString(lastVerifiedOn)}
- } + )}
diff --git a/components/OxygenCard.jsx b/components/OxygenCard.jsx index 3a53d3da0..0d132dc33 100644 --- a/components/OxygenCard.jsx +++ b/components/OxygenCard.jsx @@ -4,10 +4,11 @@ import { faLink, faPhoneAlt, faCheckCircle, - faExclamationTriangle + faExclamationTriangle, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { isVerified, parseDateString } from '../lib/utils'; +import { isVerified, parseDateString, copyToClipboard } from '../lib/utils'; const OxygenCard = ({ name, @@ -25,6 +26,23 @@ const OxygenCard = ({ }) => { return (
+
+

{ + copyToClipboard(` + Name: ${name ? name : 'Ambulance'} + Contact: ${phone1} + `); + alert('Copied!'); + }}> + +

+
@@ -87,17 +105,18 @@ const OxygenCard = ({
{description}
- { - lastVerifiedOn && + {lastVerifiedOn && (
- {isVerified(verificationStatus) ? "Verified on: " : "Checked on: "} - - {parseDateString(lastVerifiedOn)} + + {isVerified(verificationStatus) + ? 'Verified on: ' + : 'Checked on: '} + {parseDateString(lastVerifiedOn)}
- } + )}
diff --git a/components/PlasmaCard.jsx b/components/PlasmaCard.jsx index d24f046b2..b0953ce2f 100644 --- a/components/PlasmaCard.jsx +++ b/components/PlasmaCard.jsx @@ -4,10 +4,11 @@ import { faLink, faPhoneAlt, faCheckCircle, - faExclamationTriangle + faExclamationTriangle, + faCopy } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { parseDateString } from '../lib/utils'; +import { parseDateString, copyToClipboard } from '../lib/utils'; const PlasmaCard = ({ city, @@ -23,6 +24,23 @@ const PlasmaCard = ({ }) => { return (
+
+

{ + copyToClipboard(` + Name: ${name ? name : 'Ambulance'} + Contact: ${phone1 ? phone1 : ''} + `); + alert('Copied!'); + }}> + +

+
@@ -30,7 +48,7 @@ const PlasmaCard = ({ {name} {verificationStatus && - verificationStatus.toLocaleLowerCase() == 'verified' ? ( + verificationStatus.toLocaleLowerCase() == 'verified' ? (
{description}
- { - lastVerifiedOn ? ( - verifiedStatus && verifiedStatus.toLocaleLowerCase() == 'verified' ? - `Verified @ ${parseDateString(lastVerifiedOn)}` : - `Last Checked @ ${parseDateString(lastVerifiedOn)}` - ) : '' - } + {lastVerifiedOn + ? verifiedStatus && verifiedStatus.toLocaleLowerCase() == 'verified' + ? `Verified @ ${parseDateString(lastVerifiedOn)}` + : `Last Checked @ ${parseDateString(lastVerifiedOn)}` + : ''}
diff --git a/components/SocialSharing.jsx b/components/SocialSharing.jsx index 820535812..118566537 100644 --- a/components/SocialSharing.jsx +++ b/components/SocialSharing.jsx @@ -29,14 +29,8 @@ const SocialSharing = ({ twitterText, url }) => { onClick={() => { copyToClipboard(twitterText); setCopiesSuccess(true); - setTimeout(() => setCopiesSuccess(false), 2000); + alert('heye'); }}> - - Copied! -