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", "name": "Weather",
"description": "Look up the current weather in your location", "description": "Look up the current weather in your location",
"settings": { "settings": {
"title": "Settings for weather integration",
"displayInFahrenheit": { "displayInFahrenheit": {
"label": "Display in Fahrenheit" "label": "Display in Fahrenheit"
}, },

View File

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

View File

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