From a5864a517a9290980a032347c0f67d63188711ea Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:24:06 +0100 Subject: [PATCH 01/19] [TASK] implemented function for calculating the facultry --- src/lib/custom-math.ts | 22 +++++++++++++++++++--- src/routes/basic/faculty.svelte | 20 ++++++++++++++++++++ src/styles/general.scss | 7 ++++++- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 src/routes/basic/faculty.svelte diff --git a/src/lib/custom-math.ts b/src/lib/custom-math.ts index e67b33e..d278f61 100644 --- a/src/lib/custom-math.ts +++ b/src/lib/custom-math.ts @@ -1,10 +1,9 @@ /** + * This method rounds thhe given number to the fixed number of decimals * * @param val the initial number * @param decimals the number of decimals after the komma * @returns the rounded value - * - * This method rounds thhe given number to the fixed number of decimals */ function roundTo(val: number, decimals: number): number { const multiplicator = Math.pow(10, decimals); @@ -13,4 +12,21 @@ function roundTo(val: number, decimals: number): number { return +pre.toFixed(decimals); } -export { roundTo }; +/** + * Calculates the faculty of the given number and + * returns it. + * + * @param num The´number that faculty should be calculated + * @returns The faculty value of the given number + */ +function faculty(num: number): number { + let cache = 1; + let run = 1; + while (run <= num) { + cache = cache * run; + run++; + } + return cache; +} + +export { roundTo, faculty }; diff --git a/src/routes/basic/faculty.svelte b/src/routes/basic/faculty.svelte new file mode 100644 index 0000000..eb3a832 --- /dev/null +++ b/src/routes/basic/faculty.svelte @@ -0,0 +1,20 @@ + + +
+
+ +
+ {faculty(input)} +
+
+
+ + \ No newline at end of file diff --git a/src/styles/general.scss b/src/styles/general.scss index c77361e..fe8300d 100644 --- a/src/styles/general.scss +++ b/src/styles/general.scss @@ -35,7 +35,12 @@ font-size: 2em; text-overflow: clip; } -.theme-selector { +.larger-input { + width: 75px; + height: 75px; + font-size: 1.3em; + border: none; + outline: none; } @media only screen and (max-width: 680px) { From dc0da4af3e16bcfca6d6c1a9e9f4142a5c396125 Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:25:47 +0100 Subject: [PATCH 02/19] [TASK] added translations --- src/translations/de.json | 4 ++++ src/translations/en.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/translations/de.json b/src/translations/de.json index d8fdd0c..d9d8a93 100644 --- a/src/translations/de.json +++ b/src/translations/de.json @@ -26,6 +26,10 @@ "function-solver": { "title": "Funktionen lösen", "description": "Löst einfache mathematische Funktionen" + }, + "faculty": { + "title": "Fakultät berechnen", + "description": "Berechnet die Fakultät einer Zahl" } }, "vector": { diff --git a/src/translations/en.json b/src/translations/en.json index 56ecfbe..f9f24bd 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -26,6 +26,10 @@ "function-solver": { "title": "function solver", "description": "solves a math function" + }, + "faculty": { + "title": "faculty calculator", + "description": "calculates the faculty of a value" } }, "vector": { From 3a15a7224f5392559964c3d756247b8a17f34e8f Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:31:39 +0100 Subject: [PATCH 03/19] [TASK] implemented faculty calculator in listView --- src/routes/basic/index.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/basic/index.svelte b/src/routes/basic/index.svelte index 52b58ae..6fffaa1 100644 --- a/src/routes/basic/index.svelte +++ b/src/routes/basic/index.svelte @@ -18,6 +18,11 @@ name: $_('basic.function-solver.title'), description: $_('basic.function-solver.description'), route: '/basic/function-solver' + }, + { + name: $_('basic.faculty.title'), + description: $_('basic.faculty.description'), + route: '/basic/faculty' } ]; From 83d3ef95271707a46c2a6b81a2fae2c7ea810d2c Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:36:33 +0100 Subject: [PATCH 04/19] [TASK] implemented function to calculate logartithm --- src/routes/basic/logarithm.svelte | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/routes/basic/logarithm.svelte diff --git a/src/routes/basic/logarithm.svelte b/src/routes/basic/logarithm.svelte new file mode 100644 index 0000000..0186bf0 --- /dev/null +++ b/src/routes/basic/logarithm.svelte @@ -0,0 +1,16 @@ + + +
+
+ +
+ {Math.log(input)} +
+
+
+ + \ No newline at end of file From 4a9d979f1b1a955c4de9f6d885cc5260f79a4181 Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:38:06 +0100 Subject: [PATCH 05/19] [TASK] added logarithm translations --- src/translations/de.json | 4 ++++ src/translations/en.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/translations/de.json b/src/translations/de.json index d9d8a93..281a340 100644 --- a/src/translations/de.json +++ b/src/translations/de.json @@ -30,6 +30,10 @@ "faculty": { "title": "Fakultät berechnen", "description": "Berechnet die Fakultät einer Zahl" + }, + "logarithm": { + "title": "Logarithmus berechnen", + "description": "Berenchet den Logarithmus einer Zahl" } }, "vector": { diff --git a/src/translations/en.json b/src/translations/en.json index f9f24bd..f34b601 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -30,6 +30,10 @@ "faculty": { "title": "faculty calculator", "description": "calculates the faculty of a value" + }, + "logarithm": { + "title": "logarithm calculator", + "description": "calculates the logarithm of a number" } }, "vector": { From 9ac71991a7a50481edc4b5109111132af3292d6c Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:39:26 +0100 Subject: [PATCH 06/19] [TASK] added logarithm to default listView --- src/routes/basic/index.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/routes/basic/index.svelte b/src/routes/basic/index.svelte index 6fffaa1..5fe5132 100644 --- a/src/routes/basic/index.svelte +++ b/src/routes/basic/index.svelte @@ -2,6 +2,7 @@ import ListSelector from '../../lib/listSelector.svelte'; import type { ListSelectorElement } from '../../typings/ListSelectorElement'; import { _ } from 'svelte-i18n'; +import { roundTo } from '$lib/custom-math'; let apps: ListSelectorElement[] = [ { @@ -23,6 +24,11 @@ name: $_('basic.faculty.title'), description: $_('basic.faculty.description'), route: '/basic/faculty' + }, + { + name: $_('basic.logarithm.title'), + description: $_('basic.logarithm.description'), + route: '/basic/logarithm' } ]; From 30de1e615c4070773d70f7aaf825d394c980aa0d Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:50:35 +0100 Subject: [PATCH 07/19] [TASK] implemented not found page --- src/routes/__error.svelte | 14 ++++++++++++++ src/styles/error.scss | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/routes/__error.svelte create mode 100644 src/styles/error.scss diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte new file mode 100644 index 0000000..e199f7b --- /dev/null +++ b/src/routes/__error.svelte @@ -0,0 +1,14 @@ +
+
+
404 Not Found
+
+ Not found +
+
+
+ + + \ No newline at end of file diff --git a/src/styles/error.scss b/src/styles/error.scss new file mode 100644 index 0000000..b7b12ad --- /dev/null +++ b/src/styles/error.scss @@ -0,0 +1,15 @@ +.error-heading { + font-family: Arial, Helvetica, sans-serif; + font-size: 3em; + color: var(--text-color); + width: 500px; + text-align: center; + font-weight: bold; +} +.error-container { + width: 500px; + height: 300px; + text-align: center; + font-family: Arial, Helvetica, sans-serif; + font-size: 1.3em; +} \ No newline at end of file From 6ecc82f3d8dfe7f8b9d60fc459de46db0608b9fe Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:52:58 +0100 Subject: [PATCH 08/19] [TASK] added german translation --- src/routes/__error.svelte | 7 ++++++- src/translations/de.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte index e199f7b..c5790ac 100644 --- a/src/routes/__error.svelte +++ b/src/routes/__error.svelte @@ -1,8 +1,13 @@ +
404 Not Found
- Not found + {$_('notFound')}
diff --git a/src/translations/de.json b/src/translations/de.json index 281a340..8d0f271 100644 --- a/src/translations/de.json +++ b/src/translations/de.json @@ -1,5 +1,6 @@ { "indexText": "MathOnWeb ist eine open source Webanwendung, welche gebaut wurde, um effizient komplexe mathematische Operationen auszuführen. Deshalb muss diese Andwendung sehr schnell sein, um eine angenehme Nutzererfahrung zu bieten. Svelte benutzt keinen virtualDOM, sondern das native DOM des Browsers, was es sehr sehr schnell macht. Die Anwendung nutzt ES6, was von dem Großteil aller moderen Browser bereits unterstützt wird. Es wird in keinster Weise Virtualisierung genutzt, sondern nur die native Javascript-engine des Browsers. Des weiteren nutzt das Project Typescript, was eine große Type-safety und ein einige Performance Vorteile bietet. Ich würde mich freuen, würden sie einen Blick auf mein Projekt werfen.", + "notFound": "Die angefragte Seite konnte nicht gefunden werden. Falls unter dieser URL ein Feature vorhanden sein sollte, kontaktieren sie den Betreiber dieser Instanz, damit dieser die neuste Version von MathOnWeb installiert.", "navbar": { "home": "Home", "basic": "Standard", From f24317d390d97ec8a4cb1bf87d282be3e12c9a57 Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:55:11 +0100 Subject: [PATCH 09/19] [TASK] added english translation --- src/translations/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/translations/en.json b/src/translations/en.json index f34b601..cae3ca0 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1,5 +1,6 @@ { "indexText": "MathOnWeb is an open source web application that executes complex math operations. Therefore it must be very fast to provide an acceptable user experience. This is the reason why it does not use a virtualDOM like React. It uses the default DOM of ES6, supported by the most modern browsers natively. It does not use any type of virtualization. Furthermore it uses Typescript, which is typesafe and has some performance improvements. I would appreciate it, if you suppport this project on", + "notFound": "There is no resouce under this URL. If there should be a feature running, contact the server administrator so he can update to the latest version of MathOnWeb.", "navbar": { "home": "Home", "basic": "Basic", From f9f1f2bdaf8a251a1693ea68575233163a735972 Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 08:56:56 +0100 Subject: [PATCH 10/19] [TASK] added footer to __layout.svelte --- src/lib/footer.svelte | 0 src/routes/__layout.svelte | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 src/lib/footer.svelte diff --git a/src/lib/footer.svelte b/src/lib/footer.svelte new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 3800c2a..0f67414 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -1,5 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/styles/footer.scss b/src/styles/footer.scss new file mode 100644 index 0000000..426c083 --- /dev/null +++ b/src/styles/footer.scss @@ -0,0 +1,8 @@ +.footer { + width: 100vw; + height: 75px; + background: var(--footer-background); + position: absolute; + bottom: 0; + left: 0; +} \ No newline at end of file diff --git a/static/theme/dark.css b/static/theme/dark.css index 46536b1..4129c83 100644 --- a/static/theme/dark.css +++ b/static/theme/dark.css @@ -18,6 +18,7 @@ --calculator-data-display-background: white; --inverted-text-color: black; --result-form-color: white; + --footer-background: #1e1d22; } body { background: #0b0d11; overflow: hidden diff --git a/static/theme/light.css b/static/theme/light.css index cbb236c..95239cd 100644 --- a/static/theme/light.css +++ b/static/theme/light.css @@ -18,6 +18,7 @@ --calculator-data-display-background: #4b4b4b; --inverted-text-color: white; --result-form-color: #b8b8b8; + --footer-background: #dddddd; } body { background: white; overflow: hidden From 4b7f6bdbd056141f7e97141e57d667d65057816e Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 09:03:36 +0100 Subject: [PATCH 12/19] [TASK] added footer text color --- static/theme/dark.css | 1 + static/theme/light.css | 1 + 2 files changed, 2 insertions(+) diff --git a/static/theme/dark.css b/static/theme/dark.css index 4129c83..e16a2d4 100644 --- a/static/theme/dark.css +++ b/static/theme/dark.css @@ -19,6 +19,7 @@ --inverted-text-color: black; --result-form-color: white; --footer-background: #1e1d22; + --footer-text-color: #69676e; } body { background: #0b0d11; overflow: hidden diff --git a/static/theme/light.css b/static/theme/light.css index 95239cd..86fab1b 100644 --- a/static/theme/light.css +++ b/static/theme/light.css @@ -19,6 +19,7 @@ --inverted-text-color: white; --result-form-color: #b8b8b8; --footer-background: #dddddd; + --footer-text-color: #bebebe; } body { background: white; overflow: hidden From 359f341f84e2a8a8e8c3da59f1d118d463549f50 Mon Sep 17 00:00:00 2001 From: "handymathis@gmail..com" Date: Fri, 10 Dec 2021 09:08:25 +0100 Subject: [PATCH 13/19] [TASK] fixed footer themes --- src/lib/footer.svelte | 2 +- src/styles/footer.scss | 9 +++++++++ static/theme/light.css | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/footer.svelte b/src/lib/footer.svelte index 9cbe11c..c6f050d 100644 --- a/src/lib/footer.svelte +++ b/src/lib/footer.svelte @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/src/styles/privacy.scss b/src/styles/privacy.scss new file mode 100644 index 0000000..4a0db2a --- /dev/null +++ b/src/styles/privacy.scss @@ -0,0 +1,10 @@ +.privacy-heading { + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + font-size: 2.5em; +} +.privacy-text { + width: 80vw; + font-family: Arial, Helvetica, sans-serif; + font-size: 1.2em; +} \ No newline at end of file From 3ab08df87b05445da97150ff298114dacfa22c3d Mon Sep 17 00:00:00 2001 From: Mathis Burger Date: Mon, 10 Jan 2022 11:55:38 +0100 Subject: [PATCH 16/19] [TASK] added ncr calculator --- src/lib/defaults-provider.ts | 10 +++++++ src/lib/stochastics/ncr-calculator.ts | 15 ++++++++++ src/lib/stochastics/ncr-input.svelte | 17 +++++++++++ src/routes/stochastics/index.svelte | 5 ++++ src/routes/stochastics/ncr-calculator.svelte | 23 +++++++++++++++ src/styles/ncr.scss | 30 ++++++++++++++++++++ src/typings/ncr.d.ts | 4 +++ 7 files changed, 104 insertions(+) create mode 100644 src/lib/stochastics/ncr-calculator.ts create mode 100644 src/lib/stochastics/ncr-input.svelte create mode 100644 src/routes/stochastics/ncr-calculator.svelte create mode 100644 src/styles/ncr.scss create mode 100644 src/typings/ncr.d.ts diff --git a/src/lib/defaults-provider.ts b/src/lib/defaults-provider.ts index a5f5b22..570e4f6 100644 --- a/src/lib/defaults-provider.ts +++ b/src/lib/defaults-provider.ts @@ -1,4 +1,5 @@ import type { GeoLayerParameter, GeoLayerCoordinate } from '$src/typings/geo-layer'; +import type { NCR } from '$src/typings/ncr'; import type { Triangle } from '$src/typings/triangle'; import type { Vector } from '$src/typings/vector'; @@ -7,6 +8,7 @@ interface DefaultsProviderInterface { getGeoLayerParameterDefault(): GeoLayerParameter; getGeoLayerCoordinateDefault(): GeoLayerCoordinate; getDefaultTriangle(): Triangle; + getDefaultNCR(): NCR; } // Provides some functions to generate default values. @@ -54,4 +56,12 @@ export class DefaultsProvider implements DefaultsProviderInterface { getVectorDefault(): Vector { return { x: 0, y: 0, z: 0 }; } + + /** + * Returns a default NCR. + * @returns The generated NCR + */ + getDefaultNCR(): NCR { + return {n: 0, k: 0}; + } } diff --git a/src/lib/stochastics/ncr-calculator.ts b/src/lib/stochastics/ncr-calculator.ts new file mode 100644 index 0000000..8c1f7fd --- /dev/null +++ b/src/lib/stochastics/ncr-calculator.ts @@ -0,0 +1,15 @@ +import { faculty } from "$lib/custom-math"; +import type { NCR } from "$src/typings/ncr"; + +/** + * Calculates an nCr of a input. + * + * @param ncr Instance of the ncr value + * @returns number The nCr value of the calculation + */ +export function calculateNCr(ncr: NCR): number { + + const top = faculty(ncr.n); + const bottom = faculty(ncr.k) * faculty((ncr.n - ncr.k)); + return top / bottom; +} \ No newline at end of file diff --git a/src/lib/stochastics/ncr-input.svelte b/src/lib/stochastics/ncr-input.svelte new file mode 100644 index 0000000..24da34c --- /dev/null +++ b/src/lib/stochastics/ncr-input.svelte @@ -0,0 +1,17 @@ + + +
+
(
+
+ + +
+
)
+
+ + \ No newline at end of file diff --git a/src/routes/stochastics/index.svelte b/src/routes/stochastics/index.svelte index d05c525..7ca09fb 100644 --- a/src/routes/stochastics/index.svelte +++ b/src/routes/stochastics/index.svelte @@ -8,6 +8,11 @@ name: $_('stochastics.4-field-table.title'), description: $_('stochastics.4-field-table.description'), route: '/stochastics/4-field-table-completer' + }, + { + name: 'NCR', + description: 'NCR', + route: '/stochastics/ncr-calculator' } ]; diff --git a/src/routes/stochastics/ncr-calculator.svelte b/src/routes/stochastics/ncr-calculator.svelte new file mode 100644 index 0000000..233cd07 --- /dev/null +++ b/src/routes/stochastics/ncr-calculator.svelte @@ -0,0 +1,23 @@ + + +
+
+ + +
+ {calculateNCr(input)} +
+
+
+ + \ No newline at end of file diff --git a/src/styles/ncr.scss b/src/styles/ncr.scss new file mode 100644 index 0000000..3146716 --- /dev/null +++ b/src/styles/ncr.scss @@ -0,0 +1,30 @@ +.ncr-input { + display: flex; + flex-direction: column; + gap: 5px; + width: fit-content; + height: fit-content; +} + +.ncr-input-field { + width: 50px; + height: 50px; + outline: none; + border: none; +} + +.ncr-input-symbols { + color: var(--text-color); + font-size: 135px; + height: 100%; + text-align: center; + margin-top: -30px; +} + +.ncr-outer-wrapper { + display: flex; + flex-direction: row; + gap: 3px; + width: fit-content; + height: fit-content; +} \ No newline at end of file diff --git a/src/typings/ncr.d.ts b/src/typings/ncr.d.ts new file mode 100644 index 0000000..a17887a --- /dev/null +++ b/src/typings/ncr.d.ts @@ -0,0 +1,4 @@ +export interface NCR { + n: number; + k: number; +} \ No newline at end of file From 7df05422956123f175a558ff183a138b410b07c3 Mon Sep 17 00:00:00 2001 From: Mathis Burger Date: Mon, 10 Jan 2022 11:58:42 +0100 Subject: [PATCH 17/19] [TASK] added translations for nCr engine --- src/routes/stochastics/index.svelte | 4 ++-- src/translations/de.json | 4 ++++ src/translations/en.json | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/stochastics/index.svelte b/src/routes/stochastics/index.svelte index 7ca09fb..abb5fdd 100644 --- a/src/routes/stochastics/index.svelte +++ b/src/routes/stochastics/index.svelte @@ -10,8 +10,8 @@ route: '/stochastics/4-field-table-completer' }, { - name: 'NCR', - description: 'NCR', + name: $_('stochastics.ncr-calculator.title'), + description: $_('stochastics.ncr-calculator.description'), route: '/stochastics/ncr-calculator' } ]; diff --git a/src/translations/de.json b/src/translations/de.json index 8d0f271..b0397fe 100644 --- a/src/translations/de.json +++ b/src/translations/de.json @@ -72,6 +72,10 @@ "title": "4-Felder-Tafel", "description": "Vervollständigt eine 4 Felder Tafel", "button-text": "Tafel vervollständigen" + }, + "ncr-calculator": { + "title": "nCr berechnen", + "description": "Berechnet den nCr Wert einer stochastischen Berechnung" } } } diff --git a/src/translations/en.json b/src/translations/en.json index cae3ca0..e5e8c8f 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -72,6 +72,10 @@ "title": "4 Field table completer", "description": "Completes a 4 field table, if enough values are given", "button-text": "Complete table" + }, + "ncr-calculator": { + "title": "nCr calculator", + "description": "Calculates the nCr of tan stochastical calculation" } } } From 70820d5966e0166be7b1d3d490ca4b4bdcccf4d4 Mon Sep 17 00:00:00 2001 From: Mathis Burger Date: Mon, 10 Jan 2022 12:07:23 +0100 Subject: [PATCH 18/19] [TASK] documented typings --- src/typings/ListSelectorElement.d.ts | 9 +++++++++ src/typings/error.d.ts | 9 +++++++++ src/typings/four-field-table.d.ts | 27 +++++++++++++++++++++++++++ src/typings/geo-layer.d.ts | 21 +++++++++++++++++++++ src/typings/ncr.d.ts | 6 ++++++ src/typings/triangle.d.ts | 18 ++++++++++++++++++ src/typings/vector.d.ts | 9 +++++++++ 7 files changed, 99 insertions(+) diff --git a/src/typings/ListSelectorElement.d.ts b/src/typings/ListSelectorElement.d.ts index ce7f183..cb2bae1 100644 --- a/src/typings/ListSelectorElement.d.ts +++ b/src/typings/ListSelectorElement.d.ts @@ -1,5 +1,14 @@ export interface ListSelectorElement { + /** + * The name of the method. + */ name: string; + /** + * An general description of the method + */ description: string; + /** + * The route to the method. + */ route: string; } diff --git a/src/typings/error.d.ts b/src/typings/error.d.ts index 03330ca..ef5bafd 100644 --- a/src/typings/error.d.ts +++ b/src/typings/error.d.ts @@ -1,5 +1,14 @@ export interface ErrorMessage { + /** + * Indicates whether an error occured + */ errorOccurred: boolean; + /** + * The message of the response + */ message?: string; + /** + * The status code of the response + */ code?: number; } diff --git a/src/typings/four-field-table.d.ts b/src/typings/four-field-table.d.ts index 31eaa66..ab8d229 100644 --- a/src/typings/four-field-table.d.ts +++ b/src/typings/four-field-table.d.ts @@ -1,11 +1,38 @@ export interface FourFieldTableValues { + /** + * The combination of A and B + */ AB: number; + /** + * The combination of a and B + */ aB: number; + /** + * The combination of B and A + */ BA: number; + /** + * The combination of a and b + */ ab: number; + /** + * The sum of all A values + */ A_ALL: number; + /** + * The sum of all a values + */ a_ALL: number; + /** + * The sum of all B values + */ B_ALL: number; + /** + * The sum of all b values + */ b_ALL: number; + /** + * The complete result of the 4 field table. + */ ALL: number; } diff --git a/src/typings/geo-layer.d.ts b/src/typings/geo-layer.d.ts index 4d36ea0..2f988ba 100644 --- a/src/typings/geo-layer.d.ts +++ b/src/typings/geo-layer.d.ts @@ -1,13 +1,34 @@ import type { Vector } from './vector'; export interface GeoLayerParameter { + /** + * The starting vector of the layer + */ startVector: Vector; + /** + * The r vector of the layer + */ rVector: Vector; + /** + * The s vector of the layer + */ sVector: Vector; } export interface GeoLayerCoordinate { + /** + * The x value of the layer + */ x: number; + /** + * The y value of the layer + */ y: number; + /** + * The z value of the layer + */ z: number; + /** + * The result of the equation. + */ result: number; } diff --git a/src/typings/ncr.d.ts b/src/typings/ncr.d.ts index a17887a..f302390 100644 --- a/src/typings/ncr.d.ts +++ b/src/typings/ncr.d.ts @@ -1,4 +1,10 @@ export interface NCR { + /** + * The n value of the NCR + */ n: number; + /** + * The k value of the NCR + */ k: number; } \ No newline at end of file diff --git a/src/typings/triangle.d.ts b/src/typings/triangle.d.ts index 57a8d0a..4a05656 100644 --- a/src/typings/triangle.d.ts +++ b/src/typings/triangle.d.ts @@ -1,8 +1,26 @@ export interface Triangle { + /** + * The first kathethe of the triangle. + */ kathete1: number; + /** + * The second kathethe of the triangle. + */ kathete2: number; + /** + * The hypothenuse of the triangle. + */ hypothenuse: number; + /** + * The value of the alpha angle. + */ alpha: number; + /** + * The value of the beta angle. + */ beta: number; + /** + * The value of the gamma angle. + */ gamma: number; } diff --git a/src/typings/vector.d.ts b/src/typings/vector.d.ts index 0da05cb..c9bcef0 100644 --- a/src/typings/vector.d.ts +++ b/src/typings/vector.d.ts @@ -1,5 +1,14 @@ export interface Vector { + /** + * The x value of the vector + */ x: number; + /** + * The y value of the vector + */ y: number; + /** + * The z value of the vector + */ z: number; } From 2a5ef4e94e7b6dfe8deee1c15506e971c601f758 Mon Sep 17 00:00:00 2001 From: Mathis Burger Date: Mon, 10 Jan 2022 12:09:56 +0100 Subject: [PATCH 19/19] [LINT] linted code --- src/lib/custom-math.ts | 2 +- src/lib/defaults-provider.ts | 2 +- src/lib/footer.svelte | 8 ++--- src/lib/stochastics/ncr-calculator.ts | 15 +++++---- src/lib/stochastics/ncr-input.svelte | 20 ++++++------ src/routes/__error.svelte | 24 +++++++-------- src/routes/basic/faculty.svelte | 22 ++++++-------- src/routes/basic/index.svelte | 2 +- src/routes/basic/logarithm.svelte | 18 +++++------ src/routes/privacy.svelte | 15 +++++---- src/routes/stochastics/ncr-calculator.svelte | 25 ++++++++------- src/styles/error.scss | 26 ++++++++-------- src/styles/footer.scss | 26 ++++++++-------- src/styles/ncr.scss | 32 ++++++++++---------- src/styles/privacy.scss | 14 ++++----- src/typings/ncr.d.ts | 18 +++++------ 16 files changed, 130 insertions(+), 139 deletions(-) diff --git a/src/lib/custom-math.ts b/src/lib/custom-math.ts index d278f61..ebe63e4 100644 --- a/src/lib/custom-math.ts +++ b/src/lib/custom-math.ts @@ -15,7 +15,7 @@ function roundTo(val: number, decimals: number): number { /** * Calculates the faculty of the given number and * returns it. - * + * * @param num The´number that faculty should be calculated * @returns The faculty value of the given number */ diff --git a/src/lib/defaults-provider.ts b/src/lib/defaults-provider.ts index 570e4f6..59c5359 100644 --- a/src/lib/defaults-provider.ts +++ b/src/lib/defaults-provider.ts @@ -62,6 +62,6 @@ export class DefaultsProvider implements DefaultsProviderInterface { * @returns The generated NCR */ getDefaultNCR(): NCR { - return {n: 0, k: 0}; + return { n: 0, k: 0 }; } } diff --git a/src/lib/footer.svelte b/src/lib/footer.svelte index c6f050d..a602197 100644 --- a/src/lib/footer.svelte +++ b/src/lib/footer.svelte @@ -1,12 +1,10 @@ - \ No newline at end of file + @import '../styles/footer.scss'; + diff --git a/src/lib/stochastics/ncr-calculator.ts b/src/lib/stochastics/ncr-calculator.ts index 8c1f7fd..f429cc9 100644 --- a/src/lib/stochastics/ncr-calculator.ts +++ b/src/lib/stochastics/ncr-calculator.ts @@ -1,15 +1,14 @@ -import { faculty } from "$lib/custom-math"; -import type { NCR } from "$src/typings/ncr"; +import { faculty } from '$lib/custom-math'; +import type { NCR } from '$src/typings/ncr'; /** * Calculates an nCr of a input. - * + * * @param ncr Instance of the ncr value * @returns number The nCr value of the calculation */ export function calculateNCr(ncr: NCR): number { - - const top = faculty(ncr.n); - const bottom = faculty(ncr.k) * faculty((ncr.n - ncr.k)); - return top / bottom; -} \ No newline at end of file + const top = faculty(ncr.n); + const bottom = faculty(ncr.k) * faculty(ncr.n - ncr.k); + return top / bottom; +} diff --git a/src/lib/stochastics/ncr-input.svelte b/src/lib/stochastics/ncr-input.svelte index 24da34c..948e7d5 100644 --- a/src/lib/stochastics/ncr-input.svelte +++ b/src/lib/stochastics/ncr-input.svelte @@ -1,17 +1,17 @@
-
(
-
- - -
-
)
+
(
+
+ + +
+
)
\ No newline at end of file + @import '../../styles/ncr.scss'; + diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte index c5790ac..cd261a4 100644 --- a/src/routes/__error.svelte +++ b/src/routes/__error.svelte @@ -1,19 +1,17 @@ +
-
-
404 Not Found
-
- {$_('notFound')} -
-
+
+
404 Not Found
+
+ {$_('notFound')} +
+
- \ No newline at end of file + @import '../styles/general.scss'; + @import '../styles/error.scss'; + diff --git a/src/routes/basic/faculty.svelte b/src/routes/basic/faculty.svelte index eb3a832..38c4e3e 100644 --- a/src/routes/basic/faculty.svelte +++ b/src/routes/basic/faculty.svelte @@ -1,20 +1,18 @@
-
- -
- {faculty(input)} -
-
+
+ +
+ {faculty(input)} +
+
\ No newline at end of file + @import '../../styles/general.scss'; + diff --git a/src/routes/basic/index.svelte b/src/routes/basic/index.svelte index 5fe5132..e5fa163 100644 --- a/src/routes/basic/index.svelte +++ b/src/routes/basic/index.svelte @@ -2,7 +2,7 @@ import ListSelector from '../../lib/listSelector.svelte'; import type { ListSelectorElement } from '../../typings/ListSelectorElement'; import { _ } from 'svelte-i18n'; -import { roundTo } from '$lib/custom-math'; + import { roundTo } from '$lib/custom-math'; let apps: ListSelectorElement[] = [ { diff --git a/src/routes/basic/logarithm.svelte b/src/routes/basic/logarithm.svelte index 0186bf0..22427e5 100644 --- a/src/routes/basic/logarithm.svelte +++ b/src/routes/basic/logarithm.svelte @@ -1,16 +1,16 @@
-
- -
- {Math.log(input)} -
-
+
+ +
+ {Math.log(input)} +
+
\ No newline at end of file + @import '../../styles/general.scss'; + diff --git a/src/routes/privacy.svelte b/src/routes/privacy.svelte index 9dded87..db00715 100644 --- a/src/routes/privacy.svelte +++ b/src/routes/privacy.svelte @@ -1,12 +1,11 @@
-
-

Privacy

-
Some privacy placeholder text
-
+
+

Privacy

+
Some privacy placeholder text
+
- \ No newline at end of file + @import '../styles/general.scss'; + @import '../styles/privacy.scss'; + diff --git a/src/routes/stochastics/ncr-calculator.svelte b/src/routes/stochastics/ncr-calculator.svelte index 233cd07..75c6072 100644 --- a/src/routes/stochastics/ncr-calculator.svelte +++ b/src/routes/stochastics/ncr-calculator.svelte @@ -1,23 +1,22 @@
-
- +
+ -
- {calculateNCr(input)} -
-
+
+ {calculateNCr(input)} +
+
\ No newline at end of file + @import '../../styles/general.scss'; + diff --git a/src/styles/error.scss b/src/styles/error.scss index 2e3a636..58e8125 100644 --- a/src/styles/error.scss +++ b/src/styles/error.scss @@ -1,16 +1,16 @@ .error-heading { - font-family: Arial, Helvetica, sans-serif; - font-size: 3em; - color: var(--text-color); - width: 500px; - text-align: center; - font-weight: bold; + font-family: Arial, Helvetica, sans-serif; + font-size: 3em; + color: var(--text-color); + width: 500px; + text-align: center; + font-weight: bold; } .error-container { - width: 500px; - height: 300px; - text-align: center; - font-family: Arial, Helvetica, sans-serif; - font-size: 1.3em; - color: var(--text-color); -} \ No newline at end of file + width: 500px; + height: 300px; + text-align: center; + font-family: Arial, Helvetica, sans-serif; + font-size: 1.3em; + color: var(--text-color); +} diff --git a/src/styles/footer.scss b/src/styles/footer.scss index 682dbc5..7c93286 100644 --- a/src/styles/footer.scss +++ b/src/styles/footer.scss @@ -1,17 +1,17 @@ .footer { - width: 100vw; - height: 75px; - background: var(--footer-background); - position: absolute; - bottom: 0; - left: 0; - display: grid; - place-items: center; - grid-template-columns: 20% 80%; + width: 100vw; + height: 75px; + background: var(--footer-background); + position: absolute; + bottom: 0; + left: 0; + display: grid; + place-items: center; + grid-template-columns: 20% 80%; } .footer-copyright { - font-size: 1.3em; - color: var(--footer-text-color); - font-weight: bold; -} \ No newline at end of file + font-size: 1.3em; + color: var(--footer-text-color); + font-weight: bold; +} diff --git a/src/styles/ncr.scss b/src/styles/ncr.scss index 3146716..8efe80a 100644 --- a/src/styles/ncr.scss +++ b/src/styles/ncr.scss @@ -1,20 +1,20 @@ .ncr-input { - display: flex; - flex-direction: column; - gap: 5px; - width: fit-content; - height: fit-content; + display: flex; + flex-direction: column; + gap: 5px; + width: fit-content; + height: fit-content; } .ncr-input-field { - width: 50px; - height: 50px; - outline: none; - border: none; + width: 50px; + height: 50px; + outline: none; + border: none; } .ncr-input-symbols { - color: var(--text-color); + color: var(--text-color); font-size: 135px; height: 100%; text-align: center; @@ -22,9 +22,9 @@ } .ncr-outer-wrapper { - display: flex; - flex-direction: row; - gap: 3px; - width: fit-content; - height: fit-content; -} \ No newline at end of file + display: flex; + flex-direction: row; + gap: 3px; + width: fit-content; + height: fit-content; +} diff --git a/src/styles/privacy.scss b/src/styles/privacy.scss index 4a0db2a..23cd306 100644 --- a/src/styles/privacy.scss +++ b/src/styles/privacy.scss @@ -1,10 +1,10 @@ .privacy-heading { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - font-size: 2.5em; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + font-size: 2.5em; } .privacy-text { - width: 80vw; - font-family: Arial, Helvetica, sans-serif; - font-size: 1.2em; -} \ No newline at end of file + width: 80vw; + font-family: Arial, Helvetica, sans-serif; + font-size: 1.2em; +} diff --git a/src/typings/ncr.d.ts b/src/typings/ncr.d.ts index f302390..d6dcb35 100644 --- a/src/typings/ncr.d.ts +++ b/src/typings/ncr.d.ts @@ -1,10 +1,10 @@ export interface NCR { - /** - * The n value of the NCR - */ - n: number; - /** - * The k value of the NCR - */ - k: number; -} \ No newline at end of file + /** + * The n value of the NCR + */ + n: number; + /** + * The k value of the NCR + */ + k: number; +}