Skip to content

Commit

Permalink
Merge pull request #111 from MicroPad/101-move-shared-code
Browse files Browse the repository at this point in the history
Splitting non-react code from react code
  • Loading branch information
NickGeek authored Jan 27, 2019
2 parents 853c41c + 8c35c48 commit 3ecf7b8
Show file tree
Hide file tree
Showing 77 changed files with 130 additions and 130 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { filter, map } from 'rxjs/operators';
import { Action, isType } from 'redux-typescript-actions';
import { actions } from '../actions';
import { INotepadStoreState } from '../types/NotepadTypes';
import { isAction } from '../util';
import { isAction } from '../../react-web/util';
import { NewNotepadObjectAction } from '../types/ActionTypes';
import { IStoreState } from '../types';
import { FlatNotepad } from 'upad-parse/dist';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { HashTagSearchResult, HashTagSearchResults } from '../reducers/SearchRed
import { IStoreState } from '../types';
import { Store } from 'redux';
import { SearchIndices } from '../types/ActionTypes';
import { isAction } from '../util';
import { indexNotepads } from '../SearchWorker';
import { isAction } from '../../react-web/util';
import { indexNotepads } from '../../react-web/SearchWorker';

export namespace SearchEpics {
export const refreshIndices = action$ =>
export const refreshIndices$ = action$ =>
action$.pipe(
isAction(actions.saveNotepad.done),
map(() => actions.indexNotepads.started(undefined))
Expand Down Expand Up @@ -62,7 +62,7 @@ export namespace SearchEpics {
);

export const searchEpics$ = combineEpics(
refreshIndices,
refreshIndices$,
indexNotepads$,
search$
);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MicroPadReducer } from '../types/ReducerType';
import { IStoreState } from '../types';
import * as deepFreeze from 'deep-freeze';
import { isDev } from '../util';
import { isDev } from '../../react-web/util';
import { Action } from 'redux-typescript-actions';
import { NotepadsReducer } from './NotepadsReducer';
import { NoteReducer } from './NoteReducer';
Expand Down
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.
4 changes: 2 additions & 2 deletions app/src/react-web/DifferenceEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import SyncWorker from '!workerize-loader!./SyncWorker.js';

import { Observable } from 'rxjs';
import { MICROPAD_URL } from './types';
import { MICROPAD_URL } from '../core/types';
import { map, retry } from 'rxjs/operators';
import { AssetList, ISyncedNotepad, ISyncWorker, SyncedNotepadList } from './types/SyncTypes';
import { AssetList, ISyncedNotepad, ISyncWorker, SyncedNotepadList } from '../core/types/SyncTypes';
import { parse } from 'date-fns';
import { Base64 } from 'js-base64';
import * as QueryString from 'querystring';
Expand Down
2 changes: 1 addition & 1 deletion app/src/react-web/SearchWorker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localforage from 'localforage';
import { FlatNotepad, Translators, Trie } from 'upad-parse/dist';
import { SearchIndices } from './types/ActionTypes';
import { SearchIndices } from '../core/types/ActionTypes';

export async function indexNotepads(indices: SearchIndices) {
const NOTEPAD_STORAGE = localforage.createInstance({
Expand Down
2 changes: 1 addition & 1 deletion app/src/react-web/ThemeValues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ITheme, ThemeName } from './types/Themes';
import { ITheme, ThemeName } from '../core/types/Themes';

const classicBackground = require('./assets/background.png');
const filledBackground = require('./assets/dark-background.png');
Expand Down
2 changes: 1 addition & 1 deletion app/src/react-web/components/HelpMessageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { CSSProperties } from 'react';
import { isMobile } from '../util';
import * as Materialize from 'materialize-css/dist/js/materialize';
import { ITheme } from '../types/Themes';
import { ITheme } from '../../core/types/Themes';

export interface IHelpMessageComponentProps {
show: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { IRenameNotepadObjectAction } from '../../types/NotepadTypes';
import { IRenameNotepadObjectAction } from '../../../core/types/NotepadTypes';
import { Button, Col, Icon, Input, Modal, Row } from 'react-materialize';
import { APP_NAME } from '../../types';
import { APP_NAME } from '../../../core/types';
import { Dialog } from 'src/react-web/dialogs';
import { Notepad } from 'upad-parse/dist';
import { NPXObject } from 'upad-parse/dist/NPXObject';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as React from 'react';
import { CSSProperties } from 'react';
import './NotepadExplorerComponent.css';
import { IRenameNotepadObjectAction } from '../../types/NotepadTypes';
import { IRenameNotepadObjectAction } from '../../../core/types/NotepadTypes';
import { Icon } from 'react-materialize';
import TreeView from 'react-treeview';
import { generateGuid } from '../../util';
import ExplorerOptionsComponent from './ExplorerOptionsComponent';
import { NewNotepadObjectAction } from '../../types/ActionTypes';
import { NewNotepadObjectAction } from '../../../core/types/ActionTypes';
import HelpMessageComponent from '../../containers/HelpMessageContainer';
import { Dialog } from '../../dialogs';
import SyncOptionsComponent from '../../containers/SyncOptionsContainer';
import { Note, Notepad, Parent, Section } from 'upad-parse/dist';
import { ITheme } from '../../types/Themes';
import { NEW_SECTION_HELP, OPEN_NOTE_HELP, OPEN_NOTEPAD_HELP } from '../../types';
import { ITheme } from '../../../core/types/Themes';
import { NEW_SECTION_HELP, OPEN_NOTE_HELP, OPEN_NOTEPAD_HELP } from '../../../core/types';
import DueDateListComponent from '../../containers/DueDateListContainer';

export interface INotepadExplorerComponentProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import * as enzyme from 'enzyme';
import AppNameComponent from './AppNameComponent';
import { APP_NAME } from '../../../types';
import { APP_NAME } from '../../../../core/types';
import '../../../setupTests';

describe(`version number tests`, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { APP_NAME } from '../../../types';
import { APP_NAME } from '../../../../core/types';
import './AppNameComponent.css';
import { IVersion } from '../../../reducers/AppReducer';
import { IVersion } from '../../../../core/reducers/AppReducer';

export default class AppNameComponent extends React.Component<IVersion> {
private readonly statusToSymbol = {
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/components/header/HeaderComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { CSSProperties } from 'react';
import AppNameComponent from '../../containers/header/AppNameContainer';
import { Dropdown, Icon, Navbar, NavItem } from 'react-materialize';
import NotepadDropdownComponent from '../../containers/header/NotepadDropdownContainer';
import { INotepadStoreState } from '../../types/NotepadTypes';
import { INotepadStoreState } from '../../../core/types/NotepadTypes';
import NotepadBreadcrumbs from '../../containers/header/NotepadBreadcrumbsContainer';
import SearchComponent from '../../containers/SearchContainer';
import ThemeDropdownComponent from '../../containers/header/ThemeDropdownContainer';
import { ITheme } from '../../types/Themes';
import { ITheme } from '../../../core/types/Themes';

export interface IHeaderComponentProps {
isFullScreen: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CSSProperties } from 'react';
import './NotepadBreadcrumbsComponent.css';
import { Breadcrumb, MenuItem } from 'react-materialize';
import { generateGuid } from '../../../util';
import { ThemeName } from '../../../types/Themes';
import { ThemeName } from '../../../../core/types/Themes';

export interface INotepadBreadcrumbsProps {
themeName: ThemeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Col, Dropdown, Icon, Modal, NavItem, ProgressBar, Row } from 'react-mat
import UploadNotepadsComponent from '../../containers/header/UploadNotepadsContainer';
import { generateGuid } from '../../util';
import { Dialog } from '../../dialogs';
import { SYNC_NAME } from '../../types';
import { SYNC_NAME } from '../../../core/types';
import LoginComponent from '../../containers/LoginContainer';
import { ISyncState } from '../../reducers/SyncReducer';
import { ISyncState } from '../../../core/reducers/SyncReducer';
import ManageSyncComponent from '../../containers/ManageSyncContainer';
import { FlatNotepad, Note } from 'upad-parse/dist';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Dropdown, Icon, NavItem } from 'react-materialize';
import { ThemeName } from '../../types/Themes';
import { ThemeName } from '../../../core/types/Themes';
import { ThemeValues } from '../../ThemeValues';

export interface IThemeDropdownComponentProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as React from 'react';
import { InsertElementAction } from '../../types/ActionTypes';
import { InsertElementAction } from '../../../core/types/ActionTypes';
import './elements/NoteElementComponent.css';
import './InsertElementComponent.css';
import { IInsertElementState } from '../../reducers/NoteReducer';
import { IInsertElementState } from '../../../core/reducers/NoteReducer';
import { generateGuid } from 'src/react-web/util';
import { Icon } from 'react-materialize';
import JupyterInserterComponent from './elements/JupyterInserterComponent';
import { Note } from 'upad-parse/dist';
import { ElementArgs, NoteElement } from 'upad-parse/dist/Note';
import { ITheme } from '../../types/Themes';
import { ITheme } from '../../../core/types/Themes';
import { FullScreenService } from '../../FullscreenService';

export interface IInsertElementComponentProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import * as Materialize from 'materialize-css/dist/js/materialize.js';
import { ProgressBar } from 'react-materialize';
import { filter, map } from 'rxjs/operators';
import { fromEvent, Observable } from 'rxjs';
import { IInsertElementState } from '../../reducers/NoteReducer';
import { IInsertElementState } from '../../../core/reducers/NoteReducer';
import ZoomComponent from '../../containers/ZoomContainer';
import { Note } from 'upad-parse/dist';
import { NoteElement } from 'upad-parse/dist/Note';
import { ITheme } from '../../types/Themes';
import { ITheme } from '../../../core/types/Themes';
import { FullScreenService } from '../../FullscreenService';
import { TOAST_HANDLER } from '../..';
import { generateGuid } from '../../util';
Expand Down
2 changes: 1 addition & 1 deletion app/src/react-web/components/note-viewer/ZoomComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { isMobile } from '../../util';
import { Button, Icon } from 'react-materialize';
import { ITheme } from '../../types/Themes';
import { ITheme } from '../../../core/types/Themes';

export interface IZoomComponentProps {
update: (newZoom: number) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { NoteElement } from 'upad-parse/dist/Note';
import { ITheme } from '../../../types/Themes';
import { ITheme } from '../../../../core/types/Themes';
import { distanceInWordsStrict, format } from 'date-fns';

export const DueInMessageComponent = (props: { dueDate: Date }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { INoteElementComponentProps } from './NoteElementComponent';
import { Button, Row } from 'react-materialize';
import { dataURItoBlob } from '../../../util';
import { Dialog } from '../../../dialogs';
import { ITheme } from '../../../types/Themes';
import { ITheme } from '../../../../core/types/Themes';

export interface IFileElementComponent extends INoteElementComponentProps {
downloadAsset: (filename: string, uuid: string) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Button, Icon } from 'react-materialize';
import './RecordingElementComponent.css';
import { IFileElementComponent } from './FileElementComponent';
import { BAD_BROWSER_AUDIO } from '../../../types';
import { BAD_BROWSER_AUDIO } from '../../../../core/types';
import Recorder from 'opus-recorder';

export default class RecordingElementComponent extends React.Component<IFileElementComponent> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { INoteElementComponentProps } from '../NoteElementComponent';
import { Converter, ConverterOptions, extension } from 'showdown';
import { MarkDownViewer } from './MarkdownViewerHtml';
import { IAppWindow, UNSUPPORTED_MESSAGE } from '../../../../types';
import { IAppWindow, UNSUPPORTED_MESSAGE } from '../../../../../core/types';
import { enableTabs } from './enable-tabs';
import TodoListComponent from './TodoListComponent';
import { debounce } from '../../../../util';
Expand All @@ -11,7 +11,7 @@ import MarkdownHelpComponent from './MarkdownHelpComponent';
import Resizable from 're-resizable';
import { Dialog } from '../../../../dialogs';
import { NoteElement } from 'upad-parse/dist/Note';
import { ITheme } from '../../../../types/Themes';
import { ITheme } from '../../../../../core/types/Themes';
import Twemoji from 'twemoji/2/twemoji.amd';

export interface IMarkdownElementComponentProps extends INoteElementComponentProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-ignore
import MathJax from '!raw-loader!../../../../assets/MathJax.js';
import { ITheme } from '../../../../types/Themes';
import { ITheme } from '../../../../../core/types/Themes';

export namespace MarkDownViewer {
export const getHtml = (id: string, theme: ITheme, fontSize: string = '16px'): string => `<!DOCTYPE html>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './PrintViewComponent.css';
import MarkdownElementComponent from '../note-viewer/elements/markdown/MarkdownElementComponent';
import { Note } from 'upad-parse/dist';
import { NoteElement } from 'upad-parse/dist/Note';
import { ITheme } from '../../types/Themes';
import { ITheme } from '../../../core/types/Themes';
import { ThemeValues } from '../../ThemeValues';

export interface IPrintViewComponentProps {
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/components/search/SearchComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { shareReplay } from 'rxjs/operators';
import { FlatNotepad } from 'upad-parse/dist';
import { Subscription } from 'rxjs/Subscription';
import { fromEvent } from 'rxjs';
import { HashTagSearchResult, HashTagSearchResults } from '../../reducers/SearchReducer';
import { RestoreJsonNotepadAndLoadNoteAction, SearchIndices } from '../../types/ActionTypes';
import { HashTagSearchResult, HashTagSearchResults } from '../../../core/reducers/SearchReducer';
import { RestoreJsonNotepadAndLoadNoteAction, SearchIndices } from '../../../core/types/ActionTypes';

export interface ISearchComponentProps {
notepad?: FlatNotepad;
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/components/sync/LoginComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Button, Input, Modal, NavItem } from 'react-materialize';
import { APP_NAME, MICROPAD_URL, SYNC_NAME } from '../../types';
import { SyncUser } from '../../types/SyncTypes';
import { APP_NAME, MICROPAD_URL, SYNC_NAME } from '../../../core/types';
import { SyncUser } from '../../../core/types/SyncTypes';
import { Dialog } from '../../dialogs';

export interface ILoginComponentProps {
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/components/sync/ManageSyncComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ISyncState } from '../../reducers/SyncReducer';
import { ISyncState } from '../../../core/reducers/SyncReducer';
import { Modal, NavItem } from 'react-materialize';
import { MICROPAD_URL, SYNC_NAME } from '../../types';
import { MICROPAD_URL, SYNC_NAME } from '../../../core/types';

export interface IManageSyncComponentProps {
syncState: ISyncState;
Expand Down
6 changes: 3 additions & 3 deletions app/src/react-web/components/sync/SyncOptionsComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ISyncState } from '../../reducers/SyncReducer';
import { SYNC_NAME } from '../../types';
import { ISyncedNotepad, SyncUser } from '../../types/SyncTypes';
import { ISyncState } from '../../../core/reducers/SyncReducer';
import { SYNC_NAME } from '../../../core/types';
import { ISyncedNotepad, SyncUser } from '../../../core/types/SyncTypes';
import { DifferenceEngine } from '../../DifferenceEngine';
import { Dialog } from '../../dialogs';
import LoginComponent from '../../containers/LoginContainer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Button, Modal } from 'react-materialize';
import { MICROPAD_URL, SYNC_NAME } from '../../types';
import { MICROPAD_URL, SYNC_NAME } from '../../../core/types';

export const SyncProErrorComponent = () => (
<Modal
Expand Down
2 changes: 1 addition & 1 deletion app/src/react-web/containers/AppBodyContainer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import AppBodyComponent, { IAppBodyComponentProps } from '../components/AppBodyComponent';
import { connect } from 'react-redux';

Expand Down
6 changes: 3 additions & 3 deletions app/src/react-web/containers/DueDateListContainer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import DueDateListComponent, { DueItem, IDueDateListComponentProps } from '../components/explorer/DueDateListComponent';
import { INotepadStoreState } from '../types/NotepadTypes';
import { INotepadStoreState } from '../../core/types/NotepadTypes';
import { connect } from 'react-redux';
import { Action, Dispatch } from 'redux';
import { actions } from '../actions';
import { actions } from '../../core/actions';

export function mapStateToProps({ notepads }: IStoreState): IDueDateListComponentProps {
const notepad = (notepads.notepad || {} as INotepadStoreState).item;
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/containers/HelpMessageContainer.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import {
default as HelpMessageComponent,
IHelpMessageComponentLocalProps,
IHelpMessageComponentProps
} from '../components/HelpMessageComponent';
import { connect } from 'react-redux';
import { Action, Dispatch } from 'redux';
import { actions } from '../actions';
import { actions } from '../../core/actions';
import { ThemeValues } from '../ThemeValues';

export function mapStateToProps({ app }: IStoreState, { message, video }: IHelpMessageComponentLocalProps) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/containers/InsertElementContainer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import { connect } from 'react-redux';
import { Action, Dispatch } from 'redux';
import { actions } from '../actions';
import { actions } from '../../core/actions';
import {
default as InsertElementComponent,
IInsertElementComponentProps
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/containers/LoginContainer.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import {
default as LoginComponent,
ILoginComponentLocalProps,
ILoginComponentProps
} from '../components/sync/LoginComponent';
import { Action, Dispatch } from 'redux';
import { connect } from 'react-redux';
import { actions } from '../actions';
import { actions } from '../../core/actions';

export function mapStateToProps({ sync }: IStoreState, { trigger, manageTrigger }: ILoginComponentLocalProps) {
return {
Expand Down
4 changes: 2 additions & 2 deletions app/src/react-web/containers/ManageSyncContainer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IStoreState } from '../types';
import { IStoreState } from '../../core/types';
import { connect } from 'react-redux';
import { Action, Dispatch } from 'redux';
import { default as ManageSyncComponent, IManageSyncComponentProps } from '../components/sync/ManageSyncComponent';
import { actions } from '../actions';
import { actions } from '../../core/actions';

export function mapStateToProps({ sync }: IStoreState) {
return {
Expand Down
Loading

0 comments on commit 3ecf7b8

Please sign in to comment.