Skip to content

Add repo-age feature - #2560

Merged
fregante merged 23 commits into
refined-github:masterfrom
maxmclau:add-repo-age
Nov 25, 2019
Merged

fregante merged 23 commits into
refined-github:masterfrom
maxmclau:add-repo-age

Conversation

@maxmclau

Copy link
Copy Markdown
Contributor

Adds the age of the repository to the end of the stats bar

Closes #2526

Screenshot

Screen Shot 2019-11-21 at 3 18 11 AM

@fregante fregante left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking great! Thank you! Only a few notes:

Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/libs/utils.ts Resolved
Comment thread source/libs/icons.tsx Resolved
@fregante fregante changed the title Add repo age Add repo-age feature Nov 21, 2019
maxmclau and others added 2 commits November 22, 2019 00:49
Co-Authored-By: Federico Brigante <[email protected]>
@yakov116

Copy link
Copy Markdown
Member

I think there should be tooltip since it's not obvious what was ' 21hours ago '

@fregante

fregante commented Nov 22, 2019 •

Copy link
Copy Markdown
Member

I think there should be tooltip since it's not obvious what was ' 21hours ago '

We don't show ago but old, which would be self-explanatory in the repo’s header.

As long as old is always visible, the tooltip isn't necessary. If there's a chance that our string doesn't include old ("Just now", "Today", etc), then yes we need tooltipped + aria-label

@fregante fregante self-assigned this Nov 23, 2019
@sindresorhus

Copy link
Copy Markdown
Member

Looks good.

@maxmclau Can you add it to the readme?

@fregante
fregante merged commit bb629f6 into refined-github:master Nov 25, 2019
@fregante

Copy link
Copy Markdown
Member

Thanks for this feature @maxmclau! 🎂

@maxmclau
maxmclau deleted the add-repo-age branch November 25, 2019 17:50
}
`);

return new Date(repository.createdAt);

@fregante fregante Dec 1, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@maxmclau could you add long-term caching to this value?
Something like

const key = __featureName__ + ':' + getRepoURL();
if (await cache.has(key)) {
	return cache.get(key);
}

const {repository} = await api.v4(`
	repository(${getRepoGQL()}) {
		createdAt
	}
`);

cache.set(key, repository.createdAt);
return repository.createdAt;

Edit: maybe wait for #2578

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

#2578 merged

@maxmclau maxmclau Dec 6, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fregante this memoization implementation is pretty neat - I opened a PR that should close this.
#2602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Repository creation date

4 participants