Skip to content
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

Ida/implement start page #324

Merged
merged 8 commits into from
Dec 3, 2018
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

module.exports = function capitalizeFirstLetterOfEachWord(string) {
if (!string) {
return string;
}
return string.split(' ').map(function (a) {
return a.charAt(0).toUpperCase() + a.slice(1);
}).join(' ');
};
3 changes: 2 additions & 1 deletion packages/common/es5/stringFormatters/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';

exports.camelCaseToUpperSnakeCase = require('./camelCaseToUpperSnakeCase');
exports.capitalizeFirstLetter = require('./capitalizeFirstLetter');
exports.capitalizeFirstLetter = require('./capitalizeFirstLetter');
exports.capitalizeFirstLetterOfEachWord = require('./capitalizeFirstLetterOfEachWord');
2 changes: 1 addition & 1 deletion packages/common/es5/stringFormatters/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de

var exportedFunctions = require('./index');

var expectedFunctions = ['capitalizeFirstLetter', 'camelCaseToUpperSnakeCase'];
var expectedFunctions = ['capitalizeFirstLetter', 'capitalizeFirstLetterOfEachWord', 'camelCaseToUpperSnakeCase'];

describe('stringFormatters', function () {
it('exports expected functions', function () {
Expand Down
7 changes: 7 additions & 0 deletions packages/common/es5/version/getVersionFromRootPackageJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

var rootPackageJson = require('../../../../package.json');

module.exports = function getVersionFromRootPackageJson() {
return rootPackageJson.version;
};
16 changes: 16 additions & 0 deletions packages/common/es5/version/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _getVersionFromRootPackageJson = require('./getVersionFromRootPackageJson');

Object.defineProperty(exports, 'getVersionFromRootPackageJson', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_getVersionFromRootPackageJson).default;
}
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function capitalizeFirstLetterOfEachWord(string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's great you add utilities!

Copy link
Contributor

Choose a reason for hiding this comment

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

even if you don't need it for username when you use name instead, we can still keep this utility

if (!string) {
return string
}
return string
.split(' ')
.map(a => a.charAt(0).toUpperCase() + a.slice(1))
.join(' ')
}
1 change: 1 addition & 0 deletions packages/common/src/stringFormatters/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
exports.camelCaseToUpperSnakeCase = require('./camelCaseToUpperSnakeCase')
exports.capitalizeFirstLetter = require('./capitalizeFirstLetter')
exports.capitalizeFirstLetterOfEachWord = require('./capitalizeFirstLetterOfEachWord')
6 changes: 5 additions & 1 deletion packages/common/src/stringFormatters/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const exportedFunctions = require('./index')

const expectedFunctions = ['capitalizeFirstLetter', 'camelCaseToUpperSnakeCase']
const expectedFunctions = [
'capitalizeFirstLetter',
'capitalizeFirstLetterOfEachWord',
'camelCaseToUpperSnakeCase',
]

describe('stringFormatters', () => {
it('exports expected functions', () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/common/src/version/getVersionFromRootPackageJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const rootPackageJson = require('../../../../package.json')

module.exports = function getVersionFromRootPackageJson() {
return rootPackageJson.version
}
3 changes: 3 additions & 0 deletions packages/common/src/version/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export {
default as getVersionFromRootPackageJson,
} from './getVersionFromRootPackageJson'
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ShortcutsDisplay,
} from 'coreModules/keyboardShortcuts/components'

import Home from '../home/Async'
import Start from '../start/Async'
import SpecimensMammals from '../specimensMammals/Async'
import PageNotFound from '../pageNotFound/Async'
import Settings from '../settings/Async'
Expand Down Expand Up @@ -53,7 +53,7 @@ class App extends Component {
<KeyboardShortcuts shortcuts={this.shortcuts} />
<ViewWrap leftSidebarEnabled leftSidebarTogglable topMenuEnabled>
<Switch>
<Route component={Home} exact path={match.url} />
<Route component={Start} exact path={match.url} />
<Route
component={SpecimensMammals}
exact
Expand Down
10 changes: 0 additions & 10 deletions packages/ui/src/apps/collectionsUi/viewModules/home/Async.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ import { createAsyncView } from 'coreModules/bootstrap/higherOrderComponents'
import { MODULE_NAME } from './constants'

export default createAsyncView({
modules: () => {
return [
import('coreModules/search'),
import('domainModules/locality'),
import('domainModules/storage'),
import('domainModules/taxon'),
import('domainModules/agent'),
import('coreModules/form'),
]
},
name: MODULE_NAME,
view: () => {
return import('./index.js')
Expand Down
Loading