Skip to content

Commit eddc2d0

Browse files
committed
refactor(table): add columnPicker functionality
1 parent effaeff commit eddc2d0

27 files changed

Lines changed: 1285 additions & 65 deletions

client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AssessmentsListing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { Card, CardContent, ListSubheader } from '@mui/material';
44

5-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
65
import TypeBadge from 'course/duplication/components/TypeBadge';
76
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
87
import { selectDuplicationStore } from 'course/duplication/selectors';
@@ -12,6 +11,7 @@ import {
1211
DuplicationTabData,
1312
} from 'course/duplication/types';
1413
import componentTranslations from 'course/translations';
14+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1515
import { useAppSelector } from 'lib/hooks/store';
1616
import useTranslation from 'lib/hooks/useTranslation';
1717

client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/MaterialsListing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { Card, CardContent, ListSubheader } from '@mui/material';
44

5-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
65
import TypeBadge from 'course/duplication/components/TypeBadge';
76
import { selectDuplicationStore } from 'course/duplication/selectors';
87
import {
98
DuplicationFolderData,
109
DuplicationMaterialData,
1110
} from 'course/duplication/types';
1211
import componentTranslations from 'course/translations';
12+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1313
import { useAppSelector } from 'lib/hooks/store';
1414
import useTranslation from 'lib/hooks/useTranslation';
1515

client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/VideosListing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { Card, CardContent, ListSubheader } from '@mui/material';
44

5-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
65
import TypeBadge from 'course/duplication/components/TypeBadge';
76
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
87
import { selectDuplicationStore } from 'course/duplication/selectors';
@@ -11,6 +10,7 @@ import {
1110
DuplicationVideoTabData,
1211
} from 'course/duplication/types';
1312
import componentTranslations from 'course/translations';
13+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1414
import { useAppSelector } from 'lib/hooks/store';
1515
import useTranslation from 'lib/hooks/useTranslation';
1616

client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AchievementsSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { ListSubheader, Typography } from '@mui/material';
44

5-
import BulkSelectors from 'course/duplication/components/BulkSelectors';
6-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
75
import TypeBadge from 'course/duplication/components/TypeBadge';
86
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
97
import { selectDuplicationStore } from 'course/duplication/selectors';
108
import { actions } from 'course/duplication/store';
119
import { DuplicationAchievementData } from 'course/duplication/types';
1210
import { getAchievementBadgeUrl } from 'course/helper/achievements';
1311
import componentTranslations from 'course/translations';
12+
import BulkSelectors from 'lib/components/core/BulkSelectors';
13+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1414
import Thumbnail from 'lib/components/core/Thumbnail';
1515
import { useAppDispatch, useAppSelector } from 'lib/hooks/store';
1616
import useTranslation from 'lib/hooks/useTranslation';

client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AssessmentsSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { ListSubheader, Typography } from '@mui/material';
44

5-
import BulkSelectors from 'course/duplication/components/BulkSelectors';
6-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
75
import TypeBadge from 'course/duplication/components/TypeBadge';
86
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
97
import {
@@ -17,6 +15,8 @@ import {
1715
DuplicationTabData,
1816
} from 'course/duplication/types';
1917
import componentTranslations from 'course/translations';
18+
import BulkSelectors from 'lib/components/core/BulkSelectors';
19+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
2020
import { useAppDispatch, useAppSelector } from 'lib/hooks/store';
2121
import useTranslation from 'lib/hooks/useTranslation';
2222

client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/MaterialsSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { ListSubheader, Typography } from '@mui/material';
44

5-
import BulkSelectors from 'course/duplication/components/BulkSelectors';
6-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
75
import TypeBadge from 'course/duplication/components/TypeBadge';
86
import { selectDuplicationStore } from 'course/duplication/selectors';
97
import { actions } from 'course/duplication/store';
@@ -12,6 +10,8 @@ import {
1210
DuplicationMaterialData,
1311
} from 'course/duplication/types';
1412
import componentTranslations from 'course/translations';
13+
import BulkSelectors from 'lib/components/core/BulkSelectors';
14+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1515
import { useAppDispatch, useAppSelector } from 'lib/hooks/store';
1616
import useTranslation from 'lib/hooks/useTranslation';
1717

client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/SurveysSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { ListSubheader, Typography } from '@mui/material';
44

5-
import BulkSelectors from 'course/duplication/components/BulkSelectors';
6-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
75
import TypeBadge from 'course/duplication/components/TypeBadge';
86
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
97
import { selectDuplicationStore } from 'course/duplication/selectors';
108
import { actions } from 'course/duplication/store';
119
import { DuplicationSurveyData } from 'course/duplication/types';
1210
import componentTranslations from 'course/translations';
11+
import BulkSelectors from 'lib/components/core/BulkSelectors';
12+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1313
import { useAppDispatch, useAppSelector } from 'lib/hooks/store';
1414
import useTranslation from 'lib/hooks/useTranslation';
1515

client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/VideosSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { FC } from 'react';
22
import { defineMessages } from 'react-intl';
33
import { ListSubheader, Typography } from '@mui/material';
44

5-
import BulkSelectors from 'course/duplication/components/BulkSelectors';
6-
import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox';
75
import TypeBadge from 'course/duplication/components/TypeBadge';
86
import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon';
97
import { selectDuplicationStore } from 'course/duplication/selectors';
@@ -13,6 +11,8 @@ import {
1311
DuplicationVideoTabData,
1412
} from 'course/duplication/types';
1513
import componentTranslations from 'course/translations';
14+
import BulkSelectors from 'lib/components/core/BulkSelectors';
15+
import IndentedCheckbox from 'lib/components/core/IndentedCheckbox';
1616
import { useAppDispatch, useAppSelector } from 'lib/hooks/store';
1717
import useTranslation from 'lib/hooks/useTranslation';
1818

client/app/bundles/course/duplication/components/BulkSelectors.jsx renamed to client/app/lib/components/core/BulkSelectors.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,53 @@
1+
import { CSSProperties, FC } from 'react';
12
import { defineMessages, FormattedMessage } from 'react-intl';
2-
import PropTypes from 'prop-types';
33

44
import Link from 'lib/components/core/Link';
55

66
const translations = defineMessages({
77
selectAll: {
8-
id: 'course.duplication.BulkSelectors.selectAll',
8+
id: 'lib.components.core.BulkSelectors.selectAll',
99
defaultMessage: 'Select All',
1010
},
1111
deselectAll: {
12-
id: 'course.duplication.BulkSelectors.deselectAll',
12+
id: 'lib.components.core.BulkSelectors.deselectAll',
1313
defaultMessage: 'Deselect All',
1414
},
1515
});
1616

17-
const styles = {
17+
const defaultStyles = {
1818
selectLink: {
1919
marginLeft: 20,
2020
lineHeight: '24px',
21-
},
21+
} as CSSProperties,
2222
deselectLink: {
2323
marginLeft: 10,
2424
lineHeight: '24px',
25-
},
25+
} as CSSProperties,
2626
};
2727

28-
const BulkSelectors = ({ callback, styles: userStyles = {} }) => (
28+
interface BulkSelectorsProps {
29+
callback: (value: boolean) => void;
30+
styles?: {
31+
selectLink?: CSSProperties;
32+
deselectLink?: CSSProperties;
33+
};
34+
}
35+
36+
const BulkSelectors: FC<BulkSelectorsProps> = ({ callback, styles = {} }) => (
2937
<>
3038
<Link
3139
onClick={() => callback(true)}
32-
style={{ ...styles.selectLink, ...userStyles.selectLink }}
40+
style={{ ...defaultStyles.selectLink, ...styles.selectLink }}
3341
>
3442
<FormattedMessage {...translations.selectAll} />
3543
</Link>
3644
<Link
3745
onClick={() => callback(false)}
38-
style={{ ...styles.deselectLink, ...userStyles.deselectLink }}
46+
style={{ ...defaultStyles.deselectLink, ...styles.deselectLink }}
3947
>
4048
<FormattedMessage {...translations.deselectAll} />
4149
</Link>
4250
</>
4351
);
4452

45-
BulkSelectors.propTypes = {
46-
callback: PropTypes.func,
47-
styles: PropTypes.object,
48-
};
49-
5053
export default BulkSelectors;

client/app/bundles/course/duplication/components/IndentedCheckbox.tsx renamed to client/app/lib/components/core/IndentedCheckbox.tsx

File renamed without changes.

0 commit comments

Comments
 (0)