learningtribes-studio-frontend 1.2.0 → 1.4.0-alpha.0

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": "learningtribes-studio-frontend",
3
- "version": "1.2.0",
3
+ "version": "1.4.0-alpha.0",
4
4
  "description": "The frontend for the Open edX platform",
5
5
  "repository": "Learningtribes/studio-frontend",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  @import 'edx-bootstrap';
2
2
 
3
3
  .center-text {
4
- text-align: center;
4
+ text-align: center !important;
5
5
  }
6
6
 
7
7
  .drop-zone-compact {
@@ -42,3 +42,9 @@
42
42
  outline: $dark dashed 2px;
43
43
  background-color: rgba($primary, 0.2);
44
44
  }
45
+
46
+ .supported-files-types {
47
+ color: #727272;
48
+ font-size: 12px !important;
49
+ font-weight: 400;
50
+ }
@@ -6,6 +6,8 @@ import { uploadAssets, uploadExceedMaxSize, uploadExceedMaxCount, uploadInvalidF
6
6
 
7
7
  const mapStateToProps = state => ({
8
8
  courseDetails: state.studioDetails.course,
9
+ collapseBorder: (state.studioDetails.collapseBorder !== undefined) ? state.studioDetails.collapseBorder : false,
10
+ supportedFileTypes: state.studioDetails.supportedFileTypes
9
11
  });
10
12
 
11
13
  const mapDispatchToProps = dispatch => ({
@@ -21,6 +21,11 @@ const messages = defineMessages({
21
21
  defaultMessage: 'Size limit: {maxFileSizeMB} MB',
22
22
  description: 'Upload label for maximum file size',
23
23
  },
24
+ assetsDropZoneSupportedFileTypesLabel: {
25
+ id: 'assetsDropZoneSupportedFileTypesLabel',
26
+ defaultMessage: 'Supported file types: {filesTypesList}',
27
+ description: 'Supported file types information',
28
+ }
24
29
  });
25
30
 
26
31
  export default messages;
@@ -46,10 +46,10 @@ export default class AssetsDropZone extends React.Component {
46
46
 
47
47
  render() {
48
48
  return (
49
- <WrappedMessage message={messages.assetsDropZoneAriaLabel}>
49
+ <WrappedMessage message={messages.assetsDropZoneAriaLabel} collapseBorder={this.props.collapseBorder}>
50
50
  { regionLabel =>
51
51
  (
52
- <div role="region" aria-label={regionLabel}>
52
+ <div role="region" aria-label={regionLabel} className={this.props.collapseBorder ? "collapsedZoneStyle": ""}>
53
53
  <Dropzone
54
54
  accept={this.props.acceptedFileTypes}
55
55
  activeClassName={styles['drop-active']}
@@ -110,6 +110,20 @@ export default class AssetsDropZone extends React.Component {
110
110
  </p>
111
111
  )}
112
112
  </WrappedMessage>
113
+ {this.props.supportedFileTypes !== undefined &&
114
+ <WrappedMessage message={messages.assetsDropZoneSupportedFileTypesLabel} values={{filesTypesList: this.props.supportedFileTypes}}>
115
+ { displayText => (
116
+ <p
117
+ aria-hidden
118
+ className={styles['center-text'] + " supported-files-types"}
119
+ data-identifier="asset-drop-zone-supported-file-types-label"
120
+ id="asset-drop-zone-supported-file-types-label"
121
+ >
122
+ {displayText}
123
+ </p>
124
+ )}
125
+ </WrappedMessage>
126
+ }
113
127
  </Dropzone>
114
128
  </div>
115
129
  )
@@ -4,3 +4,15 @@
4
4
  top: -2em;
5
5
  }
6
6
  }
7
+
8
+ .collapsedBorderStyle {
9
+ padding: 0px !important;
10
+ background-color: white !important;
11
+ }
12
+
13
+ .collapsedZoneStyle {
14
+ margin: 0px !important;
15
+ padding: 20px 3px 20px 3px !important;
16
+ width: 940px !important;
17
+ max-width: 100% !important;
18
+ }
@@ -15,6 +15,7 @@ const mapStateToProps = state => ({
15
15
  uploadSettings: state.studioDetails.upload_settings,
16
16
  searchMetadata: state.metadata.search,
17
17
  status: state.metadata.status,
18
+ showFilterAndList: (state.studioDetails.showFilterAndList !== undefined) ? state.studioDetails.showFilterAndList : true
18
19
  });
19
20
 
20
21
  const mapDispatchToProps = dispatch => ({
@@ -25,6 +25,8 @@ export default class AssetsPage extends React.Component {
25
25
 
26
26
  this.state = {
27
27
  pageType: pageTypes.SKELETON,
28
+ showFilterAndList: props.showFilterAndList,
29
+ collapseBorder: props.collapseBorder
28
30
  };
29
31
 
30
32
  this.statusAlertRef = null;
@@ -122,24 +124,29 @@ export default class AssetsPage extends React.Component {
122
124
  <div className="page-header">
123
125
  <WrappedAssetsImagePreviewFilter />
124
126
  </div>
125
- {this.renderAssetsFilters()}
127
+ {this.state.showFilterAndList && this.renderAssetsFilters()}
126
128
  </div>
127
- <div className="col-10 table-list" id={TABLE_CONTENTS_ID} tabIndex="-1">
129
+ {this.state.showFilterAndList && <div className="col-10 table-list" id={TABLE_CONTENTS_ID} tabIndex="-1">
128
130
  <div className="row">
129
131
  <WrappedAssetsTable
130
132
  deleteButtonRefs={(button, asset) => { this.deleteButtonRefs[asset.id] = button; }}
131
133
  />
132
134
  </div>
133
- </div>
134
- </div>
135
- <div className="row">
136
- <WrappedAssetsResultsCount />
135
+ </div>}
137
136
  </div>
137
+ {this.state.showFilterAndList &&
138
+ <div className="row">
139
+ <WrappedAssetsResultsCount/>
140
+ </div>
141
+ }
142
+ {this.state.showFilterAndList &&
138
143
  <div className="row">
144
+
139
145
  <div className="col-10 offset-2">
140
- <WrappedPagination />
146
+ <WrappedPagination/>
141
147
  </div>
142
148
  </div>
149
+ }
143
150
  </React.Fragment>
144
151
  );
145
152
 
@@ -169,7 +176,7 @@ export default class AssetsPage extends React.Component {
169
176
  <div className="row file-upload-main">
170
177
  <div className="col">
171
178
  {this.renderAssetsDropZone()}
172
- {this.renderAssetsFilters()}
179
+ {this.state.showFilterAndList && this.renderAssetsFilters()}
173
180
  </div>
174
181
  <div className="col-10 no-result-body">
175
182
  {this.renderNoResultsBody()}
@@ -181,7 +188,7 @@ export default class AssetsPage extends React.Component {
181
188
  <div className="row">
182
189
  <div className="col-2">
183
190
  {this.renderAssetsDropZone()}
184
- {this.renderAssetsFilters()}
191
+ {this.state.showFilterAndList && this.renderAssetsFilters()}
185
192
  </div>
186
193
  </div>
187
194
  );
@@ -67,6 +67,12 @@ export const getAssets = (parameters, courseDetails) =>
67
67
  })
68
68
  .then((json) => {
69
69
  if (isLastRequestMade(getState().metadata.request, requestParameters)) {
70
+
71
+ // dispatch get assets success event to the root div
72
+ const rootDiv = document.getElementById('root');
73
+ const event = new CustomEvent('getAssetsSuccessEvent', {"detail": json});
74
+ rootDiv.dispatchEvent(event);
75
+
70
76
  return dispatch(requestAssetsSuccess(json));
71
77
  }
72
78
  return Promise.resolve();
@@ -296,6 +302,12 @@ export const uploadAssets = (assets, courseDetails) =>
296
302
  if (response.ok) {
297
303
  return response.json().then((json) => {
298
304
  dispatch(uploadAssetSuccess(json));
305
+
306
+ // dispatch upload assets success event to the root div
307
+ const rootDiv = document.getElementById('root');
308
+ const event = new CustomEvent('uploadAssetsSuccessEvent', {"detail": json});
309
+ rootDiv.dispatchEvent(event);
310
+
299
311
  // dispatch(getAssets(..)) returns a promise, so we return it
300
312
  return dispatch(getAssets({}, courseDetails));
301
313
  });
@@ -29,14 +29,14 @@ import './zh_CN.json';
29
29
 
30
30
  const localeDataMap = {
31
31
  'ar': arData,
32
- 'de_DE': deData,
32
+ 'de-de': deData,
33
33
  'el': elData,
34
34
  'en': enData,
35
35
  'es-419': esData,
36
36
  'fr': frData,
37
- 'it_IT': itData,
38
- 'pt_BR': ptData,
39
- 'tr_TR': trData,
37
+ 'it-it': itData,
38
+ 'pt-br': ptData,
39
+ 'tr-tr': trData,
40
40
  'zh-cn': zhData,
41
41
  };
42
42
 
@@ -3,16 +3,18 @@ import PropTypes from 'prop-types';
3
3
  import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
4
4
 
5
5
  const WrappedMessage = (props) => {
6
- const { message, intl, ...other } = props;
6
+ const { message, intl, collapseBorder, ...other } = props;
7
7
 
8
+ var collapseBorderFlag = (collapseBorder !== undefined) ? collapseBorder : false;
8
9
  // manually check if a translation exists for this message in the current (non-default) locale
9
10
  // this allows us to match the containing "lang" span when we fallback to the default locale
10
11
  let locale = intl.defaultLocale;
11
12
  if (message.id in intl.messages) {
12
13
  locale = intl.locale;
13
14
  }
15
+
14
16
  return (
15
- <span lang={locale}>
17
+ <span lang={locale} className={collapseBorderFlag ? "collapsedBorderStyle" : ""}>
16
18
  <FormattedMessage
17
19
  {...message}
18
20
  {...other}