-
Notifications
You must be signed in to change notification settings - Fork 70
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
wip: github components kit #66
wip: github components kit #66
Conversation
Forcing workflow run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a compact mode for the component. Full page components are NOT THAT useful. We may as well just create a route for it. Imagine it is embedded as one of 4 components in a row of the page, restyle the component under this circumstance.
Typically, this should also be the reactive mode display when the width is shrunk (or using mobile browser).
@Sing-Li the way I am imagining it is,
Please suggest your opinions and I'll start working on it! |
Great ideas @sidmohanty11 ! Really do like the two components idea. But please do name it consistent with bootstrap culture (I don't know if "card" is the right word in that design language - sounds very Material Design'ish). Also please name the two components appropriately so that the "large" one is for 1/3, 1/2, 1 page layouts where the "card?" one is for finer compositions. As far as aesthetics and layout go - please confer in DM directly with @demonicirfan .... he's got some extreme "design chops" and may be able to figma you some workable ideas. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a lot of potential for github integration, and for that reason I suggested using octokit from that start.
Since we're now using octokit, imo it'd be better to not have a octokit
library (which also confuses people with main octokit
), but rather a collection of helper functions for grabbing common github resources.
app/pages/index.js
Outdated
const issues = await octokitClient('GET /repos/{owner}/{repo}/issues', { | ||
owner: 'RocketChat', | ||
repo: 'RC4Community' | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a separate function in lib/github
const issues = await octokitClient('GET /repos/{owner}/{repo}/issues', { | |
owner: 'RocketChat', | |
repo: 'RC4Community' | |
}); | |
const issues = await getIssues(`RocketChat`, `RC4Community`) |
app/lib/octokit.js
Outdated
@@ -0,0 +1,15 @@ | |||
import { Octokit } from '@octokit/core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert this whole to a github library of sorts.
app/pages/index.js
Outdated
@@ -9,6 +9,8 @@ import Growthcounters from '../components/growthcounters'; | |||
import { Container, Col } from 'react-bootstrap'; | |||
import { fetchAPI } from '../lib/api'; | |||
import { withFirebaseAuthUser } from '../components/auth/firebase'; | |||
import GithubIssuesList from '../components/githubissueslist'; | |||
import { octokitClient } from '../lib/octokit' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { octokitClient } from '../lib/octokit' | |
import { getIssues } from '../lib/github' |
Consider these just suggestions, do it your own way, no need to commit these exact ones.
@sidmohanty11 if you have any questions or need any clarifications for the changes I requested, feel free to ask :) |
@Sing-Li Got it! I've already DMed him, as soon as he comes up with an idea I will start the execution part. |
@debdutdeb thank you so much for the suggestions! Just so I am crystal clear, I am going to make a For example, const issues = await getIssues('RocketChat', 'RC4Community'); // will return all issues
const prs = await getPRs('RocketChat', 'RC4Community'); // will return all PRs Thank you |
@sidmohanty11 perhaps make this into a 3 components - Github components kit. If you add this component - I am sure it will eventually become the most used out of all the Github components 😃 We'll use it immediately on community.rocket.chat ;-) Static-gen preferred please. |
@Sing-Li Amazing suggestion! I will start working Thank you |
@Sing-Li like the idea 💯 Just a suggestion, maybe we don't change and mix the goal of this pr, and merge it as it is, then move the component kit to a seperate pr? |
Thx 4 suggestion. All the Github related components in one "kit" or PR is best, IMO. Each component is actually quite trivial at the moment - and they'll use many common APIs. Otherwise we might end up with too much to manage. We've been doing 3 or 4 components PRs quite frequently so far. There will likely be another 30 to 40 to be done yet before we get a reasonable foundation for the project. |
a3e0af8
to
543bb18
Compare
Thank you |
@sidmohanty11 really looks good. I'll give it a test now. |
@sidmohanty11 I've tested everything and basically working fine. I also liked how you've structured the code, making it very easy to migrate to the next step. Which is to cache the data (issues, etc) through strapi, the headless CMS, like all the other getStaticProps() fetches. Strapi's cron should be used for this task. This step is important to lighten the load on Github API calls if the site re-generation frequency is high. Please use the currently open Leaderboard component PR as an example. It should be quite easy now that you have your data fetch functions all under a Thanks. |
7ae1cea
to
f926dce
Compare
@Sing-Li I've added the cron job which will make fetch requests after an hour and an initial fetch request during initialisation of data(so that we don't wait for data for 1st 1hr). And I've checked that it will be very rare but if at any edge case situation we change the cron request time to 60secs or so.. we might get an error that says we have exceeded the fetch request quota. So for that I've just made a default issue template otherwise in this way the cron job will update the Issues accordingly. :- if maxed outnormal fetchPlease give it a test and provide me some of your suggestions Thank you |
This is awesome @sidmohanty11 ! I'll test this tonight or over the weekend. In the meantime, please add component kit documentation (following standard ReactJS component doc format, not the leaderboard component's format) here:
Thanks. |
@sidmohanty11 the URL to docs is updated above - https://github.com/RocketChat/RC4Community/tree/master/docs/components |
@Sing-Li sorry for the late reply, I went to visit Grandma this weekend. I will finish the work by today. Thank you |
73a5340
to
35f88d8
Compare
@Sing-Li I've added the documentation and have tried to be as much descriptive as I could, still if I've missed something or for any improvements, I would love to get your suggestions |
#27