From 6459a85ba646be329e0d27df849c52f7bbbe508c Mon Sep 17 00:00:00 2001 From: aakash2330 Date: Mon, 23 Sep 2024 20:30:14 +0530 Subject: [PATCH 1/5] ui-fixes --- src/components/RecentJobs.tsx | 2 ++ src/components/TestimonialCard.tsx | 4 ++-- src/components/Testimonials.tsx | 2 +- src/layouts/mobile-nav.tsx | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/RecentJobs.tsx b/src/components/RecentJobs.tsx index 73573269..827c039f 100644 --- a/src/components/RecentJobs.tsx +++ b/src/components/RecentJobs.tsx @@ -21,6 +21,8 @@ export default async function RecentJobs() { {job.companyLogo ? (
company-logo @@ -27,7 +27,7 @@ export default function TestimonialCard({ testimonial }: testimonialCardProps) { : '', }} > -
+

diff --git a/src/components/Testimonials.tsx b/src/components/Testimonials.tsx index 7d022498..8c0adc02 100644 --- a/src/components/Testimonials.tsx +++ b/src/components/Testimonials.tsx @@ -13,7 +13,7 @@ export default function Testimonials() { Real Success Stories from Job Seekers and Employers

-
+
{testimonials.map((testimonial, i) => ( ))} diff --git a/src/layouts/mobile-nav.tsx b/src/layouts/mobile-nav.tsx index a0d0d7b6..de226332 100644 --- a/src/layouts/mobile-nav.tsx +++ b/src/layouts/mobile-nav.tsx @@ -85,6 +85,8 @@ export function MobileNav() { ) : (
company-logo Date: Tue, 24 Sep 2024 01:22:06 +0530 Subject: [PATCH 2/5] reset gmaps input --- src/components/RecentJobs.tsx | 6 +- src/components/gmaps-autosuggest.tsx | 88 +++++++++++++++++----------- src/components/job-form.tsx | 10 +++- 3 files changed, 67 insertions(+), 37 deletions(-) diff --git a/src/components/RecentJobs.tsx b/src/components/RecentJobs.tsx index 827c039f..62e4c5db 100644 --- a/src/components/RecentJobs.tsx +++ b/src/components/RecentJobs.tsx @@ -3,6 +3,7 @@ import { calculateTimeSincePosted, getFirstLetterCaps } from './job-landing'; import Image from 'next/image'; import { formatSalary } from '@/lib/utils'; import { Briefcase, MapPin } from 'lucide-react'; +import Link from 'next/link'; export default async function RecentJobs() { const recentJobs = await getRecentJobs(); @@ -13,7 +14,8 @@ export default async function RecentJobs() { return (
{recentJobs.additional.recentJobs.map((job, i) => ( -
@@ -76,7 +78,7 @@ export default async function RecentJobs() { ) )}
-
+ ))}
); diff --git a/src/components/gmaps-autosuggest.tsx b/src/components/gmaps-autosuggest.tsx index d6e6b76e..0da347d5 100644 --- a/src/components/gmaps-autosuggest.tsx +++ b/src/components/gmaps-autosuggest.tsx @@ -1,43 +1,65 @@ import Script from 'next/script'; import { Input } from './ui/input'; import { clientEnv } from '@/env/client'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; export type TgmapsAddress = { city: string; fullAddress: string }; -export function GmapsAutocompleteAddress({ form }: { form: any }) { - let autocomplete: any = null; +export const GmapsAutocompleteAddress = forwardRef( + function GmapsAutocompleteAddress( + { + form, + }: { + form: any; + }, + ref + ) { + let autocomplete: any = null; + const inputRef = useRef(null); - function onPlaceChanged() { - const { name, formatted_address } = autocomplete.getPlace(); - form.setValue('city', name); - form.setValue('address', formatted_address); - } + function onPlaceChanged() { + const { name, formatted_address } = autocomplete.getPlace(); + form.setValue('city', name); + form.setValue('address', formatted_address); + } - function initializeGmaps() { - if ((window as any).google) { - autocomplete = new (window as any).google.maps.places.Autocomplete( - document.getElementById('autocomplete'), - { - types: ['(cities)'], - } - ); - autocomplete.addListener('place_changed', onPlaceChanged); + function initializeGmaps() { + if ((window as any).google) { + autocomplete = new (window as any).google.maps.places.Autocomplete( + document.getElementById('autocomplete'), + { + types: ['(cities)'], + } + ); + autocomplete.addListener('place_changed', onPlaceChanged); + } } - } - return ( - <> -