Skip to content

Commit

Permalink
Merge pull request #113 from MicroPad/next-dev
Browse files Browse the repository at this point in the history
v3.13.0
  • Loading branch information
NickGeek authored Jan 27, 2019
2 parents 083cfe6 + b2b3086 commit 58021d0
Show file tree
Hide file tree
Showing 141 changed files with 882 additions and 708 deletions.
603 changes: 346 additions & 257 deletions INCLUDED.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "micropad",
"version": "3.12.6",
"version": "3.13.0",
"repository": {
"type": "git",
"url": "https://github.com/MicroPad/Web.git"
Expand Down
Binary file removed app/src/assets/background.png
Binary file not shown.
Binary file removed app/src/assets/click-to-insert-dark.png
Binary file not shown.
Binary file removed app/src/assets/click-to-make-dark.png
Binary file not shown.
Binary file removed app/src/assets/click-to-make-open-dark.png
Binary file not shown.
Binary file removed app/src/assets/click-to-make.png
Binary file not shown.
Binary file removed app/src/assets/dark-background.png
Binary file not shown.
37 changes: 0 additions & 37 deletions app/src/containers/header/NotepadBreadcrumbsContainer.ts

This file was deleted.

5 changes: 4 additions & 1 deletion app/src/actions.ts → app/src/core/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export const actions = {
restoreJsonNotepadAndLoadNote: actionCreator<RestoreJsonNotepadAndLoadNoteAction>('PARSE_JSON_NOTEPAD_AND_LOAD_NOTE'),
newNotepad: actionCreator<FlatNotepad>('NEW_NOTEPAD'),
flipFullScreenState: actionCreator<void>('FLIP_FULL_SCREEN'),
exitFullScreen: actionCreator<void>('EXIT_FULL_SCREEN'),
openBreadcrumb: actionCreator<string>('OPEN_BREADCRUMB'),
deleteNotepad: actionCreator<string>('DELETE_NOTEPAD'),
exportNotepad: actionCreator<void>('EXPORT_NOTEPAD'),
expandSection: actionCreator<string>('OPEN_SECTION'),
Expand Down Expand Up @@ -91,5 +93,6 @@ export const actions = {
selectTheme: actionCreator<ThemeName>('SELECT_THEME'),
moveNotepadObject: actionCreator<MoveNotepadObjectAction>('MOVE_NOTEPAD_OBJECT'),
quickMarkdownInsert: actionCreator<void>('QUICK_MARKDOWN_INSERT'),
quickNotepad: actionCreator<void>('QUICK_NOTEPAD')
quickNotepad: actionCreator<void>('QUICK_NOTEPAD'),
flashExplorer: actionCreator<void>('FLASH_EXPLORER')
};
87 changes: 87 additions & 0 deletions app/src/core/epics/ExplorerEpics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { combineEpics } from 'redux-observable';
import { concatMap, filter, map, startWith, tap } from 'rxjs/operators';
import { Action, isType } from 'redux-typescript-actions';
import { actions } from '../actions';
import { INotepadStoreState } from '../types/NotepadTypes';
import { isAction } from '../../react-web/util';
import { NewNotepadObjectAction } from '../types/ActionTypes';
import { IStoreState } from '../types';
import { FlatNotepad, Note } from 'upad-parse/dist';
import { FlatSection } from 'upad-parse/dist/FlatNotepad';
import { Observable } from 'rxjs';
import { Store } from 'redux';
import { ThemeValues } from '../../react-web/ThemeValues';

export namespace ExplorerEpics {
export const expandAll$ = (action$, store) =>
action$.pipe(
filter((action: Action<void>) => isType(action, actions.expandAllExplorer.started)),
map(() => (store.getState().notepads.notepad || <INotepadStoreState> {}).item),
filter(Boolean),
map((notepad: FlatNotepad) => [
...Object.keys(notepad.sections),
...Object.keys(notepad.notes)
]),
map((allRefs: string[]) => actions.expandAllExplorer.done({ params: undefined, result: allRefs }))
);

export const autoLoadNewSection$ = (action$, store) =>
action$.pipe(
isAction(actions.newSection),
map((action: Action<NewNotepadObjectAction>) => [action.payload, (<IStoreState> store.getState()).notepads.notepad!.item]),
filter(([insertAction, notepad]: [NewNotepadObjectAction, FlatNotepad]) => !!insertAction && !!notepad),
map(([insertAction, notepad]: [NewNotepadObjectAction, FlatNotepad]) => {
const parentRef = insertAction.parent || undefined;

return Object.values((notepad as FlatNotepad).sections).find(s => s.title === insertAction.title && s.parentRef === parentRef);
}),
filter(Boolean),
map((newSection: FlatSection) => actions.expandSection(newSection.internalRef))
);

export const openBreadcrumb$ = (action$: Observable<Action<string>>, store: Store<IStoreState>) =>
action$.pipe(
isAction(actions.openBreadcrumb),
map(action => action.payload),
filter(() => !!store.getState().notepads.notepad && !!store.getState().notepads.notepad!.item),
map((ref: string) =>
store.getState().notepads.notepad!.item!.notes[ref]
|| store.getState().notepads.notepad!.item!.sections[ref]
),
map((notepadObj: FlatSection | Note) => {
const notepad = store.getState().notepads.notepad!.item!;
return [...notepad.pathFrom(notepadObj).slice(1), notepadObj];
}),
concatMap((path: Array<FlatSection | Note>) =>
[
actions.exitFullScreen(),
actions.collapseAllExplorer(),
...path
.filter(obj => !(obj as Note).parent)
.map(section => actions.expandSection(section.internalRef)),
actions.flashExplorer()
]
),
tap(a => console.log(a))
);

export const flashExplorer$ = (action$: Observable<Action<void>>, store: Store<IStoreState>) =>
action$.pipe(
isAction(actions.flashExplorer),
tap(() => {
const theme = ThemeValues[store.getState().app.theme];
const explorer = document.getElementById('notepad-explorer')!;

explorer.style.backgroundColor = theme.accent;
setTimeout(() => explorer.style.backgroundColor = theme.chrome, 150);
}),
filter(() => false)
);

export const explorerEpics$ = combineEpics(
expandAll$,
autoLoadNewSection$,
openBreadcrumb$,
flashExplorer$
);
}
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.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import { version } from '../../package.json';
import { version } from '../../../package.json';

import { Action } from 'redux';
import { MicroPadReducer } from '../types/ReducerType';
Expand Down Expand Up @@ -48,6 +48,11 @@ export class AppReducer extends MicroPadReducer<IAppStoreState> {
...state,
isFullScreen: !state.isFullScreen
};
} else if (isType(action, actions.exitFullScreen)) {
return {
...state,
isFullScreen: false
};
} else if (isType(action, actions.updateDefaultFontSize)) {
return {
...state,
Expand Down
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.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Action, ActionCreator } from 'redux-typescript-actions';
import { IStoreState } from './index';
import { IStoreState } from '.';

export type ReducerHandler<S, A> = (state: S, action: Action<A>) => S;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 0 additions & 43 deletions app/src/epics/ExplorerEpics.ts

This file was deleted.

Loading

0 comments on commit 58021d0

Please sign in to comment.