diff --git a/Components/Results/PaymentsTable/config.ts b/Components/Output/PaymentsTable/config.ts
similarity index 100%
rename from Components/Results/PaymentsTable/config.ts
rename to Components/Output/PaymentsTable/config.ts
diff --git a/Components/Results/PaymentsTable/index.jsx b/Components/Output/PaymentsTable/index.jsx
similarity index 100%
rename from Components/Results/PaymentsTable/index.jsx
rename to Components/Output/PaymentsTable/index.jsx
diff --git a/Components/Results/PaymentsTable/types.ts b/Components/Output/PaymentsTable/types.ts
similarity index 100%
rename from Components/Results/PaymentsTable/types.ts
rename to Components/Output/PaymentsTable/types.ts
diff --git a/Components/Results/Output/config.ts b/Components/Output/Results/config.ts
similarity index 94%
rename from Components/Results/Output/config.ts
rename to Components/Output/Results/config.ts
index 2f40f2b..977bf7d 100644
--- a/Components/Results/Output/config.ts
+++ b/Components/Output/Results/config.ts
@@ -1,7 +1,7 @@
/* eslint-disable object-curly-newline */
import type { Values } from 'stores/results/types';
-import { formatMoney, formatPercent } from 'tools/format';
+import { formatMoney, formatNumber, formatPercent } from 'tools/format';
import { pipe } from 'tools/function';
import { round } from 'tools/number';
@@ -58,7 +58,7 @@ const percentFormatters = Object.fromEntries(
);
const defaultFormatters = {
- resultTerm: (value: number) => value,
+ resultTerm: (value: number) => formatNumber(value),
};
export const formatters = Object.assign(moneyFormatters, percentFormatters, defaultFormatters);
diff --git a/Components/Results/Output/index.jsx b/Components/Output/Results/index.jsx
similarity index 91%
rename from Components/Results/Output/index.jsx
rename to Components/Output/Results/index.jsx
index ce522d2..c61419c 100644
--- a/Components/Results/Output/index.jsx
+++ b/Components/Output/Results/index.jsx
@@ -17,9 +17,9 @@ const Grid = styled(Box)`
}
`;
-const Output = observer(() => {
+const Results = observer(() => {
const { $results } = useStore();
- const values = toJS($results.output);
+ const values = toJS($results.values);
return (
@@ -42,5 +42,5 @@ const Output = observer(() => {
export default {
id,
title,
- Component: Output,
+ Component: Results,
};
diff --git a/Components/Results/Validation.jsx b/Components/Output/Validation.jsx
similarity index 100%
rename from Components/Results/Validation.jsx
rename to Components/Output/Validation.jsx
diff --git a/Components/Results/index.jsx b/Components/Output/index.jsx
similarity index 75%
rename from Components/Results/index.jsx
rename to Components/Output/index.jsx
index 7b062ae..1172607 100644
--- a/Components/Results/index.jsx
+++ b/Components/Output/index.jsx
@@ -2,11 +2,11 @@ import Background from 'Elements/layout/Background';
import Tabs from 'Elements/layout/Tabs';
import styled from 'styled-components';
import { min } from 'UIKit/mq';
-import Output from './Output';
import PaymentsTable from './PaymentsTable';
+import Results from './Results';
import Validation from './Validation';
-const resultsTabs = [PaymentsTable, Output, Validation];
+const outputTabs = [PaymentsTable, Results, Validation];
const Wrapper = styled(Background)`
padding: 4px 10px;
@@ -18,11 +18,11 @@ const Wrapper = styled(Background)`
}
`;
-function Results() {
+function Output() {
return (
- {resultsTabs.map(({ id, title, Component }) => (
+ {outputTabs.map(({ id, title, Component }) => (
@@ -32,4 +32,4 @@ function Results() {
);
}
-export default Results;
+export default Output;
diff --git a/pages/index.tsx b/pages/index.tsx
index 9335ee4..e4e4464 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,6 +1,6 @@
import initializeApollo from 'apollo/client';
import * as Calculation from 'Components/Calculation';
-import Results from 'Components/Results';
+import Output from 'Components/Output';
import type { GetServerSideProps } from 'next';
import Head from 'next/head';
import { fetchUser } from 'services/user';
@@ -38,7 +38,7 @@ function Home() {
-
+
);
}
diff --git a/stores/results/default-values.ts b/stores/results/default-values.ts
index 3f66c16..03a3377 100644
--- a/stores/results/default-values.ts
+++ b/stores/results/default-values.ts
@@ -1,8 +1,7 @@
/* eslint-disable import/prefer-default-export */
+import type { ResultsValues } from './types';
-import type { OutputValues } from './types';
-
-export const defaultOutputValues: OutputValues = {
+export const defaultResultsValues: ResultsValues = {
resultTotalGraphwithNDS: 0,
resultPlPrice: 0,
resultPriceUpPr: 0,
diff --git a/stores/results/index.ts b/stores/results/index.ts
index fdbb779..205d352 100644
--- a/stores/results/index.ts
+++ b/stores/results/index.ts
@@ -1,19 +1,19 @@
-import type { Payment } from 'Components/Results/PaymentsTable/types';
+import type { Payment } from 'Components/Output/PaymentsTable/types';
import type { IObservableArray } from 'mobx';
import { makeAutoObservable, observable } from 'mobx';
import type RootStore from 'stores/root';
-import { defaultOutputValues } from './default-values';
-import type { OutputValues } from './types';
+import { defaultResultsValues } from './default-values';
+import type { ResultsValues } from './types';
export default class Results {
root: RootStore;
payments: IObservableArray;
- output: OutputValues;
+ values: ResultsValues;
constructor(rootStore: RootStore) {
this.payments = observable([]);
- this.output = defaultOutputValues;
+ this.values = defaultResultsValues;
makeAutoObservable(this);
this.root = rootStore;
@@ -23,12 +23,12 @@ export default class Results {
this.payments.replace(payments);
};
- setOutput = (output: OutputValues) => {
- this.output = output;
+ setValues = (values: ResultsValues) => {
+ this.values = values;
};
clear = () => {
this.payments.clear();
- this.output = defaultOutputValues;
+ this.values = defaultResultsValues;
};
}
diff --git a/stores/results/types.ts b/stores/results/types.ts
index a9dc00f..e4d418e 100644
--- a/stores/results/types.ts
+++ b/stores/results/types.ts
@@ -1,4 +1,4 @@
-export type OutputValues = {
+export type ResultsValues = {
resultTotalGraphwithNDS: number;
resultPlPrice: number;
resultPriceUpPr: number;
@@ -19,4 +19,4 @@ export type OutputValues = {
resultFirstPaymentRiskPolicy: number;
};
-export type Values = keyof OutputValues;
+export type Values = keyof ResultsValues;