Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 70 additions & 20 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,43 @@ exports.createSchemaCustomization = ({ actions }) => {
userId: String!
playlistItems: [String]!
}
type CrmDataCollection implements Node {
slug: String
fullName: String
emailAddress: String
location: String
jobTitle: String
role: String
billingRate: String
skills: CrmSkills
isActive: Boolean
nickname: String
blogUrl: String
facebookUrl: String
skypeUsername: String
linkedInUrl: String
twitterUsername: String
gitHubUrl: String
youTubePlayListId: String
publicPhotoAlbumUrl: String
}
type CrmSkills {
intermediateSkills: [CrmSkillItem]
advancedSkills: [CrmSkillItem]
}
type CrmSkillItem {
service: String
marketingPageUrl: String
}
type SkillUrls implements Node {
service: SkillUrlsService
}
type SkillUrlsService {
service: String
marketingPage: String
marketingPageUrl: String
highlightskill: Boolean
}
`;
createTypes(typeDefs);
};
Expand Down Expand Up @@ -187,21 +224,34 @@ exports.sourceNodes = async ({
});
}

const crmDataResult = await getViewDataFromCRM();
let skills = await getUsersSkills();
skills = skills
.map((user) => {
return {
service: user.technology,
marketingPage: user.marketingPage,
marketingPageUrl: user.marketingPageUrl,
highlightskill: user.highlightskill,
};
})
.filter(
(value, index, self) =>
index === self.findIndex((t) => t.service === value.service)
);
let crmDataResult = [];
let skills = [];

const hasCrmCredentials = process.env.CRM_APP_ID && process.env.CRM_APP_SECRET;
if (hasCrmCredentials) {
try {
crmDataResult = await getViewDataFromCRM();
skills = await getUsersSkills();
skills = skills
.map((user) => {
return {
service: user.technology,
marketingPage: user.marketingPage,
marketingPageUrl: user.marketingPageUrl,
highlightskill: user.highlightskill,
};
})
.filter(
(value, index, self) =>
index === self.findIndex((t) => t.service === value.service)
);
} catch (error) {
console.warn('Failed to fetch CRM data:', error.message);
console.warn('Continuing build without CRM data...');
}
} else {
console.warn('CRM credentials not found. Skipping CRM data fetch. Set CRM_APP_ID and CRM_APP_SECRET in .env.development to enable.');
}

// load data for the sample profile
loadSampleData(crmDataResult);
Expand Down Expand Up @@ -423,15 +473,15 @@ exports.createPages = async function ({ actions, graphql }) {
}
`);

const skillUrls = data.allSkillUrls.nodes.map((node) => {
const skillUrls = data.allSkillUrls?.nodes?.map((node) => {
return node;
});
}) || [];

const peopleCRM = data.peopleCRM.nodes.map((node) => {
const peopleCRM = data.peopleCRM?.nodes?.map((node) => {
return node;
});
}) || [];

const youtubePlaylists = data.peopleYoutubePlaylists.nodes;
const youtubePlaylists = data.peopleYoutubePlaylists?.nodes || [];
const peopleAudios = data.peopleAudios.nodes.map((node) => {
return {
src: node.publicURL,
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"gatsby-transformer-remark": "^3.2.0",
"gatsby-transformer-sharp": "^5.16.0",
"gray-matter": "^4.0.3",
"history": "^5.3.0",
"https-browserify": "^1.0.0",
"lottie-web": "^5.13.0",
"moment": "^2.30.1",
Expand All @@ -73,7 +72,6 @@
"query-string": "^9.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-ga": "^3.3.1",
"react-github-btn": "^1.4.0",
"react-github-calendar": "^4.5.11",
"react-helmet": "^6.1.0",
Expand All @@ -82,13 +80,10 @@
"react-lazy-youtube": "^1.0.1",
"react-pose": "^4.0.10",
"react-responsive-modal": "^6.4.2",
"react-youtube": "^10.1.0",
"ssw.megamenu": "^4.13.8",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"styled-components": "^6.3.12",
"to": "^0.2.9",
"update": "^0.7.4",
"url": "^0.11.4",
"util": "^0.12.5",
"webpack-assets-manifest": "^5.2.1"
Expand All @@ -103,7 +98,6 @@
"array-flat-polyfill": "^1.0.1",
"autoprefixer": "^10.4.27",
"ava": "^6.4.1",
"babel-eslint": "^10.1.0",
"chrome-launcher": "^1.2.1",
"directory-named-webpack-plugin": "^4.1.0",
"dotenv": "^17.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/eventHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function mapEvent(properties) {
startdatetime: startdatetime,
endDateTime: endDateTime,
isSameDay: startdatetime === endDateTime,
daysToGo: moment(startdatetime).diff(moment(today), 'days'),
daysToGo: moment(startdatetime, 'DD MMM YYYY').diff(moment(today, 'DD MMM YYYY'), 'days'),

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

This PR is titled/described as a dependency-cleanup, but this hunk changes runtime behavior in mapEvent() (Moment parsing for daysToGo). Please either (a) drop this change from the dependency-removal PR, or (b) update the PR description to explain the behavioral fix and why it’s needed (and ideally add coverage / verification steps for it).

Copilot uses AI. Check for mistakes.
technologycategory: properties.Category,
eventtype: properties.CalendarType,
presenter: properties.Presenter,
Expand Down
Loading
Loading