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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ class ChunkRGB {
isBasechunk; isBasechunk;
constructor(palette, zoom = 0, cx = 0, cy = 0) { 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 // if true => chunk got requested from api/chunk and
// receives websocket pixel updates // receives websocket pixel updates
// if false => chunk is an zoomed png tile // if false => chunk is an zoomed png tile