Skip to content

Commit

Permalink
Add location data if available to invites, increase limits and make s…
Browse files Browse the repository at this point in the history
…electing dates easier on mobile
  • Loading branch information
developerfromjokela committed Oct 29, 2024
1 parent b977fa9 commit 77ac884
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
32 changes: 30 additions & 2 deletions client/src/components/availabilities/MeetingGridBodyCells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ const Cell = React.memo(function Cell({
if (rowIdx % 2 === 1) classNames.push('weeklyview__bodycell_oddrow');

const style: Style = {gridArea: `c${cellIdx}`};

let onTouchStart: React.TouchEventHandler | undefined;
let onTouchMove: React.TouchEventHandler | undefined;
let onTouchEnd: React.TouchEventHandler | undefined;


let showRespondentsColour = false;
if (selMode.type === 'addingRespondent' || selMode.type === 'editingRespondent') {
if (
Expand Down Expand Up @@ -400,10 +406,26 @@ const Cell = React.memo(function Cell({
|| selMode.type === 'editingSchedule'
) {
if (mouseStateType === 'upNoCellsSelected') {
onMouseDown = () => dispatch(notifyMouseDown({cell: {rowIdx, colIdx}, wasOriginallySelected: isSelected}));
onMouseDown = () => dispatch(notifyMouseDown({ cell: { rowIdx, colIdx }, wasOriginallySelected: isSelected }));
onTouchStart = (e) => {
e.preventDefault(); // Prevents triggering mouse events on touch
dispatch(notifyMouseDown({ cell: { rowIdx, colIdx }, wasOriginallySelected: isSelected }));
};
} else if (mouseStateType === 'down') {
onMouseEnter = () => dispatch(notifyMouseEnter({cell: {rowIdx, colIdx}}));
onMouseEnter = () => dispatch(notifyMouseEnter({ cell: { rowIdx, colIdx } }));
onTouchMove = (e) => {
e.preventDefault();
const touch = e.touches[0];
const targetElement = document.elementFromPoint(touch.clientX, touch.clientY);
if (targetElement) {
const targetRowIdx = Number(targetElement.getAttribute('data-row-idx'));
const targetColIdx = Number(targetElement.getAttribute('data-col-idx'));
dispatch(notifyMouseEnter({ cell: { rowIdx: targetRowIdx, colIdx: targetColIdx } }));
}
};
}
onTouchEnd = () => dispatch(notifyMouseUp());
onMouseLeave = () => dispatch(notifyMouseUp());
} else if (selMode.type === 'selectedUser') {
onMouseDown = () => showToast({
msg: `Klikkaa 'Muokkaa sopiva ajankohta' painiketta`,
Expand All @@ -425,9 +447,15 @@ const Cell = React.memo(function Cell({
<div
className={classNames.join(' ')}
style={style}
data-row-idx={rowIdx}
data-col-idx={colIdx}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onMouseDown={onMouseDown}

onTouchStart={onTouchStart}
onTouchMove={onTouchMove}
onTouchEnd={onTouchEnd}
>
{/* at most one of these will be shown */}
{scheduledTimeBox}
Expand Down
6 changes: 3 additions & 3 deletions server/src/meetings/create-meeting.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export default class CreateMeetingDto {
@ApiProperty({ example: 'Some meeting' })
@IsString()
@IsNotEmpty()
@MaxLength(64)
@MaxLength(128)
name: string;

@ApiProperty({ example: 'Some meeting description' })
@IsOptional()
@IsString()
@MaxLength(256)
@MaxLength(5000)
about?: string;

@ApiProperty({
Expand Down Expand Up @@ -66,7 +66,7 @@ export default class CreateMeetingDto {

@ApiProperty({ example: ['2022-10-23', '2022-10-24'] })
@ArrayNotEmpty()
@ArrayMaxSize(30)
@ArrayMaxSize(100)
@IsOnlyDateString({ each: true })
tentativeDates: string[];
}
2 changes: 0 additions & 2 deletions server/src/meetings/meeting.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export default class Meeting {
@Column({ nullable: true })
ScheduledEndDateTime?: string;

// This is used to avoid sending redundant email notifications when
// a meeting is rescheduled
@Column({ default: true })
AllowGuests: boolean;

Expand Down
6 changes: 6 additions & 0 deletions server/src/oauth2/google-oauth2-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ export default class ExternalGoogleOauth2Provider implements IOAuth2Provider {
};
if (meeting.About) {
params.description = meeting.About;

const regex = /(?<=[S|s]ijainti:).*(?=\n)/gm;
const regexResult = meeting.About.match(regex);
if (regexResult) {
params.location = regexResult[0];
}
}
let response: GoogleInsertEventResponse | undefined;
const body = JSON.stringify(params);
Expand Down

0 comments on commit 77ac884

Please sign in to comment.