From e9db7d3015cb93d542fe6fa8f544e01c0d5613f2 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 10 May 2024 12:39:05 +0530 Subject: [PATCH 1/2] Issue #PS-325 fix: resolve mediaQuery error when build app --- src/utils/Helper.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index e8f18287..e83fd11a 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -1,4 +1,3 @@ -import { useMediaQuery } from '@mui/material'; export const ATTENDANCE_ENUM = { PRESENT: 'present', @@ -58,8 +57,11 @@ export const getMonthName = () => { }; // Function to truncate URL if it's too long -export const truncateURL = (url: string, maxLength: number) => { - const isMobile = useMediaQuery('(max-width:600px)'); +export const truncateURL = ( + url: string, + maxLength: number, + isMobile: boolean +) => { if (isMobile) { return url.length > maxLength ? `${url.substring(0, maxLength)} ...` : url; } From 286f1ffb3498ea8e6fa9d6a6602c0cc3eafa2c47 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 10 May 2024 12:55:31 +0530 Subject: [PATCH 2/2] Issue #PS-325 fix: resolve mediaQuery error when build app --- src/components/ExtraSessionsCard.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ExtraSessionsCard.tsx b/src/components/ExtraSessionsCard.tsx index 2160f39f..51d2aa73 100644 --- a/src/components/ExtraSessionsCard.tsx +++ b/src/components/ExtraSessionsCard.tsx @@ -5,7 +5,7 @@ import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; import { useTranslation } from 'react-i18next'; import { truncateURL } from '@/utils/Helper'; import { ExtraSessionsCardProps } from '@/utils/Interfaces'; - +import { useMediaQuery } from '@mui/material'; const ExtraSessionsCard: React.FC = ({ subject, instructor, @@ -16,6 +16,8 @@ const ExtraSessionsCard: React.FC = ({ }) => { const { t } = useTranslation(); + const isMobile = useMediaQuery('(max-width:600px)'); + return ( = ({ display={'flex'} justifyContent={'space-between'} > - {truncateURL(meetingURL, 30)} + {truncateURL(meetingURL, 30, isMobile)} {onCopyClick && (