Skip to content

Commit

Permalink
COM-3849: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysseferreira committed Dec 4, 2024
1 parent 9d6d848 commit 2963eec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/components/form/MultipleCheckboxList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import {
} from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
import { GREY } from '../../../styles/colors';
import { DataOptionsType } from '../../../store/attendanceSheets/slice';
import styles from './styles';

type CheckboxOptionsType = { label: string, value: string };

interface MultipleCheckboxListProps {
optionsGroups: CheckboxOptionsType[][],
optionsGroups: DataOptionsType[][],
groupTitles: string[],
setOptions: (options: string[]) => void,
checkedList: string[],
}

interface RenderItemProps {
item: { label: string, value: string },
item: DataOptionsType,
checkedList: string[],
onPressCheckbox: (value: string) => void
}
Expand Down
7 changes: 3 additions & 4 deletions src/components/form/RadioButtonList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { TouchableOpacity, Text } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
import styles from './styles';
import { GREY } from '../../../styles/colors';

type RadioButtonOptionsType = { label: string, value: string };
import { DataOptionsType } from '../../../store/attendanceSheets/slice';

interface RadioButtonProps {
options: RadioButtonOptionsType[],
options: DataOptionsType[],
setOption: (option: string) => void,
checkedRadioButton: string
}

interface RenderItemProps {
item: { label: string, value: string },
item: DataOptionsType,
checkedRadioButton: string,
onPressCheckbox: (value: string) => void
}
Expand Down
4 changes: 2 additions & 2 deletions src/screens/courses/profile/AdminCourseProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const AdminCourseProfile = ({ route, navigation }: AdminCourseProfileProps) => {
const stepsById: object = useMemo(() => keyBy(course?.subProgram.steps, '_id'), [course]);

const groupedSlotsToBeSigned = useMemo(() => {
if (!isSingle || !course?.slots.length) return [];
if (!isSingle || !course?.slots.length) return {};
const signedSlots = (savedAttendanceSheets as SingleAttendanceSheetType[])
.map(as => get(as, 'slots', []).map(s => s._id))
.flat();
Expand All @@ -98,7 +98,7 @@ const AdminCourseProfile = ({ route, navigation }: AdminCourseProfileProps) => {
}, [course, isSingle, savedAttendanceSheets, stepsById]);

const missingAttendanceSheets = useMemo(() => {
if (!course?.slots.length) return [];
if (!course?.slots.length || !firstSlot) return [];

if ([INTRA, INTRA_HOLDING].includes(course?.type)) {
const intraOrIntraHoldingCourseSavedSheets = savedAttendanceSheets as IntraOrIntraHoldingAttendanceSheetType[];
Expand Down
2 changes: 1 addition & 1 deletion src/store/attendanceSheets/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useSetCourse = () => {
export const useSetMissingAttendanceSheets = () => {
const dispatch = useAppDispatch();

return useCallback((missingAttendanceSheets: DataOptionsType) =>
return useCallback((missingAttendanceSheets: DataOptionsType[]) =>
dispatch(setMissingAttendanceSheets(missingAttendanceSheets)), [dispatch]);
};

Expand Down
6 changes: 3 additions & 3 deletions src/store/attendanceSheets/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { resetAllReducers } from '../actions';
import { BlendedCourseType, SlotType } from '../../types/CourseTypes';

export type DataOptionsType = {value: string; label: string;}[]
export type DataOptionsType = { value: string; label: string }

export type AttendanceSheetStateType = {
course: BlendedCourseType | null,
missingAttendanceSheets: DataOptionsType,
missingAttendanceSheets: DataOptionsType[],
groupedSlotsToBeSigned: Record<string, SlotType[]>,
}
const initialState: AttendanceSheetStateType = {
Expand All @@ -22,7 +22,7 @@ const setBlendedCourse = (state: AttendanceSheetStateType, action: PayloadAction
);

const setMissingAttendanceSheetList =
(state: AttendanceSheetStateType, action: PayloadAction<DataOptionsType>) => (
(state: AttendanceSheetStateType, action: PayloadAction<DataOptionsType[]>) => (
{ ...state, missingAttendanceSheets: action.payload }
);

Expand Down

0 comments on commit 2963eec

Please sign in to comment.