Skip to content

Commit

Permalink
react: Move /lib to react/src/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Dec 26, 2018
1 parent 47d25d5 commit 9ef1e1a
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 93 deletions.
92 changes: 0 additions & 92 deletions lib/constants.js

This file was deleted.

1 change: 0 additions & 1 deletion react/src/lib

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
101 changes: 101 additions & 0 deletions react/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { normalize, schema } from "normalizr";

import githubActivities from "../data/scraped/gh_activities.json";
import githubActors from "../data/scraped/gh_actors.json";
import myActivities from "../data/my_activities.json";
import myActors from "../data/my_actors.json";
import { expandRelations } from "./expand-data";
import { validateActors } from "./precheck-data";
import { CVActivityType } from "./types";

export const activityTypes: CVActivityType[] = [
{
name: "Open Source Contributions",
singular_name: "Open Source Contribution",
component_name: "Patch"
},
{
name: "Applications",
singular_name: "Application",
component_name: "SoftwareApp"
},
{
name: "Libraries",
singular_name: "Library",
component_name: "SoftwareLib"
},
{
name: "Work",
singular_name: "Work",
component_name: "Work"
},
{
name: "Publications",
singular_name: "Publication",
component_name: "Publication"
},
{
name: "Volunteering",
singular_name: "Volunteering",
component_name: "Volunteer"
},
{
name: "Websites",
singular_name: "Website",
component_name: "Website"
},
{
name: "Articles",
singular_name: "Article",
component_name: "Article"
}
];

export const DEFAULT_SELECTED_FILTERS = [
"Hide Spelling Contributions",
"Hide Documentation Contributions",
"Hide Code Style Contributions",
"Hide Unmerged Contributions"
];

export const ACTORS = [...githubActors, ...myActors];

validateActors(ACTORS);

// Resolve ID to object relationships so they're available in data
export const ACTIVITIES = expandRelations(
[...githubActivities, ...myActivities],
ACTORS
);

const activityType = new schema.Entity(
"activityTypes",
{},
{
idAttribute: "component_name"
}
);

const language = new schema.Entity("languages", {}, { idAttribute: "name" });
const actor = new schema.Entity(
"actors",
{ languages: [language] },
{
idAttribute: "id"
}
);
const normalizedActivityTypes = normalize(activityTypes, [activityType]);
const activity = new schema.Entity(
"activities",
{ actor, component_name: activityType },
{
processStrategy: entity =>
Object.assign({}, entity, {
visible: false,
component_name:
normalizedActivityTypes.entities.activityTypes[entity.component_name]
})
}
);

export const INITIAL_DATA = normalize(ACTIVITIES, [activity]);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9ef1e1a

Please sign in to comment.