diff --git a/apps/amakrushi/lang/en.json b/apps/amakrushi/lang/en.json index eb0840d..175fb12 100644 --- a/apps/amakrushi/lang/en.json +++ b/apps/amakrushi/lang/en.json @@ -1,89 +1,90 @@ { - "label.title":"Ama Krushi AI Chatbot", - "label.welcome":"Welcome", - "label.chats":"Chats", - "label.farmer":"Farmer", - "label.extension_worker":"Extension Worker", - "label.continue":"Continue", - "label.search":"Search", - "label.back":"Back", - "label.send":"Send", - "label.profile":"Profile", - "label.faqs":"FAQs", - "label.dial":"Dial", - "label.feedback":"Feedback", + "label.title": "Ama Krushi AI Chatbot", + "label.welcome": "Welcome", + "label.chats": "Chats", + "label.farmer": "Farmer", + "label.extension_worker": "Extension Worker", + "label.continue": "Continue", + "label.search": "Search", + "label.back": "Back", + "label.send": "Send", + "label.profile": "Profile", + "label.faqs": "FAQs", + "label.dial": "Dial", + "label.feedback": "Feedback", "label.share": "Share", "label.download": "Download", - "label.comment":"Comment", - "label.logout":"Logout", - "label.more":"More", - "label.submit":"Submit", - "label.submit_review":"Submit Review", - "label.submit_feedback":"Submit Feedback", - "label.mobile_number":"Mobile Number", - "label.ask_me":"Ask me anything about farming", - "label.click":"Reload", - "label.new_chat":"New chat", - "label.confirm_delete":"Are you sure you want to delete this conversation?", - "label.no_history":"No Chats", - "label.call_amakrushi":"Call Ama Krushi", - "label.no_internet":"No Internet", + "label.comment": "Comment", + "label.logout": "Logout", + "label.more": "More", + "label.submit": "Submit", + "label.submit_review": "Submit Review", + "label.submit_feedback": "Submit Feedback", + "label.mobile_number": "Mobile Number", + "label.ask_me": "Ask me anything about farming", + "label.click": "Reload", + "label.new_chat": "New chat", + "label.confirm_delete": "Are you sure you want to delete this conversation?", + "label.no_history": "No Chats", + "label.call_amakrushi": "Call Ama Krushi", + "label.no_internet": "No Internet", "label.helpful": "Helpful", "label.not_helpful": "Not Helpful", "label.refresh": "Refresh", - "label.type":"Type", - "label.speak":"Speak", + "label.type": "Type", + "label.speak": "Speak", "label.tap_to_speak": "Tap to speak", - "label.manual":"User Manual - For VAWs", + "label.manual": "User Manual - For VAWs", "table.header_date": "Date", - "table.header_temp_max":"Temp Max", + "table.header_temp_max": "Temp Max", "table.header_temp_min": "Temp Min", "table.header_temp": "Temp", "table.header_humidity": "Humidity", "table.header_precip": "Precip", - "table.header_precip_prob": "Precip Prob", + "table.header_precip_prob": "Precip Prob", "table.header_windspeed": "Windspeed", "table.header_cloudcover": "Cloudcover", "table.header_conditions": "Conditions", "message.speaker": "Click to hear", - "message.options":"To know the advisory for your crop, please click on the relevant button below:", - "message.no_signal":"No signal. \nPlease check your internet connection", + "message.options": "To know the advisory for your crop, please click on the relevant button below:", + "message.no_signal": "No signal. \nPlease check your internet connection", "message.click_to_type": "Click here to type", "message.downloading": "Downloading...", "message.download_audio": "Loading Audio", "message.no_link": "Something went wrong, please try later.", "message.sharing": "Sharing...", - "message.no_history":"Your Chat History with AI will come here", + "message.no_history": "Your Chat History with AI will come here", "message.socket_disconnect_msg": "to connect again.", - "message.enter_mobile":"Enter Mobile Number", - "message.register_message":"If you are already registered then use your mobile number to login.", - "message.not_register_yet":"Not registered yet ?", - "message.register_at_krushak":"Register at Krushak Odisha", - "message.otp_verification":" OTP Verification", - "message.ask_ur_question":"Ask Your Question", - "message.otp_message":"We will send you a one time password on this", - "message.invalid_mobile":"Enter a 10 digit number!", + "message.enter_mobile": "Enter Mobile Number", + "message.register_message": "If you are already registered then use your mobile number to login.", + "message.not_register_yet": "Not registered yet ?", + "message.register_at_krushak": "Register at Krushak Odisha", + "message.otp_verification": " OTP Verification", + "message.ask_ur_question": "Ask Your Question", + "message.otp_message": "We will send you a one time password on this", + "message.invalid_mobile": "Enter a 10 digit number!", "message.cannot_answer_again": "Cannot answer again", - "message.invalid_otp":"Invalid Otp", - "message.otp_not_sent":"Otp not sent", + "message.invalid_otp": "Invalid Otp", + "message.otp_not_sent": "Otp not sent", "message.otp_sent_again": "OTP sent again", "message.wait_resending_otp": "Please wait before resending OTP", + "message.wait_before_choosing": "Please wait before choosing again", "message.helpful": "Was this helpful?", - "message.retry":"Please retry.", - "message.down_time_title":"We're under maintenance", - "message.down_time_retry":"Try again", + "message.retry": "Please retry.", + "message.down_time_title": "We're under maintenance", + "message.down_time_retry": "Try again", "message.down_time_view_prev_chats": "View previous chats", - "message.taking_longer":"Please wait, servers are taking longer than usual.", + "message.taking_longer": "Please wait, servers are taking longer than usual.", "message.rating_submitted": "Rating Submitted!", "message.review_submitted": "Review Submitted!", "message.didnt_receive": "Didn't receive the OTP?", "message.resend_again": "Resend again", - "message.shareUrl_android_error" : "Share feature coming soon, please download pdf to share", - "message.coming_soon" : "Coming Soon!", - "message.coming_soon_description" : "We are going to launch this feature very soon. Stay tuned!", - "message.dial_description" : "To connect with call centre", - "message.rating" : "Did you find this useful?", - "message.rating_description" : "Tap a star to rate", + "message.shareUrl_android_error": "Share feature coming soon, please download pdf to share", + "message.coming_soon": "Coming Soon!", + "message.coming_soon_description": "We are going to launch this feature very soon. Stay tuned!", + "message.dial_description": "To connect with call centre", + "message.rating": "Did you find this useful?", + "message.rating_description": "Tap a star to rate", "message.review": "Write your review (optional)", "message.review_description": "Give positive/negative feedback for advisory", "message.comment_description": "Let us know your issue with the response", @@ -91,16 +92,16 @@ "message.temporarily_down_description": "We are experiencing high user volume at the moment, please try logging in after some time", "message.recorder_wait": "Please wait while we process your request...", "message.recorder_error": "Your question was not recognised. Pls try speaking more clearly.", - "message.dialer_popup":"You may speak to an Ama Krushi expert to get a satisfactory response", + "message.dialer_popup": "You may speak to an Ama Krushi expert to get a satisfactory response", "message.cannot_share": "Your system doesn't support sharing this file.", - "error.fail_to_submit":"Failed to submit rating.", + "error.fail_to_submit": "Failed to submit rating.", "error.fail_to_submit_review": "Failed to submit review.", - "error.sending_otp":"Error sending OTP", - "error.otp_not_sent":"OTP not sent", + "error.sending_otp": "Error sending OTP", + "error.otp_not_sent": "OTP not sent", "error.empty_msg": "Please type or select a message to send.", "error.wait_new_chat": "Please wait for reply.", "error.disconnected": "You are disconnected. Please refresh or login again.", - "toast.reaction_like":"Successfully liked the response", - "toast.reaction_dislike":"Successfully disliked the response", - "toast.reaction_reset":"Successfully removed the response" + "toast.reaction_like": "Successfully liked the response", + "toast.reaction_dislike": "Successfully disliked the response", + "toast.reaction_reset": "Successfully removed the response" } \ No newline at end of file diff --git a/apps/amakrushi/lang/or.json b/apps/amakrushi/lang/or.json index 836995c..df60c2d 100644 --- a/apps/amakrushi/lang/or.json +++ b/apps/amakrushi/lang/or.json @@ -68,6 +68,7 @@ "message.otp_not_sent":"ୱାନ୍ ଟାଇମ଼ ପାସୱାର୍ଡ ପଠାଯାଇ ନାହିଁ", "message.otp_sent_again": "OTP ପୁନର୍ବାର ପଠାଗଲା |", "message.wait_resending_otp": "OTP ପଠାଇବା ପୂର୍ବରୁ ଦୟାକରି ଅପେକ୍ଷା କରନ୍ତୁ |", + "message.wait_before_choosing": "ପୁନର୍ବାର ବାଛିବା ପୂର୍ବରୁ ଦୟାକରି ଅପେକ୍ଷା କରନ୍ତୁ |", "message.helpful": "ଏହା ସାହାଯ୍ୟକାରୀ ଥିଲା କି?", "message.retry":"ପୁନର୍ବାର ଚେଷ୍ଟା କରନ୍ତୁ", "message.down_time_title":"ଆମେ ରକ୍ଷଣାବେକ୍ଷଣ ଅଧୀନରେ ଅଛୁ", diff --git a/apps/amakrushi/src/components/chat-message-item/index.tsx b/apps/amakrushi/src/components/chat-message-item/index.tsx index f520ba9..9534317 100644 --- a/apps/amakrushi/src/components/chat-message-item/index.tsx +++ b/apps/amakrushi/src/components/chat-message-item/index.tsx @@ -133,7 +133,7 @@ const ChatMessageItem: FC = ({ message, onSend }) => { message?.content?.data?.optionClicked || false ); const getLists = useCallback( - ({ choices }: { choices: any }) => { + ({ choices, isWeather = false }: { choices: any, isWeather: Boolean }) => { console.log('qwer12:', { choices, optionDisabled }); return ( @@ -145,23 +145,27 @@ const ChatMessageItem: FC = ({ message, onSend }) => { style={ optionDisabled ? { - background: 'var(--lightgrey)', - color: 'var(--font)', - boxShadow: 'none', - } + background: 'var(--lightgrey)', + color: 'var(--font)', + boxShadow: 'none', + } : null } onClick={(e: any): void => { e.preventDefault(); if (optionDisabled) { - toast.error(`${t('message.cannot_answer_again')}`); + toast.error(`${isWeather ? t('message.wait_before_choosing') : t('message.cannot_answer_again')}`); } else { if (context?.messages?.[0]?.exampleOptions) { console.log('clearing chat'); context?.setMessages([]); } context?.sendMessage(choice); - // setOptionDisabled(true); + setOptionDisabled(true); + if (isWeather) + setTimeout(() => { + setOptionDisabled(false); + }, 7000) } }}>
= ({ message, onSend }) => { content?.data?.position === 'right' ? 'white' : optionDisabled - ? 'var(--font)' - : 'var(--secondarygreen)', + ? 'var(--font)' + : 'var(--secondarygreen)', }}>
{choice}
@@ -364,7 +368,7 @@ const ChatMessageItem: FC = ({ message, onSend }) => { }}> {getFormatedTime( content?.data?.sentTimestamp || - content?.data?.repliedTimestamp + content?.data?.repliedTimestamp )}
@@ -392,19 +396,19 @@ const ChatMessageItem: FC = ({ message, onSend }) => {
{}} + onClick={!ttsLoader ? downloadAudio : () => { }} style={ !content?.data?.isEnd ? { - pointerEvents: 'none', - filter: 'grayscale(100%)', - opacity: '0.5', - } + pointerEvents: 'none', + filter: 'grayscale(100%)', + opacity: '0.5', + } : { - pointerEvents: 'auto', - opacity: '1', - filter: 'grayscale(0%)', - } + pointerEvents: 'auto', + opacity: '1', + filter: 'grayscale(0%)', + } }> {context?.clickedAudioUrl === content?.data?.audio_url ? ( = ({ message, onSend }) => { {getFormatedTime( content?.data?.sentTimestamp || - content?.data?.repliedTimestamp + content?.data?.repliedTimestamp )}
@@ -558,7 +562,7 @@ const ChatMessageItem: FC = ({ message, onSend }) => { {getFormatedTime( content?.data?.sentTimestamp || - content?.data?.repliedTimestamp + content?.data?.repliedTimestamp )}
@@ -575,8 +579,8 @@ const ChatMessageItem: FC = ({ message, onSend }) => { <>
-
= ({ message, onSend }) => { {getFormatedTime( content?.data?.sentTimestamp || - content?.data?.repliedTimestamp + content?.data?.repliedTimestamp )}
@@ -612,6 +616,7 @@ const ChatMessageItem: FC = ({ message, onSend }) => { {getLists({ choices: content?.data?.payload?.buttonChoices ?? content?.data?.choices, + isWeather: true })} @@ -670,12 +675,12 @@ const ChatMessageItem: FC = ({ message, onSend }) => { {' '} {intl.locale == 'or' ? oriaWeatherTranslates[ - el?.conditions - ?.trim() - ?.split(' ') - ?.join('') - ?.toLowerCase() - ] + el?.conditions + ?.trim() + ?.split(' ') + ?.join('') + ?.toLowerCase() + ] : el.conditions}
@@ -697,6 +702,7 @@ const ChatMessageItem: FC = ({ message, onSend }) => { t('message.options')} {getLists({ choices: JSON.parse(content?.text)?.crops, + isWeather: true })}