Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project widget V1 #16248

Merged
merged 14 commits into from Jul 10, 2017
Merged

Project widget V1 #16248

merged 14 commits into from Jul 10, 2017

Conversation

caleybrock
Copy link
Contributor

Recent projects and static new project list.

screen shot 2017-07-06 at 9 05 00 am

Moved ContentContainer to make it more generalized.

@caleybrock
Copy link
Contributor Author

caleybrock commented Jul 6, 2017

I added this to a page by adding the following:

#projects-widget to a haml file.

To a js file:

  $.ajax({
    method: 'GET',
    url: `/v3/channels`,
    dataType: 'json'
  }).done(projectLists => {
    const widget = document.getElementById('projects-widget');
    projectLists.sort((a, b) => {
      if (a.updatedAt < b.updatedAt) {
        return 1;
      } else {
        return -1;
      }
    });
    projectLists = projectLists.filter(project => {
      return !project.hidden;
    });
    projectLists = projectLists.slice(0,4);
    let convertedProjectList = [];
    for (let i = 0; i < projectLists.length; i++){
      let convertedProject = {
        name: projectLists[i].name,
        channel: projectLists[i].id,
        thumbnailUrl: projectLists[i].thumbnailUrl,
        type: projectLists[i].projectType,
        updatedAt: projectLists[i].updatedAt
      };
      convertedProjectList.push(convertedProject);
    }
    ReactDOM.render(
      <Provider store={getStore()}>
        <ProjectWidget projectList={convertedProjectList}/>
      </Provider>,
      widget);
  });
});

^This is not a super clean way to pass data in, just a way to prove we have the data setup in a way that will work with our components.

This work item didn't include adding this to pages yet, but the student page and course overview pages might be ones to come.

Component is 970px wide, our new width going forward, so it should work well on other pages, but was tested on the projects page.

return (
<div style={styles.fullsize}>
<div style={styles.description}>{i18n.projectStartNew()}</div>
{this.renderButtons()}
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 prefer just inlining renderButtons here

return (
<div style={styles.grid}>
<div style={styles.description}>{i18n.projectsContinueWorking()}</div>
{this.renderProjectCardList(this.props.projectList)}
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 again recommend inlining renderProjectCardList.

{(this.props.currentGallery !== 'personal' && projectData.publishedAt) &&
<div style={styles.lastEdit}>
{i18n.published()}:&nbsp;
<time style={styles.bold} className="versionTimestamp" dateTime={projectData.publishedAt}> {this.getLastModifiedTimestamp(projectData.publishedAt)}</time>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would prefer to break up these long lines (here and 263)

{this.props.projectList.length > 0 &&
<PersonalRecentProjects projectList={this.props.projectList} />
}
<NewProjectButtons />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space before />

grid: {
width: '100%'
},
link: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use the styling for the linkToViewAll in ContentContatiner here, so it's consistent?

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 was unused CSS, removed.

publishedToPublic: true
};

const PUBLISHED_CLASS = {
...defaultData,
const publishedToClassPersonal = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused about why some of these const are CAPS_SNAKE and some are lowerCamel. Should they be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also confused. Updating to all lowerCamel.

Copy link
Contributor

@Erin007 Erin007 left a comment

Choose a reason for hiding this comment

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

Thanks for doing all of the work to move ContentContainer out of studioHomepages!

Is the goal to be able to just have something like: <ProjectWidget/> on the student homepage and /courses? Data for that will be the next step?

@caleybrock
Copy link
Contributor Author

Data exists but will probably be different because not all pages are set up the same. I'll talk to poorva/tanya about if we want the V1 version on any pages, before implementing V2.

@caleybrock
Copy link
Contributor Author

@Bjvanminnen updated based on review.

<FontAwesome icon={icon} style={styles.arrowIcon} onClick={this.toggleActionBox}/>
if (!this.props.hideActions) {
// Only the student can access the menu options when viewing their personal projects.
let icon = this.state.actionsOpen ? 'chevron-up' : 'chevron-down';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could be const

@caleybrock caleybrock merged commit b3b9e28 into staging Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants