diff --git a/src/app.html b/src/app.html index b082ec7..bba211f 100644 --- a/src/app.html +++ b/src/app.html @@ -34,46 +34,40 @@ - - - - Статистика - - - Хранилищ: - 0 + + + + + + + - - Сервисов: - 0 - - - Авторов: - 0 + + Добро пожаловать в + Storage Service - - Ошибки - - - Критические: - 0 - - - Ошибки запросов: - 0 - - + + Storage Service - + это платформа для быстрого создания JSON хранилищ с удобным API для внедрения в + Web-приложения + + + + + Хранилищ 0 + + + Сервисов 0 + + + Авторов 0 + - - - - - Добро пожаловать в приложение Storage Service @@ -391,7 +385,7 @@ - + diff --git a/src/components/main-content/MainContent.js b/src/components/main-content/MainContent.js deleted file mode 100644 index b1a4201..0000000 --- a/src/components/main-content/MainContent.js +++ /dev/null @@ -1,9 +0,0 @@ -import Component from '../component/Component'; - -class MainContent extends Component { - constructor (parentNode) { - super('#main-content', parentNode); - } -} - -export default MainContent; diff --git a/src/components/main-content/index.js b/src/components/main-content/index.js deleted file mode 100644 index 456aa7e..0000000 --- a/src/components/main-content/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import MainContent from './MainContent'; - -export default MainContent; diff --git a/src/components/main-page/MainPage.js b/src/components/main-page/MainPage.js index 1c52ec5..33a099c 100644 --- a/src/components/main-page/MainPage.js +++ b/src/components/main-page/MainPage.js @@ -1,12 +1,10 @@ import Component from '../component/index'; import MainStatistic from '../main-statistic'; -import MainContent from '../main-content'; class MainPage extends Component { constructor (mainNodeSelector, parentNode) { super(mainNodeSelector, parentNode); this.mainStatistic = this.createComponent(MainStatistic, this.mainNode); - this.mainContent = this.createComponent(MainContent, this.mainNode); } } diff --git a/src/components/main-statistic/MainStatistic.css b/src/components/main-statistic/MainStatistic.css new file mode 100644 index 0000000..b9b1331 --- /dev/null +++ b/src/components/main-statistic/MainStatistic.css @@ -0,0 +1,30 @@ +.MainStatistic__logo { + width: 120px; +} + +.MainStatistic__text { + max-width: 400px; +} + +.MainStatistic__notify { + width: 150px; + max-width: 150px; +} + +.MainStatistic__notify { + margin: 0 8px 16px 8px; +} + +@media (max-width: 420px) { + .MainStatistic__logo { + width: 80px; + } +} + +@media (max-width: 530px) { + .MainStatistic__notifyContainer { + display: flex; + flex-direction: column; + align-items: center; + } +} diff --git a/src/components/main-statistic/MainStatistic.js b/src/components/main-statistic/MainStatistic.js index 9fe50b5..483c385 100644 --- a/src/components/main-statistic/MainStatistic.js +++ b/src/components/main-statistic/MainStatistic.js @@ -1,8 +1,34 @@ import Component from '../component/index'; +import './MainStatistic.css'; +import storageApi from '../../api/StorageServiceAPI'; class MainStatistic extends Component { constructor (parentNode) { super('#main-statistic', parentNode); + + this.storeCount = this.mainNode.querySelector('.MainStatistic__storeCount'); + this.serviceCount = this.mainNode.querySelector('.MainStatistic__serviceCount'); + this.authorCount = this.mainNode.querySelector('.MainStatistic__authorCount'); + + this.initStatistic(); + } + + initStatistic = async () => { + const storageList = await storageApi.request(); + const [services, authors] = storageList.reduce((memo, store) => { + const {service_name, author} = store; + if (!memo[0].includes(service_name)) { + memo[0].push(service_name); + } + if (!memo[1].includes(author)) { + memo[1].push(author); + } + return memo; + }, [[], []]); + + this.storeCount.textContent = storageList.length; + this.serviceCount.textContent = services.length; + this.authorCount.textContent = authors.length; } }
Добро пожаловать в
Storage Service
Storage Service - + это платформа для быстрого создания JSON хранилищ с удобным API для внедрения в + Web-приложения +
Добро пожаловать в приложение Storage Service