diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte index 126cd21e..d699de32 100644 --- a/src/components/DataSync.svelte +++ b/src/components/DataSync.svelte @@ -43,7 +43,7 @@ timeout = setTimeout(() => { handleError(); - }, 5000); + }, 15000); } function cancelTimeout() { diff --git a/src/functions/wish.js b/src/functions/wish.js index a7c8a97d..c628e1c2 100644 --- a/src/functions/wish.js +++ b/src/functions/wish.js @@ -6,6 +6,7 @@ import { readSave } from '../stores/saveManager'; import { banners } from '../data/banners'; import { weaponList } from '../data/weaponList'; import { characters } from '../data/characters'; +import { pushToast } from '../stores/toast'; const bannerTypes = { 'character-event': 'characters', @@ -97,6 +98,17 @@ export function process(id) { if (currentBanner === null || currentBanner.end < pull.time) { const nextBanner = getNextBanner(pull.time, currentBannerIndex, selectedBanners); + + if (nextBanner === undefined) { + pushToast('Something went wrong, please leave a message on Discord 😅', 'error'); + Sentry.captureException(new Error('failed to get current banner'), { + contexts: { + pull, + }, + }); + return null; + } + currentBanner = nextBanner.selectedBanner; currentBannerIndex = nextBanner.currentBannerIndex; startBanner = true; diff --git a/src/locales/en.json b/src/locales/en.json index b52f231b..11bdff74 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -24,6 +24,7 @@ "welcomeStart2": "button up there", "manual": "If you want to manually input the data, you can enable it here:", "manualButton": "Enable Manual Input", + "errorBanner": "Banner time missmatch! Please adjust your server. Still not working? please leave a message on Discord 😅", "import": { "title": "Import Wish History", "faqsButton": "FAQ - READ FIRST", diff --git a/src/locales/id.json b/src/locales/id.json index cb491c96..2f109cae 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -24,6 +24,7 @@ "welcomeStart2": "diatas untuk mulai", "manual": "Jika kamu ingin memasukkan datanya secara manual, kamu bisa menyalakannya disini:", "manualButton": "Nyalakan Input Manual", + "errorBanner": "Waktu banner salah! Coba sesuaikan server. Masih gak bisa? tolong chat di Discord 😅", "import": { "title": "Import Riwayat Wish", "faqsButton": "FAQS - BACA DULU", diff --git a/src/routes/wish/[id].svelte b/src/routes/wish/[id].svelte index 74c5b244..10639551 100644 --- a/src/routes/wish/[id].svelte +++ b/src/routes/wish/[id].svelte @@ -23,6 +23,7 @@ import { getAccountPrefix } from '../../stores/account'; import { fromRemote, readSave } from '../../stores/saveManager'; import { getTimeOffset } from '../../stores/server'; + import { pushToast } from '../../stores/toast'; Chart.defaults.global.defaultFontColor = '#cbd5e0'; Chart.defaults.global.defaultFontFamily = 'Poppins'; @@ -135,6 +136,17 @@ if (currentBanner === null || currentBanner.end < pull.time) { currentBanner = getNextBanner(pull.time); + + if (currentBanner === undefined) { + pushToast($t('wish.errorBanner'), 'error'); + Sentry.captureException(new Error('failed to get current banner'), { + contexts: { + pull, + }, + }); + return; + } + startBanner = true; if (i > 0) { @@ -294,7 +306,6 @@ return selectedBanners[tooltipItem[0].index].name; }, label: (tooltipItem, data) => { - console.log(tooltipItem, data); const label = data.datasets[tooltipItem.datasetIndex].label; const value = tooltipItem.datasetIndex === 2 @@ -514,7 +525,10 @@ {#if sortBy === 'time' && ((pull.end && !sortOrder) || (pull.start && sortOrder))} -
+
+