/* * Copyright (C) 2024 Aleksander WilczyƄski (aleks@alekswilc.dev) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * See LICENSE for more. */ import { useTranslation } from "react-i18next"; import { TLogTrainData } from "../../../types/log.ts"; import dayjs from "dayjs"; import { toast } from "react-toastify"; import { Link } from "react-router-dom"; import { FaCheck } from 'react-icons/fa6'; export const TrainLog = ({ data }: { data: TLogTrainData }) => { const { t } = useTranslation(); const copyLink = () => { void navigator.clipboard.writeText(location.href); toast.success(t("log.toasts.copied")); }; const report = () => { toast.info(t("log.toasts.report"), { autoClose: 5000, }); void navigator.clipboard.writeText(`;user: \`${ data.player.username }\`\n;steam: \`${ data.player.id }\`\n;left: ${ data.joinedDate ? `\n;joined: ` : "" }\n;train: \`${ data.trainNumber }\`\n;link: ${ location.href }\n\n`); }; return
profile

{ data.player.username } { data.player.flags.includes('verified') && }

{ t("log.train.header") }

{ t("log.train.server", { server: data.server.toUpperCase() }) }

{ t("log.train.train", { name: data.trainName, number: data.trainNumber }) }

{ (data.distance || data.distance === 0) &&

{ t("log.train.distance", { distance: (data.distance / 1000).toFixed(2) }) }

} { (data.points || data.points === 0) &&

{ t("log.train.points", { points: data.points }) }

} { data.joinedDate &&

{ t("log.train.joined", { date: dayjs(data.joinedDate).format("DD/MM/YYYY HH:mm") }) }

}

{ t("log.train.left", { date: dayjs(data.leftDate).format("DD/MM/YYYY HH:mm") }) }

{ data.joinedDate &&

{ t("log.train.spent", { date: dayjs.duration(data.leftDate - data.joinedDate).format("H[h] m[m]") }) }

}
; };