Skip to content

Commit

Permalink
#35: create index, help and reducers files
Browse files Browse the repository at this point in the history
 create index File for the visualization with all Components and Imports, create the empty Help File and define config props and data actions handler in reducers
  • Loading branch information
miriamgehbauer committed Oct 1, 2021
1 parent 64225f3 commit e68c557
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ui/src/visualizations/File-Evolution/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

import cx from 'classnames';
import styles from './styles.scss';

export default () => (
<div className={cx('box', styles.help)}>
<h1 className="title">File Evolution Help</h1>
</div>
);
17 changes: 17 additions & 0 deletions ui/src/visualizations/File-Evolution/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

import ChartComponent from './chart';
import ConfigComponent from './config.js';
import HelpComponent from './help.js';
import saga from './sagas';
import reducer from './reducers';

export default {
id: 'fileEvolution',
label: 'File Evolution',
saga,
reducer,
ChartComponent,
ConfigComponent,
HelpComponent
};
27 changes: 27 additions & 0 deletions ui/src/visualizations/File-Evolution/reducers/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

import { handleActions } from 'redux-actions';
import _ from 'lodash';

export default handleActions(
{
SET_COMMIT_BOX_WIDTH: (state, action) => _.assign({}, state, { commitBoxWidth: action.payload }),
SET_COMMIT_BOX_HEIGHT: (state, action) => _.assign({}, state, { commitBoxHeight: action.payload }),
SET_COMMIT_BOX_COLOR: (state, action) => _.assign({}, state, { commitBoxColor: action.payload }),
SET_SELECTED_AUTHORS: (state, action) => _.assign({}, state, { selectedAuthors: [...action.payload] }),
SET_SELECTED_BRANCHES: (state, action) => _.assign({}, state, { selectedBranches: [...action.payload] }),
SET_SHOW_COMMIT_DATE: (state, action) => _.assign({}, state, { showCommitDate: action.payload }),
SET_SHOW_COMMIT_MESSAGE: (state, action) => _.assign({}, state, { showCommitMessage: action.payload }),
SET_SHOW_COMMIT_AUTHOR: (state, action) => _.assign({}, state, { showCommitAuthor: action.payload })
},
{
commitBoxWidth: 100,
commitBoxHeight: 100,
commitBoxColor: 'author',
selectedAuthors: [],
selectedBranches: [],
showCommitDate: true,
showCommitMessage: 'header',
showCommitAuthor: false
}
);
23 changes: 23 additions & 0 deletions ui/src/visualizations/File-Evolution/reducers/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

import { handleActions } from 'redux-actions';
import _ from 'lodash';

export default handleActions(
{
REQUEST_FILE_EVOLUTION_DATA: state => _.assign({}, state, { isFetching: true }),
RECEIVE_FILE_EVOLUTION_DATA: (state, action) => {
console.log(action.payload);
return _.assign({}, state, {
data: action.payload,
isFetching: false,
receivedAt: action.meta.receivedAt
});
}
},
{
data: {},
lastFetched: null,
isFetching: null
}
);
10 changes: 10 additions & 0 deletions ui/src/visualizations/File-Evolution/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

import config from './config.js';
import data from './data.js';
import { combineReducers } from 'redux';

export default combineReducers({
data,
config
});

0 comments on commit e68c557

Please sign in to comment.