Skip to content

Commit

Permalink
Fix compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Nov 21, 2023
1 parent cab5e4d commit 88765aa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
2 changes: 1 addition & 1 deletion client-next/src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Stack } from 'react-bootstrap';
import { Button } from 'react-bootstrap';
import { ServerInfo, TripQueryVariables } from '../../gql/graphql.ts';
import { LocationInputField } from './LocationInputField.tsx';
import { DepartureArrivalSelect } from './DepartureArrivalSelect.tsx';
Expand Down
37 changes: 13 additions & 24 deletions client-next/src/components/SearchBar/ServerInfoTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
import { ServerInfo } from '../../gql/graphql.ts';
import { Overlay } from 'react-bootstrap';
import { MutableRefObject, ReactNode, useRef } from 'react';
import { MutableRefObject } from 'react';

export function ServerInfoTooltip({ target, serverInfo }: { target: MutableRefObject<any>; serverInfo?: ServerInfo }) {
export function ServerInfoTooltip({ target, serverInfo }: { target: MutableRefObject<null>; serverInfo?: ServerInfo }) {
return (
<Overlay target={target.current} show={!!serverInfo} placement="right">
{({
placement: _placement,
arrowProps: _arrowProps,
show: _show,
popper: _popper,
hasDoneInitialMeasure: _hasDoneInitialMeasure,
...props
}) => (
<div
{...props}
style={{
position: 'absolute',
backgroundColor: 'rgba(255, 100, 100, 0.85)',
padding: '2px 10px',
color: 'white',
borderRadius: 3,
...props.style,
}}
>
<pre>{JSON.stringify(serverInfo, null, 2)}</pre>
</div>
)}
<div
style={{
position: 'absolute',
backgroundColor: 'rgba(255, 100, 100, 0.85)',
padding: '2px 10px',
color: 'white',
borderRadius: 3,
}}
>
<pre>{JSON.stringify(serverInfo, null, 2)}</pre>
</div>
</Overlay>
);
}
4 changes: 2 additions & 2 deletions client-next/src/hooks/useServerInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { graphql } from '../gql';
import request from 'graphql-request';
import { QueryType, TripQueryVariables } from '../gql/graphql.ts';
import { QueryType } from '../gql/graphql.ts';

const endpoint = import.meta.env.VITE_API_URL;

Expand Down
2 changes: 1 addition & 1 deletion client-next/src/util/formatDistance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Adapted from src/client/js/otp/util/Geo.js#distanceStringMetric
*/
export function formatDistance(meters: number) {
let kilometers = meters / 1000;
const kilometers = meters / 1000;
if (kilometers > 100) {
//100 km => 999999999 km
return `${kilometers.toFixed(0)} km`;
Expand Down

0 comments on commit 88765aa

Please sign in to comment.