🚨 Try to make TS linter happy
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { JSX } from 'solid-js';
|
||||
|
||||
import { Line } from './types';
|
||||
|
||||
const validTransportModes = ["bus", "tram", "metro", "rer", "transilien", "funicular", "ter", "unknown"];
|
||||
|
||||
export const TransportModeWeights = {
|
||||
export const TransportModeWeights: Record<string, number> = {
|
||||
bus: 1,
|
||||
tram: 2,
|
||||
val: 3,
|
||||
@@ -13,20 +15,19 @@ export const TransportModeWeights = {
|
||||
ter: 8,
|
||||
};
|
||||
|
||||
export function renderLineTransportMode(line: Line): JSX.Element {
|
||||
return <img src={getTransportModeSrc(line.transportMode)} />
|
||||
}
|
||||
|
||||
export function getTransportModeSrc(mode: string, color: boolean = true): string | null {
|
||||
let ret = null;
|
||||
export function getTransportModeSrc(mode: string, color: boolean = true): string | undefined {
|
||||
let ret = undefined;
|
||||
if (validTransportModes.includes(mode)) {
|
||||
ret = `/public/symbole_${mode}_${color ? "" : "support_fonce_"}RVB.svg`;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function renderLineTransportMode(line: Line): JSX.Element {
|
||||
return <img src={getTransportModeSrc(line.transportMode)} />
|
||||
}
|
||||
|
||||
function renderBusLinePicto(line: Line, styles): JSX.Element {
|
||||
function renderBusLinePicto(line: Line, styles: CSSModuleClasses): JSX.Element {
|
||||
return (
|
||||
<div class={styles.busLinePicto}>
|
||||
<svg viewBox="0 0 31.5 14">
|
||||
@@ -44,7 +45,7 @@ function renderBusLinePicto(line: Line, styles): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
function renderTramLinePicto(line: Line, styles): JSX.Element {
|
||||
function renderTramLinePicto(line: Line, styles: CSSModuleClasses): JSX.Element {
|
||||
const lineStyle = { fill: `#${line.backColorHexa}` };
|
||||
return (
|
||||
<div class={styles.tramLinePicto}>
|
||||
@@ -64,10 +65,10 @@ function renderTramLinePicto(line: Line, styles): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
function renderMetroLinePicto(line: Line, styles): JSX.Element {
|
||||
function renderMetroLinePicto(line: Line, styles: CSSModuleClasses): JSX.Element {
|
||||
return (
|
||||
<div class={styles.metroLinePicto}>
|
||||
<svg viewbox="0 0 20 20">
|
||||
<svg viewBox="0 0 20 20">
|
||||
<circle cx="10" cy="10" r="10" style={{ fill: `#${line.backColorHexa}` }} />
|
||||
<text x="50%"
|
||||
y="55%"
|
||||
@@ -81,10 +82,10 @@ function renderMetroLinePicto(line: Line, styles): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
function renderTrainLinePicto(line: Line, styles): JSX.Element {
|
||||
function renderTrainLinePicto(line: Line, styles: CSSModuleClasses): JSX.Element {
|
||||
return (
|
||||
<div class={styles.trainLinePicto}>
|
||||
<svg viewbox="0 0 20 20">
|
||||
<svg viewBox="0 0 20 20">
|
||||
<rect x="0" y="0" width="20" height="20" rx="4.5" ry="4.5" style={{ fill: `#${line.backColorHexa}` }} />
|
||||
<text x="50%"
|
||||
y="55%"
|
||||
@@ -99,7 +100,7 @@ function renderTrainLinePicto(line: Line, styles): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
export function renderLinePicto(line: Line, styles): JSX.Element {
|
||||
export function renderLinePicto(line: Line, styles: CSSModuleClasses): JSX.Element {
|
||||
switch (line.transportMode) {
|
||||
case "bus":
|
||||
case "funicular":
|
||||
|
Reference in New Issue
Block a user