Skip to content

Conversation

@ildyria
Copy link
Member

@ildyria ildyria commented Aug 31, 2025

Optionally display the number of photos and/or albums under the album thumbnail.

Summary by CodeRabbit

  • New Features

    • Added album thumbnail subtitle options to show number of photos, number of subalbums, or both (combined when available).
    • Album grid overlays now display the selected counts with proper localization.
    • Added a settings control to choose the album subtitle type.
  • Chores

    • Updated configuration to include and persist the new subtitle options.

@ildyria ildyria requested a review from a team as a code owner August 31, 2025 09:03
@coderabbitai
Copy link

coderabbitai bot commented Aug 31, 2025

📝 Walkthrough

Walkthrough

Adds three new album subtitle enum cases, updates a migration to append/remove these options in configs.type_range, adjusts AlbumThumbOverlay.vue to render new subtitle types via switch, introduces a select control for album_subtitle_type in settings, and expands TypeScript definitions to include the new literals.

Changes

Cohort / File(s) Summary of changes
Backend enum additions
app/Enum/ThumbAlbumSubtitleType.php
Added enum cases: NUM_PHOTOS ('num_photos'), NUM_ALBUMS ('num_albums'), NUM_PHOTOS_ALBUMS ('num_photos_albums').
Database migration for config range
database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php
New migration updates configs.type_range for key album_subtitle_type to append (`
Frontend rendering & settings
resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue, resources/js/components/settings/ConfigGroup.vue
Overlay: replaced conditional logic with a switch on config.album_subtitle_type, added handlers for num_photos, num_albums, num_photos_albums (with translations) and explicit default "". Settings: added a SelectField entry for album_subtitle_type and fixed :config="config" bindings for related SelectFields.
Type definitions
resources/js/lychee.d.ts
Extended App.Enum.ThumbAlbumSubtitleType union with "num_photos", "num_albums", and "num_photos_albums".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble keys and count with glee,
Three new labels hop to me.
Photos, albums, or both combined—
I tuck the numbers in a line.
A little hop, the views align. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 916d4bd and 0ad8bfa.

📒 Files selected for processing (1)
  • resources/js/components/settings/ConfigGroup.vue (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
resources/**/*.{vue,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

resources/**/*.{vue,ts}: Use the Vue 3 Composition API with TypeScript; prefer PrimeVue for UI components
In Vue3 code, do not use await; prefer promise chaining with .then()
Do not use const fn = () => {}; define functions with function functionName() {}

Files:

  • resources/js/components/settings/ConfigGroup.vue
resources/**/*.vue

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Order sections in .vue files as: template first, then script lang="ts", then style

Files:

  • resources/js/components/settings/ConfigGroup.vue
🔇 Additional comments (1)
resources/js/components/settings/ConfigGroup.vue (1)

127-129: LGTM: Correct prop binding and placement for new SelectField

:config="config" is correctly bound for all three keys, resolving the earlier boolean-binding issue. Placement before the generic branches keeps rendering logic consistent.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-display-num-photo-album-thumb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php (1)

9-11: Import DB facade for clarity and tooling

Explicitly import the DB facade to satisfy static analysis and keep consistency with other migrations.

 use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\DB;
resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue (1)

40-67: Subtitle composition works; consider pluralization and zero handling

  • Current output may read “0 images” or “0 subalbums”; combined case hides zeros. Align behavior across cases and consider pluralization for i18n.

Example (if transChoice is available):

// pseudo-code
const photos = props.album.num_photos > 0 ? transChoice('gallery.album.hero.images', props.album.num_photos) : '';
const albums = props.album.num_subalbums > 0 ? transChoice('gallery.album.hero.subalbums', props.album.num_subalbums) : '';

Additionally, there’s a small icon-class typo tied to these date-based cases. Apply outside-this-hunk fix:

- <i v-if="props.config.album_subtitle_type === 'takedate' || props.config.album_subtitle_type === 'creation'" class="pi pi-pi-camera"></i>
+ <i v-if="props.config.album_subtitle_type === 'takedate' || props.config.album_subtitle_type === 'creation'" class="pi pi-camera"></i>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3bd3f and 916d4bd.

📒 Files selected for processing (5)
  • app/Enum/ThumbAlbumSubtitleType.php (1 hunks)
  • database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php (1 hunks)
  • resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue (1 hunks)
  • resources/js/components/settings/ConfigGroup.vue (1 hunks)
  • resources/js/lychee.d.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
resources/**/*.{vue,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

resources/**/*.{vue,ts}: Use the Vue 3 Composition API with TypeScript; prefer PrimeVue for UI components
In Vue3 code, do not use await; prefer promise chaining with .then()
Do not use const fn = () => {}; define functions with function functionName() {}

Files:

  • resources/js/lychee.d.ts
  • resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue
  • resources/js/components/settings/ConfigGroup.vue
resources/**/*.vue

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Order sections in .vue files as: template first, then script lang="ts", then style

Files:

  • resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue
  • resources/js/components/settings/ConfigGroup.vue
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: New PHP files must include the project license header and have a single blank line after the opening <?php tag
Use snake_case for PHP variable names
Apply PSR-4 coding standard to PHP code
Always call in_array with true as the third parameter for strict checking (in_array($needle, $haystack, true))
Only use boolean expressions in if statements; avoid integers or strings as conditions
Use strict comparison (===, !==) instead of loose comparison (==, !=)
Avoid duplicating code in both if and else branches
Do not use empty(); prefer explicit checks (e.g., === null, === '', count(...) === 0)

Files:

  • database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php
  • app/Enum/ThumbAlbumSubtitleType.php
🧠 Learnings (1)
📚 Learning: 2025-08-18T10:19:04.946Z
Learnt from: ildyria
PR: LycheeOrg/Lychee#3626
File: database/migrations/2025_06_07_144157_photo_tags_to_table.php:87-105
Timestamp: 2025-08-18T10:19:04.946Z
Learning: In the Lychee photo management system, the migration `2025_06_07_144157_photo_tags_to_table.php` runs on data that only contains comma-separated tag names in tag_albums.show_tags - OR/AND expressions do not exist at this migration time, so handling them is unnecessary.

Applied to files:

  • database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: 3️⃣ PHP dist / 8.4 - sqlite
  • GitHub Check: 3️⃣ PHP dist / 8.3 - mariadb
  • GitHub Check: 3️⃣ PHP dist / 8.4 - postgresql
  • GitHub Check: 3️⃣ PHP dist / 8.4 - mariadb
  • GitHub Check: 3️⃣ PHP dist / 8.3 - sqlite
  • GitHub Check: 3️⃣ PHP dist / 8.3 - postgresql
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.4 - mariadb -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.4 - sqlite -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.4 - postgresql -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit,Feature_v2
🔇 Additional comments (4)
app/Enum/ThumbAlbumSubtitleType.php (1)

22-24: Enum additions are consistent with frontend types — LGTM

New cases look correct and align with the TS union. No further changes needed.

database/migrations/2025_08_31_122020_add_display_num_photos_option_album_view.php (1)

15-20: Keep the up()→down() pattern for idempotent migrations
Migrations in Lychee intentionally call down() inside up() to reset state before applying changes; removing that call or adding null‐guards here conflicts with established conventions.

Likely an incorrect or invalid review comment.

resources/js/lychee.d.ts (1)

107-107: TS union updated — LGTM

Frontend type matches backend enum and UI. Ship it.

resources/js/components/gallery/albumModule/thumbs/AlbumThumbOverlay.vue (1)

35-35: Importing trans is correct

Import aligns with the new subtitle cases.

@codecov
Copy link

codecov bot commented Aug 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (5c3bd3f) to head (0ad8bfa).
⚠️ Report is 3 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria merged commit 2e389b2 into master Aug 31, 2025
36 checks passed
@ildyria ildyria deleted the add-display-num-photo-album-thumb branch August 31, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants