Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

1.3 KB
Raw Blame
import { IconCalendarStats } from "@tabler/icons-react";

import { getWidgetIntegrationConfig } from "@homarr/definitions";

import { createWidgetDefinition, matchesWidgetRuntimeQuery } from "../../definition";
import { optionsBuilder } from "../../options";

export const { definition, componentLoader } = createWidgetDefinition("thingport-activityHeatmap", {
  icon: IconCalendarStats,
  supportsAdvancedFocus: false,
  queryKey: [["widget", "thingport", "getActivity"]],
  queryMatcher: matchesWidgetRuntimeQuery,
  refetchInterval: null,
  ...getWidgetIntegrationConfig("thingport-activityHeatmap"),
  createOptions() {
    return optionsBuilder.from((factory) => ({
      showTitle: factory.switch({ defaultValue: false }),
      weekStart: factory.select({
        options: [
          {
            label: (t) => t("widget.thingport-activityHeatmap.option.weekStart.option.sunday"),
            value: "sunday",
          },
          {
            label: (t) => t("widget.thingport-activityHeatmap.option.weekStart.option.monday"),
            value: "monday",
          },
        ] as const,
        defaultValue: "sunday",
      }),
      showTotal: factory.switch({ defaultValue: true }),
      showLegend: factory.switch({ defaultValue: true }),
    }));
  },
}).withDynamicImport(() => import("./component"));