From 333ac62b6194e8192e19ddfa026c021028a2be0a Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 26 Feb 2018 22:22:56 -0800 Subject: [PATCH] further refactor ComposeBox --- bin/svgs.js | 2 +- routes/_actions/instances.js | 10 ++- routes/_components/compose/ComposeBox.html | 82 ++----------------- routes/_components/compose/ComposeButton.html | 24 ++++++ routes/_components/compose/ComposeInput.html | 62 ++++++++++++++ .../compose/ComposeLengthGauge.html | 10 ++- .../compose/ComposeLengthIndicator.html | 18 ++-- routes/_database/constants.js | 2 +- routes/_static/statuses.js | 2 +- routes/_store/computations.js | 2 + routes/_store/statusComputations.js | 13 +++ routes/_store/store.js | 3 +- 12 files changed, 141 insertions(+), 89 deletions(-) create mode 100644 routes/_components/compose/ComposeButton.html create mode 100644 routes/_components/compose/ComposeInput.html create mode 100644 routes/_store/statusComputations.js diff --git a/bin/svgs.js b/bin/svgs.js index c5f7f35f..ed7b4db6 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -27,5 +27,5 @@ module.exports = [ {id: 'fa-ban', src: 'node_modules/font-awesome-svg-png/white/svg/ban.svg', title: 'Ban'}, {id: 'fa-camera', src: 'node_modules/font-awesome-svg-png/white/svg/camera.svg', title: 'Camera'}, {id: 'fa-smile', src: 'node_modules/font-awesome-svg-png/white/svg/smile-o.svg', title: 'Smile'}, - {id: 'fa-exclamation-triangle', src: 'node_modules/font-awesome-svg-png/white/svg/exclamation-triangle.svg', title: 'Warning'}, + {id: 'fa-exclamation-triangle', src: 'node_modules/font-awesome-svg-png/white/svg/exclamation-triangle.svg', title: 'Warning'} ] diff --git a/routes/_actions/instances.js b/routes/_actions/instances.js index adfb9149..6b22c112 100644 --- a/routes/_actions/instances.js +++ b/routes/_actions/instances.js @@ -19,7 +19,12 @@ export function changeTheme (instanceName, newTheme) { export function switchToInstance (instanceName) { let instanceThemes = store.get('instanceThemes') - store.set({currentInstance: instanceName}) + store.set({ + currentInstance: instanceName, + searchResults: null, + queryInSearch: '', + rawInputTextInCompose: '' + }) store.save() switchToTheme(instanceThemes[instanceName]) } @@ -41,7 +46,8 @@ export async function logOutOfInstance (instanceName) { loggedInInstancesInOrder: loggedInInstancesInOrder, currentInstance: newInstance, searchResults: null, - queryInSearch: '' + queryInSearch: '', + rawInputTextInCompose: '' }) store.save() toast.say(`Logged out of ${instanceName}`) diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html index a5c77941..cd931a87 100644 --- a/routes/_components/compose/ComposeBox.html +++ b/routes/_components/compose/ComposeBox.html @@ -1,17 +1,10 @@
- - + + - - + +
diff --git a/routes/_components/compose/ComposeButton.html b/routes/_components/compose/ComposeButton.html new file mode 100644 index 00000000..c77f7a08 --- /dev/null +++ b/routes/_components/compose/ComposeButton.html @@ -0,0 +1,24 @@ + + + \ No newline at end of file diff --git a/routes/_components/compose/ComposeInput.html b/routes/_components/compose/ComposeInput.html new file mode 100644 index 00000000..d48b4fae --- /dev/null +++ b/routes/_components/compose/ComposeInput.html @@ -0,0 +1,62 @@ + + + \ No newline at end of file diff --git a/routes/_components/compose/ComposeLengthGauge.html b/routes/_components/compose/ComposeLengthGauge.html index d23811be..1bcf9d48 100644 --- a/routes/_components/compose/ComposeLengthGauge.html +++ b/routes/_components/compose/ComposeLengthGauge.html @@ -1,4 +1,4 @@ - @@ -20,9 +20,11 @@