import React from "react";
import { action } from "storybook/actions";
import styled from "styled-components";
import { Stop } from "@opentripplanner/types";
import {
RentalVehicle,
VehicleRentalStation
} from "@opentripplanner/types/otp2";
import { IntlProvider } from "react-intl";
import { Meta } from "@storybook/react-vite";
import MapPopupContents, { Feed } from "./index";
// HOC to wrap components with IntlProvider
const withIntl = (Story: () => JSX.Element) => (
);
export default {
title: "Map Popup",
decorators: [withIntl]
} as Meta;
const STOP_NO_CODE = {
flex: false,
gtfsId: "9526",
id: "9526",
lat: 45.523009,
lon: -122.672529,
name: "W Burnside & SW 2nd"
};
const STOP_WITH_CODE = {
flex: false,
code: "9526",
gtfsId: "9526",
id: "9526",
lat: 45.523009,
lon: -122.672529,
name: "W Burnside & SW 2nd"
};
const STOP_WITH_FEED_ID = {
flex: false,
code: "9526",
gtfsId: "trimet:9526",
id: "trimet:9526",
lat: 45.523009,
lon: -122.672529,
name: "W Burnside & SW 2nd"
};
const SAMPLE_FEEDS: Feed[] = [
{
feedId: "trimet",
publisher: {
name: "TriMet"
}
},
{
feedId: "c-tran",
publisher: {
name: "C-TRAN"
}
},
{
feedId: "portland-streetcar",
publisher: {
name: "Portland Streetcar"
}
}
];
const VEHICLE_RENTAL_STATION: VehicleRentalStation = {
allowDropoff: true,
allowPickup: true,
availableVehicles: {
total: 6,
byType: [{ count: 6, vehicleType: { formFactor: "BICYCLE" } }]
},
availableSpaces: {
total: 11,
byType: [{ count: 12, vehicleType: { formFactor: "BICYCLE" } }]
},
id: '"hub_1580"',
lat: 45.5219604810172,
lon: -122.6896771788597,
name: "SW Morrison at 18th",
rentalNetwork: { networkId: "BIKETOWN" },
realtime: true
};
const FLOATING_VEHICLE: RentalVehicle = {
allowPickupNow: true,
id: '"bike_6861"',
vehicleType: { formFactor: "BICYCLE" },
lat: 45.525486666666666,
lon: -122.70486,
name: "0541",
rentalNetwork: { networkId: "BIKETOWN" }
};
const FLOATING_CAR: RentalVehicle = {
allowPickupNow: true,
id: "car_6861",
vehicleType: { formFactor: "CAR" },
lat: 52.52,
lon: 13.405,
name: "0541",
rentalNetwork: { networkId: "MILES" }
};
const getEntityPrefixExample = (entity: Stop | VehicleRentalStation) => {
const DemoIcon = styled.span`
background-color: blue;
border-radius: 50px;
color: white;
margin-right: 0.5ch;
padding: 2px;
`;
return {entity.name?.charAt(0)};
};
export const StopEntity = (): JSX.Element => (
);
export const StopEntityWithFeedName = (): JSX.Element => (
);
export const StopEntityWithEntityPrefix = (): JSX.Element => (
);
export const StopEntityNoHandlers = (): JSX.Element => (
);
export const StopEntityNoStopCode = (): JSX.Element => (
);
export const StationEntity = (): JSX.Element => (
);
export const FloatingCarEntity = (): JSX.Element => (
);
export const FloatingVehicleEntity = (): JSX.Element => (
);