Rename interfaces

This commit is contained in:
Siklos 2022-07-31 00:11:37 +02:00
parent 58ec891db3
commit d9822fdabc
11 changed files with 33 additions and 67 deletions

View file

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import './App.scss'; import './App.scss';
import Sidebar from './Components/Sidebar/Sidebar'; import Sidebar from './Components/Sidebar/Sidebar';
import { IAvailableContainerModel } from './Interfaces/IAvailableContainerModel'; import { AvailableContainer } from './Interfaces/AvailableContainer';
import { IConfigurationResponseModel } from './Interfaces/IConfigurationResponseModel'; import { Configuration } from './Interfaces/Configuration';
import { SVG } from './SVG/SVG'; import { SVG } from './SVG/SVG';
interface IAppProps { interface IAppProps {
@ -10,7 +10,7 @@ interface IAppProps {
interface IAppState { interface IAppState {
isSidebarOpen: boolean, isSidebarOpen: boolean,
configuration: IConfigurationResponseModel configuration: Configuration
} }
class App extends React.Component<IAppProps> { class App extends React.Component<IAppProps> {
@ -23,13 +23,13 @@ class App extends React.Component<IAppProps> {
configuration: { configuration: {
AvailableContainers: [], AvailableContainers: [],
AvailableSymbols: [], AvailableSymbols: [],
MainContainer: {} as IAvailableContainerModel MainContainer: {} as AvailableContainer
} }
}; };
} }
componentDidMount() { componentDidMount() {
fetchConfiguration().then((configuration: IConfigurationResponseModel) => { fetchConfiguration().then((configuration: Configuration) => {
this.setState({ this.setState({
isSidebarOpen: this.state.isSidebarOpen, isSidebarOpen: this.state.isSidebarOpen,
configuration configuration
@ -55,7 +55,7 @@ class App extends React.Component<IAppProps> {
} }
} }
async function fetchConfiguration(): Promise<IConfigurationResponseModel> { async function fetchConfiguration(): Promise<Configuration> {
const url = `${import.meta.env.VITE_API_URL}`; const url = `${import.meta.env.VITE_API_URL}`;
const myHeaders = new Headers({ const myHeaders = new Headers({
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -69,7 +69,7 @@ async function fetchConfiguration(): Promise<IConfigurationResponseModel> {
return await fetch(url, myInit) return await fetch(url, myInit)
.then((response) => .then((response) =>
response.json() response.json()
) as IConfigurationResponseModel; ) as Configuration;
} }
export default App; export default App;

View file

@ -1,8 +1,8 @@
import * as React from 'react'; import * as React from 'react';
import { IAvailableContainerModel } from '../../Interfaces/IAvailableContainerModel'; import { AvailableContainer } from '../../Interfaces/AvailableContainer';
interface ISidebarProps { interface ISidebarProps {
componentOptions: IAvailableContainerModel[] componentOptions: AvailableContainer[]
isOpen: boolean; isOpen: boolean;
onClick: () => void; onClick: () => void;
} }

View file

@ -1,11 +0,0 @@
import { AddingBehavior } from '../Enums/AddingBehavior';
import { IImageModel } from './IImageModel';
export interface IActionContainerModel {
Id: string
CustomLogo: IImageModel
Label: string
Description: string
Action: string
AddingBehavior: AddingBehavior
}

View file

@ -0,0 +1,9 @@
import React from 'react';
/** Model of available container used in application configuration */
export interface AvailableContainer {
Type: string
Width: number
Height: number
Style: React.CSSProperties
}

View file

@ -1,12 +1,12 @@
import { XPositionReference } from '../Enums/XPositionReference'; import { XPositionReference } from '../Enums/XPositionReference';
import { IImageModel } from './IImageModel'; import { Image } from './Image';
/** /**
* Model of available symbol to configure the application */ * Model of available symbol to configure the application */
export interface IAvailableSymbolModel { export interface AvailableSymbolModel {
Name: string Name: string
XPositionReference: XPositionReference XPositionReference: XPositionReference
Image: IImageModel Image: Image
Width: number Width: number
Height: number Height: number
} }

View file

@ -0,0 +1,9 @@
import { AvailableContainer } from './AvailableContainer';
import { AvailableSymbolModel } from './AvailableSymbol';
/** Model of configuration for the application to configure it */
export interface Configuration {
AvailableContainers: AvailableContainer[];
AvailableSymbols: AvailableSymbolModel[];
MainContainer: AvailableContainer;
}

View file

@ -1,28 +0,0 @@
import { IActionContainerModel } from './ActionContainerModel'
import { IAvailableDefaultContainerModel } from './IAvailableDefaultContainerModel'
/** Model of available container used in application configuration */
export interface IAvailableContainerModel {
Type: string
BodyColor: string
BorderColor: string
BorderWidth: number
Width: number
Height: number
Padding: number
MinWidth: number
MaxWidth: number
MinHeight: number
MaxHeight: number
IsWidthFixed: boolean
IsPositionFixed: boolean
ShowCotation: boolean
/** Default Type container to add with this container (Priority on DefaultChildrenContainers property) */
TypeChildContainerDefault: string
/** Default children container to add with this container */
DefaultChildrenContainers: IAvailableDefaultContainerModel[]
ContainerActions: IActionContainerModel[]
}

View file

@ -1,4 +0,0 @@
export interface IAvailableDefaultContainerModel {
Type: string
DefaultChildrenContainers: IAvailableDefaultContainerModel[]
}

View file

@ -1,9 +0,0 @@
import { IAvailableContainerModel } from './IAvailableContainerModel';
import { IAvailableSymbolModel } from './IAvailableSymbolModel';
/** Model of configuration for the application to configure it */
export interface IConfigurationResponseModel {
AvailableContainers: IAvailableContainerModel[];
AvailableSymbols: IAvailableSymbolModel[];
MainContainer: IAvailableContainerModel;
}

View file

@ -1,5 +1,5 @@
/** Model of an image with multiple source */ /** Model of an image with multiple source */
export interface IImageModel { export interface Image {
Name: string; Name: string;
Url: string; Url: string;
Base64Image: string; Base64Image: string;

View file

@ -1,9 +1,9 @@
import * as React from 'react'; import * as React from 'react';
import { IAvailableContainerModel } from '../Interfaces/IAvailableContainerModel'; import { AvailableContainer } from '../Interfaces/AvailableContainer';
import { MainContainer } from './Elements/MainContainer'; import { MainContainer } from './Elements/MainContainer';
interface ISVGProps { interface ISVGProps {
MainContainer: IAvailableContainerModel MainContainer: AvailableContainer
} }
export class SVG extends React.Component<ISVGProps> { export class SVG extends React.Component<ISVGProps> {