Skip to content

Commit 6e34dee

Browse files
committed
fit all published models columns without horizontal scrolling
1 parent c0fb137 commit 6e34dee

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

‎frontend/app/published-models/page.tsx‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Skeleton } from "@/components/ui/skeleton";
77
import { Input } from "@/components/ui/input";
88
import {
99
BookOpen,
10-
ExternalLink,
1110
Search,
1211
ArrowUp,
1312
ArrowDown,
@@ -45,19 +44,19 @@ const COLUMNS: {
4544
numeric?: boolean;
4645
sortValue: (pub: PublishedModel) => string | number | null;
4746
}[] = [
48-
{ key: "title", label: "Title", width: "min-w-[320px]", sortValue: (p) => p.title },
49-
{ key: "authors", label: "Authors", width: "min-w-[200px]", sortValue: (p) => p.authors ?? null },
50-
{ key: "year", label: "Year", numeric: true, sortValue: (p) => p.year ?? null },
51-
{ key: "citation", label: "Citation", width: "min-w-[200px]", sortValue: (p) => p.citation ?? null },
52-
{ key: "pubmedid", label: "PubMed", numeric: true, sortValue: (p) => (p.pubmedid ? Number(p.pubmedid) : null) },
47+
{ key: "title", label: "Title", width: "w-[24%]", sortValue: (p) => p.title },
48+
{ key: "authors", label: "Authors", width: "w-[16%]", sortValue: (p) => p.authors ?? null },
49+
{ key: "year", label: "Year", width: "w-[5%]", numeric: true, sortValue: (p) => p.year ?? null },
50+
{ key: "citation", label: "Citation", width: "w-[17%]", sortValue: (p) => p.citation ?? null },
51+
{ key: "pubmedid", label: "PubMed", width: "w-[8%]", numeric: true, sortValue: (p) => (p.pubmedid ? Number(p.pubmedid) : null) },
5352
{
5453
key: "biomodels",
5554
label: "Biomodels",
56-
width: "min-w-[220px]",
55+
width: "w-[21%]",
5756
// Sorted by the names as displayed, so the ordering matches what's on screen.
5857
sortValue: (p) => p.biomodels.map((m) => m.name || m.bmKey).join(", ") || null,
5958
},
60-
{ key: "owners", label: "Owner", width: "min-w-[120px]", sortValue: (p) => p.owners.join(", ") || null },
59+
{ key: "owners", label: "Owner", width: "w-[9%]", sortValue: (p) => p.owners.join(", ") || null },
6160
];
6261

6362
export default function PublishedModelsPage() {
@@ -199,7 +198,7 @@ export default function PublishedModelsPage() {
199198
{/* Wide table: scrolls inside its own container so the page
200199
itself never scrolls sideways. */}
201200
<div className="overflow-x-auto">
202-
<table className="w-full text-sm border-collapse">
201+
<table className="w-full table-fixed text-xs border-collapse">
203202
<thead className="bg-slate-100 border-b border-slate-200">
204203
<tr className="text-left text-slate-700">
205204
{COLUMNS.map((column) => {
@@ -214,7 +213,7 @@ export default function PublishedModelsPage() {
214213
: "descending"
215214
: "none"
216215
}
217-
className={`px-4 py-3 font-semibold ${column.width ?? ""}`}
216+
className={`px-3 py-2 font-semibold align-bottom ${column.width ?? ""}`}
218217
>
219218
<button
220219
type="button"
@@ -243,41 +242,40 @@ export default function PublishedModelsPage() {
243242
key={pub.pubKey}
244243
className="border-b border-slate-100 last:border-0 hover:bg-slate-50 align-top"
245244
>
246-
<td className="px-4 py-3 text-slate-900 font-medium">
245+
<td className="px-3 py-2 text-slate-900 font-medium break-words">
247246
{pub.title}
248247
</td>
249-
<td className="px-4 py-3 text-slate-600 italic">
248+
<td className="px-3 py-2 text-slate-600 italic break-words">
250249
{pub.authors || "—"}
251250
</td>
252-
<td className="px-4 py-3 text-slate-700 whitespace-nowrap">
251+
<td className="px-3 py-2 text-slate-700 whitespace-nowrap">
253252
{pub.year ?? "—"}
254253
</td>
255-
<td className="px-4 py-3 text-slate-600">
254+
<td className="px-3 py-2 text-slate-600 break-words">
256255
{pub.citation || "—"}
257256
</td>
258-
<td className="px-4 py-3 whitespace-nowrap">
257+
<td className="px-3 py-2 whitespace-nowrap">
259258
{pub.pubmedid ? (
260259
<a
261260
href={`https://pubmed.ncbi.nlm.nih.gov/${pub.pubmedid}`}
262261
target="_blank"
263262
rel="noopener noreferrer"
264-
className="text-blue-700 hover:underline inline-flex items-center gap-1"
263+
className="text-blue-700 hover:underline"
265264
>
266265
{pub.pubmedid}
267-
<ExternalLink className="h-3 w-3" />
268266
</a>
269267
) : (
270268
<span className="text-slate-400">—</span>
271269
)}
272270
</td>
273-
<td className="px-4 py-3">
271+
<td className="px-3 py-2">
274272
{pub.biomodels.length > 0 ? (
275273
<div className="flex flex-col gap-1">
276274
{pub.biomodels.map((model) => (
277275
<Link
278276
key={model.bmKey}
279277
href={`/search/${model.bmKey}`}
280-
className="text-blue-700 hover:underline"
278+
className="text-blue-700 hover:underline break-words"
281279
>
282280
{model.name || model.bmKey}
283281
</Link>
@@ -287,7 +285,7 @@ export default function PublishedModelsPage() {
287285
<span className="text-slate-400">—</span>
288286
)}
289287
</td>
290-
<td className="px-4 py-3 text-slate-700">
288+
<td className="px-3 py-2 text-slate-700 break-words">
291289
{pub.owners.length > 0 ? (
292290
pub.owners.join(", ")
293291
) : (

0 commit comments

Comments
 (0)