From 287091a70469d08569abe8c188251fef172f9f7d Mon Sep 17 00:00:00 2001 From: Julien Gautier Date: Mon, 18 Sep 2023 22:53:28 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'models'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core/models/calculator.model.ts | 27 ++++--- src/app/core/models/chart.model.ts | 95 +++++-------------------- src/app/core/models/profile.model.ts | 3 +- src/app/core/models/user.model.ts | 1 + 4 files changed, 40 insertions(+), 86 deletions(-) diff --git a/src/app/core/models/calculator.model.ts b/src/app/core/models/calculator.model.ts index d462908..e3e2c07 100644 --- a/src/app/core/models/calculator.model.ts +++ b/src/app/core/models/calculator.model.ts @@ -1,21 +1,28 @@ -export interface CalcResult { - weight: number; - jumps: number; - minSize: number; - minSize11: number; - minSize21: number; +export interface CalculatorInfo { + charges: CalculatorResult; + sizesFeet: CalculatorResult; + sizesMeter: CalculatorResult; + state: { + color: string + }, error?: string; } +export interface CalculatorResult { + current?: number; + min: number; + min11: number; +} export interface InputParams { jumps: number; weight: number; gear: number; current: number; + color: string; } export interface Range { num: number; - active?: string; + active: string; name: string; label: string; start: number; @@ -23,9 +30,13 @@ export interface Range { value: number; } +export interface TableHeader { + name: string; + active: string; +} export interface WeightSize { weight: number; - active?: string; + active: string; ranges: Range[]; } diff --git a/src/app/core/models/chart.model.ts b/src/app/core/models/chart.model.ts index 8db338a..c838f54 100644 --- a/src/app/core/models/chart.model.ts +++ b/src/app/core/models/chart.model.ts @@ -1,80 +1,21 @@ +import { ChartConfiguration, ChartOptions } from 'chart.js'; -import { Configuration } from 'ng-chartist'; +export interface BarConfig { + barChartData: ChartConfiguration<'bar'>['data'], + barChartOptions: ChartConfiguration<'bar'>['options'], + barChartPlugins: any[], + barChartLegend: boolean +} -export const chartPieDonute: Configuration = { - type: 'Pie', - data: { - "labels": [], - "series": [] - }, - options: { - donut: true, - height: 260, - donutWidth: 46, - startAngle: 270, - showLabel: true - } -}; +export interface DoughnutConfig { + doughnutChartLabels: string[], + doughnutChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'], + doughnutChartOptions: ChartConfiguration<'doughnut'>['options'], + doughnutChartLegend: boolean +} -export const chartBar: Configuration = { - type: 'Bar', - data: { - "labels": [], - "series": [] - }, - options: {}, - responsiveOptions: [] -}; -/* -export const chartBar: Configuration = { - type: 'Bar', - data: { - "labels": [], - "series": [] - }, - options: { - seriesBarDistance: 5, - high: 170, - axisX: { - showGrid: false, - offset: 20 - }, - axisY: { - showGrid: true, - offset: 40 - }, - height: 207 - }, - responsiveOptions: [ - ['screen and (min-width: 1024px)', { - axisX: { - labelInterpolationFnc: function(value: number, index: number): string { - return index % 1 === 0 ? `${value}` : ''; - } - } - }], - ['screen and (min-width: 641px) and (max-width: 1024px)', { - seriesBarDistance: 10, - axisY: { - offset: 30 - }, - axisX: { - labelInterpolationFnc: function(value: any, index: number): string { - return index % 1 === 0 ? `${value[2]}${value[3]}` : ''; - } - } - }], - ['screen and (max-width: 640px)', { - seriesBarDistance: 5, - axisY: { - offset: 20 - }, - axisX: { - labelInterpolationFnc: function(value: any, index: number): string { - return index % 1 === 0 ? `${value[2]}${value[3]}` : ''; - } - } - }] - ] -}; -*/ \ No newline at end of file +export interface LineConfig { + lineChartData: ChartConfiguration<'line'>['data'], + lineChartOptions: ChartOptions<'line'>, + lineChartLegend: boolean +} diff --git a/src/app/core/models/profile.model.ts b/src/app/core/models/profile.model.ts index a501c8a..4d8c0a2 100644 --- a/src/app/core/models/profile.model.ts +++ b/src/app/core/models/profile.model.ts @@ -1,6 +1,7 @@ export interface Profile { username: string; - licence?: string; + licence?: number; + poids?: number; image?: string; bg_image?: string; following: boolean; diff --git a/src/app/core/models/user.model.ts b/src/app/core/models/user.model.ts index de84058..b83edd2 100644 --- a/src/app/core/models/user.model.ts +++ b/src/app/core/models/user.model.ts @@ -6,6 +6,7 @@ export interface User { lastname: string; phone: string; licence?: number; + poids?: number; image?: string; bg_image?: string; token: string;