rename WINDOW actions to WIN

This commit is contained in:
HF 2022-08-17 12:35:35 +02:00
parent 6ee78ff5d6
commit 352649e3bd
5 changed files with 35 additions and 35 deletions

View File

@ -134,7 +134,7 @@ export function setMobile(mobile) {
export function windowResize() { export function windowResize() {
return { return {
type: 'WINDOW_RESIZE', type: 'WIN_RESIZE',
}; };
} }

View File

@ -16,7 +16,7 @@ export function openWindow(
height = null, height = null,
) { ) {
return { return {
type: 'OPEN_WINDOW', type: 'OPEN_WIN',
windowType, windowType,
title, title,
args, args,
@ -34,7 +34,7 @@ export function setWindowArgs(
args, args,
) { ) {
return { return {
type: 'SET_WINDOW_ARGS', type: 'SET_WIN_ARGS',
windowId, windowId,
args, args,
}; };
@ -51,7 +51,7 @@ function showFullscreenWindow(modalType, title) {
export function closeFullscreenWindows() { export function closeFullscreenWindows() {
return { return {
type: 'CLOSE_FULLSCREEN_WINDOWS', type: 'CLOSE_FULLSCREEN_WINS',
}; };
} }
@ -76,7 +76,7 @@ export function changeWindowType(
args = null, args = null,
) { ) {
return { return {
type: 'CHANGE_WINDOW_TYPE', type: 'CHANGE_WIN_TYPE',
windowId, windowId,
windowType, windowType,
title, title,
@ -86,7 +86,7 @@ export function changeWindowType(
export function setWindowTitle(windowId, title) { export function setWindowTitle(windowId, title) {
return { return {
type: 'SET_WINDOW_TITLE', type: 'SET_WIN_TITLE',
windowId, windowId,
title, title,
}; };
@ -152,42 +152,42 @@ export function addToChatInputMessage(windowId, msg, focus = true) {
export function closeWindow(windowId) { export function closeWindow(windowId) {
return { return {
type: 'CLOSE_WINDOW', type: 'CLOSE_WIN',
windowId, windowId,
}; };
} }
export function removeWindow(windowId) { export function removeWindow(windowId) {
return { return {
type: 'REMOVE_WINDOW', type: 'REMOVE_WIN',
windowId, windowId,
}; };
} }
export function focusWindow(windowId) { export function focusWindow(windowId) {
return { return {
type: 'FOCUS_WINDOW', type: 'FOCUS_WIN',
windowId, windowId,
}; };
} }
export function cloneWindow(windowId) { export function cloneWindow(windowId) {
return { return {
type: 'CLONE_WINDOW', type: 'CLONE_WIN',
windowId, windowId,
}; };
} }
export function toggleMaximizeWindow(windowId) { export function toggleMaximizeWindow(windowId) {
return { return {
type: 'TOGGLE_MAXIMIZE_WINDOW', type: 'TOGGLE_MAXIMIZE_WIN',
windowId, windowId,
}; };
} }
export function moveWindow(windowId, xDiff, yDiff) { export function moveWindow(windowId, xDiff, yDiff) {
return { return {
type: 'MOVE_WINDOW', type: 'MOVE_WIN',
windowId, windowId,
xDiff, xDiff,
yDiff, yDiff,
@ -196,7 +196,7 @@ export function moveWindow(windowId, xDiff, yDiff) {
export function resizeWindow(windowId, xDiff, yDiff) { export function resizeWindow(windowId, xDiff, yDiff) {
return { return {
type: 'RESIZE_WINDOW', type: 'RESIZE_WIN',
windowId, windowId,
xDiff, xDiff,
yDiff, yDiff,
@ -205,7 +205,7 @@ export function resizeWindow(windowId, xDiff, yDiff) {
export function closeAllWindowTypes(windowType) { export function closeAllWindowTypes(windowType) {
return { return {
type: 'CLOSE_ALL_WINDOW_TYPE', type: 'CLOSE_ALL_WIN_TYPE',
windowType, windowType,
}; };
} }
@ -215,7 +215,7 @@ export function hideAllWindowTypes(
hide, hide,
) { ) {
return { return {
type: 'HIDE_ALL_WINDOW_TYPE', type: 'HIDE_ALL_WIN_TYPE',
windowType, windowType,
hide, hide,
}; };

View File

@ -97,7 +97,7 @@ export default function chatRead(
}; };
} }
case 'OPEN_WINDOW': { case 'OPEN_WIN': {
const { windowType } = action; const { windowType } = action;
if (windowType !== 'CHAT') { if (windowType !== 'CHAT') {
return state; return state;

View File

@ -33,7 +33,7 @@ export default function contextMenu(
}; };
} }
case 'WINDOW_RESIZE': case 'WIN_RESIZE':
case 'HIDE_CONTEXT_MENU': { case 'HIDE_CONTEXT_MENU': {
return { return {
...state, ...state,

View File

@ -12,7 +12,7 @@ const MIN_HEIGHT = 50;
// allow Modals // allow Modals
const SCREEN_WIDTH_THRESHOLD = 604; const SCREEN_WIDTH_THRESHOLD = 604;
// how many windows can be open // how many windows can be open
const MAX_AMOUNT_WINDOWS = 100; const MAX_AMOUNT_WINS = 100;
function generateWindowId(state) { function generateWindowId(state) {
let windowId = Math.floor(Math.random() * 99999) + 1; let windowId = Math.floor(Math.random() * 99999) + 1;
@ -72,7 +72,7 @@ function clampPos(prefXPos, prefYPos, width, height) {
* resort the zIndex, remove gaps * resort the zIndex, remove gaps
*/ */
function sortWindows(newState, force = false) { 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 positions = { ...newState.positions };
const ids = Object.keys(positions); const ids = Object.keys(positions);
const orderedZ = ids const orderedZ = ids
@ -136,7 +136,7 @@ export default function windows(
action, action,
) { ) {
switch (action.type) { switch (action.type) {
case 'OPEN_WINDOW': { case 'OPEN_WIN': {
/* /*
* prefered xPos, yPos, height adn width * prefered xPos, yPos, height adn width
* can be given in action (but doesn't have to) * can be given in action (but doesn't have to)
@ -157,7 +157,7 @@ export default function windows(
const fullscreen = !state.showWindows || action.fullscreen; const fullscreen = !state.showWindows || action.fullscreen;
if (state.windows.length >= MAX_AMOUNT_WINDOWS) { if (state.windows.length >= MAX_AMOUNT_WINS) {
return state; return state;
} }
const windowId = generateWindowId(state); const windowId = generateWindowId(state);
@ -197,7 +197,7 @@ export default function windows(
}); });
} }
case 'REMOVE_WINDOW': { case 'REMOVE_WIN': {
const { const {
windowId, windowId,
} = action; } = action;
@ -214,7 +214,7 @@ export default function windows(
}; };
} }
case 'CLOSE_WINDOW': { case 'CLOSE_WIN': {
const { const {
windowId, windowId,
} = action; } = action;
@ -233,7 +233,7 @@ export default function windows(
}; };
} }
case 'CLOSE_ALL_WINDOW_TYPE': { case 'CLOSE_ALL_WIN_TYPE': {
const { const {
windowType, windowType,
} = action; } = action;
@ -251,7 +251,7 @@ export default function windows(
}; };
} }
case 'HIDE_ALL_WINDOW_TYPE': { case 'HIDE_ALL_WIN_TYPE': {
const { const {
windowType, windowType,
hide, hide,
@ -269,7 +269,7 @@ export default function windows(
}; };
} }
case 'CLONE_WINDOW': { case 'CLONE_WIN': {
const { const {
windowId, windowId,
} = action; } = action;
@ -309,7 +309,7 @@ export default function windows(
}); });
} }
case 'CHANGE_WINDOW_TYPE': { case 'CHANGE_WIN_TYPE': {
const { const {
windowId, windowId,
windowType, windowType,
@ -337,7 +337,7 @@ export default function windows(
}; };
} }
case 'FOCUS_WINDOW': { case 'FOCUS_WIN': {
const { const {
windowId, windowId,
} = action; } = action;
@ -361,7 +361,7 @@ export default function windows(
}); });
} }
case 'TOGGLE_MAXIMIZE_WINDOW': { case 'TOGGLE_MAXIMIZE_WIN': {
const { const {
windowId, windowId,
} = action; } = action;
@ -382,7 +382,7 @@ export default function windows(
}; };
} }
case 'CLOSE_FULLSCREEN_WINDOWS': { case 'CLOSE_FULLSCREEN_WINS': {
const newWindows = state.windows.map((win) => { const newWindows = state.windows.map((win) => {
if (win.fullscreen) { if (win.fullscreen) {
return { return {
@ -399,7 +399,7 @@ export default function windows(
}; };
} }
case 'MOVE_WINDOW': { case 'MOVE_WIN': {
const { const {
windowId, windowId,
xDiff, xDiff,
@ -425,7 +425,7 @@ export default function windows(
}; };
} }
case 'RESIZE_WINDOW': { case 'RESIZE_WIN': {
const { const {
windowId, windowId,
xDiff, xDiff,
@ -447,7 +447,7 @@ export default function windows(
} }
case 'REC_ME': case 'REC_ME':
case 'WINDOW_RESIZE': { case 'WIN_RESIZE': {
const { const {
innerWidth: width, innerWidth: width,
innerHeight: height, innerHeight: height,
@ -529,7 +529,7 @@ export default function windows(
}; };
} }
case 'SET_WINDOW_TITLE': { case 'SET_WIN_TITLE': {
const { const {
windowId, windowId,
title, title,
@ -547,7 +547,7 @@ export default function windows(
}; };
} }
case 'SET_WINDOW_ARGS': { case 'SET_WIN_ARGS': {
const { const {
windowId, windowId,
args, args,