From e3bf86a6cb9b09edc4f6f48bdf58b241adcef027 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 3 May 2021 17:11:39 +0200 Subject: [PATCH] Minor fixes --- src/css/states/puzzle_menu.scss | 6 +++--- src/js/platform/api.js | 6 +++--- translations/base-en.yaml | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/css/states/puzzle_menu.scss b/src/css/states/puzzle_menu.scss index b3e562ff..e247252d 100644 --- a/src/css/states/puzzle_menu.scss +++ b/src/css/states/puzzle_menu.scss @@ -62,7 +62,7 @@ > .puzzles { display: grid; - grid-template-columns: repeat(auto-fit, D(150px)); + grid-template-columns: repeat(auto-fit, minmax(D(150px), 1fr)); @include S(grid-auto-rows, 120px); @include S(grid-gap, 3px); @include S(margin-top, 10px); @@ -149,8 +149,6 @@ align-self: end; @include S(height, 14px); - @include DarkThemeInvert; - > .downloads { @include SuperSmallText; color: #000; @@ -162,6 +160,7 @@ display: inline-flex; align-items: center; justify-content: center; + @include DarkThemeInvert; & { /* @load-async */ @@ -179,6 +178,7 @@ font-weight: bold; @include S(padding-left, 14px); opacity: 0.7; + @include DarkThemeInvert; & { /* @load-async */ diff --git a/src/js/platform/api.js b/src/js/platform/api.js index 4c5bf38e..0933ac2a 100644 --- a/src/js/platform/api.js +++ b/src/js/platform/api.js @@ -23,7 +23,7 @@ export class ClientAPI { this.token = null; this.syncToken = window.localStorage.getItem("tmp.syncToken"); - if (!this.syncToken || G_IS_DEV) { + if (!this.syncToken) { this.syncToken = rusha .createHash() .update(new Date().getTime() + "=" + Math.random()) @@ -78,10 +78,10 @@ export class ClientAPI { return res; }) .then(res => res.json()), - new Promise(resolve => setTimeout(resolve, 5000)), + new Promise((resolve, reject) => setTimeout(() => reject("timeout"), 15000)), ]) .then(data => { - if (data.error) { + if (data && data.error) { logger.warn("Got error from api:", data); throw T.backendErrors[data.error] || data.error; } diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 8a2d0e08..022b89e7 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -1376,6 +1376,7 @@ backendErrors: can-not-report-your-own-puzzle: You can not report your own puzzle. bad-payload: The request contains invalid data. bad-building-placement: Your puzzle contains invalid placed buildings. + timeout: The request timed out. tips: - The hub will accept any input, not just the current shape!