/* * 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 { TLogStationData } from "../../../types/log.ts"; import dayjs from "dayjs"; import { toast } from "react-toastify"; import { Link } from "react-router-dom"; import { UserIcons } from "../../mini/icons/UserIcons.tsx"; export const StationLog = ({ data }: { data: TLogStationData }) => { 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: \`https://steamcommunity.com/profiles/${ data.player.id }\`\n;server: \`${ data.server.toUpperCase() }\`\n;left: ${ data.joinedDate ? `\n;joined: ` : "" }\n;station: \`${ data.stationName }\`\n;link: ${ location.href }\n\n`); }; return
Player

{ data.player.username }

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

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

{ t("log.station.station", { name: data.stationName, short: data.stationShort }) }

{ data.joinedDate &&

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

}

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

{ data.joinedDate &&

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

}
; };