From dd96b2323bdbc30cb25beb1ee5e923ff5d12d18e Mon Sep 17 00:00:00 2001 From: fadhlu Date: Wed, 17 Mar 2021 01:57:40 +0700 Subject: [PATCH] add resin section --- src/locales/en.json | 8 ++++ src/locales/id.json | 8 ++++ src/routes/calculator/_resin.svelte | 68 +++++++++++++++++++++++++++++ src/routes/calculator/index.svelte | 8 ++++ src/stores/time.js | 11 +++++ 5 files changed, 103 insertions(+) create mode 100644 src/routes/calculator/_resin.svelte create mode 100644 src/stores/time.js diff --git a/src/locales/en.json b/src/locales/en.json index 40682bc0..5a19ac50 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -132,6 +132,7 @@ "calculator": { "titleWeapon": "Weapon Calculator", "titleCharacter": "Character Calculator", + "titleResin": "Resin Calculator", "goto": "Go To", "howToUse": "How to Use", "guide": { @@ -184,6 +185,13 @@ "items": "Items", "wasted": "Wasted Exp", "mora": "Mora Cost" + }, + "resin": { + "inputCurrentResin": "Input Current Resin...", + "timeFormat": "en", + "calculate": "Calculate", + "currentTime": "Current Time", + "fullTime": "Your Resin Will Replenished After" } }, "items": { diff --git a/src/locales/id.json b/src/locales/id.json index 342101eb..8312dbd4 100644 --- a/src/locales/id.json +++ b/src/locales/id.json @@ -132,6 +132,7 @@ "calculator": { "titleWeapon": "Kalulator Senjata", "titleCharacter": "Kalkulator Karakter", + "titleResin": "Kalkulator Resin", "goto": "Ke", "howToUse": "Cara Penggunaan", "guide": { @@ -184,6 +185,13 @@ "items": "Items", "wasted": "Exp Terbuang", "mora": "Jumlah Mora" + }, + "resin": { + "inputCurrentResin": "Masukkan Jumlah Resin Sekarang...", + "timeFormat": "id", + "calculate": "Hitung", + "currentTime": "Waktu Sekarang", + "fullTime": "Resin Akan Penuh Pada" } }, "items": { diff --git a/src/routes/calculator/_resin.svelte b/src/routes/calculator/_resin.svelte new file mode 100644 index 00000000..64951e2d --- /dev/null +++ b/src/routes/calculator/_resin.svelte @@ -0,0 +1,68 @@ + + +
+
+ +
+ +

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

+ {#if fullTime} +

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

+ {/if} +
+
+ +
+
+
diff --git a/src/routes/calculator/index.svelte b/src/routes/calculator/index.svelte index 3fe9ad0e..be55f08f 100644 --- a/src/routes/calculator/index.svelte +++ b/src/routes/calculator/index.svelte @@ -7,6 +7,7 @@ import WeaponCalculator from './_weapon.svelte'; import CharacterCalculator from './_character.svelte'; import LevelUpTable from './_characterTable.svelte'; + import ResinCalculator from './_resin.svelte'; import Button from '../../components/Button.svelte'; import Icon from '../../components/Icon.svelte'; import HowToModal from '../../components/CalculatorHowToModal.svelte'; @@ -91,5 +92,12 @@
+

+ {$t('calculator.titleResin')} +

+ +
diff --git a/src/stores/time.js b/src/stores/time.js new file mode 100644 index 00000000..c131bcec --- /dev/null +++ b/src/stores/time.js @@ -0,0 +1,11 @@ +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); + }; +});