-
Notifications
You must be signed in to change notification settings - Fork 53
Add Admin > Edit Album XML #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
bc56c90
chore(Admin > Edit Album): Select a thumbnail and generate XML
danactive 456fb5e
feat(Admin > Edit Album): Generate XML ready for copy and paste
danactive b29b2aa
feat(Admin > Edit Album): Keyboard arrows next and prev image
danactive 937a8f2
feat(Admin > Edit Album): Add filename filter before Gallery/Album dr…
danactive 8bc1696
feat(Admin > Edit Album): Refactor all keyword items
danactive 585ef57
feat(Admin > Edit Album): Add keyword autocomplete
danactive 161986f
fix(Admin > Edit Album): Fix the XML order
danactive ec439b2
chore(Slippy Map): Optimize with less iteration
danactive 77a457e
inprogress
danactive 72dc75b
Merge branch 'main' into feature/admin-edit
danactive 5a3ef6c
chore(Slippy Map): Optimize with less iteration
danactive 582826c
Merge commit with TypeScript fixes
danactive 9512cee
feat(Admin > Edit Album): Persist album data
danactive 1ca56d2
feat(Admin > Edit Album): Discard empty XML elements
danactive b30d189
feat(Admin > Edit Album): Input lat,long spilt, clipboard, allow degr…
danactive 104c0d7
feat(Admin > Edit Album): Clipboard for reference
danactive 27ebcf7
feat(Admin > Edit Album): Add Edit count pill
danactive e64099f
feat(View Album > useSearch): Add Expand button
danactive 75a2bf2
feat(View Album > useSearch): Add Bookmark button
danactive 8054ca6
chore(View Album > useSearch): Fix Expand button to clear Map Filter too
danactive b2863f0
chore(View All > useSearch): Fix Expand button; select filename as id
danactive 0e2fa64
fix(Slippy Map): Tweak CSS
danactive e9ebfa8
feat(View Album > useSearch): Rename Expand button to Clear
danactive 69e7147
chore(View All > useSearch): Fix unit tests
danactive 0afc052
chore(View Album > useSearch): Bookmark anchors you in your current f…
danactive 8295287
fix(npm run build): Remove Node.js from client component
danactive c3f3720
feat(Admin > Edit Album): Edit multiple photos
danactive e03fa23
feat(Admin > Edit Album): Change layout to vertical thumbs with stick…
danactive 44f04ec
feat(Admin > Edit Album): Yellow border to indicate multiple selected…
danactive c64fa61
chore(release): 12.3.0
danactive 0f11f41
chore(package): Bump deps to minor
danactive bf6de1c
Apply best practices
danactive ff28617
feat(Admin > Edit Album): View photo in new tab as original dimensions
danactive 9dfe69f
feat(Admin > Edit Album): Toggle photo or video
danactive dfb04e1
chore(package): Bump deps to minor
danactive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| v24.11.0 | ||
| v24.13.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { NextResponse } from 'next/server' | ||
|
|
||
| import { getAllKeywords } from '../../../../src/lib/get-all-items' | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| const { indexedKeywords } = await getAllKeywords() | ||
| return NextResponse.json({ keywords: indexedKeywords }) | ||
| } catch (error) { | ||
| console.error('Failed to get keywords:', error) | ||
| return NextResponse.json({ error: 'Failed to get keywords' }, { status: 500 }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { NextRequest, NextResponse } from 'next/server' | ||
|
|
||
| import getAlbums from '../../../../src/lib/albums' | ||
| import { rawParseOptions, readAlbum } from '../../../../src/lib/xml' | ||
| import type { AlbumMeta, Gallery, Item, RawXmlAlbum, RawXmlItem } from '../../../../src/types/common.d' | ||
|
|
||
| export type SearchResult = { | ||
| gallery: Gallery; | ||
| album: AlbumMeta['albumName']; | ||
| filename: Item['filename']; | ||
| index: number; | ||
| } | ||
|
|
||
| export async function GET(request: NextRequest) { | ||
| const { searchParams } = new URL(request.url) | ||
| const query = searchParams.get('query') | ||
|
|
||
| if (!query) { | ||
| return NextResponse.json({ error: 'Query parameter is required' }, { status: 400 }) | ||
| } | ||
|
|
||
| try { | ||
| // Get all galleries and albums | ||
| const galleryAlbum = await getAlbums() | ||
| const results: SearchResult[] = [] | ||
|
|
||
| // Search through all galleries and albums | ||
| for (const gallery of Object.keys(galleryAlbum) as Gallery[]) { | ||
| const albums = galleryAlbum[gallery].albums | ||
|
|
||
| for (const album of albums) { | ||
| try { | ||
| // Read the album XML | ||
| const xmlAlbum: RawXmlAlbum = await readAlbum(gallery, album.name, rawParseOptions) | ||
| const items = xmlAlbum?.album?.item ? (Array.isArray(xmlAlbum.album.item) ? xmlAlbum.album.item : [xmlAlbum.album.item]) : [] | ||
|
|
||
| // Search through items for matching filenames | ||
| items.forEach((item: RawXmlItem, index: number) => { | ||
| const filenames = Array.isArray(item.filename) ? item.filename : [item.filename] | ||
| const hasMatch = filenames.some((filename: string) => | ||
| filename.toLowerCase().includes(query.toLowerCase()), | ||
| ) | ||
|
|
||
| if (hasMatch) { | ||
| results.push({ | ||
| gallery, | ||
| album: album.name, | ||
| filename: Array.isArray(item.filename) ? item.filename[0] : item.filename, | ||
| index, | ||
| }) | ||
| } | ||
| }) | ||
| } catch (error) { | ||
| // Skip albums that can't be read | ||
| console.error(`Error reading album ${gallery}/${album.name}:`, error) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return NextResponse.json({ results }) | ||
| } catch (error) { | ||
| console.error('Search error:', error) | ||
| return NextResponse.json({ error: 'Search failed' }, { status: 500 }) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { NextRequest, NextResponse } from 'next/server' | ||
|
|
||
| import { rawParseOptions, readAlbum } from '../../../../../../src/lib/xml' | ||
| import type { Gallery, RawXmlAlbum } from '../../../../../../src/types/common' | ||
|
|
||
| export async function GET( | ||
| request: NextRequest, | ||
| { params }: { params: Promise<{ gallery: string, album: string }> }, | ||
| ) { | ||
| const { gallery, album } = await params | ||
danactive marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| try { | ||
| // Use existing readAlbum with raw parse options (no camelCase transformation) | ||
| const xmlAlbum: RawXmlAlbum = await readAlbum(gallery as Gallery, album, rawParseOptions) | ||
|
|
||
| return NextResponse.json(xmlAlbum) | ||
| } catch (error) { | ||
| return NextResponse.json({ error: 'Failed to load XML' }, { status: 500 }) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,7 @@ html { | |
| --gridPx: 4px; | ||
| --grid2Px: calc(2 * 4px); | ||
| } | ||
|
|
||
| .mapboxgl-control-container { | ||
| display: none; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.