milestone 18: collapse duplicated infrastructure into shared listener core, crud list helper, resource shells, transport race, name and line helpers, ui modules
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { formatTime } from "@/lib/format";
|
||||
import type { SourceStatus } from "@/lib/types";
|
||||
|
||||
const TH_CLASS = "border-b border-zinc-300 px-3 py-2 text-left font-medium dark:border-zinc-700";
|
||||
const TD_CLASS = "border-b border-zinc-200 px-3 py-2 dark:border-zinc-800";
|
||||
import { tdClass, thClass } from "@/ui/classes";
|
||||
|
||||
function formatAttempt(unixSeconds: number): string {
|
||||
return unixSeconds === 0 ? "never" : formatTime(unixSeconds);
|
||||
@@ -28,26 +26,26 @@ export default function SourceStatusSection({ sources, namesById }: SourceStatus
|
||||
<table className="w-full min-w-max border-collapse text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={TH_CLASS}>Source</th>
|
||||
<th className={TH_CLASS}>State</th>
|
||||
<th className={TH_CLASS}>Last attempt</th>
|
||||
<th className={TH_CLASS}>Last success</th>
|
||||
<th className={TH_CLASS}>Domains</th>
|
||||
<th className={TH_CLASS}>Wildcards</th>
|
||||
<th className={TH_CLASS}>Skipped regex</th>
|
||||
<th className={TH_CLASS}>Last error</th>
|
||||
<th className={thClass}>Source</th>
|
||||
<th className={thClass}>State</th>
|
||||
<th className={thClass}>Last attempt</th>
|
||||
<th className={thClass}>Last success</th>
|
||||
<th className={thClass}>Domains</th>
|
||||
<th className={thClass}>Wildcards</th>
|
||||
<th className={thClass}>Skipped regex</th>
|
||||
<th className={thClass}>Last error</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sources.map((source) => (
|
||||
<tr key={source.id}>
|
||||
<td className={TD_CLASS}>
|
||||
<td className={tdClass}>
|
||||
<span className="font-medium">{namesById.get(source.id) ?? source.url}</span>
|
||||
<span className="mt-0.5 block max-w-64 truncate text-xs text-zinc-500">
|
||||
{source.url}
|
||||
</span>
|
||||
</td>
|
||||
<td className={TD_CLASS}>
|
||||
<td className={tdClass}>
|
||||
<span
|
||||
className={
|
||||
source.loaded
|
||||
@@ -58,12 +56,12 @@ export default function SourceStatusSection({ sources, namesById }: SourceStatus
|
||||
{source.state}
|
||||
</span>
|
||||
</td>
|
||||
<td className={TD_CLASS}>{formatAttempt(source.last_attempt)}</td>
|
||||
<td className={TD_CLASS}>{formatAttempt(source.last_success)}</td>
|
||||
<td className={`${TD_CLASS} tabular-nums`}>{source.domains}</td>
|
||||
<td className={`${TD_CLASS} tabular-nums`}>{source.wildcards}</td>
|
||||
<td className={`${TD_CLASS} tabular-nums`}>{source.skipped_regex}</td>
|
||||
<td className={TD_CLASS}>
|
||||
<td className={tdClass}>{formatAttempt(source.last_attempt)}</td>
|
||||
<td className={tdClass}>{formatAttempt(source.last_success)}</td>
|
||||
<td className={`${tdClass} tabular-nums`}>{source.domains}</td>
|
||||
<td className={`${tdClass} tabular-nums`}>{source.wildcards}</td>
|
||||
<td className={`${tdClass} tabular-nums`}>{source.skipped_regex}</td>
|
||||
<td className={tdClass}>
|
||||
{source.last_error === "" ? (
|
||||
<span className="text-zinc-400">—</span>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user