mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-12 08:25:47 +01:00
✅ Added infocard to location widget
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
Center,
|
Center,
|
||||||
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
Loader,
|
Loader,
|
||||||
Modal,
|
Modal,
|
||||||
@@ -23,13 +24,14 @@ import { City } from '~/server/api/routers/weather';
|
|||||||
import { api } from '~/utils/api';
|
import { api } from '~/utils/api';
|
||||||
|
|
||||||
import { IntegrationOptionsValueType } from '../WidgetsEditModal';
|
import { IntegrationOptionsValueType } from '../WidgetsEditModal';
|
||||||
import Link from 'next/link';
|
import { InfoCard } from '~/components/InfoCard/InfoCard';
|
||||||
|
|
||||||
type LocationSelectionProps = {
|
type LocationSelectionProps = {
|
||||||
widgetId: string;
|
widgetId: string;
|
||||||
propName: string;
|
propName: string;
|
||||||
value: any;
|
value: any;
|
||||||
handleChange: (key: string, value: IntegrationOptionsValueType) => void;
|
handleChange: (key: string, value: IntegrationOptionsValueType) => void;
|
||||||
|
info?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LocationSelection = ({
|
export const LocationSelection = ({
|
||||||
@@ -37,6 +39,7 @@ export const LocationSelection = ({
|
|||||||
propName: key,
|
propName: key,
|
||||||
value,
|
value,
|
||||||
handleChange,
|
handleChange,
|
||||||
|
info,
|
||||||
}: LocationSelectionProps) => {
|
}: LocationSelectionProps) => {
|
||||||
const { t } = useTranslation('widgets/location');
|
const { t } = useTranslation('widgets/location');
|
||||||
const [query, setQuery] = useState(value.name ?? '');
|
const [query, setQuery] = useState(value.name ?? '');
|
||||||
@@ -58,7 +61,10 @@ export const LocationSelection = ({
|
|||||||
<>
|
<>
|
||||||
<Card>
|
<Card>
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
|
<Flex direction="row" justify="space-between" wrap="nowrap">
|
||||||
<Title order={5}>{t(`modules/${widgetId}:descriptor.settings.${key}.label`)}</Title>
|
<Title order={5}>{t(`modules/${widgetId}:descriptor.settings.${key}.label`)}</Title>
|
||||||
|
{info && <InfoCard content={t(`modules/${widgetId}:descriptor.settings.${key}.info`)}/>}
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Group noWrap align="end">
|
<Group noWrap align="end">
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ const WidgetOptionTypeSwitch: FC<{
|
|||||||
value={value}
|
value={value}
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
widgetId={widgetId}
|
widgetId={widgetId}
|
||||||
|
info={info}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user