Skip to content

Commit

Permalink
Merge branch 'main' into pages/rename
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
danactive committed Nov 30, 2024
2 parents 166b32c + 14643a7 commit d9a4aa4
Show file tree
Hide file tree
Showing 31 changed files with 2,220 additions and 2,927 deletions.
2 changes: 1 addition & 1 deletion diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
4,099 changes: 1,379 additions & 2,720 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,61 @@
"test": "jest --watch",
"test:ci": "jest --ci",
"test:e2e": "npx playwright test",
"typecheck": "tsc",
"typecheck": "echo 'Typecheck...' && tsc",
"release": "standard-version"
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@hello-pangea/dnd": "^16.6.0",
"@mui/joy": "^5.0.0-beta.32",
"async": "2.6.4",
"boom": "^7.3.0",
"camelcase": "^6.3.0",
"color-thief-react": "^2.1.0",
"glob": "^10.4.2",
"glob": "^10.4.5",
"heic-convert": "^2.1.0",
"mapbox-gl": "^3.4.0",
"mapbox-gl": "^3.8.0",
"mime-types": "^2.1.35",
"next": "^14.2.4",
"next": "^14.2.18",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-image-gallery": "^1.3.0",
"react-map-gl": "^7.1.7",
"stylis": "^4.3.2",
"stylis": "^4.3.4",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@playwright/test": "^1.45.0",
"@testing-library/jest-dom": "^6.4.6",
"@playwright/test": "^1.48.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^15.0.7",
"@types/async": "2.6.4",
"@types/boom": "^7.3.5",
"@types/geojson": "^7946.0.14",
"@types/heic-convert": "^1.2.3",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/mime-types": "^2.1.4",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/node": "^20.17.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-image-gallery": "^1.2.4",
"@types/xml2js": "^0.4.14",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^14.2.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest-dom": "^5.4.0",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.34.3",
"eslint-config-next": "^14.2.18",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-testing-library": "^6.2.2",
"eslint-plugin-testing-library": "^6.4.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"next-test-api-route-handler": "^4.0.8",
"snyk": "^1.1292.1",
"next-test-api-route-handler": "^4.0.14",
"snyk": "^1.1294.0",
"standard-version": "^9.5.0",
"ts-jest": "^29.1.5",
"typescript": "^5.5.2"
"ts-jest": "^29.2.5",
"typescript": "^5.6.3"
},
"engines": {
"node": "20",
Expand Down
43 changes: 7 additions & 36 deletions pages/[gallery].tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import type { GetStaticPaths, GetStaticProps } from 'next'
import Head from 'next/head'
import { type ParsedUrlQuery } from 'node:querystring'

import GalleryPageComponent from '../src/components/GalleryPage'
import getAlbums from '../src/lib/albums'
import getGalleries from '../src/lib/galleries'
import indexKeywords from '../src/lib/search'
import type { ServerSideAlbumItem } from '../src/types/common'
import { Gallery } from '../src/types/pages'

import Galleries from '../src/components/Albums'
import Link from '../src/components/Link'
import useSearch from '../src/hooks/useSearch'
import type { AlbumMeta, IndexedKeywords, ServerSideAlbumItem } from '../src/types/common'

type ComponentProps = {
gallery: NonNullable<AlbumMeta['gallery']>;
albums: ServerSideAlbumItem[];
indexedKeywords: IndexedKeywords[];
}

interface Params extends ParsedUrlQuery {
gallery: NonNullable<AlbumMeta['gallery']>
}

export const getStaticProps: GetStaticProps<ComponentProps, Params> = async (context) => {
export const getStaticProps: GetStaticProps<Gallery.ComponentProps, Gallery.Params> = async (context) => {
const params = context.params!
const { albums } = await getAlbums(params.gallery)
const preparedAlbums = albums.map((album): ServerSideAlbumItem => ({
Expand All @@ -43,25 +29,10 @@ export const getStaticPaths: GetStaticPaths = async () => {
}
}

function AlbumsPage({ gallery, albums, indexedKeywords }: ComponentProps) {
const {
filtered,
searchBox,
} = useSearch({ items: albums, indexedKeywords })

function GalleryPage({ gallery, albums, indexedKeywords }: Gallery.ComponentProps) {
return (
<div>
<Head>
<title>History App - List Albums</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<div>{searchBox}</div>
<h1>Links</h1>
<ul><li><Link href={`/${gallery}/all`}>All</Link></li></ul>
<ul><li><Link href={`/${gallery}/today`}>Today</Link></li></ul>
<Galleries items={filtered} gallery={gallery} />
</div>
<GalleryPageComponent albums={albums} gallery={gallery} indexedKeywords={indexedKeywords} />
)
}

export default AlbumsPage
export default GalleryPage
21 changes: 3 additions & 18 deletions pages/[gallery]/[album].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getAlbum from '../../src/lib/album'
import getAlbums from '../../src/lib/albums'
import getGalleries from '../../src/lib/galleries'
import indexKeywords, { addGeographyToSearch } from '../../src/lib/search'
import type { AlbumMeta, IndexedKeywords, Item } from '../../src/types/common'
import type { Album } from '../../src/types/pages'

async function buildStaticPaths() {
const { galleries } = await getGalleries()
Expand All @@ -17,22 +17,7 @@ async function buildStaticPaths() {
return groups.flat()
}

interface ServerSideAlbumItem extends Item {
corpus: string;
}

type ComponentProps = {
items?: ServerSideAlbumItem[];
meta: AlbumMeta;
indexedKeywords: IndexedKeywords[];
}

interface Params extends ParsedUrlQuery {
gallery: NonNullable<AlbumMeta['gallery']>
album: NonNullable<AlbumMeta['albumName']>
}

export const getStaticProps: GetStaticProps<ComponentProps, Params> = async (context) => {
export const getStaticProps: GetStaticProps<Album.ComponentProps, Album.Params> = async (context) => {
const params = context.params!
const { album: { items, meta } } = await getAlbum(params.gallery, params.album)
const preparedItems = items.map((item) => ({
Expand All @@ -54,7 +39,7 @@ export const getStaticPaths: GetStaticPaths = async () => (
}
)

function AlbumPage({ items = [], meta, indexedKeywords }: ComponentProps) {
function AlbumPage({ items = [], meta, indexedKeywords }: Album.ComponentProps) {
return <AlbumPageComponent items={items} meta={meta} indexedKeywords={indexedKeywords} />
}

Expand Down
15 changes: 0 additions & 15 deletions pages/[gallery]/[album]/nearby.tsx

This file was deleted.

Loading

0 comments on commit d9a4aa4

Please sign in to comment.