From 951ef15d3406d9f93fb3bc2419f8adefa758d8ca Mon Sep 17 00:00:00 2001 From: biratdatta Date: Thu, 13 Jun 2024 22:57:26 +0530 Subject: [PATCH 01/12] added husky --- .husky/pre-commit | 4 ++++ .prettierrc.json | 8 ++++++++ package.json | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .husky/pre-commit create mode 100644 .prettierrc.json diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..25d2235 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..4ec54b0 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": true, + "bracketSpacing": true +} + diff --git a/package.json b/package.json index c6b19dd..5d7d65b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "lint": "next lint", "analyze": "cross-env ANALYZE=true next build", "analyze:server": "cross-env BUNDLE_ANALYZE=server next build", - "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build" + "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build", + "prepare": "husky" }, "dependencies": { "@emotion/react": "^11.11.4", @@ -72,9 +73,17 @@ "dotenv-cli": "^7.2.1", "eslint": "8.18.0", "eslint-config-next": "12.1.6", - "prettier": "^2.5.1", + "husky": "^9.0.11", + "lint-staged": "^15.2.7", + "prettier": "^2.8.8", "typescript": "4.7.4", "webpack": "^5.69.1", "webpack-dev-server": "^4.9.0" - } + + }, + "lint-staged": { + + "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write" +} + } From 4b52b41a8bedfeb3209ceac7cdb2cb988affc3ed Mon Sep 17 00:00:00 2001 From: biratdatta Date: Thu, 13 Jun 2024 22:58:38 +0530 Subject: [PATCH 02/12] added husky --- src/pages/faq.tsx | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/pages/faq.tsx b/src/pages/faq.tsx index bf778ec..218f118 100644 --- a/src/pages/faq.tsx +++ b/src/pages/faq.tsx @@ -1,23 +1,22 @@ -import React from 'react'; -import type { NextPage } from 'next'; -import Head from 'next/head'; -import { useConfig } from "../hooks/useConfig"; -import { useLocalization } from '../hooks'; -import FAQPage from '../pageComponents/faq-page'; +import React from 'react' +import type { NextPage } from 'next' +import Head from 'next/head' +import { useConfig } from '../hooks/useConfig' +import { useLocalization } from '../hooks' +import FAQPage from '../pageComponents/faq-page' const Faq: NextPage = () => { - const t=useLocalization(); - const config = useConfig("component", "botDetails"); - return ( - - - {t("label.tab_title")} - - - - - - ); -}; + const t = useLocalization() + const config = useConfig('component', 'botDetails') + return ( + + + {t('label.tab_title')} + + + + + ) +} -export default Faq; +export default Faq From 05023db790764e1a5a333bbdaa5af951ea1d957e Mon Sep 17 00:00:00 2001 From: biratdatta Date: Thu, 13 Jun 2024 23:07:01 +0530 Subject: [PATCH 03/12] added lint --- .eslintrc.json | 3 +++ .husky/pre-commit | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.husky/pre-commit b/.husky/pre-commit index 25d2235..a009fd9 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ #!/usr/bin/env sh . "$(dirname "$0")/_/husky.sh" -npx lint-staged \ No newline at end of file +npx lint-staged +npm run lint \ No newline at end of file From ef1473973650d42dfec990131a62ed59a174b71a Mon Sep 17 00:00:00 2001 From: biratdatta Date: Thu, 13 Jun 2024 23:17:44 +0530 Subject: [PATCH 04/12] changed prettier.json --- .husky/pre-commit | 1 - .prettierrc.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index a009fd9..a16d8b1 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,3 @@ . "$(dirname "$0")/_/husky.sh" npx lint-staged -npm run lint \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index 4ec54b0..dcba7b5 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,7 @@ { "trailingComma": "es5", "tabWidth": 4, - "semi": false, + "semi": true, "singleQuote": true, "bracketSpacing": true } From 8302df2e243857c17d78f8da8ed5d981e30b3eba Mon Sep 17 00:00:00 2001 From: biratdatta Date: Thu, 13 Jun 2024 23:18:38 +0530 Subject: [PATCH 05/12] minor changes --- src/pages/faq.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pages/faq.tsx b/src/pages/faq.tsx index 218f118..0fd0430 100644 --- a/src/pages/faq.tsx +++ b/src/pages/faq.tsx @@ -1,13 +1,13 @@ -import React from 'react' -import type { NextPage } from 'next' -import Head from 'next/head' -import { useConfig } from '../hooks/useConfig' -import { useLocalization } from '../hooks' -import FAQPage from '../pageComponents/faq-page' +import React from 'react'; +import type { NextPage } from 'next'; +import Head from 'next/head'; +import { useConfig } from '../hooks/useConfig'; +import { useLocalization } from '../hooks'; +import FAQPage from '../pageComponents/faq-page'; const Faq: NextPage = () => { - const t = useLocalization() - const config = useConfig('component', 'botDetails') + const t = useLocalization(); + const config = useConfig('component', 'botDetails'); return ( @@ -16,7 +16,7 @@ const Faq: NextPage = () => { - ) -} + ); +}; -export default Faq +export default Faq; From 9bbe7d83c1a6711f658984aae9dc91ef49caa117 Mon Sep 17 00:00:00 2001 From: biratdatta Date: Tue, 18 Jun 2024 15:56:57 +0530 Subject: [PATCH 06/12] fix: linting issues --- .../message-item/assets/speaker.tsx | 37 +- .../message-item/assets/speakerPause.tsx | 100 +- src/components/message-item/index.tsx | 2386 +++++++++-------- src/components/navbar/index.tsx | 430 +-- src/components/option-selector/index.tsx | 432 +-- src/components/user-type-selector/index.tsx | 394 +-- 6 files changed, 2089 insertions(+), 1690 deletions(-) diff --git a/src/components/message-item/assets/speaker.tsx b/src/components/message-item/assets/speaker.tsx index 9d76cb4..12b21a5 100644 --- a/src/components/message-item/assets/speaker.tsx +++ b/src/components/message-item/assets/speaker.tsx @@ -1,24 +1,25 @@ import React from 'react'; const SpeakerIcon = (props: any) => ( - - - - - - - - - - + + + + + + + + + + ); export default SpeakerIcon; diff --git a/src/components/message-item/assets/speakerPause.tsx b/src/components/message-item/assets/speakerPause.tsx index b0d16d0..612f0fe 100644 --- a/src/components/message-item/assets/speakerPause.tsx +++ b/src/components/message-item/assets/speakerPause.tsx @@ -1,57 +1,59 @@ import React from 'react'; const SpeakerPauseIcon = (props: any) => ( - - - - - - - + - - - - - - - - - + + + + + + + + + + + + + ); export default SpeakerPauseIcon; diff --git a/src/components/message-item/index.tsx b/src/components/message-item/index.tsx index 934ded9..4a752f4 100644 --- a/src/components/message-item/index.tsx +++ b/src/components/message-item/index.tsx @@ -1,22 +1,22 @@ import { - Bubble, - Image as Img, - ScrollView, - List, - ListItem, - FileCard, - Typing, - Popup, - RichText, + Bubble, + Image as Img, + ScrollView, + List, + ListItem, + FileCard, + Typing, + Popup, + RichText, } from '@samagra-x/chatui'; import { - FC, - ReactElement, - useCallback, - useContext, - useEffect, - useMemo, - useState, + FC, + ReactElement, + useCallback, + useContext, + useEffect, + useMemo, + useState, } from 'react'; import { toast } from 'react-hot-toast'; import styles from './index.module.css'; @@ -39,1085 +39,1381 @@ import Loader from '../loader'; import { MessageType, XMessage } from '@samagra-x/xmessage'; import { v4 as uuidv4 } from 'uuid'; import router from 'next/router'; - +import Image from 'next/image'; +import Button from '@material-ui/core/Button'; const MessageItem: FC = ({ message }) => { - const { content, type } = message; - const config = useConfig('component', 'chatUI'); - const context = useContext(AppContext); - const [reaction, setReaction] = useState(content?.data?.reaction?.type); - const [optionDisabled, setOptionDisabled] = useState( - content?.data?.optionClicked || false - ); - const [audioFetched, setAudioFetched] = useState(false); - const [ttsLoader, setTtsLoader] = useState(false); - const [popupActive, setPopupActive] = useState(true); - const [searchQuery, setSearchQuery] = useState(''); - const [filteredChoices, setFilteredChoices] = useState([]); - const t = useLocalization(); - const theme = useColorPalates(); - const secondaryColor = useMemo(() => { - return theme?.primary?.light; - }, [theme?.primary?.light]); + const { content, type } = message; + const config = useConfig('component', 'chatUI'); + const context = useContext(AppContext); + const [reaction, setReaction] = useState(content?.data?.reaction?.type); + const [optionDisabled, setOptionDisabled] = useState( + content?.data?.optionClicked || false + ); + const [audioFetched, setAudioFetched] = useState(false); + const [ttsLoader, setTtsLoader] = useState(false); + const [popupActive, setPopupActive] = useState(true); + const [searchQuery, setSearchQuery] = useState(''); + const [filteredChoices, setFilteredChoices] = useState([]); + const t = useLocalization(); + const theme = useColorPalates(); + const secondaryColor = useMemo(() => { + return theme?.primary?.light; + }, [theme?.primary?.light]); - const contrastText = useMemo(() => { - return theme?.primary?.contrastText; - }, [theme?.primary?.contrastText]); + const contrastText = useMemo(() => { + return theme?.primary?.contrastText; + }, [theme?.primary?.contrastText]); - // const getToastMessage = (t: any, reaction: number): string => { - // if (reaction === 1) return t('toast.reaction_like'); - // return t('toast.reaction_reset'); - // }; + // const getToastMessage = (t: any, reaction: number): string => { + // if (reaction === 1) return t('toast.reaction_like'); + // return t('toast.reaction_reset'); + // }; - const handleSearchChange = (e: any) => { - const query = e.target.value.toLowerCase(); - setSearchQuery(query); + const handleSearchChange = (e: any) => { + const query = e.target.value.toLowerCase(); + setSearchQuery(query); - if (query) { - const results = content?.data?.choices?.choices - .filter((item: any) => item.text.toLowerCase().includes(query)) - .slice(0, 3); - setFilteredChoices(results); - } else { - setFilteredChoices([]); - } - }; + if (query) { + const results = content?.data?.choices?.choices + .filter((item: any) => item.text.toLowerCase().includes(query)) + .slice(0, 3); + setFilteredChoices(results); + } else { + setFilteredChoices([]); + } + }; - const displayedChoices = searchQuery - ? filteredChoices - : content?.data?.choices?.choices?.slice( - 0, - content?.data?.choices?.isSearchable - ? content?.data?.choices?.choices?.length - : undefined - ); + const displayedChoices = searchQuery + ? filteredChoices + : content?.data?.choices?.choices?.slice( + 0, + content?.data?.choices?.isSearchable + ? content?.data?.choices?.choices?.length + : undefined + ); - useEffect(() => { - setReaction(content?.data?.reaction); - }, [content?.data?.reaction]); + useEffect(() => { + setReaction(content?.data?.reaction); + }, [content?.data?.reaction]); - const onLikeDislike = useCallback( - ({ value, msgId }: { value: 0 | 1 | -1; msgId: string }) => { - if (value === 1) { - context?.newSocket.sendMessage({ - payload: { - app: process.env.NEXT_PUBLIC_BOT_ID || '', - from: { - userID: localStorage.getItem('userID'), - }, - messageType: MessageType.FEEDBACK_POSITIVE, - messageId: { - replyId: msgId, - channelMessageId: sessionStorage.getItem('conversationId'), - }, - } as Partial, - }); - } else if (value === -1) { - context?.setCurrentQuery(msgId); - context?.setShowFeedbackPopup(true); - } - }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [t] - ); + const onLikeDislike = useCallback( + ({ value, msgId }: { value: 0 | 1 | -1; msgId: string }) => { + if (value === 1) { + context?.newSocket.sendMessage({ + payload: { + app: process.env.NEXT_PUBLIC_BOT_ID || '', + from: { + userID: localStorage.getItem('userID'), + }, + messageType: MessageType.FEEDBACK_POSITIVE, + messageId: { + replyId: msgId, + channelMessageId: + sessionStorage.getItem('conversationId'), + }, + } as Partial, + }); + } else if (value === -1) { + context?.setCurrentQuery(msgId); + context?.setShowFeedbackPopup(true); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [t] + ); - const feedbackHandler = useCallback( - ({ like, msgId }: { like: 0 | 1 | -1; msgId: string }) => { - console.log('vbnm:', { reaction, like }); - // Don't let user change reaction once given - if (reaction !== 0) return toast.error('Cannot give feedback again'); - if (reaction === 0) { - setReaction(like); - return onLikeDislike({ value: like, msgId }); - } - if (reaction === 1 && like === -1) { - console.log('vbnm triggered 1'); - setReaction(-1); - return onLikeDislike({ value: -1, msgId }); - } - if (reaction === -1 && like === 1) { - console.log('vbnm triggered 2'); - setReaction(1); - return onLikeDislike({ value: 1, msgId }); - } - }, - [onLikeDislike, reaction] - ); + const feedbackHandler = useCallback( + ({ like, msgId }: { like: 0 | 1 | -1; msgId: string }) => { + console.log('vbnm:', { reaction, like }); + // Don't let user change reaction once given + if (reaction !== 0) + return toast.error('Cannot give feedback again'); + if (reaction === 0) { + setReaction(like); + return onLikeDislike({ value: like, msgId }); + } + if (reaction === 1 && like === -1) { + console.log('vbnm triggered 1'); + setReaction(-1); + return onLikeDislike({ value: -1, msgId }); + } + if (reaction === -1 && like === 1) { + console.log('vbnm triggered 2'); + setReaction(1); + return onLikeDislike({ value: 1, msgId }); + } + }, + [onLikeDislike, reaction] + ); - const getLists = useCallback( - ({ choices, isWeather = false }: { choices: any; isWeather: Boolean }) => { - return ( - - {choices?.map((choice: any, index: string) => ( - // {_.map(choices ?? [], (choice, index) => ( - { - e.preventDefault(); - console.log('Option Disabled', optionDisabled); - if (optionDisabled) { - toast.error( - `${ - isWeather - ? t('message.wait_before_choosing') - : t('message.cannot_answer_again') - }` - ); - } else { - context?.sendMessage(choice?.key, choice?.text); - setOptionDisabled(true); - setTimeout( - () => - document - .getElementsByClassName('PullToRefresh')?.[0] - ?.scrollTo({ - top: 999999, - left: 0, - behavior: 'smooth', - }), - 500 - ); - if (isWeather) { - setTimeout(() => { - console.log('Enabling options again'); - setOptionDisabled(false); - }, 4001); - } - } - }}> -
-
{choice?.text}
-
- -
-
-
- ))} -
- ); - }, - [context, t, optionDisabled] - ); + const getLists = useCallback( + ({ + choices, + isWeather = false, + }: { + choices: any; + isWeather: Boolean; + }) => { + return ( + + {choices?.map((choice: any, index: string) => ( + // {_.map(choices ?? [], (choice, index) => ( + { + e.preventDefault(); + console.log('Option Disabled', optionDisabled); + if (optionDisabled) { + toast.error( + `${ + isWeather + ? t( + 'message.wait_before_choosing' + ) + : t( + 'message.cannot_answer_again' + ) + }` + ); + } else { + context?.sendMessage( + choice?.key, + choice?.text + ); + setOptionDisabled(true); + setTimeout( + () => + document + .getElementsByClassName( + 'PullToRefresh' + )?.[0] + ?.scrollTo({ + top: 999999, + left: 0, + behavior: 'smooth', + }), + 500 + ); + if (isWeather) { + setTimeout(() => { + console.log( + 'Enabling options again' + ); + setOptionDisabled(false); + }, 4001); + } + } + }} + > +
+
{choice?.text}
+
+ +
+
+
+ ))} +
+ ); + }, + [context, t, optionDisabled] + ); - // useEffect(() => { - // if (content?.data?.choices?.choices?.length > 0) { - // setPopupActive(true); - // } - // }, [content]); + // useEffect(() => { + // if (content?.data?.choices?.choices?.length > 0) { + // setPopupActive(true); + // } + // }, [content]); - console.log('here', content); + console.log('here', content); - const handleAudio = useCallback( - (url: any) => { - // console.log(url) - if (!url) { - if (audioFetched) toast.error('No audio'); - return; - } - context?.playAudio(url, content); - setTtsLoader(false); - saveTelemetryEvent('0.1', 'E015', 'userQuery', 'timesAudioUsed', { - botId: process.env.NEXT_PUBLIC_BOT_ID || '', - orgId: process.env.NEXT_PUBLIC_ORG_ID || '', - userId: localStorage.getItem('userID') || '', - phoneNumber: localStorage.getItem('phoneNumber') || '', - conversationId: sessionStorage.getItem('conversationId') || '', - messageId: content?.data?.replyId, - text: content?.text, - timesAudioUsed: 1, - }); - }, - [audioFetched, content, context?.playAudio] - ); + const handleAudio = useCallback( + (url: any) => { + // console.log(url) + if (!url) { + if (audioFetched) toast.error('No audio'); + return; + } + context?.playAudio(url, content); + setTtsLoader(false); + saveTelemetryEvent('0.1', 'E015', 'userQuery', 'timesAudioUsed', { + botId: process.env.NEXT_PUBLIC_BOT_ID || '', + orgId: process.env.NEXT_PUBLIC_ORG_ID || '', + userId: localStorage.getItem('userID') || '', + phoneNumber: localStorage.getItem('phoneNumber') || '', + conversationId: sessionStorage.getItem('conversationId') || '', + messageId: content?.data?.replyId, + text: content?.text, + timesAudioUsed: 1, + }); + }, + [audioFetched, content, context?.playAudio] + ); - const downloadAudio = useCallback(() => { - const fetchAudio = async (text: string) => { - const startTime = Date.now(); - try { - const response = await axios.post( - `${process.env.NEXT_PUBLIC_AI_TOOLS_API}/text-to-speech`, - { - text: text, - language: context?.locale, - messageId: content?.data?.replyId, - conversationId: sessionStorage.getItem('conversationId') || '', - }, - { - headers: { - botId: process.env.NEXT_PUBLIC_BOT_ID || '', - orgId: process.env.NEXT_PUBLIC_ORG_ID || '', - userId: localStorage.getItem('userID') || '', - }, - } - ); - setAudioFetched(true); - const endTime = Date.now(); - const latency = endTime - startTime; - await saveTelemetryEvent( - '0.1', - 'E045', - 'aiToolProxyToolLatency', - 't2sLatency', - { - botId: process.env.NEXT_PUBLIC_BOT_ID || '', - orgId: process.env.NEXT_PUBLIC_ORG_ID || '', - userId: localStorage.getItem('userID') || '', - phoneNumber: localStorage.getItem('phoneNumber') || '', - conversationId: sessionStorage.getItem('conversationId') || '', - text: text, - messageId: content?.data?.replyId, - timeTaken: latency, - createdAt: Math.floor(startTime / 1000), - audioUrl: response?.data?.url || 'No audio URL', - } - ); - // cacheAudio(response.data); - return response?.data?.url; - } catch (error: any) { - console.error('Error fetching audio:', error); - setAudioFetched(true); - const endTime = Date.now(); - const latency = endTime - startTime; - await saveTelemetryEvent( - '0.1', - 'E045', - 'aiToolProxyToolLatency', - 't2sLatency', - { - botId: process.env.NEXT_PUBLIC_BOT_ID || '', - orgId: process.env.NEXT_PUBLIC_ORG_ID || '', - userId: localStorage.getItem('userID') || '', - phoneNumber: localStorage.getItem('phoneNumber') || '', - conversationId: sessionStorage.getItem('conversationId') || '', - text: text, - msgId: content?.data?.replyId, - timeTaken: latency, - createdAt: Math.floor(startTime / 1000), - error: error?.message || 'Error fetching audio', - } - ); - return null; - } - }; + const downloadAudio = useCallback(() => { + const fetchAudio = async (text: string) => { + const startTime = Date.now(); + try { + const response = await axios.post( + `${process.env.NEXT_PUBLIC_AI_TOOLS_API}/text-to-speech`, + { + text: text, + language: context?.locale, + messageId: content?.data?.replyId, + conversationId: + sessionStorage.getItem('conversationId') || '', + }, + { + headers: { + botId: process.env.NEXT_PUBLIC_BOT_ID || '', + orgId: process.env.NEXT_PUBLIC_ORG_ID || '', + userId: localStorage.getItem('userID') || '', + }, + } + ); + setAudioFetched(true); + const endTime = Date.now(); + const latency = endTime - startTime; + await saveTelemetryEvent( + '0.1', + 'E045', + 'aiToolProxyToolLatency', + 't2sLatency', + { + botId: process.env.NEXT_PUBLIC_BOT_ID || '', + orgId: process.env.NEXT_PUBLIC_ORG_ID || '', + userId: localStorage.getItem('userID') || '', + phoneNumber: localStorage.getItem('phoneNumber') || '', + conversationId: + sessionStorage.getItem('conversationId') || '', + text: text, + messageId: content?.data?.replyId, + timeTaken: latency, + createdAt: Math.floor(startTime / 1000), + audioUrl: response?.data?.url || 'No audio URL', + } + ); + // cacheAudio(response.data); + return response?.data?.url; + } catch (error: any) { + console.error('Error fetching audio:', error); + setAudioFetched(true); + const endTime = Date.now(); + const latency = endTime - startTime; + await saveTelemetryEvent( + '0.1', + 'E045', + 'aiToolProxyToolLatency', + 't2sLatency', + { + botId: process.env.NEXT_PUBLIC_BOT_ID || '', + orgId: process.env.NEXT_PUBLIC_ORG_ID || '', + userId: localStorage.getItem('userID') || '', + phoneNumber: localStorage.getItem('phoneNumber') || '', + conversationId: + sessionStorage.getItem('conversationId') || '', + text: text, + msgId: content?.data?.replyId, + timeTaken: latency, + createdAt: Math.floor(startTime / 1000), + error: error?.message || 'Error fetching audio', + } + ); + return null; + } + }; - const fetchData = async () => { - if (!content?.data?.audio_url && content?.data?.position === 'left') { - const toastId = toast.loading(`${t('message.download_audio')}`); - setTimeout(() => { - toast.dismiss(toastId); - }, 1500); - const text = content?.data?.card?.content?.cells - ? content?.data?.card?.content?.cells - ?.map((cell: any) => { - const texts = []; - if (cell.header) texts.push(cell.header); - if (cell.footer) texts.push(cell.footer); - return texts.join(' '); - }) - .join(' ') - : content?.text; - const audioUrl = await fetchAudio(text ?? 'No text found'); + const fetchData = async () => { + if ( + !content?.data?.audio_url && + content?.data?.position === 'left' + ) { + const toastId = toast.loading(`${t('message.download_audio')}`); + setTimeout(() => { + toast.dismiss(toastId); + }, 1500); + const text = content?.data?.card?.content?.cells + ? content?.data?.card?.content?.cells + ?.map((cell: any) => { + const texts = []; + if (cell.header) texts.push(cell.header); + if (cell.footer) texts.push(cell.footer); + return texts.join(' '); + }) + .join(' ') + : content?.text; + const audioUrl = await fetchAudio(text ?? 'No text found'); - setTtsLoader(false); - if (audioUrl) { - content.data.audio_url = audioUrl; - handleAudio(audioUrl); - } else setTtsLoader(false); - } - }; + setTtsLoader(false); + if (audioUrl) { + content.data.audio_url = audioUrl; + handleAudio(audioUrl); + } else setTtsLoader(false); + } + }; - if (content?.data?.audio_url) { - handleAudio(content.data.audio_url); - } else { - setTtsLoader(true); - fetchData(); - } - }, [handleAudio, content?.data, content?.text, t]); + if (content?.data?.audio_url) { + handleAudio(content.data.audio_url); + } else { + setTtsLoader(true); + fetchData(); + } + }, [handleAudio, content?.data, content?.text, t]); - // Hide input box if there are buttons - useEffect(() => { - if (content?.data?.choices?.choices?.length > 0) { - context?.setShowInputBox(false); - } - }, [content?.data?.choices?.choices]); + // Hide input box if there are buttons + useEffect(() => { + if (content?.data?.choices?.choices?.length > 0) { + context?.setShowInputBox(false); + } + }, [content?.data?.choices?.choices]); - const parseWeatherJson = (data: any) => { - if (!data || data.length === 0) { - console.error('Data is undefined or empty.'); - return []; - } - const firstKey = Object.keys(data[0])[0] || 'datetime'; - const result = Object.keys(data[0]).reduce((acc: any, key) => { - if (key !== firstKey) { - acc.push({ - [firstKey]: key, - ...data.reduce((obj: any, item: any) => { - obj[item[firstKey]] = item[key]; - return obj; - }, {}), - }); - } - return acc; - }, []); - console.log({ result, data }); - return result; - }; + const parseWeatherJson = (data: any) => { + if (!data || data.length === 0) { + console.error('Data is undefined or empty.'); + return []; + } + const firstKey = Object.keys(data[0])[0] || 'datetime'; + const result = Object.keys(data[0]).reduce((acc: any, key) => { + if (key !== firstKey) { + acc.push({ + [firstKey]: key, + ...data.reduce((obj: any, item: any) => { + obj[item[firstKey]] = item[key]; + return obj; + }, {}), + }); + } + return acc; + }, []); + console.log({ result, data }); + return result; + }; - useEffect(() => { - console.log({ popupActive, msg: content?.text }); - }, [popupActive]); + useEffect(() => { + console.log({ popupActive, msg: content?.text }); + }, [popupActive, content?.text]); - switch (type) { - case 'loader': - return ; - case 'text': - return ( -
- - {content?.data?.card ? ( -
- {content?.data?.card?.banner &&
- {content?.data?.card?.banner?.logo && } -
{content?.data?.card?.banner?.title}
-
} + switch (type) { + case 'loader': + return ; + case 'text': + return (
-
{content?.data?.card?.header?.title}
-
{content?.data?.card?.header?.description}
-
-
- {content?.data?.card?.content?.cells?.map((cell: any) => { - return ( -
-
- -
-
- -
-
- ); - })} -
- {content?.data?.card?.footer && ( -
-
- -
-
- -
-
- )} -
- ) : ( - - {content?.text}{' '} - {content?.data?.position === 'right' - ? null - : !content?.data?.isEnd && } - {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( -
-

- messageId: {content?.data?.messageId} -

- conversationId: {content?.data?.conversationId} -
- )} -
- )} + position: 'relative', + maxWidth: '50vh', + fontFamily: 'NotoSans-Medium', + }} + > + + {content?.data?.card ? ( +
+ {content?.data?.card?.banner && ( +
+ {content?.data?.card?.banner?.logo && ( + + )} +
+ {content?.data?.card?.banner?.title} +
+
+ )} +
+
+ {content?.data?.card?.header?.title} +
+
+ { + content?.data?.card?.header + ?.description + } +
+
+
+ {content?.data?.card?.content?.cells?.map( + (cell: any, index: number) => { + return ( +
+
+ +
+
+ +
+
+ ); + } + )} +
+ {content?.data?.card?.footer && ( +
+
+ +
+
+ +
+
+ )} +
+ ) : ( + + {content?.text}{' '} + {content?.data?.position === 'right' + ? null + : !content?.data?.isEnd && ( + + )} + {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( +
+

+ + messageId:{' '} + {content?.data?.messageId} + +

+ + conversationId:{' '} + {content?.data?.conversationId} + +
+ )} +
+ )} - {/* {getLists({ + {/* {getLists({ choices: content?.data?.payload?.buttonChoices ?? content?.data?.choices, isWeather: false })} */} -
- - {moment(content?.data?.timestamp).format('hh:mma ')} - -
-
- {content?.data?.btns ? ( -
- -
- ) : ( - content?.data?.position === 'left' && ( -
- {config?.allowTextToSpeech && ( -
-
- {context?.clickedAudioUrl === content?.data?.audio_url ? ( - !context?.audioPlaying ? ( - - ) : ( - - ) - ) : ttsLoader ? ( - - ) : ( - - )} - -

- {t('message.speaker')} -

-
-
- )} - {config?.allowFeedback && - (!content?.data?.isGuided || content?.data?.card) && ( -
-
- feedbackHandler({ - like: 1, - msgId: content?.data?.messageId, - }) - }> - -

- {t('label.helpful')} -

+ display: 'flex', + justifyContent: 'flex-end', + }} + > + + {moment(content?.data?.timestamp).format( + 'hh:mma ' + )} + +
+ + {content?.data?.btns ? ( +
+
+ ) : ( + content?.data?.position === 'left' && ( +
+ {config?.allowTextToSpeech && ( +
+
+ {context?.clickedAudioUrl === + content?.data?.audio_url ? ( + !context?.audioPlaying ? ( + + ) : ( + + ) + ) : ttsLoader ? ( + + ) : ( + + )} + +

+ {t('message.speaker')} +

+
+
+ )} + {config?.allowFeedback && + (!content?.data?.isGuided || + content?.data?.card) && ( +
+
+
+ feedbackHandler({ + like: 1, + msgId: content?.data + ?.messageId, + }) + } + > + +

+ {t('label.helpful')} +

+
+
+ +
+ feedbackHandler({ + like: -1, + msgId: content?.data + ?.messageId, + }) + } + > + +

+ {t('label.not_helpful')} +

+
+
+
+ )} +
+ ) + )} + {content?.data?.choices?.choices?.length > 0 && ( + <> + { + setPopupActive(false); + }} + active={popupActive} + backdrop={false} + showClose={false} + bgColor="transparent" + title={content?.data?.choices?.header} + titleColor="var(--font)" + titleSize="16px" + > + {displayedChoices.map( + (item: any, index: number) => { + return ( +
{ + setPopupActive(false); + if (item?.showTextInput) { + context?.setShowInputBox( + true + ); + context?.sendMessage( + item?.key, + item?.text + ); + } else if ( + item?.action === 'home' + ) { + const newConversationId = + uuidv4(); + sessionStorage.setItem( + 'conversationId', + newConversationId + ); + sessionStorage.removeItem( + 'tags' + ); + context?.setShowInputBox( + true + ); + if ( + context?.audioElement + ) + context?.audioElement.pause(); + if ( + context?.setAudioPlaying + ) + context?.setAudioPlaying( + false + ); + context?.setConversationId( + newConversationId + ); + context?.setMessages( + [] + ); + context?.setIsMsgReceiving( + false + ); + context?.setLoading( + false + ); + router.push('/'); + } else { + context?.sendMessage( + item?.key, + item?.text + ); + } + }} + > + {item.text} +
+ ); + } + )} +
+ {content?.data?.choices?.isSearchable && + popupActive && ( +
+ +
+ )} + + )} + {content?.data?.choices?.choices?.length > 0 && (
+ style={{ + height: popupActive ? '250px' : '0px', + width: '100vw', + }} + >
+ )} +
+ ); + case 'image': { + const url = + content?.data?.payload?.media?.url || content?.data?.imageUrl; + return ( +
+ {content?.data?.position === 'left' && (
- feedbackHandler({ - like: -1, - msgId: content?.data?.messageId, - }) - }> - -

- {t('label.not_helpful')} -

+ width: '40px', + marginRight: '4px', + textAlign: 'center', + }} + >
+ )} + +
+ image +
+ + {moment(content?.data?.timestamp).format( + 'hh:mm A DD/MM/YYYY' + )} + +
-
-
- )} -
- ) - )} - {content?.data?.choices?.choices?.length > 0 && ( - <> - { - setPopupActive(false); - }} - active={popupActive} - backdrop={false} - showClose={false} - bgColor="transparent" - title={content?.data?.choices?.header} - titleColor="var(--font)" - titleSize="16px"> - {displayedChoices.map((item: any) => { - return ( -
{ - setPopupActive(false); - if (item?.showTextInput) { - context?.setShowInputBox(true); - context?.sendMessage(item?.key, item?.text); - }else if(item?.action === "home"){ - const newConversationId = uuidv4(); - sessionStorage.setItem('conversationId', newConversationId); - sessionStorage.removeItem('tags'); - context?.setShowInputBox(true); - if (context?.audioElement) context?.audioElement.pause(); - if (context?.setAudioPlaying) context?.setAudioPlaying(false); - context?.setConversationId(newConversationId); - context?.setMessages([]); - context?.setIsMsgReceiving(false); - context?.setLoading(false); - router.push('/'); - }else{ - context?.sendMessage(item?.key, item?.text); - } - }}> - {item.text} -
- ); - })} -
- {content?.data?.choices?.isSearchable && popupActive && ( -
- +
- )} - - )} - {content?.data?.choices?.choices?.length > 0 && ( -
- )} - - ); + ); + } - case 'image': { - const url = content?.data?.payload?.media?.url || content?.data?.imageUrl; - return ( -
- {content?.data?.position === 'left' && ( -
- )} - -
- image -
- - {moment(content?.data?.timestamp).format( - 'hh:mm A DD/MM/YYYY' - )} - -
-
-
-
- ); - } + case 'file': { + const url = + content?.data?.payload?.media?.url || content?.data?.fileUrl; + return ( +
+ {content?.data?.position === 'left' && ( +
+ )} + +
+ +
+ + {moment(content?.data?.timestamp).format( + 'hh:mm A DD/MM/YYYY' + )} + +
+
+
+
+ ); + } - case 'file': { - const url = content?.data?.payload?.media?.url || content?.data?.fileUrl; - return ( -
- {content?.data?.position === 'left' && ( -
- )} - -
- -
- - {moment(content?.data?.timestamp).format( - 'hh:mm A DD/MM/YYYY' - )} - -
-
-
-
- ); - } + case 'video': { + const url = + content?.data?.payload?.media?.url || content?.data?.videoUrl; + const videoId = url.split('=')[1]; + return ( +
+ +
+ +
+ + {moment(content?.data?.timestamp).format( + 'hh:mm A DD/MM/YYYY' + )} + +
+
+
+
+ ); + } + case 'options': { + return ( +
+ +
+ + {content?.data?.payload?.text} + {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( +
+

+ + messageId:{' '} + {content?.data?.messageId} + +

+ + conversationId:{' '} + {content?.data?.conversationId} + +
+ )} +
+
+ {getLists({ + choices: content?.data?.choices?.choices, + isWeather: false, + })} +
+
+ ); + } - case 'video': { - const url = content?.data?.payload?.media?.url || content?.data?.videoUrl; - const videoId = url.split('=')[1]; - return ( -
- -
- -
- - {moment(content?.data?.timestamp).format( - 'hh:mm A DD/MM/YYYY' - )} - -
-
-
-
- ); - } - case 'options': { - return ( -
- -
- - {content?.data?.payload?.text} - {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( -
-

- messageId: {content?.data?.messageId} -

- conversationId: {content?.data?.conversationId} -
- )} -
-
- {getLists({ - choices: content?.data?.choices?.choices, - isWeather: false, - })} -
-
- ); - } - - case 'table': { - console.log({ table: content }); - return ( -
- -
- { - - } - -
- - {`\n` + JSON.parse(content?.text)?.generalAdvice || - '' + `\n\n` + JSON.parse(content?.text)?.buttonDescription || - ''} - {/* {getLists({ + +
+ + {`\n` + JSON.parse(content?.text)?.generalAdvice || + '' + + `\n\n` + + JSON.parse(content?.text) + ?.buttonDescription || + ''} + {/* {getLists({ choices: JSON.parse(content?.text)?.buttons, isWeather: true, })} */} - {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( -
-

- messageId: {content?.data?.messageId} -

- conversationId: {content?.data?.conversationId} -
- )} -
- - {content?.data?.choices?.choices?.length > 0 && ( - <> - { - setPopupActive(false); - }} - active={popupActive} - backdrop={false} - showClose={false} - bgColor="transparent" - title={content?.data?.choices?.header} - titleColor="var(--font)" - titleSize="16px"> - {displayedChoices.map((item: any) => { - return ( -
{ - setPopupActive(false); - if (item?.showTextInput) { - context?.setShowInputBox(true); - context?.sendMessage(item?.key, item?.text); - }else if(item?.action === "home"){ - const newConversationId = uuidv4(); - sessionStorage.setItem('conversationId', newConversationId); - sessionStorage.removeItem('tags'); - context?.setShowInputBox(true); - if (context?.audioElement) context?.audioElement.pause(); - if (context?.setAudioPlaying) context?.setAudioPlaying(false); - context?.setConversationId(newConversationId); - context?.setMessages([]); - context?.setIsMsgReceiving(false); - context?.setLoading(false); - router.push('/'); - }else{ - context?.sendMessage(item?.key, item?.text); - } - }}> - {item.text} -
- ); - })} -
- {content?.data?.choices?.isSearchable && ( -
- + {process.env.NEXT_PUBLIC_DEBUG === 'true' && ( +
+

+ + messageId: {content?.data?.messageId} + +

+ + conversationId:{' '} + {content?.data?.conversationId} + +
+ )} + + + {content?.data?.choices?.choices?.length > 0 && ( + <> + { + setPopupActive(false); + }} + active={popupActive} + backdrop={false} + showClose={false} + bgColor="transparent" + title={content?.data?.choices?.header} + titleColor="var(--font)" + titleSize="16px" + > + {displayedChoices.map( + (item: any, index: number) => { + return ( +
{ + setPopupActive(false); + if (item?.showTextInput) { + context?.setShowInputBox( + true + ); + context?.sendMessage( + item?.key, + item?.text + ); + } else if ( + item?.action === 'home' + ) { + const newConversationId = + uuidv4(); + sessionStorage.setItem( + 'conversationId', + newConversationId + ); + sessionStorage.removeItem( + 'tags' + ); + context?.setShowInputBox( + true + ); + if ( + context?.audioElement + ) + context?.audioElement.pause(); + if ( + context?.setAudioPlaying + ) + context?.setAudioPlaying( + false + ); + context?.setConversationId( + newConversationId + ); + context?.setMessages( + [] + ); + context?.setIsMsgReceiving( + false + ); + context?.setLoading( + false + ); + router.push('/'); + } else { + context?.sendMessage( + item?.key, + item?.text + ); + } + }} + > + {item.text} +
+ ); + } + )} +
+ {content?.data?.choices?.isSearchable && ( +
+ +
+ )} + + )} + {content?.data?.choices?.choices?.length > 0 && ( +
+ )}
- )} - - )} - {content?.data?.choices?.choices?.length > 0 && ( -
- )} - - ); + ); + } + default: + return ( + ( + + - - - )} -
- -
-

- {localStorage.getItem('locale') === 'en' ? commodity?.name : commodity.translation} -

- - - ))} - - - - - - {t('label.skip_for_now')} - - - - - ); + {t('label.skip_for_now')} + + + + + ); }; -export default OptionSelector; \ No newline at end of file +export default OptionSelector; diff --git a/src/components/user-type-selector/index.tsx b/src/components/user-type-selector/index.tsx index d7d9465..93578b3 100644 --- a/src/components/user-type-selector/index.tsx +++ b/src/components/user-type-selector/index.tsx @@ -5,194 +5,228 @@ import { useLocalization } from '../../hooks'; import { Button, TextField } from '@mui/material'; import { useEffect, useState } from 'react'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; - +import Image from 'next/image'; const UserTypeSelector = (props: any) => { - const t = useLocalization(); - const theme = useColorPalates(); - const config = useConfig('component', 'userTypeSelectorPage'); - const [data, setData] = useState(null); + const t = useLocalization(); + const theme = useColorPalates(); + const config = useConfig('component', 'userTypeSelectorPage'); + const [data, setData] = useState(null); - return ( -
-
- -
-
-
-

- {t('label.who_are_you')} -

-
- {/* Two cards/buttons */} + color: '#333', + margin: 'auto', + backgroundColor: '#fff', + height: '100dvh', + position: 'relative', + overflow: 'hidden', + fontWeight: '500', + }} + >
{ - setData((prev: any) => ({ - ...prev, - userType: 'user1', - })); - }} - style={{ - backgroundColor: data?.userType === 'user1' ? theme?.primary?.main : '#F4F4F4', - boxShadow: '0 2px 4px rgba(0,0,0,0.1)', - borderRadius: '16px', - padding: '8px', - width: '40%', - height: '120px', - color: data?.userType === 'user1' ? theme?.primary?.contrastText : 'black', - // display: 'flex', - // flexDirection: 'column', - // justifyContent: 'center', - // alignItems: 'center', - textAlign: 'center', - }}> - user1 -

{t('label.user1')}

+ style={{ + position: 'absolute', + top: '16px', + left: 'calc(100% - 117px)', + zIndex: 10, + }} + > +
-

{t('label.or')}

{ - setData((prev: any) => ({ - ...prev, - userType: 'user2', - })); - }} - style={{ - backgroundColor: data?.userType === 'user2' ? theme?.primary?.main : '#F4F4F4', - boxShadow: '0 2px 4px rgba(0,0,0,0.1)', - borderRadius: '16px', - padding: '8px', - width: '40%', - height: '120px', - color: data?.userType === 'user2' ? theme?.primary?.contrastText : 'black', - // display: 'flex', - // flexDirection: 'column', - // justifyContent: 'center', - // alignItems: 'center', - textAlign: 'center', - }}> - user2 -

{t('label.user2')}

+ style={{ + position: 'absolute', + top: '45%', // Adjust this value to move the container up or down + width: '100%', + bottom: '0', + backgroundColor: '#fff', + borderTopLeftRadius: '30% 5%', // Adjust the curvature + borderTopRightRadius: '30% 5%', + overflow: 'hidden', // Ensures content aligns with the curved edges + }} + > +
+

+ {t('label.who_are_you')} +

+
+ {/* Two cards/buttons */} +
{ + setData((prev: any) => ({ + ...prev, + userType: 'user1', + })); + }} + style={{ + backgroundColor: + data?.userType === 'user1' + ? theme?.primary?.main + : '#F4F4F4', + boxShadow: '0 2px 4px rgba(0,0,0,0.1)', + borderRadius: '16px', + padding: '8px', + width: '40%', + height: '120px', + color: + data?.userType === 'user1' + ? theme?.primary?.contrastText + : 'black', + // display: 'flex', + // flexDirection: 'column', + // justifyContent: 'center', + // alignItems: 'center', + textAlign: 'center', + }} + > + user1 +

{t('label.user1')}

+
+

{t('label.or')}

+
{ + setData((prev: any) => ({ + ...prev, + userType: 'user2', + })); + }} + style={{ + backgroundColor: + data?.userType === 'user2' + ? theme?.primary?.main + : '#F4F4F4', + boxShadow: '0 2px 4px rgba(0,0,0,0.1)', + borderRadius: '16px', + padding: '8px', + width: '40%', + height: '120px', + color: + data?.userType === 'user2' + ? theme?.primary?.contrastText + : 'black', + // display: 'flex', + // flexDirection: 'column', + // justifyContent: 'center', + // alignItems: 'center', + textAlign: 'center', + }} + > + user2 +

{t('label.user2')}

+
+
+
+
+

+ {t('label.enter_your_name')} +

+
+ { + setData((prev: any) => ({ + ...prev, + name: e.target.value, + })); + }} + label={t('label.your_name')} + name={'name'} + autoComplete={'name'} + autoFocus + /> + +
+
+
+
+ bgImage
-
-
-
-

- {t('label.enter_your_name')} -

-
- { - setData((prev: any) => ({ - ...prev, - name: e.target.value, - })); - }} - label={t('label.your_name')} - name={'name'} - autoComplete={'name'} - autoFocus - /> - -
-
-
- bgImage -
-
- ); + ); }; export default UserTypeSelector; From 8c360853aef0bed70ffa9077c1ba53cc15b3fd5d Mon Sep 17 00:00:00 2001 From: biratdatta Date: Tue, 18 Jun 2024 16:01:02 +0530 Subject: [PATCH 07/12] feat: add minor changes --- .husky/commit-msg | 4 ++++ commitlint.config.js | 21 +++++++++++++++++++++ package.json | 14 +++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 .husky/commit-msg create mode 100644 commitlint.config.js diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..a789998 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit \ No newline at end of file diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..a30253d --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,21 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + [ + 'ci', + 'chore', + 'docs', + 'ticket', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + ], + ], + }, +}; diff --git a/package.json b/package.json index 5d7d65b..28976bd 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,11 @@ "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build", "prepare": "husky" }, + "husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + }, "dependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.0", @@ -63,6 +68,8 @@ "web-vitals": "^2.1.4" }, "devDependencies": { + "@commitlint/cli": "^19.3.0", + "@commitlint/config-conventional": "^19.2.2", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^12.20.55", "@types/react": "^18.0.10", @@ -79,11 +86,8 @@ "typescript": "4.7.4", "webpack": "^5.69.1", "webpack-dev-server": "^4.9.0" - }, "lint-staged": { - - "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write" -} - + "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write" + } } From b068bb59ee58db48f46a6fec0f4495871d744d5f Mon Sep 17 00:00:00 2001 From: biratdatta Date: Tue, 25 Jun 2024 00:00:31 +0530 Subject: [PATCH 08/12] feat: add build command --- package.json | 6 ------ src/components/message-item/index.tsx | 13 +++---------- src/components/navbar/index.tsx | 9 +++------ 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index b2f5336..28976bd 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,11 @@ "analyze:server": "cross-env BUNDLE_ANALYZE=server next build", "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build", "prepare": "husky" - }, "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } - }, "dependencies": { "@emotion/react": "^11.11.4", @@ -88,12 +86,8 @@ "typescript": "4.7.4", "webpack": "^5.69.1", "webpack-dev-server": "^4.9.0" - }, "lint-staged": { "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write" } - - - } diff --git a/src/components/message-item/index.tsx b/src/components/message-item/index.tsx index 2bc320d..6946852 100644 --- a/src/components/message-item/index.tsx +++ b/src/components/message-item/index.tsx @@ -436,8 +436,7 @@ const MessageItem: FC = ({ message }) => { }} > = ({ message }) => { }} > = ({ message }) => { padding: '10px', background: '#F4F4F4', }} - ><<<<<<< feat/newpipeline + > = ({ message }) => { return ( ( - - - )} /> ); diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index 7649446..d58e225 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -213,10 +213,7 @@ const Navbar: React.FC = () => { > {showCenterLogo && (
- Center Logo {
{showRightLogo1 && ( - {`Right )} {showRightLogo2 && ( - {`Right )} {showRightLogo3 && ( - {`Right Date: Wed, 26 Jun 2024 00:19:41 +0530 Subject: [PATCH 09/12] feat: add build command --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index a16d8b1..393de52 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname "$0")/_/husky.sh" -npx lint-staged +npx lint-staged && npm run build From 7290b76e535e788e184c50c4ccabe5b2448605fd Mon Sep 17 00:00:00 2001 From: Birat Datta <88641794+biratdatta@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:02:50 +0530 Subject: [PATCH 10/12] fix: update index.tsx --- src/components/navbar/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index 53b25ce..3633527 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -209,7 +209,7 @@ const Navbar: React.FC = () => { > {showCenterLogo && (
- Center Logo { )}
+ <
{showRightLogo1 && ( - {`Right )} {showRightLogo2 && ( - {`Right )} {showRightLogo3 && ( - {`Right Date: Wed, 26 Jun 2024 15:17:44 +0530 Subject: [PATCH 11/12] fix: minor index.tsx change --- src/components/navbar/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index 3633527..cf6be53 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -219,7 +219,7 @@ const Navbar: React.FC = () => { )}
- < +
{showRightLogo1 && ( Date: Wed, 26 Jun 2024 16:13:31 +0530 Subject: [PATCH 12/12] Update index.tsx --- src/components/navbar/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index cf6be53..e7ebc05 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -15,7 +15,7 @@ import { useLocalization } from '../../hooks'; import toast from 'react-hot-toast'; import { useColorPalates } from '../../providers/theme-provider/hooks'; import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'; -import Image from 'next/image'; + const Navbar: React.FC = () => { const router = useRouter(); const config = useConfig('component', 'navbar');