dce-reactkit 3.2.2-beta.31 → 3.2.2-beta.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.31",
3
+ "version": "3.2.2-beta.33",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -272,12 +272,14 @@ const IntelliTable: React.FC<Props> = (props) => {
272
272
  // Custom info based on current sort type
273
273
  let sortButtonAriaLabel;
274
274
  let sortIcon = faSort;
275
+ let sortingByThisColumn = false;
275
276
  if (!sortColumnParam) {
276
277
  // Not being sorted yet
277
278
  sortButtonAriaLabel = `sort ascending by ${column.title}`;
278
279
  sortIcon = faSort;
279
280
  } else if (column.param === sortColumnParam) {
280
281
  // Already sorted by this column
282
+ sortingByThisColumn = true;
281
283
  if (sortType === SortType.Ascending) {
282
284
  // Sorted ascending
283
285
  sortButtonAriaLabel = `sort descending by ${column.title}`;
@@ -299,6 +301,7 @@ const IntelliTable: React.FC<Props> = (props) => {
299
301
  key={column.param}
300
302
  scope="col"
301
303
  id={`IntelliTable-${id}-header-${column.param}`}
304
+ className="text-start"
302
305
  >
303
306
  <div className="d-flex align-items-center justify-content-center flex-row h-100">
304
307
  {/* Title */}
@@ -309,7 +312,8 @@ const IntelliTable: React.FC<Props> = (props) => {
309
312
  <div>
310
313
  <button
311
314
  type="button"
312
- className="btn btn-light btn-sm ms-1"
315
+ id={`IntelliTable-${id}-sort-by-${column.param}-button`}
316
+ className={`btn btn-${sortingByThisColumn ? 'light' : 'secondary'} btn-sm ms-1 ps-1 pe-1 pt-0 pb-0`}
313
317
  aria-label={sortButtonAriaLabel}
314
318
  onClick={() => {
315
319
  dispatch({
@@ -1961,7 +1961,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1961
1961
  type: ParamType.Int,
1962
1962
  },
1963
1963
  {
1964
- title: 'Student',
1964
+ title: 'Student?',
1965
1965
  param: 'isLearner',
1966
1966
  type: ParamType.Boolean,
1967
1967
  },
@@ -5,13 +5,13 @@
5
5
  * @returns escaped cell text
6
6
  */
7
7
  const escapeCellText = (text: string): string => {
8
- if (!text.includes(',')) {
8
+ if (!String(text).includes(',')) {
9
9
  // No need to escape
10
- return text;
10
+ return String(text);
11
11
  }
12
12
 
13
13
  // Perform escape
14
- return `"${text.replace(/"/g, '""')}`;
14
+ return `"${String(text).replace(/"/g, '""')}`;
15
15
  };
16
16
 
17
17
  /**
@@ -46,7 +46,24 @@ const genCSV = (
46
46
  csv += (
47
47
  columns
48
48
  .map((column) => {
49
- return escapeCellText(datum[column.param]);
49
+ let contents: string;
50
+ const cell = datum[column.param];
51
+ if (
52
+ typeof cell === 'string'
53
+ || typeof cell === 'number'
54
+ ) {
55
+ contents = String(cell);
56
+ } else if (
57
+ typeof cell === 'undefined'
58
+ || cell === null
59
+ ) {
60
+ contents = '';
61
+ } else if (typeof cell === 'object') {
62
+ contents = JSON.stringify(cell);
63
+ } else {
64
+ contents = '';
65
+ }
66
+ return escapeCellText(contents);
50
67
  })
51
68
  .join(',')
52
69
  );
@@ -500,7 +500,7 @@ const genRouteHandler = (
500
500
  isAdmin: !!launchInfo.isAdmin,
501
501
  isTTM: !!launchInfo.isTTM,
502
502
  courseId: launchInfo.courseId,
503
- courseName: launchInfo.courseName,
503
+ courseName: launchInfo.contextLabel,
504
504
  browser,
505
505
  device,
506
506
  year,