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.2 KB
Raw Blame
import { IconServerOff, IconSpeedboat } from "@tabler/icons-react";

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

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

export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
  icon: IconSpeedboat,
  refetchInterval: null,
  createOptions() {
    return optionsBuilder.from(
      (factory) => ({
        showLatestResult: factory.switch({
          defaultValue: true,
        }),
        showStats: factory.switch({
          defaultValue: true,
        }),
        showRecentResults: factory.switch({
          defaultValue: true,
        }),
        showPingGraph: factory.switch({
          defaultValue: true,
        }),
      }),
      {
        showPingGraph: {
          shouldHide: (options) => !options.showRecentResults,
        },
      },
    );
  },
  ...getWidgetIntegrationConfig("speedtestTracker"),
  errors: {
    INTERNAL_SERVER_ERROR: {
      icon: IconServerOff,
      message: (t) => t("widget.speedtestTracker.error.internalServerError"),
    },
  },
}).withDynamicImport(() => import("./component"));