mirror of
https://github.com/gethomepage/homepage.git
synced 2026-10-01 16:31:16 -07:00
Chore: full react hooks eslint compliance (#7040)
This commit is contained in:
@@ -3,6 +3,9 @@ import Container from "components/services/widget/container";
|
||||
import { useTranslation } from "next-i18next/pages";
|
||||
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
import withWidgetFields from "utils/widget-fields";
|
||||
|
||||
const DEFAULT_FIELDS = ["title", "message", "priority", "lastReceived"];
|
||||
|
||||
const priorityLabels = {
|
||||
1: "min",
|
||||
@@ -20,8 +23,9 @@ function Truncated({ text }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default function Component({ service }) {
|
||||
export default function Component({ service: configuredService }) {
|
||||
const { t } = useTranslation();
|
||||
const service = withWidgetFields(configuredService, DEFAULT_FIELDS);
|
||||
const { widget } = service;
|
||||
|
||||
const { data: messagesData, error: messagesError } = useWidgetAPI(widget, "messages");
|
||||
@@ -30,12 +34,6 @@ export default function Component({ service }) {
|
||||
return <Container service={service} error={messagesError} />;
|
||||
}
|
||||
|
||||
if (!widget.fields || widget.fields.length === 0) {
|
||||
widget.fields = ["title", "message", "priority", "lastReceived"];
|
||||
} else if (widget.fields?.length > 4) {
|
||||
widget.fields = widget.fields.slice(0, 4);
|
||||
}
|
||||
|
||||
if (!messagesData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
|
||||
Reference in New Issue
Block a user