Skip to content

Commit

Permalink
Merge pull request #37 from Kentico/js-sdk-ugrade-v6
Browse files Browse the repository at this point in the history
Upgrade to SDK v6
  • Loading branch information
Simply007 committed Aug 29, 2019
2 parents 7c4a5ee + 6c88f84 commit f10e1d8
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 219 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = {
options: {
deliveryClientConfig: {
projectId: '1bb2313f-2550-0025-06d9-f3e5065607c0',
typeResolvers:[]
typeResolvers: []
},
languageCodenames: [
"default"
Expand Down
63 changes: 50 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kentico-github-io",
"description": "Official landing page for GitHub community in Kentico",
"version": "1.0.21",
"version": "1.0.23",
"author": "Ondřej Chrastina <ondrejch@kentico.com> (https://github.com/Simply007)",
"scripts": {
"build": "gatsby build && cpx -v \".github/**/*\" public/.github && cpx CODE_OF_CONDUCT.md public && cpx CONTRIBUTING.md public && cpx README.md public && cpx LICENSE public",
Expand All @@ -19,7 +19,7 @@
"gatsby-plugin-offline": "^2.0.5",
"gatsby-plugin-react-helmet": "^3.0.5",
"gatsby-plugin-sass": "^2.0.1",
"gatsby-source-kentico-cloud": "^3.1.0",
"gatsby-source-kentico-cloud": "^4.0.0-beta1",
"github-api": "^3.0.0",
"html-to-react": "^1.3.3",
"loaders.css": "^0.1.2",
Expand All @@ -34,7 +34,7 @@
"react-inlinesvg": "^0.8.2",
"react-loaders": "^3.0.1",
"react-responsive-navbar": "^1.0.11",
"rxjs": "6.2.0"
"rxjs": "^6.2.0"
},
"keywords": [
"gatsby",
Expand Down
1 change: 1 addition & 0 deletions src/azureFunctions/Utils/GitHubDataLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class GitHubDataLoader {
});

const mergedPullRequests = await search.forIssues(options);
const test = await search._requestAllPages('/search/issues', undefined, undefined);
return mergedPullRequests.data.length;
}

Expand Down
9 changes: 6 additions & 3 deletions src/azureFunctions/loadGitHubData/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"disabled": false,
"bindings": [
{
"name": "timeSchedulerTrigger",
"type": "timerTrigger",
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"schedule": "0 0 */2 * * *"
"name": "req",
"methods": [
"get"
]
}
]
}
23 changes: 14 additions & 9 deletions src/components/githubIssuesListSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class GithubIssuesListSection extends Component {

render() {
const elements = this.state.elements;
const platforms = elements.platform_selector.map(platform =>
const platforms = elements.platform_selector.linked_items.map(platform =>
<option key={platform.elements.codename.value} value={platform.elements.codename.value}>{platform.elements.name.value}</option>);

const steps = elements.steps
const steps = elements.steps.linked_items
.map((step, index) =>
<div key={index}>
<span>{("0" + (index + 1)).slice(-2)}/</span>
Expand Down Expand Up @@ -101,13 +101,14 @@ class GithubIssuesListSection extends Component {
</select>
);

const selectedPlatforms = elements.platform_selector.filter(({ elements }) => elements.codename.value === this.state.platformSelection);
const selectedPlatforms = elements.platform_selector.linked_items.filter(({ elements }) =>
elements.codename.value === this.state.platformSelection);
const selectedPlatformLink =
selectedPlatforms.length > 0
&& selectedPlatforms[0].elements.detail_url.text
&& selectedPlatforms[0].elements.detail_url.value
&& <a
className="btn"
href={selectedPlatforms[0].elements.detail_url.text}
href={selectedPlatforms[0].elements.detail_url.value}
target="_blank"
rel="noopener noreferrer">
Public backlog
Expand Down Expand Up @@ -137,11 +138,11 @@ class GithubIssuesListSection extends Component {

return (
<section className="task-list" id="task-list" style={{
background: `#1C263F url(${elements.section_info__background_image.assets[0].url}) bottom center no-repeat`
background: `#1C263F url(${elements.section_info__background_image.value[0].url}) bottom center no-repeat`
}}>
<div className="row-flex">
<h2>
{elements.section_info__title.text}
{elements.section_info__title.value}
</h2>
</div>
<div className="row-flex">
Expand Down Expand Up @@ -169,9 +170,13 @@ GithubIssuesListSection.propTypes = {
section_info__title: PropTypes.object,
section_info__subtitle: PropTypes.object,
section_info__background_image: PropTypes.object,
platform_selector_nodes: PropTypes.array,
platform_selector: PropTypes.shape({
linked_items: PropTypes.array
}),
steps_label: PropTypes.object,
steps: PropTypes.array,
steps: PropTypes.shape({
linked_items: PropTypes.array
}),
issues_label: PropTypes.object,
})
})
Expand Down
18 changes: 10 additions & 8 deletions src/components/iconsSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import React from 'react';
import PropTypes from 'prop-types';

const IconsSection = (props) => {
const icons = props.data.elements.icons
const icons = props.data.elements.icons.linked_items
.map(icon =>
<div className="box-33" key={icon.system.codename}>
<div className="box-33">
<img src={icon.elements.icon.assets[0].url} alt="" />
<h3>{icon.elements.title.text}</h3>
<p>{icon.elements.subtitle.text}</p>
<img src={icon.elements.icon.value[0].url} alt="" />
<h3>{icon.elements.title.value}</h3>
<p>{icon.elements.subtitle.value}</p>
</div>
</div>
);
const headline = props.data.elements.section_info__title.text && <div className="row-flex type">
const headline = props.data.elements.section_info__title.value && <div className="row-flex type">
<div className="box-100">
{props.data.elements.section_info__title.text}
{props.data.elements.section_info__title.value}
</div>
</div>;

return (
<section className="icons-section" id="value-propositions" style={{
background: `#151B31 url(${props.data.elements.section_info__background_image.assets[0].url}) top center no-repeat`
background: `#151B31 url(${props.data.elements.section_info__background_image.value[0].url}) top center no-repeat`
}}>
{headline}
<div id="content1" className="content">
Expand All @@ -37,7 +37,9 @@ IconsSection.propTypes = {
elements: PropTypes.shape({
section_info__title: PropTypes.object,
section_info__background_image: PropTypes.object,
icons: PropTypes.array
icons: PropTypes.shape({
linked_items: PropTypes.array
})
})
})
};
Expand Down
Loading

0 comments on commit f10e1d8

Please sign in to comment.