Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add scheduling form to board settings #1430

Merged
merged 65 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
87470a0
feat: add basic date picker
GoncaloCanteiro Apr 11, 2023
ec814f0
fix: remove unused datePicker files
GoncaloCanteiro Apr 11, 2023
8457f8f
fix: change calendar style
GoncaloCanteiro Apr 11, 2023
b224c67
feat: create calendar primitive and with new style
GoncaloCanteiro Apr 12, 2023
5275ef1
fix: calendar margin top
GoncaloCanteiro Apr 12, 2023
27cd94d
fix: remove unused react-datepicker
GoncaloCanteiro Apr 12, 2023
42fcad6
feat: add props to calendar primitive
GoncaloCanteiro Apr 12, 2023
01a3422
fix: icon size
GoncaloCanteiro Apr 12, 2023
829f223
refactor: calendar to DatePicker
GoncaloCanteiro Apr 12, 2023
578058e
fix: current day outline
GoncaloCanteiro Apr 13, 2023
cbb93a7
feat: add UncontrolledInput and story
GoncaloCanteiro Apr 13, 2023
9de2d20
fix: calendar outline style
GoncaloCanteiro Apr 13, 2023
d59d117
feat: add calendar story
GoncaloCanteiro Apr 13, 2023
81a6bf5
fix: change calendar style name
GoncaloCanteiro Apr 13, 2023
aaf4c58
fix: calendar style import
GoncaloCanteiro Apr 13, 2023
8eb4448
test: add UncontrolledInput tests and change ids
GoncaloCanteiro Apr 13, 2023
8ca0087
fix: remove unused imports useState
GoncaloCanteiro Apr 13, 2023
43ac486
refactor: change searchInput in UsersSubHeader
GoncaloCanteiro Apr 13, 2023
a5c02b3
refactor: change searchInput in userListDialog
GoncaloCanteiro Apr 13, 2023
2f59827
refactor: change searchInput in teamsDialog
GoncaloCanteiro Apr 13, 2023
0d18967
fix: remove unused SearchInput
GoncaloCanteiro Apr 13, 2023
02a06b3
fix: uninstall unused react-datepicker
GoncaloCanteiro Apr 13, 2023
6743906
fix: id in test userListDialog
GoncaloCanteiro Apr 13, 2023
698cc44
feat: add datePicker story
GoncaloCanteiro Apr 13, 2023
f68f81b
feat: add rangeDate to datePicker and code null
GoncaloCanteiro Apr 14, 2023
f4cd9d8
test: add date picker test
GoncaloCanteiro Apr 14, 2023
ee9869f
fix: space between days
GoncaloCanteiro Apr 14, 2023
82234f3
Merge branch 'main' into feat/calendar-primitive
GoncaloCanteiro Apr 14, 2023
6c1b09a
fix: teamsDialog searchInput ID
GoncaloCanteiro Apr 14, 2023
e398f6c
fix: eslint imports order
GoncaloCanteiro Apr 14, 2023
847af65
Merge branch 'main' into feat/calendar-primitive
GoncaloCanteiro Apr 14, 2023
ae8dd9c
fix: iconName spacing
GoncaloCanteiro Apr 14, 2023
e84011c
feat: add scheduling component to board settings
GoncaloCanteiro Apr 18, 2023
ff5a1f5
fix: uncontrolledInput placeholder color
GoncaloCanteiro Apr 18, 2023
aea4f4d
fix: select time range
GoncaloCanteiro Apr 18, 2023
ac11b80
refactor: change repeat to component, rm undefined
GoncaloCanteiro Apr 19, 2023
627c2fe
feat: add underline color to Text link
GoncaloCanteiro Apr 19, 2023
74a1fa6
refactor: change reminder to new component
GoncaloCanteiro Apr 19, 2023
04c9811
feat: add boardCreation
GoncaloCanteiro Apr 20, 2023
2ed9168
feat: add radio group for repeat
GoncaloCanteiro Apr 20, 2023
ee03080
fix: calendar week days abbreviation, time labels
GoncaloCanteiro Apr 20, 2023
eea1ade
feat: add board creation and refactors
GoncaloCanteiro Apr 24, 2023
a3ba2d2
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 24, 2023
a8a9c91
refactor: change options constants folder
GoncaloCanteiro Apr 24, 2023
5157973
refactor: change options folder name
GoncaloCanteiro Apr 24, 2023
da26b94
fix: scroll height
GoncaloCanteiro Apr 24, 2023
2324250
feat: add round variant to checkbox and showIcon
GoncaloCanteiro Apr 24, 2023
1f6ee13
fix: eslint on useEffect disableChecboxes
GoncaloCanteiro Apr 24, 2023
c36abc6
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 24, 2023
34db50f
fix: import week days from constant
GoncaloCanteiro Apr 24, 2023
a03b8d6
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 26, 2023
316c700
fix: remove typescript optional for booleans
GoncaloCanteiro Apr 26, 2023
1108826
fix: handleReminderActive to set booleans to false
GoncaloCanteiro Apr 26, 2023
0570988
fix: days function, export, files types
GoncaloCanteiro Apr 26, 2023
14dd081
fix: reminder export
GoncaloCanteiro Apr 26, 2023
4a1dd7b
fix: schedulingSettings export
GoncaloCanteiro Apr 26, 2023
888b053
fix: repeat export
GoncaloCanteiro Apr 26, 2023
59e73d7
fix: reminderSchedule export
GoncaloCanteiro Apr 26, 2023
089cec1
fix: board creation export
GoncaloCanteiro Apr 26, 2023
91f2369
fix: move const to folder, change width
GoncaloCanteiro Apr 26, 2023
955e199
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 26, 2023
94db492
fix: value to lowercase
GoncaloCanteiro Apr 26, 2023
0793bb4
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 26, 2023
f7f5534
fix: change styles to css, remove px
GoncaloCanteiro Apr 26, 2023
43e7e99
Merge branch 'main' into feat/scheduling-form
GoncaloCanteiro Apr 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion frontend/src/components/Board/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { colors } from '@/components/Board/Column/partials/OptionsMenu';
import { ColumnSettings } from '@/components/Board/Settings/partials/Columns';
import { ColumnBoxAndDelete } from '@/components/Board/Settings/partials/Columns/ColumnBoxAndDelete';
import { ConfigurationSettings } from '@/components/Board/Settings/partials/ConfigurationSettings';
import { SchedulingSettings } from '@/components/Board/Settings/partials/Scheduling/Scheduling';
import { TeamResponsibleSettings } from '@/components/Board/Settings/partials/TeamResponsible';
import { ScrollableContent } from '@/components/Boards/MyBoards/ListBoardMembers/styles';
import Avatar from '@/components/Primitives/Avatars/Avatar/Avatar';
Expand All @@ -25,7 +26,7 @@ import useBoard from '@/hooks/useBoard';
import SchemaUpdateBoard from '@/schema/schemaUpdateBoardForm';
import { boardInfoState, deletedColumnsState } from '@/store/board/atoms/board.atom';
import { FlexForm } from '@/styles/pages/pages.styles';
import { UpdateBoardType } from '@/types/board/board';
import { UpdateBoardType, UpdateScheduleType } from '@/types/board/board';
import { BoardUserToAdd } from '@/types/board/board.user';
import ColumnType, { CreateColumn } from '@/types/column';
import { getInitials } from '@/utils/getInitials';
Expand Down Expand Up @@ -116,6 +117,16 @@ const BoardSettings = ({
postAnonymously: initialData.postAnonymously,
});

// State used to change values
const initialSchedulingData: UpdateScheduleType = {
GoncaloCanteiro marked this conversation as resolved.
Show resolved Hide resolved
reminderViaSlack: false,
reminderViaEmail: false,
reminderPrefillingCards: false,
};

//state used for scheduling
const [schedulingData, setSchedulingData] = useState<UpdateScheduleType>(initialSchedulingData);

// User Board Hook
const {
updateBoard: { mutate },
Expand Down Expand Up @@ -370,6 +381,12 @@ const BoardSettings = ({
)}
</ConfigurationSettings>

{!isSubBoard && hasPermissions && (
<SchedulingSettings
schedulingData={schedulingData}
setSchedulingData={setSchedulingData}
/>
)}
{isSubBoard && hasPermissions && (
<TeamResponsibleSettings>
<ConfigurationSwitch
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Dispatch, SetStateAction, useState } from 'react';

import { UpdateScheduleType } from '@/types/board/board';
import { SelectDateUnit } from '@components/Board/Settings/partials/Scheduling/SelectDateUnit';

export type SchedulingProps = {
schedulingData: UpdateScheduleType;
setSchedulingData: Dispatch<SetStateAction<UpdateScheduleType>>;
};

const BoardCreation = ({ schedulingData, setSchedulingData }: SchedulingProps) => {
const [isBoardCreationActive, setBoardCreation] = useState(false);

const handleCreationActiveChange = (isActive: boolean) => {
setBoardCreation(isActive);
if (!isActive) {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
timeBeforeMeeting: undefined,
creationTimeUnit: undefined,
}));
}
};

const handleTimeBeforeReunionChange = (timeBefore: string) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
timeBeforeMeeting: timeBefore,
}));
};
const handleCreationTimeUnitChange = (timeUnit: string) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
creationTimeUnit: timeUnit,
}));
};
return (
<SelectDateUnit
description="Create board days/weeks before retro"
isChecked={isBoardCreationActive}
setCheckboxState={handleCreationActiveChange}
setTimeRange={handleTimeBeforeReunionChange}
setUnitTime={handleCreationTimeUnitChange}
timeRange={schedulingData.timeBeforeMeeting}
timeUnit={schedulingData.creationTimeUnit}
title="Board creation"
/>
);
};

export { BoardCreation };
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { useState } from 'react';

import Flex from '@/components/Primitives/Layout/Flex/Flex';
import Text from '@/components/Primitives/Text/Text';
import { TIME_RANGE } from '@/constants/schedulingOptions/hours';
import { TimeSlot } from '@/types/board/board';
import DatePicker from '@components/Primitives/DatePicker/DatePicker';
import Icon from '@components/Primitives/Icons/Icon/Icon';
import {
Select,
SelectContent,
SelectIcon,
SelectTrigger,
SelectValue,
} from '@components/Primitives/Inputs/Select/Select';
import isEmpty from '@utils/isEmpty';

export type SchedulingProps = {
currentDate?: Date;
setDate: (date: Date) => void;
};

let customRange: TimeSlot[] = [];

const DateAndTimePicker = ({ currentDate, setDate }: SchedulingProps) => {
const [startTime, setStartTime] = useState('');
const [endTime, setEndTime] = useState('');

function handleStartTimeChange(event: string) {
setStartTime(event);
customRange = [];
handleCustomRange(event);
}

function handleEndTimeChange(event: string) {
setEndTime(event);
}

function handleCustomRange(startTime: string) {
TIME_RANGE.map((time) => {
if (Number(time.value) > Number(startTime)) customRange.push(time);
});
}

return (
<>
<Text fontWeight="medium">Date and time</Text>
<DatePicker currentDate={currentDate} setDate={setDate} />
<Flex css={{ flex: 1, paddingBottom: '24px' }} direction="row">
GoncaloCanteiro marked this conversation as resolved.
Show resolved Hide resolved
<Select
css={{ width: '50%', height: '$60', marginRight: '$16' }}
disabled={false}
onValueChange={handleStartTimeChange}
value={startTime}
>
<SelectTrigger css={{ padding: '$24' }}>
<Flex direction="column">
<Text color="primary300">From</Text>
<SelectValue />
</Flex>
<SelectIcon className="SelectIcon">
<Icon name="arrow-down" />
</SelectIcon>
</SelectTrigger>
<SelectContent options={TIME_RANGE} />
</Select>
<Select
css={{ width: '50%', height: '$60' }}
disabled={false}
onValueChange={handleEndTimeChange}
value={endTime}
>
<SelectTrigger css={{ padding: '$24' }}>
<Flex direction="column">
<Text color="primary300">To</Text>
<SelectValue />
</Flex>
<SelectIcon className="SelectIcon">
<Icon name="arrow-down" />
</SelectIcon>
</SelectTrigger>
<SelectContent options={isEmpty(customRange) ? TIME_RANGE : customRange} />
</Select>
</Flex>
</>
);
};

export { DateAndTimePicker };
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { Dispatch, SetStateAction, useState } from 'react';

import { UpdateScheduleType } from '@/types/board/board';
import { SelectDateUnit } from '@components/Board/Settings/partials/Scheduling/SelectDateUnit';
import Checkbox from '@components/Primitives/Inputs/Checkboxes/Checkbox/Checkbox';
import Flex from '@components/Primitives/Layout/Flex/Flex';

export type SchedulingProps = {
schedulingData: UpdateScheduleType;
setSchedulingData: Dispatch<SetStateAction<UpdateScheduleType>>;
};

const ReminderSchedule = ({ schedulingData, setSchedulingData }: SchedulingProps) => {
const [isReminderActive, setReminderState] = useState<boolean>(false);

const handleReminderActiveChange = (isActive: boolean) => {
setReminderState(isActive);
if (!isActive) {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderTimeRange: undefined,
reminderTimeUnit: undefined,
reminderViaEmail: false,
reminderPrefillingCards: false,
reminderViaSlack: false,
}));
}
};

const handleReminderTimeRangeChange = (timeRange: string) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderTimeRange: timeRange,
}));
};

const handleReminderTimeUnitChange = (timeUnit: string) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderTimeUnit: timeUnit,
}));
};

const handleSlackChange = (viaSlackActive: boolean) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderViaSlack: viaSlackActive,
}));
};
const handleEmailChange = (viaEmailActive: boolean) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderViaEmail: viaEmailActive,
}));
};

const handlePrefillingCardChange = (prefillingCards: boolean) => {
setSchedulingData((prev: UpdateScheduleType) => ({
...prev,
reminderPrefillingCards: prefillingCards,
}));
};
return (
<Flex direction="column" gap={16}>
<SelectDateUnit
description="Send reminder minutes/days/weeks before"
isChecked={isReminderActive}
setCheckboxState={handleReminderActiveChange}
setTimeRange={handleReminderTimeRangeChange}
setUnitTime={handleReminderTimeUnitChange}
timeRange={schedulingData.reminderTimeRange}
timeUnit={schedulingData.reminderTimeUnit}
title="Reminder"
/>
<Flex direction="column" style={{ marginLeft: '35px' }}>
GoncaloCanteiro marked this conversation as resolved.
Show resolved Hide resolved
<Checkbox
checked={schedulingData.reminderViaSlack}
disabled={!isReminderActive}
handleChange={handleSlackChange}
id="repeatCheckbox"
label="Via Slack"
size="md"
/>
<Checkbox
checked={schedulingData.reminderViaEmail}
disabled={!isReminderActive}
handleChange={handleEmailChange}
id="repeatCheckbox"
label="Via Email"
size="md"
/>
<Checkbox
checked={schedulingData.reminderPrefillingCards}
disabled={!isReminderActive}
handleChange={handlePrefillingCardChange}
id="repeatCheckbox"
label="Remind prefilling the cards"
size="md"
/>
</Flex>
</Flex>
);
};

export { ReminderSchedule };
GoncaloCanteiro marked this conversation as resolved.
Show resolved Hide resolved
Loading