Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

create page for thread and multicolumn extract #432

Merged
merged 6 commits into from May 28, 2018

Conversation

MilanBarande
Copy link
Contributor

No description provided.

@MilanBarande MilanBarande changed the title WIP: create page for thread and multicolumn extract create page for thread and multicolumn extract May 22, 2018
@MilanBarande MilanBarande force-pushed the thread-multicolumn-extraction-page branch from eee2f06 to e999ec2 Compare May 28, 2018 07:19
Copy link
Contributor

@ayyazdaniaryan ayyazdaniaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


.export-language-dropdown {
margin-top: 20px;
position: absolute;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because there is no position on any of the parents, this position will be absolute to the viewport, which might not be what you're looking for in case of mobile. Please verify.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CSS is not from me actually, but I tried removing this position:absolute and the dropdown doesn't appear at all. As there is no admin on mobile is it really worth it to change this ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yea! There is no mobile admin section! Okay, then keep this. Good call.

this.props.router.setRouteLeaveHook(this.props.route, null);
}

handleExportLocaleChange = (locale) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would bind these functions in the constructor of this class.
eg.

this.handleExportLocaleChange = this.handleExportLocaleChange.bind(this);

https://medium.com/shoutem/react-to-bind-or-not-to-bind-7bf58327e22a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the point of using an arrow function here is to avoid having to bind the function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a choice, I suspect. Arrow functions are binding your method which you are passing down to child components. But, binding them in constructor is just a tiny bit more efficient for the JS interpreter to translate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I didn't know. I think we have been using arrow functions all over the project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I made the modifications. But I just found this facebook/react#9851
apparently it's pretty much the same thing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayyazdaniaryan class properties are transformed with babel (click on the Try button in the example https://babeljs.io/docs/plugins/transform-class-properties/) to an efficient syntax. You can have perf issue with binding in the render method yes because it will create new functions, but class properties are completely different here. We prefer the class properties syntax in the project because of flow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincentfretin cool! I wasn't aware. Thank you for this update! @MilanBarande good find. TIL.

this.setState({ exportLocale: locale });
};

handleTranslationChange = (shouldTranslate) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

/>
)}
{!isNaN(currentStep) && (
<Navbar currentStep={currentStep} totalSteps={1} phaseIdentifier="multiColumn" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why show the Navbar when the admin currently only has 1 step? If it's for the future, I would put another check,

const totalSteps = 1;
!isNan(currentStep) && totalSteps > 1 && ...

In future, if totalSteps increases, the code will be rendered, otherwise the navbar is left out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you absolutely want a navbar to be present even in the case of 1 step

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I hadn't put it but I thought it made it clear that there is only one step of admin to deal with at the moment (1/1) and not that others are available but not displaying for any sort of reason (bug).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ask to the Fred but I remember that he prefer when the navbar id hidden when there is 1 step

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

this.props.router.setRouteLeaveHook(this.props.route, null);
}

handleExportLocaleChange = (locale) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bind these methods as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrow functions and class properties like this are automatically binded to this @ayyazdaniaryan

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using Flow, we should use arrow function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

/>
)}
{!isNaN(currentStep) && (
<Navbar currentStep={currentStep} totalSteps={1} phaseIdentifier="thread" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above...

@@ -1286,6 +1288,8 @@ const Translations = {
export: {
defaultAnnotation: "You can export all of the data by clicking on the export button",
surveyAnnotation: "You can export all the survey module data by clicking on the Export button",
threadAnnotation: "You can export all the thread module data by clicking on the Export butotn",
multicolumnAnnotation: "You can export all the multicolumn data by clicking on the Export button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-column or Multi Column as there is no word like this in English.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, true :)

import { get } from '../utils/routeMap';
import ExportSection from '../components/administration/exportSection';
import Navbar from '../components/administration/navbar';
import DiscussionPreferenceLanguage from '../graphql/DiscussionPreferenceLanguage.graphql';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename in DiscussionPreferenceLanguageQuery for more clarity?

import { get } from '../utils/routeMap';
import ExportSection from '../components/administration/exportSection';
import Navbar from '../components/administration/navbar';
import DiscussionPreferenceLanguage from '../graphql/DiscussionPreferenceLanguage.graphql';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename in DiscussionPreferenceLanguageQuery for more clarity?

Copy link
Contributor

@paolina92 paolina92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MilanBarande MilanBarande merged commit 6f5876a into develop May 28, 2018
@MilanBarande MilanBarande deleted the thread-multicolumn-extraction-page branch May 28, 2018 15:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants