Skip to content

Commit

Permalink
refactor: convert to TS, rename cards and listing UI
Browse files Browse the repository at this point in the history
also remove unused component
  • Loading branch information
mainawycliffe committed Jan 2, 2024
1 parent 60576da commit a4b569e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from "react";
import { GetName } from "./data";
import { Title, StatusList } from "./renderers";
import { HealthCheck } from "../../api/types/health";

export function CanaryCards(props) {
const { checks, onClick } = props;
type CanaryCardProps = {
checks: HealthCheck[];
onClick: (check: HealthCheck) => void;
};

export function CanaryCards({ checks, onClick }: CanaryCardProps) {
return (
<ul className={`mt-1 grid grid-cols-1 gap-1 sm:gap-2 `}>
{checks.map((check) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Canary/ChecksListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import PlaybooksDropdownMenu from "../Playbooks/Runs/Submit/PlaybooksDropdownMen
import { CheckDetails } from "./CanaryPopup/CheckDetails";
import { CheckTitle } from "./CanaryPopup/CheckTitle";
import { HealthCheckEdit } from "./HealthCheckEdit";
import { CanaryCards } from "./card";
import { CanaryCards } from "./CanaryCards";
import { CanaryTable } from "./table";

type ChecksListingProps = {
Expand Down Expand Up @@ -55,7 +55,7 @@ export function ChecksListing({
return (
<>
{layout === "card" ? (
<CanaryCards checks={checks} onClick={handleCheckSelect} />
<CanaryCards checks={checks!} onClick={handleCheckSelect} />
) : (
<CanaryTable
checks={checks}
Expand Down
38 changes: 0 additions & 38 deletions src/components/Canary/SidebarSubPanel/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { HealthCheck } from "../../api/types/health";
import { isEmpty } from "./utils";

export function CanarySorter(check) {
export function CanarySorter(check: Partial<HealthCheck>) {
return GetName(check).toLowerCase();
}

export function GetName(check) {
export function GetName(check: Partial<HealthCheck>) {
let title = check.name;
if (isEmpty(title)) {
title = check.description;
Expand Down

0 comments on commit a4b569e

Please sign in to comment.