1
0
Fork 0
This commit is contained in:
Layfer7 2023-12-23 13:05:22 +02:00
parent 1e0c30af69
commit 04e25bf1f1
10 changed files with 86 additions and 18 deletions

View File

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 291 B

View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 197 B

View File

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,21 +1,85 @@
import React from "react";
export default function Wagon() {
export default function Wagon({wagon}) {
const colors = {
"НТС" : ["#BCF3FF", "#2988AE"],
"ГК" : ["#C8F4C1", "#6EA566"],
"АТЛ" : ["#FFB762", "#ED7817"],
"ПГК" : ["#FFBEFC", "#B5457C"],
"МОД" : ["#C5AAFF", "#8E4D9B"],
"РЖД" : ["#ABABAB", "#6E6E6D"],
"НПК" : ["#FDF0EF", "#EB5835"],
"ФГК" : ["#FFF3B4", "#F69112"],
"МЕЧ" : ["#ACCDFF", "#7086A9"],
}
let topFillColor = colors[wagon.owner] ? colors[wagon.owner][0] : "white";
let topBorderColor = colors[wagon.owner] ? colors[wagon.owner][1] : "#B1ADC2";
let bottomFillColor = "#E8E6ED";
let bottomStrokeColor = "#B1ADC2";
if (wagon.isSick) {
topFillColor = "#EB5835";
topBorderColor = "#E32112";
bottomFillColor = "#EB5835";
bottomStrokeColor = "#E32112"
}
return (
<div className="wagon relative flex flex-col items-center">
<svg className="stroke-[#B1ADC2] fill-[#B1ADC2]" width="56" height="11" viewBox="0 0 56 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.07495 7.01257L3.31665 3.39221H22.9696L20.7285 7.01257H6.07495Z" fill="#E8E6ED"/>
<path d="M35.7659 6.83069L33.0076 3.21033H52.6605L50.4194 6.83069H35.7659Z" fill="#E8E6ED"/>
<circle cx="9.04639" cy="7.49683" r="3"/>
<circle cx="38.7373" cy="7.31482" r="3"/>
<circle cx="17.2397" cy="7.49683" r="3"/>
<circle cx="46.9307" cy="7.31482" r="3"/>
<rect x="16.2175" y="7.0127" width="2.04443" height="0.968384"/>
<rect x="45.9084" y="6.83069" width="2.04443" height="0.968384"/>
<rect x="8.02441" y="7.0127" width="2.04443" height="0.968384"/>
<rect x="37.7153" y="6.83069" width="2.04443" height="0.968384"/>
<rect x="0.925537" y="1.15942" width="54.1947" height="3.18713"/>
<div className="relative top-[2px]">
{WagonTop(wagon.type, topFillColor, topBorderColor)}
</div>
<svg width="56" height="11" viewBox="0 0 56 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.07495 7.01257L3.31665 3.39221H22.9696L20.7285 7.01257H6.07495Z" fill={bottomFillColor} stroke={bottomStrokeColor}/>
<path d="M35.7659 6.83069L33.0076 3.21033H52.6605L50.4194 6.83069H35.7659Z" fill={bottomFillColor} stroke={bottomStrokeColor}/>
<circle cx="9.04639" cy="7.49683" r="3" fill={bottomStrokeColor} stroke={bottomStrokeColor}/>
<circle cx="38.7373" cy="7.31482" r="3" fill={bottomStrokeColor} stroke={bottomStrokeColor}/>
<circle cx="17.2397" cy="7.49683" r="3" fill={bottomStrokeColor} stroke={bottomStrokeColor}/>
<circle cx="46.9307" cy="7.31482" r="3" fill={bottomStrokeColor} stroke={bottomStrokeColor}/>
<rect x="16.2175" y="7.0127" width="2.04443" height="0.968384" fill="white"/>
<rect x="45.9084" y="6.83069" width="2.04443" height="0.968384" fill="white"/>
<rect x="8.02441" y="7.0127" width="2.04443" height="0.968384" fill="white"/>
<rect x="37.7153" y="6.83069" width="2.04443" height="0.968384" fill="white"/>
<rect x="0.925537" y="1.15942" width="54.1947" height="3.18713" fill={bottomFillColor} stroke={bottomStrokeColor}/>
</svg>
</div>
)
}
function WagonTop(type, fillColor, strokeColor) {
switch(type) {
case 'Platform':
return (
<svg width="53" height="12" viewBox="0 0 53 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.36719" y="1.44104" width="50.921" height="9.63171" fill={fillColor} stroke={strokeColor}/>
</svg>);
case 'Hopper':
return (
<svg width="47" height="22" viewBox="0 0 47 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3.88965" y="6.69342" width="14.6898" height="1.11673" transform="rotate(100.267 3.88965 6.69342)" fill={strokeColor}/>
<path d="M0.791016 4.13611V0.644592H45.8314V4.13611H44.6675V7.0457H42.4562V18.9168C39.3915 19.4987 31.3532 20.6626 23.7185 20.6626C16.0837 20.6626 7.34718 19.4987 3.93326 18.9168V7.0457H1.72197V4.13611H0.791016Z" fill={fillColor} stroke={strokeColor}/>
<rect width="14.2979" height="1.11673" transform="matrix(-0.178232 -0.983988 -0.983988 0.178232 46.2188 21.0416)" fill={strokeColor}/>
</svg>
);
case 'Tank':
return (
<svg width="53" height="23" viewBox="0 0 53 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="20.0884" y="1.02466" width="12.5083" height="2.50012" fill={fillColor} stroke={strokeColor} />
<rect x="9.51611" y="1.83508" width="3.57275" height="2.1897" fill={strokeColor}/>
<rect x="39.5952" y="1.60547" width="3.57275" height="2.1897" fill={strokeColor}/>
<rect x="1.2583" y="3.42993" width="50.2886" height="18.7327" rx="4.5" fill={fillColor} stroke={strokeColor}/>
</svg>
);
case 'CoveredCarriage':
return (
<svg width="53" height="23" viewBox="0 0 53 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.36035 5.4895C1.36035 3.00422 3.37507 0.989502 5.86035 0.989502H47.7814C50.2667 0.989502 52.2814 3.00422 52.2814 5.4895V22.0762H1.36035V5.4895Z" fill={fillColor} stroke={strokeColor}/>
</svg>
)
default:
return(
<svg width="53" height="22" viewBox="0 0 53 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="0.980957" y="0.832642" width="50.921" height="20.2404" fill={fillColor} stroke={strokeColor}/>
</svg>
)
}
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import type { LoaderFunctionArgs } from "@remix-run/node";
import { authenticator } from "../services/auth.server";
import Wagon from 'app/coms/wagon';
import Wagon from '../coms/wagon';
export async function loader({ request }: LoaderFunctionArgs) {
return await authenticator.isAuthenticated(request, {
@ -12,8 +12,12 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function Index() {
return(
<div id="control-form">
<div id="control-header">
<Wagon />
<div id="control-header" className='flex items-end'>
<Wagon wagon={{type: "Hoppers", isSick: true}} />
<Wagon wagon={{type: "Platform"}} />
<Wagon wagon={{type: "CoveredCarriage"}} />
<Wagon wagon={{type: "Hopper"}} />
<Wagon wagon={{type: "Tank", owner: "НТС"}} />
</div>
</div>
)

View File

@ -1,7 +1,7 @@
import { Authenticator } from "remix-auth";
import { sessionStorage } from "./session.server";
import { FormStrategy } from "remix-auth-form";
import bcrypt from "bcrypt";
import {hash, compare } from "bcrypt";
interface User{
login: string,
@ -28,7 +28,7 @@ authenticator.use(
let password = <string>form.get("password");
let hashedPassword = "";
await bcrypt.hash(password, saltRounds, (err, hash) => {
await hash(password, saltRounds, (err, hash) => {
if (err) {
throw err;
}