mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
✨Add weather tile menu
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user