Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
mono424 committed Mar 17, 2024
1 parent b764305 commit bce9230
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions apps/dashboard/src/app/crawler/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import React from 'react';
import Moment from 'react-moment';

export default function Crawler() {
const crawlerState = useContext(CrawlerContext);
const lastRunEndedAt = new Date(crawlerState.lastRunEndedAt);
const nextRunAt = new Date(crawlerState.nextRunAt);
const { crawler } = useContext(CrawlerContext);
const lastRunEndedAt = new Date(crawler.lastRunEndedAt);
const nextRunAt = new Date(crawler.nextRunAt);

return (
<main className="h-[100vh]">
Expand All @@ -25,9 +25,9 @@ export default function Crawler() {
<CardTitle>Current Status</CardTitle>
<CardDescription className={cn(
"flex items-center gap-1",
crawlerState.isRunning ? "text-green-800" : "text-red-800",
crawler.isRunning ? "text-green-800" : "text-red-800",
)}>
{crawlerState.isRunning ? <>
{crawler.isRunning ? <>
<PlayCircle className="w-5 h-5 inline-block" />
Running
</> : <>
Expand All @@ -41,13 +41,13 @@ export default function Crawler() {
<div className="flex-grow">
<h2 className="mb-1">Queue</h2>
<div className="flex justify-center gap-2 text-2xl px-3 py-2 bg-black/10 rounded-xl">
{crawlerState.inQueue}
{crawler.inQueue}
</div>
</div>
<div className="flex-grow">
<h2 className="mb-1">Done</h2>
<div className="flex justify-center gap-2 text-2xl px-3 py-2 bg-black/10 rounded-xl">
{crawlerState.processed}
{crawler.processed}
</div>
</div>
</div>
Expand All @@ -58,7 +58,7 @@ export default function Crawler() {
<CardTitle>Schedule</CardTitle>
<CardDescription>
{
crawlerState.isRunning
crawler.isRunning
? "Crawler is currently running"
: <>
Next run in&nbsp;
Expand All @@ -73,7 +73,7 @@ export default function Crawler() {
<div className="px-3 py-2">
Last run ended&nbsp;
<b><Moment fromNow date={lastRunEndedAt} /></b>
&nbsp;and took <b>{crawlerState.lastRunDuration / 1000 / 60} min</b>
&nbsp;and took <b>{crawler.lastRunDuration / 1000 / 60} min</b>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/components/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Dashboard({
defaultLayout,
children,
}: DashboardProps) {
const { crawler } = useContext(AppStateContext);
const { crawler, pageCount } = useContext(AppStateContext);

return (
<TooltipProvider delayDuration={0}>
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function Dashboard({
{
title: "Pages",
href: "/pages",
label: "20.000",
label: pageCount.count.toString(),
icon: Package,
variant: "ghost",
},
Expand Down

0 comments on commit bce9230

Please sign in to comment.