Add manifest.json, icons and install button, flatten client/src
This commit is contained in:
parent
a219e689c1
commit
474afda9c2
105 changed files with 338 additions and 283 deletions
31
client/js/modules/widthUpdates.js
Normal file
31
client/js/modules/widthUpdates.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { getCharWidth } from 'state/app';
|
||||
import { updateMessageHeight } from 'state/messages';
|
||||
import { when } from 'utils/observe';
|
||||
import { measureScrollBarWidth } from 'utils';
|
||||
import { addResizeListener } from 'utils/size';
|
||||
|
||||
const menuWidth = 200;
|
||||
const messagePadding = 30;
|
||||
const smallScreen = 600;
|
||||
|
||||
export default function widthUpdates({ store }) {
|
||||
when(store, getCharWidth, charWidth => {
|
||||
window.messageIndent = 6 * charWidth;
|
||||
const scrollBarWidth = measureScrollBarWidth();
|
||||
let prevWrapWidth;
|
||||
|
||||
function updateWidth(windowWidth) {
|
||||
let wrapWidth = windowWidth - scrollBarWidth - messagePadding;
|
||||
if (windowWidth > smallScreen) {
|
||||
wrapWidth -= menuWidth;
|
||||
}
|
||||
|
||||
if (wrapWidth !== prevWrapWidth) {
|
||||
prevWrapWidth = wrapWidth;
|
||||
store.dispatch(updateMessageHeight(wrapWidth, charWidth, windowWidth));
|
||||
}
|
||||
}
|
||||
|
||||
addResizeListener(updateWidth, true);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue