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

Add Explorer component to render resource indexes #514

Merged
merged 9 commits into from
Nov 20, 2019

Conversation

ashmaroli
Copy link
Member

@ashmaroli ashmaroli commented Oct 11, 2019

The front end for routes /pages, /drafts and /data are virtually identical except for the resource data, yet each component implements the same logic leading to repeated code.

We can extract all the repeated logic into a new React component, currently named Explorer.

Note: Currently not useful to refactoring the front end for posts and other documents.

@mertkahyaoglu
Copy link
Member

mertkahyaoglu commented Oct 11, 2019

I was planning to achieve the same. I have something bigger in mind though: rewriting whole frontend from scratch with new React API because looking at the code from 3 years ago, makes me feel bad a bit. Of course, it'll take some time to do that but this could be a good start.

Also I wanted to let you know that I'm going to start doing it sooner or later so maybe it's a good idea not to make big investments in the current code.

@ashmaroli
Copy link
Member Author

I'm going to start doing it sooner or later

That's something nice to look forward to.. 👍

@ashmaroli ashmaroli marked this pull request as ready for review November 11, 2019 15:57
Copy link
Member

@mertkahyaoglu mertkahyaoglu left a comment

Choose a reason for hiding this comment

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

This pr is so satisfying. Great job 🎉


render() {
const { items, type, newBtnLabel, search, params } = this.props;
const typeLabel = type === 'datafiles' ? 'data files' : type;
Copy link
Member

Choose a reason for hiding this comment

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

We could create a constant for this later to get type labels;

const TYPE_LABELS = {
  "datafiles": "data files",
  "pages": "pages",
  .. 
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Awesome idea!! 👍

@ashmaroli ashmaroli merged commit 8f6df92 into jekyll:master Nov 20, 2019
@ashmaroli ashmaroli deleted the explorer-component branch November 20, 2019 09:35
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.

2 participants