Skip to content

Commit

Permalink
Rename checks tab to checklist
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
  • Loading branch information
wcchang1115 committed Oct 4, 2024
1 parent de79b8b commit 16253d0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions js/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function TopBar() {
interface TabProps {
name: string;
href: string;
badge?: ReactNode;
}

function TabBadge<T, R extends number>({
Expand Down Expand Up @@ -217,22 +218,28 @@ function NavBar() {
const { isDemoSite, cloudMode, isLoading } = useLineageGraphContext();
const [location, setLocation] = useLocation();

const checklistBadge = (
<TabBadge<Check[], number>
queryKey={cacheKeys.checks()}
fetchCallback={listChecks}
selectCallback={(checks: Check[]) => {
return checks.filter((check) => !check.is_checked).length;
}}
/>
);

const tabs: TabProps[] = [
{ name: "Lineage", href: "/lineage" },
{ name: "Query", href: "/query" },
{ name: "Checks", href: "/checks" },
{ name: "Checklist", href: "/checks", badge: checklistBadge },
];

const calPendingChecks = (checks: Check[]) => {
return checks.filter((check) => !check.is_checked).length;
};

const tabIndex = _.findIndex(tabs, ({ href }) => location.startsWith(href));

return (
<Tabs index={tabIndex}>
<TabList>
{tabs.map(({ name, href }) => {
{tabs.map(({ name, href, badge }) => {
return (
<Tab
key={name}
Expand All @@ -241,13 +248,7 @@ function NavBar() {
}}
>
{name}
{name === "Checks" && (
<TabBadge<Check[], number>
queryKey={cacheKeys.checks()}
fetchCallback={listChecks}
selectCallback={calPendingChecks}
/>
)}
{badge}
</Tab>
);
})}
Expand Down

0 comments on commit 16253d0

Please sign in to comment.