summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorKamran Ahmed <kamranahmed.se@gmail.com>2018-08-27 23:14:08 +0500
committerKamran Ahmed <kamranahmed.se@gmail.com>2018-08-27 23:14:08 +0500
commit16873dad5bc3989a5cef561bdc31c9ddcda63029 (patch)
treeb1000a759765ba606055364f911c7fc46874920b /src/components
parentAdd dynamic group headings (diff)
downloadgithunt-16873dad5bc3989a5cef561bdc31c9ddcda63029.tar.gz
Load next batch and group headings
Diffstat (limited to 'src/components')
-rw-r--r--src/components/group-heading/index.js12
-rw-r--r--src/components/repository-grid/index.js9
-rw-r--r--src/components/repository-list/index.js9
3 files changed, 23 insertions, 7 deletions
diff --git a/src/components/group-heading/index.js b/src/components/group-heading/index.js
index 762d36d..2ba89a2 100644
--- a/src/components/group-heading/index.js
+++ b/src/components/group-heading/index.js
@@ -10,7 +10,7 @@ class GroupHeading extends React.Component {
const currentMoment = moment();
const yesterdayMoment = moment().subtract(1, 'day');
- // For "day" jumps show the day name
+ // For "day" jumps return the day name
if (this.props.dateJump === 'day') {
if (startMoment.isSame(currentMoment, 'day')) {
return 'Today';
@@ -21,14 +21,20 @@ class GroupHeading extends React.Component {
return startMoment.format('dddd');
}
- return startMoment.fromNow();
+ // Return the relative date
+ const formattedDate = startMoment.fromNow();
+ if (formattedDate === 'a year ago') {
+ return 'Last Year';
+ }
+
+ return formattedDate;
}
getSubtitle() {
const startMoment = moment(this.props.start);
const endMoment = moment(this.props.end);
- if (startMoment.isSame(endMoment, 'day')) {
+ if (startMoment.isSame(endMoment, 'day') || this.props.dateJump === 'day') {
return startMoment.format('MMMM D, YYYY');
}
diff --git a/src/components/repository-grid/index.js b/src/components/repository-grid/index.js
index d99a38f..8413a8e 100644
--- a/src/components/repository-grid/index.js
+++ b/src/components/repository-grid/index.js
@@ -13,7 +13,11 @@ class RepositoryGrid extends React.Component {
if (counter !== 0) {
groupHeading = (
<div className="row row-group">
- <GroupHeading/>
+ <GroupHeading
+ start={ repositoryGroup.start }
+ end={ repositoryGroup.end }
+ dateJump={ this.props.dateJump }
+ />
</div>
);
}
@@ -45,7 +49,8 @@ class RepositoryGrid extends React.Component {
}
RepositoryGrid.propTypes = {
- repositories: PropTypes.array.isRequired
+ repositories: PropTypes.array.isRequired,
+ dateJump: PropTypes.string.isRequired
};
export default RepositoryGrid;
diff --git a/src/components/repository-list/index.js b/src/components/repository-list/index.js
index be6cc76..862df11 100644
--- a/src/components/repository-list/index.js
+++ b/src/components/repository-list/index.js
@@ -15,7 +15,11 @@ class RepositoryList extends React.Component {
if (counter !== 0) {
groupHeading = (
<div className="row row-group">
- <GroupHeading/>
+ <GroupHeading
+ start={ repositoryGroup.start }
+ end={ repositoryGroup.end }
+ dateJump={ this.props.dateJump }
+ />
</div>
);
}
@@ -47,7 +51,8 @@ class RepositoryList extends React.Component {
}
RepositoryGrid.propTypes = {
- repositories: PropTypes.array.isRequired
+ repositories: PropTypes.array.isRequired,
+ dateJump: PropTypes.string.isRequired
};
export default RepositoryList;