Skip to content

Commit

Permalink
Switch to Link element to accommodate basePath.
Browse files Browse the repository at this point in the history
  • Loading branch information
ctslater committed Jun 24, 2024
1 parent 3ce1c0e commit 2c98f1e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
9 changes: 5 additions & 4 deletions app/collection/[...path]/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import React from 'react';
import Link from 'next/link'

import SelectionDropdown from '../../selectionDropdown'
import { GetSummary } from '../../summaries'
Expand Down Expand Up @@ -81,7 +82,7 @@ export default async function Collection({params}) {

return (
<div>
<div className="text-m m-5"><a href={process.env.BASE_URL ? process.env.BASE_URL : "/" }>&lt;- Back to collections</a></div>
<div className="text-m m-5"><Link href={"/"}>&lt;- Back to collections</Link></div>
<div className="text-2xl m-5">{collection}</div>

<div className="">
Expand All @@ -96,7 +97,7 @@ export default async function Collection({params}) {
<tbody>
{tractKeys.map((tract, n) =>
<tr key={n}>
<td className="p-1"><a href={`/tract/${tract}/${collection}`}>{tract}</a></td>
<td className="p-1"><Link href={`/tract/${tract}/${collection}`}>{tract}</Link></td>
<td className="p-1 text-right">{tractEntries[tract]}</td></tr>
)}
</tbody>
Expand All @@ -111,7 +112,7 @@ export default async function Collection({params}) {
<tbody>
{visitKeys.map((visit, n) =>
<tr key={n}>
<td className="p-1"><a href={`/visit/${visit}/${collection}`}>{visit}</a></td>
<td className="p-1"><Link href={`/visit/${visit}/${collection}`}>{visit}</Link></td>
<td className="p-1 text-right">{visitEntries[visit]}</td></tr>
)}
</tbody>
Expand All @@ -131,7 +132,7 @@ export default async function Collection({params}) {
<tbody>
{plotKeys.map((plot, n) =>
<tr key={n}>
<td className="p-1"><a href={`/plot/${plot}/${collection}`}>{plot}</a></td>
<td className="p-1"><Link href={`/plot/${plot}/${collection}`}>{plot}</Link></td>
<td className="p-1 text-right">{plotEntries[plot].count}</td></tr>
)}
</tbody>
Expand Down
6 changes: 6 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
}
}

@layer base {
a {
@apply hover:underline;
}
}

/*
body {
color: rgb(var(--foreground-rgb));
Expand Down
7 changes: 4 additions & 3 deletions app/page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import Link from 'next/link'

import {ListSummaries, GetSummary, ListReports} from './summaries'

Expand Down Expand Up @@ -37,7 +38,7 @@ export default async function Collections() {
</thead>
<tbody>
{collections.map((collection, n) =>
(<tr key={n}><td className={cellClassNames}><a href={`/collection/${collection}`}>{collection}</a></td>
(<tr key={n}><td className={cellClassNames}><Link href={`/collection/${collection}`}>{collection}</Link></td>
<td className={cellClassNames}>4321</td>
<td className={`text-right ${cellClassNames}`}>2024-05-06</td>
</tr>))}
Expand All @@ -50,14 +51,14 @@ export default async function Collections() {
<table className="divide-y">
<thead>
<tr>
<td className={cellClassNames}>Collection</td>
<td className={cellClassNames}>Report</td>
<td className={cellClassNames}>Plots</td>
<td className={cellClassNames}>Last Updated</td>
</tr>
</thead>
<tbody>
{reports.map((collection, n) =>
(<tr key={n}><td className={cellClassNames}><a href={`/collection/${collection}`}>{collection}</a></td>
(<tr key={n}><td className={cellClassNames}><Link href={`/collection/${collection}`}>{collection}</Link></td>
<td className={cellClassNames}>4321</td>
<td className={`text-right ${cellClassNames}`}>2024-05-06</td>
</tr>))}
Expand Down
3 changes: 2 additions & 1 deletion app/plot/[plotName]/[...path]/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import React from 'react';
import Link from 'next/link'

import { GetSummary } from '../../../summaries'

Expand Down Expand Up @@ -33,7 +34,7 @@ export default async function Collection({params, searchParams}) {

return (
<div>
<div className="text-m m-5"><a href={`/collection/${collection}`}>&lt;- Back to collection</a></div>
<div className="text-m m-5"><Link href={`/collection/${collection}`}>&lt;- Back to collection</Link></div>
<div className="text-2xl m-5">{collection}</div>
<div className="text-2xl m-5">{plotName}</div>
<div className="">
Expand Down
3 changes: 2 additions & 1 deletion app/tract/[tract]/[...path]/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import React from 'react';
import Link from 'next/link'

import { GetSummary } from '../../../summaries'

Expand Down Expand Up @@ -49,7 +50,7 @@ export default async function Collection({params, searchParams}) {

return (
<div>
<div className="text-m m-5"><a href={`/collection/${collection}`}>&lt;- Back to collection</a></div>
<div className="text-m m-5"><Link href={`/collection/${collection}`}>&lt;- Back to collection</Link></div>
<div className="text-2xl m-5">{collection}</div>
<div className="text-2xl m-5">Tract {tract}</div>
<div className="">
Expand Down

0 comments on commit 2c98f1e

Please sign in to comment.