diff --git a/client/api/main-page/main-page.types.ts b/client/api/main-page/main-page.types.ts
index 01944247..ccf18d92 100644
--- a/client/api/main-page/main-page.types.ts
+++ b/client/api/main-page/main-page.types.ts
@@ -38,6 +38,7 @@ export interface Card {
cardId: null;
subtitle: null | string;
subtitleColor: string;
+ dynamicId: string;
createdAt: Date;
updatedAt: Date;
publishedAt: Date;
diff --git a/client/components/MainPage/Card/Card.module.css b/client/components/MainPage/Card/Card.module.css
index e804a4d9..d7f247fa 100644
--- a/client/components/MainPage/Card/Card.module.css
+++ b/client/components/MainPage/Card/Card.module.css
@@ -9,6 +9,7 @@
--CardSubtitleColor: inherit;
+ position: relative;
display: flex;
flex-direction: column;
align-items: flex-start;
diff --git a/client/components/MainPage/Card/Card.tsx b/client/components/MainPage/Card/Card.tsx
index 7dc2980d..e83f494f 100644
--- a/client/components/MainPage/Card/Card.tsx
+++ b/client/components/MainPage/Card/Card.tsx
@@ -1,4 +1,3 @@
-import React from 'react';
import classNames from 'classnames/bind';
import { CardProps } from './Card.types';
@@ -24,6 +23,7 @@ export function Card({
buttonBackground,
subtitle,
subtitleColor,
+ dynamicContent
}: CardProps) {
return (
@@ -43,9 +43,15 @@ export function Card({
{t(title)}
}
- {subtitle &&
- {t(subtitle)}
-
}
+ {
+ dynamicContent
+ ? dynamicContent
+ : <>
+ {subtitle &&
+ {subtitle}
+
}
+ >
+ }
);
}
diff --git a/client/components/MainPage/Card/Card.types.ts b/client/components/MainPage/Card/Card.types.ts
index c3fe86cf..5e0b3f7c 100644
--- a/client/components/MainPage/Card/Card.types.ts
+++ b/client/components/MainPage/Card/Card.types.ts
@@ -1,3 +1,5 @@
+import { ReactElement } from "react";
+
export type CardProps = {
title: string;
titleColor: string;
@@ -11,5 +13,6 @@ export type CardProps = {
subtitle: string;
subtitleColor: string;
invert: boolean;
+ dynamicContent: ReactElement;
key: number;
};
diff --git a/client/components/MainPage/Card/CardDynamic/CardTrafficJams.module.css b/client/components/MainPage/Card/CardDynamic/CardTrafficJams.module.css
new file mode 100644
index 00000000..ce4e1d91
--- /dev/null
+++ b/client/components/MainPage/Card/CardDynamic/CardTrafficJams.module.css
@@ -0,0 +1,6 @@
+.CardTrafficJams {
+ position: absolute;
+ bottom: .35em;
+ right: .45em;
+ font-size: 100px;
+}
diff --git a/client/components/MainPage/Card/CardDynamic/CardTrafficJams.tsx b/client/components/MainPage/Card/CardDynamic/CardTrafficJams.tsx
new file mode 100644
index 00000000..184398c7
--- /dev/null
+++ b/client/components/MainPage/Card/CardDynamic/CardTrafficJams.tsx
@@ -0,0 +1,15 @@
+import classNames from 'classnames/bind';
+
+import styles from './CardTrafficJams.module.css';
+
+const cn = classNames.bind(styles);
+
+export function CardTrafficJams({ score }) {
+ return (
+ <>
+
+ {score}
+
+ >
+ )
+}
diff --git a/client/components/MainPage/Card/CardDynamic/CardTransportA11y.module.css b/client/components/MainPage/Card/CardDynamic/CardTransportA11y.module.css
new file mode 100644
index 00000000..c99824b2
--- /dev/null
+++ b/client/components/MainPage/Card/CardDynamic/CardTransportA11y.module.css
@@ -0,0 +1,17 @@
+.CardTransportA11y {
+ font-size: 1.25em;
+}
+
+.CardTransportA11yList {
+ display: flex;
+ gap: 1.25em;
+}
+
+.CardTransportA11yItem {
+ font-weight: 600;
+ text-align: left;
+}
+
+.CardTransportA11yItem dd {
+ margin: 12px 0 0;
+}
diff --git a/client/components/MainPage/Card/CardDynamic/CardTransportA11y.tsx b/client/components/MainPage/Card/CardDynamic/CardTransportA11y.tsx
new file mode 100644
index 00000000..16701bca
--- /dev/null
+++ b/client/components/MainPage/Card/CardDynamic/CardTransportA11y.tsx
@@ -0,0 +1,32 @@
+import classNames from 'classnames/bind';
+
+import styles from './CardTransportA11y.module.css';
+
+const cn = classNames.bind(styles);
+
+export function CardTransportA11y({ buses, trolls, trams }) {
+ return (
+
+
+ Сейчас в городе ходит низкопольный транспорт:
+
+
+
+
+
- Автобусы
+ - {buses}
+
+
+
+
- Троллейбусы
+ - {trolls}
+
+
+
+
- Трамваи
+ - {trams}
+
+
+
+ )
+}
diff --git a/client/components/MainPage/MainPage.module.css b/client/components/MainPage/MainPage.module.css
index b1f31364..aae7f43d 100644
--- a/client/components/MainPage/MainPage.module.css
+++ b/client/components/MainPage/MainPage.module.css
@@ -58,9 +58,7 @@
aspect-ratio: 1 / 1;
}
-/* TODO: control grid size via CMS */
-.MainPageCardGrid > *:nth-child(1),
-.MainPageCardGrid > *:nth-child(8) {
+.MainPageCardGrid > *:nth-child(1) {
grid-area: span 1 / span 2;
aspect-ratio: 2 / 1;
}
@@ -72,9 +70,7 @@
}
.MainPageCardGrid > *:nth-child(1),
- .MainPageCardGrid > *:nth-child(6),
- .MainPageCardGrid > *:nth-child(8),
- .MainPageCardGrid > *:nth-child(11) {
+ .MainPageCardGrid > *:nth-child(6) {
grid-area: span 1 / span 2;
aspect-ratio: 2 / 1;
}
@@ -85,9 +81,5 @@
.MainPageCardGrid {
grid-template-columns: repeat(4,1fr);
}
-
- .MainPageCardGrid > * {
- aspect-ratio: auto;
- }
}
diff --git a/client/components/MainPage/MainPage.tsx b/client/components/MainPage/MainPage.tsx
index 09080dae..85f5dfb3 100644
--- a/client/components/MainPage/MainPage.tsx
+++ b/client/components/MainPage/MainPage.tsx
@@ -4,18 +4,25 @@ import React from 'react';
import classNames from 'classnames/bind';
import { MainPageTypes } from './MainPage.types';
import { Card } from './Card/Card';
+import { CardTrafficJams } from './Card/CardDynamic/CardTrafficJams';
+import { CardTransportA11y } from './Card/CardDynamic/CardTransportA11y';
import Logo from './Logo.svg';
-import Footer from './Footer.svg';
import styles from './MainPage.module.css';
import { Marquee } from './Marquee/Marquee';
const cn = classNames.bind(styles);
-export function MainPage({ cards, trafficJams, a11yTransportCounters, marqueeItems }: MainPageTypes) {
- // TODO Output data to dynamic cards
- console.log({ trafficJams, a11yTransportCounters });
+export function MainPage({ cards, cardsDynamicData, marqueeItems }: MainPageTypes) {
+ const getDynamicContent = (dynamicId) => {
+ switch (dynamicId) {
+ case 'a11y-transport':
+ return
+ case 'traffic-jams':
+ return
+ }
+ }
return (
@@ -28,8 +35,8 @@ export function MainPage({ cards, trafficJams, a11yTransportCounters, marqueeIte
{cards
.sort((a, b) => a.attributes.priority - b.attributes.priority)
- .map(({ id, attributes }) => (
- {
+ return
- ))}
+ })}
);
-}
+}
\ No newline at end of file
diff --git a/client/components/MainPage/MainPage.types.tsx b/client/components/MainPage/MainPage.types.tsx
index 51644b16..3803e43a 100644
--- a/client/components/MainPage/MainPage.types.tsx
+++ b/client/components/MainPage/MainPage.types.tsx
@@ -7,8 +7,10 @@ import type {
export type MainPageTypes = {
cards: Card[];
- trafficJams: number;
- a11yTransportCounters: AccessibilityTransportCounters,
+ cardsDynamicData: {
+ trafficJams: number;
+ a11yTransportCounters: AccessibilityTransportCounters,
+ };
notifications: Notification[];
marqueeItems: Marquee[];
};
diff --git a/client/pages/index.tsx b/client/pages/index.tsx
index 99978ff8..7dbbc3d6 100644
--- a/client/pages/index.tsx
+++ b/client/pages/index.tsx
@@ -19,8 +19,10 @@ export async function getStaticProps() {
return {
props: {
cards: await MainPageApi.getCards() || [],
- trafficJams: await MainPageApi.getTrafficJamsCounter() || null,
- a11yTransportCounters: await MainPageApi.getA11yTransportCounters() || {},
+ cardsDynamicData: {
+ trafficJams: await MainPageApi.getTrafficJamsCounter() || null,
+ a11yTransportCounters: await MainPageApi.getA11yTransportCounters() || {},
+ },
marqueeItems: await MainPageApi.getMarqueeItems() || [],
},
revalidate: 60,
diff --git a/common/strapi/constants.js b/common/strapi/constants.js
new file mode 100644
index 00000000..75332c44
--- /dev/null
+++ b/common/strapi/constants.js
@@ -0,0 +1,11 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.REQUEST_PAGINATION_SIZE = exports.PASSWORD = exports.EMAIL = exports.STRAPI_URL = void 0;
+exports.STRAPI_URL = 'https://transport-cms.ekaterinburg.io';
+// email of Authenticated User
+exports.EMAIL = process.env.STRAPI_EMAIL;
+// password of Authenticated User
+exports.PASSWORD = process.env.STRAPI_PASSWORD;
+// pagination size to request all of the data from table
+exports.REQUEST_PAGINATION_SIZE = 400;
+//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/common/strapi/constants.js.map b/common/strapi/constants.js.map
new file mode 100644
index 00000000..88fbfc25
--- /dev/null
+++ b/common/strapi/constants.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,uCAAuC,CAAC;AAClE,8BAA8B;AACjB,QAAA,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AAC9C,iCAAiC;AACpB,QAAA,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;AACpD,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,GAAG,CAAC"}
\ No newline at end of file
diff --git a/common/strapi/create-methods.js b/common/strapi/create-methods.js
new file mode 100644
index 00000000..13433fec
--- /dev/null
+++ b/common/strapi/create-methods.js
@@ -0,0 +1,111 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createStrapiMethods = void 0;
+const tslib_1 = require("tslib");
+const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
+const parallelRequests_1 = require("../utils/parallelRequests");
+const constants_1 = require("./constants");
+function createStrapiMethods(contentType, jwt) {
+ const requestToStrapiOptions = {
+ headers: Object.assign({ 'Content-Type': 'application/json' }, (jwt ? { Authorization: `Bearer ${jwt}` } : {})),
+ };
+ function publish(data) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ const resp = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/${contentType}s`, Object.assign(Object.assign({}, requestToStrapiOptions), { method: 'POST', body: JSON.stringify({
+ data,
+ }) }));
+ if (resp.status !== 200) {
+ throw new Error(resp.statusText);
+ }
+ const body = (yield resp.json());
+ if (body.error) {
+ throw new Error(JSON.stringify(body.error));
+ }
+ }
+ catch (e) {
+ console.log(e);
+ }
+ });
+ }
+ function update(data) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ const { id } = data, attributes = tslib_1.__rest(data, ["id"]);
+ const resp = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/${contentType}s/${id}`, Object.assign(Object.assign({ method: 'PUT' }, requestToStrapiOptions), { body: JSON.stringify({
+ data: attributes,
+ }) }));
+ if (resp.status !== 200) {
+ throw new Error(resp.statusText);
+ }
+ const body = (yield resp.json());
+ if (body.error) {
+ throw new Error(JSON.stringify(body.error));
+ }
+ }
+ catch (e) {
+ console.log(e);
+ }
+ });
+ }
+ function deleteById(id) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ const resp = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/${contentType}s/${id}`, Object.assign({ method: 'DELETE' }, requestToStrapiOptions));
+ if (resp.status !== 200) {
+ throw new Error(resp.statusText);
+ }
+ const body = (yield resp.json());
+ if (body.error) {
+ throw new Error(JSON.stringify(body.error));
+ }
+ }
+ catch (e) {
+ console.log(e);
+ }
+ });
+ }
+ function getAll(filter, withImage = false) {
+ var _a, _b;
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ const sizeRequest = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/${contentType}s?pagination[pageSize]=1${filter ? '&' + filter : ''}`, requestToStrapiOptions);
+ if (sizeRequest.status !== 200) {
+ throw new Error(sizeRequest.statusText);
+ }
+ const sizeRequestBody = (yield sizeRequest.json());
+ if (sizeRequestBody.error) {
+ throw new Error(JSON.stringify(sizeRequestBody.error));
+ }
+ const pageCount = Math.ceil(((_b = (_a = sizeRequestBody === null || sizeRequestBody === void 0 ? void 0 : sizeRequestBody.meta) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.total) / constants_1.REQUEST_PAGINATION_SIZE);
+ const requests = [];
+ for (let i = 1; i <= pageCount; i++) {
+ requests.push((0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/${contentType}s?pagination[page]=${i}&pagination[pageSize]=${constants_1.REQUEST_PAGINATION_SIZE}${withImage ? '&populate=image' : ''}${filter ? '&' + filter : ''}`, requestToStrapiOptions));
+ }
+ const response = yield (0, parallelRequests_1.parallelRequests)(requests, (rawResult) => tslib_1.__awaiter(this, void 0, void 0, function* () {
+ if (rawResult.status !== 200) {
+ throw new Error(rawResult.statusText);
+ }
+ const result = yield rawResult.json();
+ if (result.error) {
+ throw new Error(JSON.stringify(result.error));
+ }
+ return result.data;
+ }));
+ return response;
+ }
+ catch (e) {
+ console.log(e);
+ return [];
+ }
+ });
+ }
+ return {
+ publish,
+ update,
+ deleteById,
+ getAll,
+ };
+}
+exports.createStrapiMethods = createStrapiMethods;
+//# sourceMappingURL=create-methods.js.map
\ No newline at end of file
diff --git a/common/strapi/create-methods.js.map b/common/strapi/create-methods.js.map
new file mode 100644
index 00000000..ba6ac8d1
--- /dev/null
+++ b/common/strapi/create-methods.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"create-methods.js","sourceRoot":"","sources":["create-methods.ts"],"names":[],"mappings":";;;;AAAA,oEAA6C;AAG7C,gEAA6D;AAC7D,2CAAkE;AAElE,SAAgB,mBAAmB,CAAC,WAA+B,EAAE,GAAY;IAC7E,MAAM,sBAAsB,GAAG;QAC3B,OAAO,kBACH,cAAc,EAAE,kBAAkB,IAC/B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACrD;KACJ,CAAC;IAEF,SAAe,OAAO,CAAI,IAAO;;YAC7B,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,sBAAU,QAAQ,WAAW,GAAG,kCACrD,sBAAsB,KACzB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACjB,IAAI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C;AACN,CAAC;AA9ID,kDA8IC"}
\ No newline at end of file
diff --git a/common/strapi/login.js b/common/strapi/login.js
new file mode 100644
index 00000000..fba70ff8
--- /dev/null
+++ b/common/strapi/login.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.loginStrapi = void 0;
+const tslib_1 = require("tslib");
+const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
+const constants_1 = require("./constants");
+function loginStrapi() {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ const response = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/auth/local`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ identifier: constants_1.EMAIL,
+ password: constants_1.PASSWORD,
+ }),
+ });
+ const body = (yield response.json());
+ const { jwt } = body;
+ return jwt;
+ });
+}
+exports.loginStrapi = loginStrapi;
+//# sourceMappingURL=login.js.map
\ No newline at end of file
diff --git a/common/strapi/login.js.map b/common/strapi/login.js.map
new file mode 100644
index 00000000..d2a7aa3b
--- /dev/null
+++ b/common/strapi/login.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"login.js","sourceRoot":"","sources":["login.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAG/B,2CAA0D;AAE1D,SAAsB,WAAW;;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,sBAAU,iBAAiB,EAAE;YACzD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,UAAU,EAAE,iBAAK;gBACjB,QAAQ,EAAE,oBAAQ;aACrB,CAAC;SACL,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAwB,CAAC;QAE5D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAErB,OAAO,GAAG,CAAC;IACf,CAAC;CAAA;AAjBD,kCAiBC"}
\ No newline at end of file
diff --git a/common/strapi/upload.js b/common/strapi/upload.js
new file mode 100644
index 00000000..db7dbf79
--- /dev/null
+++ b/common/strapi/upload.js
@@ -0,0 +1,44 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.uploadFile = exports.deleteFile = void 0;
+const tslib_1 = require("tslib");
+const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
+const constants_1 = require("./constants");
+function deleteFile(id, jwt) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/upload/files/${id}`, {
+ headers: Object.assign({}, (jwt ? { Authorization: `Bearer ${jwt}` } : {})),
+ method: 'DELETE',
+ });
+ }
+ catch (e) {
+ console.log(e);
+ }
+ });
+}
+exports.deleteFile = deleteFile;
+function uploadFile(data, jwt) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ try {
+ const resp = yield (0, node_fetch_1.default)(`${constants_1.STRAPI_URL}/api/upload`, {
+ headers: Object.assign(Object.assign({}, data.getHeaders()), (jwt ? { Authorization: `Bearer ${jwt}` } : {})),
+ method: 'POST',
+ body: data,
+ });
+ const body = (yield resp.json());
+ if (body.error) {
+ throw new Error(JSON.stringify(body.error));
+ }
+ if (resp.status !== 200) {
+ throw new Error(resp.statusText);
+ }
+ return body;
+ }
+ catch (e) {
+ console.log(e);
+ }
+ });
+}
+exports.uploadFile = uploadFile;
+//# sourceMappingURL=upload.js.map
\ No newline at end of file
diff --git a/common/strapi/upload.js.map b/common/strapi/upload.js.map
new file mode 100644
index 00000000..9bd1cefb
--- /dev/null
+++ b/common/strapi/upload.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"upload.js","sourceRoot":"","sources":["upload.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAG/B,2CAAyC;AAEzC,SAAsB,UAAU,CAAC,EAAU,EAA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/ekaterinburg-rf.js
new file mode 100644
index 00000000..79393427
--- /dev/null
+++ b/common/types/ekaterinburg-rf.js
@@ -0,0 +1,16 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.TransportEn = exports.TransportRu = void 0;
+var TransportRu;
+(function (TransportRu) {
+ TransportRu["Bus"] = "\u0410\u0432\u0442\u043E\u0431\u0443\u0441";
+ TransportRu["Tram"] = "\u0422\u0440\u0430\u043C\u0432\u0430\u0439";
+ TransportRu["Troll"] = "\u0422\u0440\u043E\u043B\u043B\u0435\u0439\u0431\u0443\u0441";
+})(TransportRu = exports.TransportRu || (exports.TransportRu = {}));
+var TransportEn;
+(function (TransportEn) {
+ TransportEn["Bus"] = "Bus";
+ TransportEn["Tram"] = "Tram";
+ TransportEn["Troll"] = "Trolley";
+})(TransportEn = exports.TransportEn || (exports.TransportEn = {}));
+//# sourceMappingURL=ekaterinburg-rf.js.map
\ No newline at end of file
diff --git a/common/types/ekaterinburg-rf.js.map b/common/types/ekaterinburg-rf.js.map
new file mode 100644
index 00000000..06188fcb
--- /dev/null
+++ b/common/types/ekaterinburg-rf.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"ekaterinburg-rf.js","sourceRoot":"","sources":["ekaterinburg-rf.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,iEAAe,CAAA;IACf,kEAAgB,CAAA;IAChB,qFAAoB,CAAA;AACxB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,0BAAW,CAAA;IACX,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACrB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB"}
\ No newline at end of file
diff --git a/common/types/masstrans.js b/common/types/masstrans.js
new file mode 100644
index 00000000..7f45ff23
--- /dev/null
+++ b/common/types/masstrans.js
@@ -0,0 +1,24 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ImageSizes = exports.StopType = exports.ClientUnit = void 0;
+var ClientUnit;
+(function (ClientUnit) {
+ ClientUnit["Bus"] = "bus";
+ ClientUnit["Tram"] = "tram";
+ ClientUnit["Troll"] = "troll";
+})(ClientUnit = exports.ClientUnit || (exports.ClientUnit = {}));
+var StopType;
+(function (StopType) {
+ StopType["Bus"] = "bus";
+ StopType["Tram"] = "tram";
+ StopType["Troll"] = "troll";
+ StopType["TrollBus"] = "troll-bus";
+})(StopType = exports.StopType || (exports.StopType = {}));
+var ImageSizes;
+(function (ImageSizes) {
+ ImageSizes["Thumbnail"] = "thumbnail";
+ ImageSizes["Small"] = "small";
+ ImageSizes["Medium"] = "medium";
+ ImageSizes["Large"] = "large";
+})(ImageSizes = exports.ImageSizes || (exports.ImageSizes = {}));
+//# sourceMappingURL=masstrans.js.map
\ No newline at end of file
diff --git a/common/types/masstrans.js.map b/common/types/masstrans.js.map
new file mode 100644
index 00000000..918aa1c9
--- /dev/null
+++ b/common/types/masstrans.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"masstrans.js","sourceRoot":"","sources":["masstrans.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;AACnB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAChB,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,kCAAsB,CAAA;AAC1B,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB;AA4FD,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,6BAAe,CAAA;AACnB,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB"}
\ No newline at end of file
diff --git a/common/types/strapi.js b/common/types/strapi.js
new file mode 100644
index 00000000..be250f4a
--- /dev/null
+++ b/common/types/strapi.js
@@ -0,0 +1,10 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.StrapiContentTypes = void 0;
+var StrapiContentTypes;
+(function (StrapiContentTypes) {
+ StrapiContentTypes["Stop"] = "stop";
+ StrapiContentTypes["TransportTree"] = "transport-tree";
+ StrapiContentTypes["UnitInfo"] = "unit-info";
+})(StrapiContentTypes = exports.StrapiContentTypes || (exports.StrapiContentTypes = {}));
+//# sourceMappingURL=strapi.js.map
\ No newline at end of file
diff --git a/common/types/strapi.js.map b/common/types/strapi.js.map
new file mode 100644
index 00000000..9673d721
--- /dev/null
+++ b/common/types/strapi.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"strapi.js","sourceRoot":"","sources":["strapi.ts"],"names":[],"mappings":";;;AAEA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,sDAAgC,CAAA;IAChC,4CAAsB,CAAA;AAC1B,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
\ No newline at end of file
diff --git a/common/utils/parallelRequests.js b/common/utils/parallelRequests.js
new file mode 100644
index 00000000..fc363a4e
--- /dev/null
+++ b/common/utils/parallelRequests.js
@@ -0,0 +1,17 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parallelRequests = void 0;
+const tslib_1 = require("tslib");
+function parallelRequests(jobs, concatenator) {
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
+ const rawResults = yield Promise.all(jobs);
+ const result = [];
+ for (const rawResult of rawResults) {
+ const dataToConcat = yield concatenator(rawResult);
+ result.push(...dataToConcat);
+ }
+ return result;
+ });
+}
+exports.parallelRequests = parallelRequests;
+//# sourceMappingURL=parallelRequests.js.map
\ No newline at end of file
diff --git a/common/utils/parallelRequests.js.map b/common/utils/parallelRequests.js.map
new file mode 100644
index 00000000..b00242ad
--- /dev/null
+++ b/common/utils/parallelRequests.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"parallelRequests.js","sourceRoot":"","sources":["parallelRequests.ts"],"names":[],"mappings":";;;;AAAA,SAAsB,gBAAgB,CAClC,IAAkB,EAClB,YAAyC;;QAEzC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,MAAM,GAAQ,EAAE,CAAC;QAEvB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAChC,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;SAChC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA;AAdD,4CAcC"}
\ No newline at end of file