diff --git a/src/locales/en.json b/src/locales/en.json
index 62bba4d6..ffa26086 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -150,6 +150,7 @@
"calculator": {
"titleWeapon": "Weapon Calculator",
"titleCharacter": "Character Calculator",
+ "titleResin": "Resin Calculator",
"goto": "Go To",
"howToUse": "How to Use",
"guide": {
@@ -202,6 +203,13 @@
"items": "Items",
"wasted": "Wasted EXP",
"mora": "Mora Cost"
+ },
+ "resin": {
+ "inputCurrentResin": "Input Current Resin...",
+ "timeFormat": "en",
+ "calculate": "Calculate",
+ "currentTime": "Current Time",
+ "fullTime": "Resin Will Be Replenished At"
}
},
"items": {
diff --git a/src/locales/id.json b/src/locales/id.json
index 3f18e990..0710179b 100644
--- a/src/locales/id.json
+++ b/src/locales/id.json
@@ -148,8 +148,9 @@
}
},
"calculator": {
- "titleWeapon": "Kalulator Senjata",
+ "titleWeapon": "Kalkulator Senjata",
"titleCharacter": "Kalkulator Karakter",
+ "titleResin": "Kalkulator Resin",
"goto": "Ke",
"howToUse": "Cara Penggunaan",
"guide": {
@@ -202,6 +203,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..fddf1bb3
--- /dev/null
+++ b/src/routes/calculator/_resin.svelte
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+ {$t('calculator.resin.currentTime')}: {new Intl.DateTimeFormat(
+ $t('calculator.resin.timeFormat'),
+ dateTimeOptions,
+ ).format($time)}
+
+
+
+
+ {#if fullTime}
+
+
+
+ {missingResin}
+
+ |
+
+
+
+
+
+ {originalResin.label}
+
+ |
+
+
+ |
+
+ {$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..62645bc0 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';
@@ -15,6 +16,7 @@
let weaponCalc;
let characterCalc;
+ let resinCalc;
function openHowTo() {
openModal(
@@ -27,16 +29,22 @@
);
}
- export function scroll(type) {
- const elementPosition =
- type === 'character' ? characterCalc.getBoundingClientRect().top : weaponCalc.getBoundingClientRect().top;
- const headerOffset = 80;
- const offsetPosition = elementPosition - headerOffset;
+ export function findPos(id) {
+ let node = document.getElementById(id);
+ let curtop = 0;
+ let curtopscroll = 0;
+ let headerOffset = 40;
+ if (node.offsetParent) {
+ do {
+ curtop += node.offsetTop;
+ curtopscroll += node.offsetParent ? node.offsetParent.scrollTop : 0;
+ } while ((node = node.offsetParent));
- window.scrollTo({
- top: offsetPosition,
- behavior: 'smooth',
- });
+ window.scrollTo({
+ top: curtop - curtopscroll - headerOffset,
+ behavior: 'smooth',
+ });
+ }
}
@@ -59,14 +67,15 @@
-
- scroll('weapon')}>
+ findPos('weapon')}>
{$t('calculator.goto')}
{$t('calculator.titleWeapon')}
+ findPos('resin')}>
+
+ {$t('calculator.goto')}
+ {$t('calculator.titleResin')}
+
@@ -90,6 +104,22 @@
+
+ findPos('character')}>
+
+ {$t('calculator.goto')}
+ {$t('calculator.titleCharacter')}
+
+
+ {$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);
+ };
+});