shorten type strings

This commit is contained in:
HF 2022-08-15 21:04:57 +02:00
parent 0a0acf7e12
commit 5d38af340e
17 changed files with 44 additions and 44 deletions

View File

@ -228,7 +228,7 @@ export function zoomOut(zoompoint) {
export function requestBigChunk(center) {
return {
type: 'REQUEST_BIG_CHUNK',
type: 'REQ_BIG_CHUNK',
center,
};
}
@ -247,7 +247,7 @@ export function receiveBigChunk(
chunk,
) {
return {
type: 'RECEIVE_BIG_CHUNK',
type: 'REC_BIG_CHUNK',
center,
chunk,
};
@ -255,7 +255,7 @@ export function receiveBigChunk(
export function receiveBigChunkFailure(center, error) {
return {
type: 'RECEIVE_BIG_CHUNK_FAILURE',
type: 'REC_BIG_CHUNK_FAILURE',
center,
error,
};
@ -265,7 +265,7 @@ export function receiveCoolDown(
wait,
) {
return {
type: 'RECEIVE_COOLDOWN',
type: 'REC_COOLDOWN',
wait,
};
}
@ -274,7 +274,7 @@ export function receiveMe(
me,
) {
return {
type: 'RECEIVE_ME',
type: 'REC_ME',
...me,
};
}
@ -284,7 +284,7 @@ export function receiveStats(
) {
const { ranking: totalRanking, dailyRanking: totalDailyRanking } = rankings;
return {
type: 'RECEIVE_STATS',
type: 'REC_STATS',
totalRanking,
totalDailyRanking,
};
@ -292,7 +292,7 @@ export function receiveStats(
export function receiveOnline(online) {
return {
type: 'RECEIVE_ONLINE',
type: 'REC_ONLINE',
online,
};
}
@ -307,7 +307,7 @@ export function receiveChatMessage(
isRead,
) {
return {
type: 'RECEIVE_CHAT_MESSAGE',
type: 'REC_CHAT_MESSAGE',
name,
text,
country,
@ -322,7 +322,7 @@ export function receiveChatMessage(
* check socket/packets/PixelReturn.js for args
*/
export function storeReceivePixelReturn(args) {
args.type = 'RECEIVE_PIXEL_RETURN';
args.type = 'REC_PIXEL_RETURN';
return args;
}

View File

@ -43,7 +43,7 @@ function receiveChatHistory(
history,
) {
return {
type: 'RECEIVE_CHAT_HISTORY',
type: 'REC_CHAT_HISTORY',
cid,
history,
};

View File

@ -119,7 +119,7 @@ export default (store) => (next) => (action) => {
break;
}
case 'RECEIVE_PIXEL_RETURN': {
case 'REC_PIXEL_RETURN': {
switch (action.retCode) {
case 0: {
// successfully placed pixel
@ -207,7 +207,7 @@ export default (store) => (next) => (action) => {
break;
}
case 'RECEIVE_CHAT_MESSAGE': {
case 'REC_CHAT_MESSAGE': {
if (chatNotify) break;
const { isPing, channel } = action;

View File

@ -43,7 +43,7 @@ export default () => (next) => (action) => {
break;
}
case 'RECEIVE_BIG_CHUNK': {
case 'REC_BIG_CHUNK': {
/*
* chunk: ChunkRGB or ChunkRGB3D object,
* see ui/ChunkRGB.js and ui/ChunkRGB3D.js

View File

@ -8,7 +8,7 @@ export default (store) => (next) => (action) => {
try {
if (!document.hasFocus()) {
switch (action.type) {
case 'RECEIVE_ME': {
case 'REC_ME': {
if (window.Notification
&& Notification.permission !== 'granted'
&& Notification.permission !== 'denied'
@ -40,7 +40,7 @@ export default (store) => (next) => (action) => {
break;
}
case 'RECEIVE_CHAT_MESSAGE': {
case 'REC_CHAT_MESSAGE': {
const state = store.getState();
const { chatNotify } = state.audio;
if (!chatNotify) break;

View File

@ -10,7 +10,7 @@ export default (store) => (next) => (action) => {
const ret = next(action);
switch (action.type) {
case 'RECEIVE_PIXEL_RETURN': {
case 'REC_PIXEL_RETURN': {
const renderer = getRenderer();
const {
retCode,

View File

@ -49,7 +49,7 @@ export default (store) => (next) => (action) => {
switch (type) {
case 'RELOAD_URL':
case 'SELECT_CANVAS':
case 'RECEIVE_ME': {
case 'REC_ME': {
const renderer = getRenderer();
const { is3D } = state.canvas;
@ -85,10 +85,10 @@ export default (store) => (next) => (action) => {
break;
}
case 'REQUEST_BIG_CHUNK':
case 'REQ_BIG_CHUNK':
case 'PRE_LOADED_BIG_CHUNK':
case 'RECEIVE_BIG_CHUNK':
case 'RECEIVE_BIG_CHUNK_FAILURE': {
case 'REC_BIG_CHUNK':
case 'REC_BIG_CHUNK_FAILURE': {
const renderer = getRenderer();
renderer.forceNextRender = true;
break;
@ -114,7 +114,7 @@ export default (store) => (next) => (action) => {
break;
}
case 'RECEIVE_PIXEL_RETURN': {
case 'REC_PIXEL_RETURN': {
const renderer = getRenderer();
renderer.forceNextSubrender = true;
const { coolDownSeconds } = action;

View File

@ -7,8 +7,8 @@ import SocketClient from '../../socket/SocketClient';
export default (store) => (next) => (action) => {
switch (action.type) {
case 'RECEIVE_BIG_CHUNK':
case 'RECEIVE_BIG_CHUNK_FAILURE': {
case 'REC_BIG_CHUNK':
case 'REC_BIG_CHUNK_FAILURE': {
if (!action.center) {
break;
}
@ -34,7 +34,7 @@ export default (store) => (next) => (action) => {
switch (action.type) {
case 'RELOAD_URL':
case 'SELECT_CANVAS':
case 'RECEIVE_ME': {
case 'REC_ME': {
const state = store.getState();
const { canvasId } = state.canvas;
SocketClient.setCanvas(canvasId);

View File

@ -41,7 +41,7 @@ export default (store) => (next) => (action) => {
case 'SELECT_CANVAS':
case 'RECEIVE_ME':
case 'REC_ME':
case 'RELOAD_URL':
case 'ON_VIEW_FINISH_CHANGE': {
const state = store.getState();

View File

@ -327,7 +327,7 @@ export default function canvasReducer(
};
}
case 'RECEIVE_ME': {
case 'REC_ME': {
const { canvases } = action;
let { canvasIdent, scale, view } = state;

View File

@ -32,7 +32,7 @@ export default function chat(
action,
) {
switch (action.type) {
case 'RECEIVE_ME':
case 'REC_ME':
case 'LOGIN': {
// making sure object keys are numbers
const channels = {};
@ -136,7 +136,7 @@ export default function chat(
};
}
case 'RECEIVE_CHAT_MESSAGE': {
case 'REC_CHAT_MESSAGE': {
const {
name, text, country, channel, user,
} = action;
@ -172,7 +172,7 @@ export default function chat(
};
}
case 'RECEIVE_CHAT_HISTORY': {
case 'REC_CHAT_HISTORY': {
const { cid, history } = action;
for (let i = 0; i < history.length; i += 1) {
msgId += 1;

View File

@ -23,7 +23,7 @@ export default function chatRead(
action,
) {
switch (action.type) {
case 'RECEIVE_ME':
case 'REC_ME':
case 'LOGIN': {
const { channels } = action;
const cids = Object.keys(channels);
@ -76,7 +76,7 @@ export default function chatRead(
};
}
case 'RECEIVE_CHAT_MESSAGE': {
case 'REC_CHAT_MESSAGE': {
const { channel: cid, isRead } = action;
const readTs = isRead
? {

View File

@ -30,7 +30,7 @@ export default function fetching(
};
}
case 'REQUEST_BIG_CHUNK': {
case 'REQ_BIG_CHUNK': {
const {
fetchingChunks,
} = state;
@ -41,7 +41,7 @@ export default function fetching(
};
}
case 'RECEIVE_BIG_CHUNK': {
case 'REC_BIG_CHUNK': {
const { fetchingChunks } = state;
return {
@ -50,7 +50,7 @@ export default function fetching(
};
}
case 'RECEIVE_BIG_CHUNK_FAILURE': {
case 'REC_BIG_CHUNK_FAILURE': {
const { fetchingChunks } = state;
return {

View File

@ -24,7 +24,7 @@ export default function ranks(
action,
) {
switch (action.type) {
case 'RECEIVE_PIXEL_RETURN': {
case 'REC_PIXEL_RETURN': {
const {
rankedPxlCnt,
} = action;
@ -41,7 +41,7 @@ export default function ranks(
};
}
case 'RECEIVE_ONLINE': {
case 'REC_ONLINE': {
const { online } = action;
return {
...state,
@ -49,7 +49,7 @@ export default function ranks(
};
}
case 'RECEIVE_ME':
case 'REC_ME':
case 'LOGIN': {
const {
totalPixels,
@ -66,7 +66,7 @@ export default function ranks(
};
}
case 'RECEIVE_STATS': {
case 'REC_STATS': {
const { totalRanking, totalDailyRanking } = action;
const lastFetch = Date.now();
return {

View File

@ -48,7 +48,7 @@ export default function user(
};
}
case 'RECEIVE_PIXEL_RETURN': {
case 'REC_PIXEL_RETURN': {
const {
wait: duration,
} = action;
@ -59,7 +59,7 @@ export default function user(
};
}
case 'RECEIVE_COOLDOWN': {
case 'REC_COOLDOWN': {
const { wait: duration } = action;
const wait = duration
? Date.now() + duration
@ -79,7 +79,7 @@ export default function user(
};
}
case 'RECEIVE_ME':
case 'REC_ME':
case 'LOGIN': {
const {
id,

View File

@ -446,7 +446,7 @@ export default function windows(
};
}
case 'RECEIVE_ME':
case 'REC_ME':
case 'WINDOW_RESIZE': {
const {
innerWidth: width,
@ -456,7 +456,7 @@ export default function windows(
let { windows: newWindows, args, positions } = state;
const showWindows = width > SCREEN_WIDTH_THRESHOLD;
if (action.type === 'RECEIVE_ME') {
if (action.type === 'REC_ME') {
if (!showWindows) {
// reset on phones on every refresh
return initialState;

View File

@ -19,7 +19,7 @@ class ChunkRGB {
isBasechunk;
constructor(palette, zoom = 0, cx = 0, cy = 0) {
// isBasechunk gets set to true by RECEIVE_BIG_CHUNK
// isBasechunk gets set to true by REC_BIG_CHUNK
// if true => chunk got requested from api/chunk and
// receives websocket pixel updates
// if false => chunk is an zoomed png tile