Skip to content

Commit

Permalink
Merge pull request #337 from suvarnakale/release-1.0.0
Browse files Browse the repository at this point in the history
Issue #0000 fix: prod bug fixes in session scheduling
  • Loading branch information
itsvick authored Oct 21, 2024
2 parents 956cc1f + 9cef211 commit 062ff9a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/components/PlannedSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,15 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
const value = event?.target?.value;
setLink(value);

const zoomLinkPattern =
/^https?:\/\/[\w-]*\.?zoom\.(com|us)\/(j|my)\/[\w-]+(\?[\w=&-]*)?$/;

const googleMeetLinkPattern =
/^(https?:\/\/)?(meet\.google\.com\/[a-zA-Z0-9-]+)$/;
/^https?:\/\/meet\.(google\.com|[a-zA-Z0-9-]+\.com)\/[a-z]{3,}-[a-z]{3,}-[a-z]{3}(\?[\w=&-]*)?$/;

let onlineProvider: string;
if (value.includes('zoom')) {
if (zoomLinkPattern.test(value)) {
setLinkError('');
onlineProvider = t('CENTER_SESSION.ZOOM');
} else if (googleMeetLinkPattern.test(value)) {
setLinkError('');
Expand Down Expand Up @@ -855,8 +859,8 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
(baseBody.isMeetingNew = false),
(baseBody.meetingDetails = {
url: block?.meetingLink || '',
password: block?.meetingPasscode || '7674534',
id: '123-456-789',
password: block?.meetingPasscode || '',
id: '',
});
}

Expand Down Expand Up @@ -1189,7 +1193,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
</Box>
)}
<SessionMode
mode={editSession ? mode ?? '' : block?.sessionMode ?? ''}
mode={editSession ? (mode ?? '') : (block?.sessionMode ?? '')}
handleSessionModeChange={(e) =>
handleSessionModeChange(e, block?.id)
}
Expand Down Expand Up @@ -1219,7 +1223,9 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
onChange={(event: any) =>
handleCourseTypeChange(block?.id, event)
}
value={selectedCourseType || ''}
value={
block?.courseType === undefined ? '' : selectedCourseType
}
disabled={!StateName || !medium || !grade || !board}
>
{courseTypes?.map((courseType: string) => (
Expand Down Expand Up @@ -1251,7 +1257,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
onChange={(event: any) =>
handleSubjectChange(block?.id, event)
}
value={selectedSubject || ''}
value={block?.subject ?? selectedSubject}
disabled={!(StateName && medium && grade && board)}
>
{subjects?.map((subject: string) => (
Expand All @@ -1272,7 +1278,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
id="outlined-basic"
label={t('CENTER_SESSION.SESSION_TITLE_OPTIONAL')}
variant="outlined"
value={block?.subjectTitle || shortDescription}
value={block?.subjectTitle ?? shortDescription}
onChange={(e) => {
handleSubjectTitleChange(e, block?.id);
}}
Expand All @@ -1287,7 +1293,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
<Box sx={{ mt: 2 }}>
<TextField
id="outlined-basic"
value={link}
value={block?.meetingLink ?? link}
label={t('CENTER_SESSION.MEETING_LINK')}
variant="outlined"
error={!!linkError}
Expand Down Expand Up @@ -1442,7 +1448,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
useAbbreviation={true}
selectedDays={
selectedDays?.length
? selectedDays
? editSession?.daysOfWeek
: block?.selectedWeekDays
}
onSelectionChange={(newSelectedDays) => {
Expand Down

0 comments on commit 062ff9a

Please sign in to comment.