-
Notifications
You must be signed in to change notification settings - Fork 189
Feat: developed contribution section in project page #173
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
Open
Bucky25
wants to merge
13
commits into
anitab-org:develop
Choose a base branch
from
Bucky25:contribution-_heat_map
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
88b86e9
made cards and developed event section (anitab-org#123)
Bucky25 fafb091
develop contribution section in project page #80
Bucky25 1c7ef02
develop contribution section in project page
Bucky25 ea584eb
develop contribution section in project page #80
Bucky25 760ce7b
tweaked styles and cosole errors
Bucky25 ae68497
removed gramatical errors
Bucky25 0f8f20d
removed class component and added functional component
Bucky25 2096684
moved data to content , renamed props and added scrollview
Bucky25 650b8a8
added data to content and added scrollview
Bucky25 31151ea
Merge branch 'develop' into contribution-_heat_map
annabauza 9600127
Minor tweaks
Bucky25 92b93a3
Minor tweaks
Bucky25 508de9e
removed conflicting files
Bucky25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import { StyleSheet, View} from 'react-native'; | ||
|
|
||
|
|
||
| const ContributionBox = ({ commitCount }) => { | ||
| var hue = 0; | ||
| if(commitCount < 2) { | ||
| hue = .4; | ||
| } else if (commitCount >=2 && commitCount < 4) { | ||
| hue = .6; | ||
| } else if (commitCount >=4 && commitCount < 8 ) { | ||
| hue = .7; | ||
| } else if (commitCount >=8 && commitCount < 12) { | ||
| hue = .9; | ||
| } else { | ||
| hue = 1; | ||
| } | ||
|
|
||
| var colorCode = 'rgba(0, 113, 188,' + hue + ')'; | ||
| return ( | ||
| <View style={[style.box, {backgroundColor: colorCode}]}/> | ||
| ); | ||
| }; | ||
|
|
||
| const style = StyleSheet.create({ | ||
| box: { | ||
| width: 20, | ||
| height: 20, | ||
| margin: 2.5, | ||
| } | ||
| }); | ||
|
|
||
| export default ContributionBox; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import React ,{useState} from 'react'; | ||
| import { View, Text, StyleSheet } from 'react-native'; | ||
| import ContributionBox from './Box'; | ||
|
|
||
| function ContributionRow ({...props}) { | ||
| let [data ,setData] = useState(null); | ||
| React.useEffect( () => { | ||
| const endpoint = props.detail.link; | ||
| const headers = { | ||
| "Authorization" : process.env.ACCESS_TOKEN | ||
| } | ||
| fetch(endpoint, { | ||
| "method" :"GET", | ||
| "headers" : headers | ||
| }) | ||
| .then((resp) => resp.json()) | ||
| .then((obj) => { | ||
| setData( obj) ; | ||
| }); | ||
| }, []) | ||
| let Contributionrow = []; | ||
| const reponame = props.detail.name; | ||
| const take = () =>{ | ||
| Contributionrow.push(<Text key={0} style={styles.desc}>{reponame}</Text>); | ||
| let week = 0; | ||
| let days =0; | ||
| while (true) { | ||
| for (let i=6;i>=0;i--) | ||
| { | ||
| Contributionrow.push( | ||
| <ContributionBox key={days+1} commitCount={data[51-week].days[i]} /> | ||
| ); | ||
| days++; | ||
| if(days>=30)break; | ||
| } | ||
| week++; | ||
| if(days>=30)break; | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
|
|
||
| <View> | ||
| {data === null ? | ||
| <Text style={styles.desc}>loading...</Text> | ||
| : | ||
| <View style={{ | ||
| flexDirection: 'row', | ||
| flexWrap: 'wrap', | ||
| }} | ||
| > | ||
| {take()} | ||
| {Contributionrow} | ||
| </View> | ||
| } | ||
| </View> | ||
|
|
||
| ); | ||
| //} | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| desc: { | ||
| color: '#0071BC', | ||
| fontSize: 16, | ||
| fontWeight: '400', | ||
| width: 190, | ||
| margin:4, | ||
| }, | ||
| box: { | ||
| flexDirection: 'row', | ||
| flexWrap: 'wrap', | ||
| marginTop: 8, | ||
| } | ||
| }) | ||
|
|
||
| export default ContributionRow; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import React from 'react'; | ||
| import { View, StyleSheet, Text, ScrollView } from 'react-native'; | ||
| import SectionHeader from './../../SectionHeader'; | ||
| import ContributionRow from './ContributionRow'; | ||
| import ContributionBox from './Box'; | ||
| import { getrepoData } from './../../../content/projects_content'; | ||
|
|
||
|
|
||
| function Contribution () { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use arrow function here for consistency as it's being used everywhere else. |
||
| const repoData = getrepoData(); | ||
| return ( | ||
| <View > | ||
| <SectionHeader title={'Last 30 Days Contribution'} /> | ||
| <ScrollView horizontal={true}> | ||
| <View style={{margin: 32}}> | ||
| {repoData.data.map((repo,index) => ( | ||
| <ContributionRow detail={repo} key={index} /> | ||
| )) | ||
| } | ||
| <View style={styles.description}> | ||
| <Text style={styles.text}>Less</Text> | ||
| <ContributionBox commitCount={1} /> | ||
| <ContributionBox commitCount={3} /> | ||
| <ContributionBox commitCount={6} /> | ||
| <ContributionBox commitCount={10} /> | ||
| <ContributionBox commitCount={13} /> | ||
| <Text style={styles.text}>More</Text> | ||
| </View> | ||
| </View> | ||
| </ScrollView> | ||
| </View> | ||
| ); | ||
|
|
||
| } | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| description: { | ||
| flexDirection: 'row', | ||
| flexWrap: 'wrap', | ||
| alignSelf: 'flex-end', | ||
|
|
||
| }, | ||
| text: { | ||
| color: '#0071BC', | ||
| fontSize: 12, | ||
| fontWeight: '400', | ||
| padding: 4, | ||
| }, | ||
| }); | ||
|
|
||
| export default Contribution; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.