Add weather tile menu

This commit is contained in:
Meierschlumpf
2022-12-11 13:38:05 +01:00
parent 40c9b5d203
commit 6d2254ebd5
3 changed files with 15 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
"name": "Weather",
"description": "Look up the current weather in your location",
"settings": {
"title": "Settings for weather integration",
"displayInFahrenheit": {
"label": "Display in Fahrenheit"
},

View File

@@ -4,7 +4,7 @@ import { openContextModalGeneric } from '../../../../tools/mantineModalManagerEx
import { IntegrationsType } from '../../../../types/integration';
import { TileBaseType } from '../../../../types/tile';
import { GenericTileMenu } from '../GenericTileMenu';
import { IntegrationChangePositionModalInnerProps } from '../IntegrationChangePositionModal';
import { IntegrationChangePositionModalInnerProps } from '../../Modals/ChangePosition/ChangeIntegrationPositionModal';
import { IntegrationRemoveModalInnerProps } from '../IntegrationRemoveModal';
import {
IntegrationEditModalInnerProps,

View File

@@ -4,8 +4,8 @@ import { WeatherIcon } from './WeatherIcon';
import { BaseTileProps } from '../type';
import { useWeatherForCity } from './useWeatherForCity';
import { WeatherIntegrationType } from '../../../../types/integration';
import { useCardStyles } from '../../../layout/useCardStyles';
import { HomarrCardWrapper } from '../HomarrCardWrapper';
import { IntegrationsMenu } from '../Integrations/IntegrationsMenu';
interface WeatherTileProps extends BaseTileProps {
module: WeatherIntegrationType | undefined;
@@ -45,8 +45,17 @@ export const WeatherTile = ({ className, module }: WeatherTileProps) => {
return (
<HomarrCardWrapper className={className}>
<IntegrationsMenu
integration="weather"
module={module}
options={module?.properties}
labels={{
isFahrenheit: 'descriptor.settings.displayInFahrenheit.label',
location: 'descriptor.settings.location.label',
}}
/>
<Center style={{ height: '100%' }}>
<Group spacing="xl" noWrap align="center">
<Group spacing="md" noWrap align="center">
<WeatherIcon code={weather!.current_weather.weathercode} />
<Stack p={0} spacing={4}>
<Title order={2}>
@@ -55,7 +64,7 @@ export const WeatherTile = ({ className, module }: WeatherTileProps) => {
module?.properties.isFahrenheit
)}
</Title>
<Group spacing="sm">
<Group spacing="xs" noWrap>
<div>
<span>
{getPerferedUnit(