vom laptop
This commit is contained in:
42
src/components/FlightsTable.tsx
Normal file
42
src/components/FlightsTable.tsx
Normal file
@ -0,0 +1,42 @@
|
||||
import React from "react";
|
||||
import SortableTable from "./SortableTable";
|
||||
import {THeader} from "./SortableTable";
|
||||
import {IFlight} from '../interfaces/IFlights';
|
||||
|
||||
function Link2Flight(key: string, row: any, data: string | null)
|
||||
{
|
||||
var val: JSX.Element = <></>;
|
||||
const link: string = 'https://de.dhv-xc.de/flight/' + row['IDFlight'];
|
||||
val = <td><a href={link} target="_blank" rel="noopener noreferrer" >{data}</a></td>;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function Meter2Km(key: string, row: any, data: string | null)
|
||||
{
|
||||
var val: JSX.Element = <></>;
|
||||
const numdata: number = +data! / 1000;
|
||||
val = <td>{numdata}</td>;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
export default function FlightsTable(flightdata: IFlight[])
|
||||
//export default function FlightsTable(flightdata: any)
|
||||
{
|
||||
const headers: THeader[] = [
|
||||
{ key: "IDFlight", label: "ID", visible: false },
|
||||
{ key: "FlightDate", label: "Datum", callback: Link2Flight },
|
||||
{ key: "TakeoffWaypointName", label: "Start" },
|
||||
{ key: "Glider", label: "Gleitschirm" },
|
||||
{ key: "BestTaskDistance", label: "Strecke", callback: Meter2Km },
|
||||
{ key: "BestTaskType", label: "Streckentyp" },
|
||||
{ key: "BestTaskPoints", label: "Punkte" }
|
||||
];
|
||||
|
||||
return(
|
||||
<div className='App'>
|
||||
<SortableTable<IFlight> headers={headers} dataTbl={flightdata} ></SortableTable>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user