Skip to content

Commit

Permalink
Fix directions button
Browse files Browse the repository at this point in the history
  • Loading branch information
devcshort committed Jan 10, 2024
1 parent ec1877b commit c0601ae
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 106 deletions.
2 changes: 1 addition & 1 deletion packages/client/components/molecules/Result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function Result(props: Props) {
};

const handleDirectionsClick = (e: any) => {
const coords = props?.location?.coordinates ? props?.coordinates : null;
const coords = props?.coordinates ?? null;
if (coords?.length === 0) {
e.preventDefault();
openContextModal({
Expand Down
23 changes: 19 additions & 4 deletions packages/client/components/organisms/ResourceOverviewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
USER_PREF_LOCATION,
} from '../../lib/constants/cookies';
import { useAppConfig } from '../../lib/hooks/useAppConfig';
import { openContextModal } from '@mantine/modals';

type Props = {
id: string;
Expand All @@ -45,7 +46,7 @@ type Props = {
export function ResourceOverviewSection(props: Props) {
const theme = useMantineTheme();
const [cookies] = useCookies();
const [coords, setCoords] = useState(null);
const [coords, setCoords] = useState<any>(null);
const config = useAppConfig();

useEffect(() => {
Expand All @@ -56,6 +57,19 @@ export function ResourceOverviewSection(props: Props) {

const { t } = useTranslation('page-resource');

const handleDirectionsClick = (e: any) => {
if (coords?.length === 0 || !coords) {
e.preventDefault();
openContextModal({
modal: 'update-location',
centered: true,
innerProps: {
location: props.location,
},
});
}
};

return (
<Card
id={props.id}
Expand All @@ -74,7 +88,9 @@ export function ResourceOverviewSection(props: Props) {
{props.serviceName}
</Text>

<Text mb="lg" sx={{ whiteSpace: "pre-wrap" }}>{parseHtml(props.serviceDescription ?? '')}</Text>
<Text mb="lg" sx={{ whiteSpace: 'pre-wrap' }}>
{parseHtml(props.serviceDescription ?? '')}
</Text>

<Divider />

Expand Down Expand Up @@ -159,8 +175,6 @@ export function ResourceOverviewSection(props: Props) {
resourceId={props.id}
resource={props}
fullWidth
disabled={props?.location?.coordinates == null || !coords}
aria-disabled={props?.location?.coordinates == null || !coords}
target="_blank"
href={`https://www.google.com/maps/dir/?api=1&origin=${coords}&destination=${(
props?.location?.coordinates ?? []
Expand All @@ -170,6 +184,7 @@ export function ResourceOverviewSection(props: Props) {
.join(',')}`}
size="xs"
leftIcon={<IconNavigation size={theme.fontSizes.lg} />}
onClick={handleDirectionsClick}
>
{t('call_to_action.get_directions', { ns: 'common' })}
</ReferralButton>
Expand Down
8 changes: 4 additions & 4 deletions packages/client/public/locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@
"sms_send_failed_title": "فشل إرسال الرسائل القصيرة",
"sms_send_failed_body": "فشل إرسال رسالتك."
},
"prompt_auth": "الرجاء تسجيل الدخول لاستخدام هذه الميزة.",
"update_location": {
"prompt_start_location": "ما هو موقع انطلاقك؟"
}
"prompt_auth": "الرجاء تسجيل الدخول لاستخدام هذه الميزة."
},
"data_providers": {
"provided_by": "البيانات المقدمة من"
},
"update_location": {
"prompt_start_location": "ما هو موقع انطلاقك؟"
},
"footer": {
"copyright": "كل الحقوق محفوظة.",
"privacy_policy": "سياسة الخصوصية"
Expand Down
8 changes: 4 additions & 4 deletions packages/client/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
"sms_send_failed_title": "SMS send failed",
"sms_send_failed_body": "Your message failed to send."
},
"prompt_auth": "Please login to use this feature.",
"update_location": {
"prompt_start_location": "What's your starting location?"
}
"prompt_auth": "Please login to use this feature."
},
"update_location": {
"prompt_start_location": "What's your starting location?"
},
"data_providers": {
"provided_by": "Data provided by"
Expand Down
135 changes: 58 additions & 77 deletions packages/client/public/locales/en/dynamic.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,61 @@
{
"search.hero_title": "How can we help?",
"search.query_placeholder": "Food, clothing, shelter, etc...",
"search.hero_title": "Mental Health & Substance Use Help",
"search.query_placeholder": "Find resources near you",
"search.location_placeholder": "City, state, zip, etc...",
"meta_title": "Resource Directory | Washington 211",
"meta_description": "2-1-1 connects callers, at no cost, to critical health and human services in their community. If you're unable to find a service, please dial 2-1-1 for assistance.",
"categories.0": "Disabilities",
"categories.0.subcategories.0": "Early Intervention",
"categories.0.subcategories.1": "Employment",
"categories.0.subcategories.2": "Financial Support",
"categories.0.subcategories.3": "Assistive Technology",
"categories.1": "Domestic Violence",
"categories.1.subcategories.0": "Hotline",
"categories.1.subcategories.1": "Shelter",
"categories.2": "Employment",
"categories.2.subcategories.0": "Job Search",
"categories.2.subcategories.1": "Job Seeking Skills",
"categories.2.subcategories.2": "Youth",
"categories.3": "Education",
"categories.3.subcategories.0": "Homeless Student Liaison",
"categories.3.subcategories.1": "GED Classes",
"categories.3.subcategories.2": "ESL Classes",
"categories.3.subcategories.3": "Tutoring/Homework Help",
"categories.4": "Food",
"categories.4.subcategories.0": "Free Meals",
"categories.4.subcategories.1": "Senior Meals",
"categories.4.subcategories.2": "Food Pantries/Banks",
"categories.4.subcategories.3": "Grocery Delivery",
"categories.4.subcategories.4": "Home Delivered Meals",
"categories.5": "Financial",
"categories.5.subcategories.0": "Rent Assistance",
"categories.5.subcategories.1": "Utility Assistance",
"categories.5.subcategories.2": "Move-in Assistance",
"categories.5.subcategories.3": "Utility Discounts",
"categories.6": "Personal/Household Items",
"categories.6.subcategories.0": "Hygiene Items",
"categories.6.subcategories.1": "Diapers",
"categories.6.subcategories.2": "Clothing",
"categories.7": "Health Care",
"categories.7.subcategories.0": "COVID-19 Testing",
"categories.7.subcategories.1": "Dental Care",
"categories.7.subcategories.2": "Primary Care",
"categories.7.subcategories.3": "Teen Clinics",
"categories.8": "Transportation",
"categories.8.subcategories.0": "Bus Fare",
"categories.8.subcategories.1": "Gas Money",
"categories.8.subcategories.2": "Local Transportation",
"categories.9": "Shelter/Housing",
"categories.9.subcategories.0": "Transitional Housing",
"categories.9.subcategories.1": "Homeless Day Centers",
"categories.9.subcategories.2": "Permanent Housing",
"categories.9.subcategories.3": "Overnight Shelters",
"categories.9.subcategories.4": "Youth Shelter",
"categories.10": "Mental Health",
"categories.10.subcategories.0": "General Counseling Services",
"categories.10.subcategories.1": "Mental Health Evaluation",
"categories.10.subcategories.2": "General Crisis Hotlines",
"categories.10.subcategories.3": "Teen Counseling",
"categories.11": "Traumatic Brain Injury",
"categories.11.subcategories.0": "Job Training",
"categories.11.subcategories.1": "Treatment",
"categories.11.subcategories.2": "Case Management",
"categories.11.subcategories.3": "Caregiving",
"categories.11.subcategories.4": "Supported Housing",
"suggestions.0": "I need a place to stay tonight.",
"suggestions.1": "I need help finding housing.",
"suggestions.2": "I need help affording my apartment/home.",
"suggestions.3": "I need to find a job.",
"suggestions.4": "I need help paying my utility (gas/electric/heating fuel/water) bill.",
"suggestions.5": "I need to know what kind of government help I am eligible for.",
"suggestions.6": "I need food.",
"suggestions.7": "I need health insurance for myself or my family.",
"suggestions.8": "I don't have enough money to pay all my bills.",
"suggestions.9": "I need treatment for a drug or alcohol addiction.",
"suggestions.10": "I need help preparing my taxes.",
"suggestions.11": "I need to find a counselor to talk to.",
"suggestions.12": "I'm a veteran and need help.",
"suggestions.13": "I need transportation.",
"suggestions.14": "I'm feeling depressed and need some help."
"meta_title": "Search | 988 Maryland",
"meta_description": "Mental Health and Substance Use resources for communities across Maryland State.",
"categories.0": "Emergency Mental Health Services",
"categories.0.subcategories.0": "Crisis Intervention",
"categories.0.subcategories.1": "Hospital Inpatient",
"categories.1": "Clinical Service Providers",
"categories.1.subcategories.0": "Case Management",
"categories.1.subcategories.1": "Mobile Treatment / Assertive Community Treatment",
"categories.1.subcategories.2": "Outpatient",
"categories.1.subcategories.3": "Partial Hospitalization / Day Treatment",
"categories.1.subcategories.4": "Psychiatric Rehabilitation / Day Programs",
"categories.1.subcategories.5": "Supported Employment",
"categories.2": "Special Programs",
"categories.2.subcategories.0": "Dual Diagnoses",
"categories.2.subcategories.1": "Early Childhood Mental Health Services",
"categories.2.subcategories.2": "Gambling Disorder Help",
"categories.2.subcategories.3": "LGBTQ+",
"categories.2.subcategories.4": "Mental Health Housing Resoures",
"categories.2.subcategories.5": "Older Adults",
"categories.2.subcategories.6": "Suicide Prevention",
"categories.2.subcategories.7": "Transition Age Youth (Age 18 to 25)",
"categories.2.subcategories.8": "Veterans",
"categories.3": "Other",
"categories.3.subcategories.0": "Helplines",
"categories.3.subcategories.1": "Information and Referral",
"categories.3.subcategories.2": "Self-Help Support Groups",
"categories.3.subcategories.3": "Services for Families & Significant Others",
"categories.3.subcategories.4": "Wellness & Recovery Centers",
"categories.4": "Substance Use Services",
"categories.4.subcategories.0": "Crisis Walk-in Centers",
"categories.4.subcategories.1": "Helplines for Substance Use",
"categories.4.subcategories.2": "Information and Referral",
"categories.4.subcategories.3": "Opiod Treatment Programs",
"categories.4.subcategories.4": "Recovery Residences",
"categories.4.subcategories.5": "Residential",
"categories.4.subcategories.6": "Self-Help Support Groups",
"categories.4.subcategories.7": "Services for Families & Significant Others",
"categories.4.subcategories.8": "Telemedicine",
"categories.4.subcategories.9": "Withdrawal Management / Detox",
"categories.4.subcategories.10": "Outpatient",
"categories.5": "Substance Use Special Programs",
"categories.5.subcategories.0": "Buprenorphine",
"categories.5.subcategories.1": "Dual Diagnosis",
"categories.5.subcategories.2": "Gambling Disorder Help",
"categories.5.subcategories.3": "HIV/AIDS",
"categories.5.subcategories.4": "LGBTQ+",
"categories.5.subcategories.5": "Naltrexone",
"categories.5.subcategories.6": "Suicide Prevention",
"categories.5.subcategories.7": "Tobacco Cessation",
"categories.5.subcategories.8": "Veterans",
"suggestions.0": "I don't have anyone to talk to.",
"suggestions.1": "I need help finding counseling.",
"suggestions.2": "I need help finding drug/alcohol treatment.",
"suggestions.3": "I'm concerned about my loved one's substance use.",
"suggestions.4": "I'm concerned about my safety in my relationship.",
"suggestions.5": "My child is struggling with behavioral issues."
}
8 changes: 4 additions & 4 deletions packages/client/public/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
"sms_send_failed_title": "Envío de SMS fallido",
"sms_send_failed_body": "Su mensaje no se pudo enviar."
},
"prompt_auth": "Inicia sesión para utilizar esta función.",
"update_location": {
"prompt_start_location": "¿Cuál es tu punto de partida?"
}
"prompt_auth": "Inicia sesión para utilizar esta función."
},
"update_location": {
"prompt_start_location": "¿Cuál es tu punto de partida?"
},
"data_providers": {
"provided_by": "Datos proporcionados por"
Expand Down
8 changes: 4 additions & 4 deletions packages/client/public/locales/ne/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
"sms_send_failed_title": "SMS पठाउन सकिएन",
"sms_send_failed_body": "तपाईंको सन्देश पठाउन असफल भयो।"
},
"prompt_auth": "कृपया यो सुविधा प्रयोग गर्न लगइन गर्नुहोस्।",
"update_location": {
"prompt_start_location": "तपाईंको प्रारम्भिक स्थान के हो?"
}
"prompt_auth": "कृपया यो सुविधा प्रयोग गर्न लगइन गर्नुहोस्।"
},
"update_location": {
"prompt_start_location": "तपाईंको प्रारम्भिक स्थान के हो?"
},
"data_providers": {
"provided_by": "द्वारा प्रदान गरिएको डाटा"
Expand Down
8 changes: 4 additions & 4 deletions packages/client/public/locales/so/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
"sms_send_failed_title": "Diritaanka SMS waa guul daraystay",
"sms_send_failed_body": "Fariintaadu waa ku guul daraystay in ay dirto"
},
"prompt_auth": "Fadlan gal si aad u isticmaasho sifadan",
"update_location": {
"prompt_start_location": "Waa maxay goobtaadu?"
}
"prompt_auth": "Fadlan gal si aad u isticmaasho sifadan"
},
"update_location": {
"prompt_start_location": "Waa maxay goobtaadu?"
},
"data_providers": {
"provided_by": "Xogta ay bixiyeen"
Expand Down
8 changes: 4 additions & 4 deletions packages/client/public/locales/vi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
"sms_send_failed_title": "Gửi tin nhắn SMS không thành công",
"sms_send_failed_body": "Tin nhắn của bạn không gửi được."
},
"prompt_auth": "Vui lòng đăng nhập để sử dụng tính năng này.",
"update_location": {
"prompt_start_location": "Vị trí xuất phát của bạn là gì?"
}
"prompt_auth": "Vui lòng đăng nhập để sử dụng tính năng này."
},
"update_location": {
"prompt_start_location": "Vị trí xuất phát của bạn là gì?"
},
"data_providers": {
"provided_by": "Dữ liệu được cung cấp bởi"
Expand Down

0 comments on commit c0601ae

Please sign in to comment.