fix: simplify widget feedback
This commit is contained in:
2 files changed
+7
-20
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Badge, Group, ScrollArea, SimpleGrid, Stack, Text, Tooltip } from "@mantine/core";
|
||||
import { Badge, Group, ScrollArea, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { getQueryKey } from "@trpc/react-query";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
@@ -75,15 +75,9 @@ export default function AudioStatsWidget({
|
||||
{currentlyPlaying.seasonName ?? currentlyPlaying.albumName ?? session.user.username}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Tooltip
|
||||
label={session.sessionName}
|
||||
events={{ hover: true, focus: true, touch: true }}
|
||||
position="left"
|
||||
>
|
||||
<Badge variant="light" maw="40%" style={{ flexShrink: 0 }} tabIndex={0}>
|
||||
{session.sessionName}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
<Badge variant="light" maw="40%" style={{ flexShrink: 0 }} title={session.sessionName}>
|
||||
{session.sessionName}
|
||||
</Badge>
|
||||
</Group>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { Badge, Center, Group, Stack, Text, Tooltip, UnstyledButton } from "@mantine/core";
|
||||
import { Badge, Center, Group, Stack, Text, UnstyledButton } from "@mantine/core";
|
||||
import { IconBinaryTree } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
@@ -38,7 +38,7 @@ export default function SmartHomeEntityStateWidget({
|
||||
const canInteract = useIntegrationsWithInteractAccess().some(({ id }) => id === integrationId);
|
||||
|
||||
const utils = clientApi.useUtils();
|
||||
const { mutate, isPending, error } = clientApi.widget.smartHome.switchEntity.useMutation({
|
||||
const { mutate, isPending } = clientApi.widget.smartHome.switchEntity.useMutation({
|
||||
onSettled: () => void utils.widget.smartHome.entityDetails.invalidate(input),
|
||||
onError: () =>
|
||||
showErrorNotification({
|
||||
@@ -110,7 +110,7 @@ export default function SmartHomeEntityStateWidget({
|
||||
onClick={handleClick}
|
||||
disabled={!isActionable}
|
||||
aria-label={`${displayName}: ${state}${attribute}`}
|
||||
aria-description={queryErrorLabel ?? (error ? t("widget.smartHome-entityState.error.toggleFailed") : undefined)}
|
||||
aria-description={queryErrorLabel}
|
||||
w="100%"
|
||||
h="100%"
|
||||
styles={{
|
||||
@@ -153,13 +153,6 @@ export default function SmartHomeEntityStateWidget({
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
{error && (
|
||||
<Tooltip label={error.message} multiline>
|
||||
<Text size="xs" c="red" lineClamp={2} tabIndex={0}>
|
||||
{t("widget.smartHome-entityState.error.toggleFailed")}
|
||||
</Text>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Stack>
|
||||
</Center>
|
||||
</UnstyledButton>
|
||||
|
||||
Reference in new issue
Block a user