Skip to content

Commit

Permalink
Remove index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Jun 20, 2018
1 parent a8b6664 commit c7ddfd6
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/actions/gallery.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import namespacedTypes from 'namespaced-types';

import config from '@/config';
import { cachedFetch } from '@/utils';
import cachedFetch from '@/utils/cachedFetch';

export const types = namespacedTypes('gallery', [
'SET_ITEMS',
Expand Down
3 changes: 2 additions & 1 deletion src/actions/illust.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import namespacedTypes from 'namespaced-types';

import config from '@/config';
import { cachedFetch, getImagesFromZip } from '@/utils';
import cachedFetch from '@/utils/cachedFetch';
import getImagesFromZip from '@/utils/getImagesFromZip';

export const types = namespacedTypes('illust', [
'SET_ITEM',
Expand Down
2 changes: 0 additions & 2 deletions src/actions/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CSSModules from 'react-css-modules';
import Img from 'react-image';
import ListItem from 'react-mdl/lib/List/ListItem';
import ListItemContent from 'react-mdl/lib/List/ListItemContent';
import { EmojiParser } from '@/utils';
import EmojiParser from '@/utils/EmojiParser';

const Comment = ({ item }) => {
for (const badWord of Comment.badWords) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Masonry from 'react-masonry-component';

import { Item } from '@/components';
import Item from '@/components/Item';

export default class List extends React.Component {
static propTypes = {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import Button from 'react-mdl/lib/Button';
import Textfield from 'react-mdl/lib/Textfield';
import Icon from 'react-mdl/lib/Icon';
import { FormattedMessage, injectIntl } from 'react-intl';
import { moment, Storage, withRef } from '@/utils';
import moment from '@/utils/moment';
import Storage from '@/utils/Storage';
import withRef from '@/utils/withRef';

class Login extends React.Component {
static propTypes = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/TrackPageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import ReactGA from 'react-ga';
import { Route } from 'react-router-dom';

import config from '@/config';
import { Piwik, cachedFetch } from '@/utils';
import Piwik from '@/utils/Piwik';
import cachedFetch from '@/utils/cachedFetch';

export default class TrackPageView extends React.Component {
constructor(props) {
Expand Down
12 changes: 0 additions & 12 deletions src/components/index.js

This file was deleted.

14 changes: 7 additions & 7 deletions src/containers/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import '@/styles/Base.scss';
import '@/styles/Reset.scss';

import { history } from '@/stores';
import {
GalleryContainer,
IllustContainer,
RedirectContainer,
NotFoundContainer
} from '@/containers';
import { ScrollContext, TrackPageView } from '@/components';
import GalleryContainer from '@/containers/GalleryContainer';
import IllustContainer from '@/containers/IllustContainer';
import RedirectContainer from '@/containers/RedirectContainer';
import NotFoundContainer from '@/containers/NotFoundContainer';

import ScrollContext from '@/components/ScrollContext';
import TrackPageView from '@/components/TrackPageView';

const AppContainer = () => (
<Router history={history}>
Expand Down
11 changes: 8 additions & 3 deletions src/containers/GalleryContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import { injectIntl } from 'react-intl';

import config from '@/config';

import { GalleryActions } from '@/actions';
import { InfiniteScroll, List, Loading, Refresh, Message } from '@/components';
import { scrollTo, Storage } from '@/utils';
import * as GalleryActions from '@/actions/gallery';
import InfiniteScroll from '@/components/InfiniteScroll';
import List from '@/components/List';
import Loading from '@/components/Loading';
import Refresh from '@/components/Refresh';
import Message from '@/components/Message';
import scrollTo from '@/utils/scrollTo';
import Storage from '@/utils/Storage';

@injectIntl
export class GalleryContainerWithoutStore extends React.Component {
Expand Down
22 changes: 11 additions & 11 deletions src/containers/IllustContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import { FormattedMessage, injectIntl } from 'react-intl';

import config from '@/config';

import { IllustActions } from '@/actions';
import {
Alert,
Comment,
GifPlayer,
InfiniteScroll,
Loading,
Message
} from '@/components';
import { LoginContainer } from '@/containers';
import { cachedFetch, moment, Storage } from '@/utils';
import * as IllustActions from '@/actions/illust';
import Alert from '@/components/Alert';
import Comment from '@/components/Comment';
import GifPlayer from '@/components/GifPlayer';
import InfiniteScroll from '@/components/InfiniteScroll';
import Loading from '@/components/Loading';
import Message from '@/components/Message';
import LoginContainer from '@/containers/LoginContainer';
import cachedFetch from '@/utils/cachedFetch';
import moment from '@/utils/moment';
import Storage from '@/utils/Storage';

@injectIntl
@CSSModules(styles, { allowMultiple: true })
Expand Down
8 changes: 6 additions & 2 deletions src/containers/LoginContainer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from 'react';
import { injectIntl } from 'react-intl';

import { Alert, Login } from '@/components';
import { cachedFetch, moment, Storage, withRef } from '@/utils';
import Alert from '@/components/Alert';
import Login from '@/components/Login';
import cachedFetch from '@/utils/cachedFetch';
import moment from '@/utils/moment';
import Storage from '@/utils/Storage';
import withRef from '@/utils/withRef';

import config from '@/config';

Expand Down
2 changes: 1 addition & 1 deletion src/containers/NotFoundContainer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { Message } from '@/components';
import Message from '@/components/Message';

const NotFoundContainer = () => <Message />;

Expand Down
2 changes: 1 addition & 1 deletion src/containers/RedirectContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';

import { Message } from '@/components';
import Message from '@/components/Message';

@injectIntl
export default class RedirectContainer extends React.Component {
Expand Down
10 changes: 0 additions & 10 deletions src/containers/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { configureStore } from '@/stores';
import AppContainer from '@/containers/AppContainer';

import { IntlProvider } from 'react-intl';
import { chooseLocale } from '@/locale';
import chooseLocale from '@/locale/chooseLocale';

const lang = chooseLocale(navigator.language);

Expand Down
1 change: 0 additions & 1 deletion src/locale/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/reducers/gallery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GalleryActions } from '@/actions';
import * as GalleryActions from '@/actions/gallery';

const types = GalleryActions.types;

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/illust.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IllustActions } from '@/actions';
import * as IllustActions from '@/actions/illust';

const types = IllustActions.types;

Expand Down
4 changes: 3 additions & 1 deletion src/utils/cachedFetch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// modify from https://www.sitepoint.com/cache-fetched-ajax-requests/
import { hashStr, moment, Storage } from '@/utils';
import hashStr from '@/utils/hashStr';
import moment from '@/utils/moment';
import Storage from '@/utils/Storage';

function buildURL(url, params) {
if (!params) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getImagesFromZip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import JSZip from 'jszip';
import { cachedFetch } from '@/utils';
import cachedFetch from '@/utils/cachedFetch';

export default function getImagesFromZip(zipURL) {
return new Promise(resolve => {
Expand Down
9 changes: 0 additions & 9 deletions src/utils/index.js

This file was deleted.

6 changes: 4 additions & 2 deletions test/actions/galleryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import nock from 'nock';
import mockStore from '../helpers/mockStoreHelper';

import config from '@/config';
import { GalleryActions } from '@/actions';
import * as GalleryActions from '@/actions/gallery';

describe('GalleryActions', () => {
afterEach(() => {
nock.cleanAll();
});

it('fire SET_FETCH_ERROR when fetching sources has been done', done => {
nock(config.baseURL).get(`${config.galleryURI}?tag=nico`).reply(200);
nock(config.baseURL)
.get(`${config.galleryURI}?tag=nico`)
.reply(200);

const expectedActions = [
{
Expand Down
2 changes: 1 addition & 1 deletion test/utils/EmojiParserTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { EmojiParser } from '@/utils';
import EmojiParser from '@/utils/EmojiParser';

describe('EmojiParser', () => {
it('should parse out with a <img />', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/StorageTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { Storage } from '@/utils';
import Storage from '@/utils/Storage';

describe('Storage', () => {
it('set and get storage should work', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/cachedFetchTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import fetchMock from 'fetch-mock';
import { cachedFetch } from '@/utils';
import cachedFetch from '@/utils/cachedFetch';

describe('cachedFetch', () => {
afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/hashStrTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { hashStr } from '@/utils';
import hashStr from '@/utils/hashStr';

describe('hashStr', () => {
it('hashStr of `kotori` should be -1125571242', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/momentTest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { moment } from '@/utils';
import moment from '@/utils/moment';

describe('moment', () => {
it('convert YYYY-MM-DD H:i:s to JST', () => {
Expand Down

0 comments on commit c7ddfd6

Please sign in to comment.