2022-08-27 15:26:00 +03:00
|
|
|
import WeatherApi from "components/widgets/weather/weather";
|
2022-08-27 13:30:17 +03:00
|
|
|
import OpenWeatherMap from "components/widgets/openweathermap/weather";
|
2022-08-24 10:44:35 +03:00
|
|
|
import Resources from "components/widgets/resources/resources";
|
|
|
|
|
|
|
|
const widgetMappings = {
|
2022-08-27 15:26:00 +03:00
|
|
|
weather: WeatherApi, // This key will be deprecated in the future
|
|
|
|
weatherapi: WeatherApi,
|
2022-08-27 13:30:17 +03:00
|
|
|
openweathermap: OpenWeatherMap,
|
2022-08-24 10:44:35 +03:00
|
|
|
resources: Resources,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function Widget({ widget }) {
|
|
|
|
const ServiceWidget = widgetMappings[widget.type];
|
|
|
|
|
|
|
|
if (ServiceWidget) {
|
|
|
|
return <ServiceWidget options={widget.options} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex-none flex flex-row items-center justify-center">
|
|
|
|
Missing <strong>{widget.type}</strong>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|