rename WINDOW actions to WIN
This commit is contained in:
parent
6ee78ff5d6
commit
352649e3bd
|
@ -134,7 +134,7 @@ export function setMobile(mobile) {
|
|||
|
||||
export function windowResize() {
|
||||
return {
|
||||
type: 'WINDOW_RESIZE',
|
||||
type: 'WIN_RESIZE',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export function openWindow(
|
|||
height = null,
|
||||
) {
|
||||
return {
|
||||
type: 'OPEN_WINDOW',
|
||||
type: 'OPEN_WIN',
|
||||
windowType,
|
||||
title,
|
||||
args,
|
||||
|
@ -34,7 +34,7 @@ export function setWindowArgs(
|
|||
args,
|
||||
) {
|
||||
return {
|
||||
type: 'SET_WINDOW_ARGS',
|
||||
type: 'SET_WIN_ARGS',
|
||||
windowId,
|
||||
args,
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ function showFullscreenWindow(modalType, title) {
|
|||
|
||||
export function closeFullscreenWindows() {
|
||||
return {
|
||||
type: 'CLOSE_FULLSCREEN_WINDOWS',
|
||||
type: 'CLOSE_FULLSCREEN_WINS',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ export function changeWindowType(
|
|||
args = null,
|
||||
) {
|
||||
return {
|
||||
type: 'CHANGE_WINDOW_TYPE',
|
||||
type: 'CHANGE_WIN_TYPE',
|
||||
windowId,
|
||||
windowType,
|
||||
title,
|
||||
|
@ -86,7 +86,7 @@ export function changeWindowType(
|
|||
|
||||
export function setWindowTitle(windowId, title) {
|
||||
return {
|
||||
type: 'SET_WINDOW_TITLE',
|
||||
type: 'SET_WIN_TITLE',
|
||||
windowId,
|
||||
title,
|
||||
};
|
||||
|
@ -152,42 +152,42 @@ export function addToChatInputMessage(windowId, msg, focus = true) {
|
|||
|
||||
export function closeWindow(windowId) {
|
||||
return {
|
||||
type: 'CLOSE_WINDOW',
|
||||
type: 'CLOSE_WIN',
|
||||
windowId,
|
||||
};
|
||||
}
|
||||
|
||||
export function removeWindow(windowId) {
|
||||
return {
|
||||
type: 'REMOVE_WINDOW',
|
||||
type: 'REMOVE_WIN',
|
||||
windowId,
|
||||
};
|
||||
}
|
||||
|
||||
export function focusWindow(windowId) {
|
||||
return {
|
||||
type: 'FOCUS_WINDOW',
|
||||
type: 'FOCUS_WIN',
|
||||
windowId,
|
||||
};
|
||||
}
|
||||
|
||||
export function cloneWindow(windowId) {
|
||||
return {
|
||||
type: 'CLONE_WINDOW',
|
||||
type: 'CLONE_WIN',
|
||||
windowId,
|
||||
};
|
||||
}
|
||||
|
||||
export function toggleMaximizeWindow(windowId) {
|
||||
return {
|
||||
type: 'TOGGLE_MAXIMIZE_WINDOW',
|
||||
type: 'TOGGLE_MAXIMIZE_WIN',
|
||||
windowId,
|
||||
};
|
||||
}
|
||||
|
||||
export function moveWindow(windowId, xDiff, yDiff) {
|
||||
return {
|
||||
type: 'MOVE_WINDOW',
|
||||
type: 'MOVE_WIN',
|
||||
windowId,
|
||||
xDiff,
|
||||
yDiff,
|
||||
|
@ -196,7 +196,7 @@ export function moveWindow(windowId, xDiff, yDiff) {
|
|||
|
||||
export function resizeWindow(windowId, xDiff, yDiff) {
|
||||
return {
|
||||
type: 'RESIZE_WINDOW',
|
||||
type: 'RESIZE_WIN',
|
||||
windowId,
|
||||
xDiff,
|
||||
yDiff,
|
||||
|
@ -205,7 +205,7 @@ export function resizeWindow(windowId, xDiff, yDiff) {
|
|||
|
||||
export function closeAllWindowTypes(windowType) {
|
||||
return {
|
||||
type: 'CLOSE_ALL_WINDOW_TYPE',
|
||||
type: 'CLOSE_ALL_WIN_TYPE',
|
||||
windowType,
|
||||
};
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ export function hideAllWindowTypes(
|
|||
hide,
|
||||
) {
|
||||
return {
|
||||
type: 'HIDE_ALL_WINDOW_TYPE',
|
||||
type: 'HIDE_ALL_WIN_TYPE',
|
||||
windowType,
|
||||
hide,
|
||||
};
|
||||
|
|
|
@ -97,7 +97,7 @@ export default function chatRead(
|
|||
};
|
||||
}
|
||||
|
||||
case 'OPEN_WINDOW': {
|
||||
case 'OPEN_WIN': {
|
||||
const { windowType } = action;
|
||||
if (windowType !== 'CHAT') {
|
||||
return state;
|
||||
|
|
|
@ -33,7 +33,7 @@ export default function contextMenu(
|
|||
};
|
||||
}
|
||||
|
||||
case 'WINDOW_RESIZE':
|
||||
case 'WIN_RESIZE':
|
||||
case 'HIDE_CONTEXT_MENU': {
|
||||
return {
|
||||
...state,
|
||||
|
|
|
@ -12,7 +12,7 @@ const MIN_HEIGHT = 50;
|
|||
// allow Modals
|
||||
const SCREEN_WIDTH_THRESHOLD = 604;
|
||||
// how many windows can be open
|
||||
const MAX_AMOUNT_WINDOWS = 100;
|
||||
const MAX_AMOUNT_WINS = 100;
|
||||
|
||||
function generateWindowId(state) {
|
||||
let windowId = Math.floor(Math.random() * 99999) + 1;
|
||||
|
@ -72,7 +72,7 @@ function clampPos(prefXPos, prefYPos, width, height) {
|
|||
* resort the zIndex, remove gaps
|
||||
*/
|
||||
function sortWindows(newState, force = false) {
|
||||
if (newState.zMax >= MAX_AMOUNT_WINDOWS * 0.5 || force) {
|
||||
if (newState.zMax >= MAX_AMOUNT_WINS * 0.5 || force) {
|
||||
const positions = { ...newState.positions };
|
||||
const ids = Object.keys(positions);
|
||||
const orderedZ = ids
|
||||
|
@ -136,7 +136,7 @@ export default function windows(
|
|||
action,
|
||||
) {
|
||||
switch (action.type) {
|
||||
case 'OPEN_WINDOW': {
|
||||
case 'OPEN_WIN': {
|
||||
/*
|
||||
* prefered xPos, yPos, height adn width
|
||||
* can be given in action (but doesn't have to)
|
||||
|
@ -157,7 +157,7 @@ export default function windows(
|
|||
|
||||
const fullscreen = !state.showWindows || action.fullscreen;
|
||||
|
||||
if (state.windows.length >= MAX_AMOUNT_WINDOWS) {
|
||||
if (state.windows.length >= MAX_AMOUNT_WINS) {
|
||||
return state;
|
||||
}
|
||||
const windowId = generateWindowId(state);
|
||||
|
@ -197,7 +197,7 @@ export default function windows(
|
|||
});
|
||||
}
|
||||
|
||||
case 'REMOVE_WINDOW': {
|
||||
case 'REMOVE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
} = action;
|
||||
|
@ -214,7 +214,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'CLOSE_WINDOW': {
|
||||
case 'CLOSE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
} = action;
|
||||
|
@ -233,7 +233,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'CLOSE_ALL_WINDOW_TYPE': {
|
||||
case 'CLOSE_ALL_WIN_TYPE': {
|
||||
const {
|
||||
windowType,
|
||||
} = action;
|
||||
|
@ -251,7 +251,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'HIDE_ALL_WINDOW_TYPE': {
|
||||
case 'HIDE_ALL_WIN_TYPE': {
|
||||
const {
|
||||
windowType,
|
||||
hide,
|
||||
|
@ -269,7 +269,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'CLONE_WINDOW': {
|
||||
case 'CLONE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
} = action;
|
||||
|
@ -309,7 +309,7 @@ export default function windows(
|
|||
});
|
||||
}
|
||||
|
||||
case 'CHANGE_WINDOW_TYPE': {
|
||||
case 'CHANGE_WIN_TYPE': {
|
||||
const {
|
||||
windowId,
|
||||
windowType,
|
||||
|
@ -337,7 +337,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'FOCUS_WINDOW': {
|
||||
case 'FOCUS_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
} = action;
|
||||
|
@ -361,7 +361,7 @@ export default function windows(
|
|||
});
|
||||
}
|
||||
|
||||
case 'TOGGLE_MAXIMIZE_WINDOW': {
|
||||
case 'TOGGLE_MAXIMIZE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
} = action;
|
||||
|
@ -382,7 +382,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'CLOSE_FULLSCREEN_WINDOWS': {
|
||||
case 'CLOSE_FULLSCREEN_WINS': {
|
||||
const newWindows = state.windows.map((win) => {
|
||||
if (win.fullscreen) {
|
||||
return {
|
||||
|
@ -399,7 +399,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'MOVE_WINDOW': {
|
||||
case 'MOVE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
xDiff,
|
||||
|
@ -425,7 +425,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'RESIZE_WINDOW': {
|
||||
case 'RESIZE_WIN': {
|
||||
const {
|
||||
windowId,
|
||||
xDiff,
|
||||
|
@ -447,7 +447,7 @@ export default function windows(
|
|||
}
|
||||
|
||||
case 'REC_ME':
|
||||
case 'WINDOW_RESIZE': {
|
||||
case 'WIN_RESIZE': {
|
||||
const {
|
||||
innerWidth: width,
|
||||
innerHeight: height,
|
||||
|
@ -529,7 +529,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'SET_WINDOW_TITLE': {
|
||||
case 'SET_WIN_TITLE': {
|
||||
const {
|
||||
windowId,
|
||||
title,
|
||||
|
@ -547,7 +547,7 @@ export default function windows(
|
|||
};
|
||||
}
|
||||
|
||||
case 'SET_WINDOW_ARGS': {
|
||||
case 'SET_WIN_ARGS': {
|
||||
const {
|
||||
windowId,
|
||||
args,
|
||||
|
|
Loading…
Reference in New Issue
Block a user