diff --git a/src/locales/en.json b/src/locales/en.json index d204a47b..b170a960 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -205,12 +205,23 @@ "wasted": "Wasted EXP", "mora": "Mora Cost" }, + "resinTable": { + "quantity": "Quantity", + "time": "Time To Wait" + }, "resin": { - "inputCurrentResin": "Input Current Resin...", + "currentResin": "Current Resin", + "desiredResin": "Desired Resin", + "or": "or", + "inputCurrentResin": "Input current resin...", + "inputDesireResin": "Input how many resin you want to wait...", "timeFormat": "en", "calculate": "Calculate", "currentTime": "Current Time", - "fullTime": "Resin Will Be Replenished At" + "fullTime": "Will be replenished at", + "hours": "hours", + "minutes": "minutes", + "seconds": "seconds" } }, "items": { diff --git a/src/locales/id.json b/src/locales/id.json index 6e549827..92e9f9b3 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -205,12 +205,23 @@ "wasted": "Exp Terbuang", "mora": "Jumlah Mora" }, + "resinTable": { + "quantity": "Jumlah", + "time": "Waktu Menunggu" + }, "resin": { - "inputCurrentResin": "Masukkan Jumlah Resin Sekarang...", + "currentResin": "Resin Saat Ini", + "desiredResin": "Resin Yang Diinginkan", + "or": "atau", + "inputCurrentResin": "Masukkan jumlah resin sekarang...", + "inputDesireResin": "Masukkan jumlah resin yang diinginkan...", "timeFormat": "id", "calculate": "Hitung", "currentTime": "Waktu Sekarang", - "fullTime": "Resin Akan Penuh Pada" + "fullTime": "Akan terisi pada", + "hours": "jam", + "minutes": "menit", + "seconds": "detik" } }, "items": { diff --git a/src/routes/calculator/_resin.svelte b/src/routes/calculator/_resin.svelte index fddf1bb3..d9633edb 100644 --- a/src/routes/calculator/_resin.svelte +++ b/src/routes/calculator/_resin.svelte @@ -1,18 +1,36 @@
-
+
+

+ {$t('calculator.resin.currentResin')} +

onChange('maxResin')} type="number" min={0} max={160} bind:value={currentResin} placeholder={$t('calculator.resin.inputCurrentResin')} /> -

- {$t('calculator.resin.currentTime')}: {new Intl.DateTimeFormat( - $t('calculator.resin.timeFormat'), - dateTimeOptions, - ).format($time)} +

{$t('calculator.resin.or')} {$t('calculator.resin.desiredResin')}

+ onChange('desiredResin')} + type="number" + min={1} + max={160} + bind:value={desiredResin} + placeholder={$t('calculator.resin.inputDesireResin')} + /> +

+ {$t('calculator.resin.currentTime')}: + {#if $t('calculator.resin.timeFormat') === 'en'} + {currentTime.locale('en').format('dddd HH:mm:ss')} + {:else} + {currentTime.locale('id').format('dddd HH:mm:ss')} + {/if}

-
+
- {#if fullTime} + {#if !changed}
- - - {missingResin} - - - - - - {originalResin.label} + + + + - - - - + + + {#if resinOutput.condensed.condensedResin !== 0} + + + + + + + + + + {/if} + + + +
+ {resinOutput.resin} + + + + + {originalResin.label} + + {originalResin.label} - {originalResin.label} - -
- - {$t('calculator.resin.fullTime')}: - - {new Intl.DateTimeFormat($t('calculator.resin.timeFormat'), dateTimeOptions).format(fullTime)} -
{$t('calculator.resin.or')}
+ {resinOutput.condensed.resin} + + + + + {originalResin.label} + + {originalResin.label} + +
+ {resinOutput.condensed.condensedResin} + + + + + {condensedResin.label} + + {condensedResin.label} + +
+ {$t('calculator.resin.fullTime')}: + {#if $t('calculator.resin.timeFormat') === 'en'} + {fullTime.locale('en').format('dddd HH:mm:ss')} ({fullTime.locale('en').fromNow()}) + {:else} + {fullTime.locale('id').format('dddd HH:mm:ss')} ({fullTime.locale('id').fromNow()}) + {/if} +
{/if}
diff --git a/src/routes/calculator/_resinTable.svelte b/src/routes/calculator/_resinTable.svelte new file mode 100644 index 00000000..f1433ba3 --- /dev/null +++ b/src/routes/calculator/_resinTable.svelte @@ -0,0 +1,73 @@ + + +
+
+
+ + + + + + {#each rows as _, i} + + + + + {/each} +
{$t('calculator.resinTable.quantity')}{$t('calculator.resinTable.time')}
{step[0]}{step[i + 1]} + {originalResin.label} + {#if $t('calculator.resin.timeFormat') === 'en'} + {dayjs(new Date(stepTime[i + 1])) + .locale('en') + .fromNow()} + {:else} + {dayjs(new Date(stepTime[i + 1])) + .locale('id') + .fromNow()} + {/if} +
+
+
+
+ + diff --git a/src/routes/calculator/index.svelte b/src/routes/calculator/index.svelte index 62645bc0..e2b5bc96 100644 --- a/src/routes/calculator/index.svelte +++ b/src/routes/calculator/index.svelte @@ -8,16 +8,13 @@ import CharacterCalculator from './_character.svelte'; import LevelUpTable from './_characterTable.svelte'; import ResinCalculator from './_resin.svelte'; + import ResinTable from './_resinTable.svelte'; import Button from '../../components/Button.svelte'; import Icon from '../../components/Icon.svelte'; import HowToModal from '../../components/CalculatorHowToModal.svelte'; const { open: openModal } = getContext('simple-modal'); - let weaponCalc; - let characterCalc; - let resinCalc; - function openHowTo() { openModal( HowToModal, @@ -92,7 +89,7 @@ {$t('calculator.goto')} {$t('calculator.titleWeapon')} -
-
- +
+ + +
diff --git a/src/stores/time.js b/src/stores/time.js deleted file mode 100644 index c131bcec..00000000 --- a/src/stores/time.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readable } from 'svelte/store'; - -export const time = readable(new Date(), function start(set) { - const interval = setInterval(() => { - set(new Date()); - }, 1000); - - return function stop() { - clearInterval(interval); - }; -}); diff --git a/static/images/condensed_resin.png b/static/images/condensed_resin.png new file mode 100644 index 00000000..5c164de1 Binary files /dev/null and b/static/images/condensed_resin.png differ