Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
732 B

  1. import { Theme } from "@material-ui/core";
  2. import { NTPStatus, NTPSyncStatus } from "./types";
  3. export const isNtpActive = ({ status }: NTPStatus) => status === NTPSyncStatus.NTP_ACTIVE;
  4. export const ntpStatusHighlight = ({ status }: NTPStatus, theme: Theme) => {
  5. switch (status) {
  6. case NTPSyncStatus.NTP_INACTIVE:
  7. return theme.palette.info.main;
  8. case NTPSyncStatus.NTP_ACTIVE:
  9. return theme.palette.success.main;
  10. default:
  11. return theme.palette.error.main;
  12. }
  13. }
  14. export const ntpStatus = ({ status }: NTPStatus) => {
  15. switch (status) {
  16. case NTPSyncStatus.NTP_INACTIVE:
  17. return "Inactive";
  18. case NTPSyncStatus.NTP_ACTIVE:
  19. return "Active";
  20. default:
  21. return "Unknown";
  22. }
  23. }