Skip to content

fix: Hide unusable button hints when viewing empty directory#1253

Merged
daveallie merged 3 commits intocrosspoint-reader:masterfrom
Levrk:Hide-Open
Mar 1, 2026
Merged

fix: Hide unusable button hints when viewing empty directory#1253
daveallie merged 3 commits intocrosspoint-reader:masterfrom
Levrk:Hide-Open

Conversation

@Levrk
Copy link
Contributor

@Levrk Levrk commented Mar 1, 2026

Summary

  • What is the goal of this PR?

Increase accuracy of button hints and text description in the file browser when viewing empty directory.

  • What changes are included?

Adjusted button label hint rendering logic in file browser to hide the "Open", "Up", and "Down" hints when the they are not available due to an empty directory.

I also changed the NO_BOOKS_FOUND string to NO_FILES_FOUND and updated translations. File browser shows more than just books so seeing "No Books Found" really doesn't make sense.

Additional Context

Very Simple change, here is what that looks like on my device.

Untitled (7)

AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

file browser shows more than just books so saying no books found when viewing an empty directory doesn't make sense
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f67e6c2 and 771013d.

📒 Files selected for processing (18)
  • lib/I18n/translations/belarusian.yaml
  • lib/I18n/translations/catalan.yaml
  • lib/I18n/translations/czech.yaml
  • lib/I18n/translations/danish.yaml
  • lib/I18n/translations/dutch.yaml
  • lib/I18n/translations/english.yaml
  • lib/I18n/translations/finnish.yaml
  • lib/I18n/translations/french.yaml
  • lib/I18n/translations/german.yaml
  • lib/I18n/translations/italian.yaml
  • lib/I18n/translations/polish.yaml
  • lib/I18n/translations/portuguese.yaml
  • lib/I18n/translations/romanian.yaml
  • lib/I18n/translations/russian.yaml
  • lib/I18n/translations/spanish.yaml
  • lib/I18n/translations/swedish.yaml
  • lib/I18n/translations/ukrainian.yaml
  • src/activities/home/MyLibraryActivity.cpp
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cppcheck
  • GitHub Check: build
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CaptainFrito
Repo: crosspoint-reader/crosspoint-reader PR: 725
File: src/activities/network/CalibreConnectActivity.cpp:218-264
Timestamp: 2026-02-12T06:57:35.955Z
Learning: In src/activities/network/CalibreConnectActivity.cpp, button hints (« Exit) are intentionally omitted from the SERVER_STARTING and ERROR states—only the SERVER_RUNNING state displays navigation hints. This is a deliberate design decision by the author.
Learnt from: whyte-j
Repo: crosspoint-reader/crosspoint-reader PR: 733
File: lib/I18n/I18nKeys.h:271-272
Timestamp: 2026-02-16T22:25:35.674Z
Learning: In the crosspoint-reader i18n system (lib/I18n/), missing translation keys in non-English YAML files are automatically filled with English strings at build time by the gen_i18n.py script. All generated string arrays (STRINGS_EN, STRINGS_ES, etc.) have identical lengths, so runtime array indexing is safe without per-string fallback logic. The system prints "INFO: '{key}' missing in {lang_code}, using English fallback" during code generation when this occurs.
📚 Learning: 2026-02-16T22:25:35.674Z
Learnt from: whyte-j
Repo: crosspoint-reader/crosspoint-reader PR: 733
File: lib/I18n/I18nKeys.h:271-272
Timestamp: 2026-02-16T22:25:35.674Z
Learning: In the crosspoint-reader i18n system (lib/I18n/), missing translation keys in non-English YAML files are automatically filled with English strings at build time by the gen_i18n.py script. All generated string arrays (STRINGS_EN, STRINGS_ES, etc.) have identical lengths, so runtime array indexing is safe without per-string fallback logic. The system prints "INFO: '{key}' missing in {lang_code}, using English fallback" during code generation when this occurs.

Applied to files:

  • lib/I18n/translations/swedish.yaml
  • lib/I18n/translations/portuguese.yaml
  • lib/I18n/translations/belarusian.yaml
  • lib/I18n/translations/spanish.yaml
  • lib/I18n/translations/german.yaml
  • lib/I18n/translations/czech.yaml
  • lib/I18n/translations/ukrainian.yaml
  • lib/I18n/translations/polish.yaml
  • lib/I18n/translations/english.yaml
  • lib/I18n/translations/romanian.yaml
  • lib/I18n/translations/french.yaml
  • lib/I18n/translations/russian.yaml
  • lib/I18n/translations/finnish.yaml
  • lib/I18n/translations/catalan.yaml
📚 Learning: 2026-02-23T22:11:42.181Z
Learnt from: ariel-lindemann
Repo: crosspoint-reader/crosspoint-reader PR: 1133
File: lib/I18n/translations/finnish.yaml:92-92
Timestamp: 2026-02-23T22:11:42.181Z
Learning: In translation YAML files located in lib/I18n/translations/, literal percent signs (%) in strings (e.g., STR_HIDE_BATTERY, STR_GO_TO_PERCENT, STR_PERCENT_STEP_HINT) do not require escaping as %% and this convention is consistent across all language translations. Ensure that this pattern is followed for all YAML files in this directory to avoid introducing incorrect formatting markers in localized strings.

Applied to files:

  • lib/I18n/translations/swedish.yaml
  • lib/I18n/translations/portuguese.yaml
  • lib/I18n/translations/belarusian.yaml
  • lib/I18n/translations/spanish.yaml
  • lib/I18n/translations/german.yaml
  • lib/I18n/translations/czech.yaml
  • lib/I18n/translations/ukrainian.yaml
  • lib/I18n/translations/polish.yaml
  • lib/I18n/translations/english.yaml
  • lib/I18n/translations/romanian.yaml
  • lib/I18n/translations/italian.yaml
  • lib/I18n/translations/french.yaml
  • lib/I18n/translations/russian.yaml
  • lib/I18n/translations/dutch.yaml
  • lib/I18n/translations/finnish.yaml
  • lib/I18n/translations/catalan.yaml
  • lib/I18n/translations/danish.yaml
📚 Learning: 2026-02-12T06:57:35.955Z
Learnt from: CaptainFrito
Repo: crosspoint-reader/crosspoint-reader PR: 725
File: src/activities/network/CalibreConnectActivity.cpp:218-264
Timestamp: 2026-02-12T06:57:35.955Z
Learning: In src/activities/network/CalibreConnectActivity.cpp, button hints (« Exit) are intentionally omitted from the SERVER_STARTING and ERROR states—only the SERVER_RUNNING state displays navigation hints. This is a deliberate design decision by the author.

Applied to files:

  • src/activities/home/MyLibraryActivity.cpp
📚 Learning: 2026-02-27T22:49:59.600Z
Learnt from: ngxson
Repo: crosspoint-reader/crosspoint-reader PR: 1218
File: src/activities/ActivityManager.cpp:254-265
Timestamp: 2026-02-27T22:49:59.600Z
Learning: In this codebase, assertions are always enabled (no NDEBUG). Use assert() to crash on programmer errors and surface logic bugs during development and in production builds. Do not rely on asserts for runtime error handling; they should enforce invariants that must always hold. Keep asserts side-effect free and inexpensive, and avoid relying on them for user-visible failures. Include <cassert> where appropriate and document the invariant being tested.

Applied to files:

  • src/activities/home/MyLibraryActivity.cpp
🔇 Additional comments (19)
lib/I18n/translations/belarusian.yaml (1)

17-17: Key rename and Belarusian text update look correct.

STR_NO_FILES_FOUND with a file-focused message matches the new empty-directory behavior.

lib/I18n/translations/swedish.yaml (1)

17-17: Swedish translation update is aligned with the new key.

The new STR_NO_FILES_FOUND entry is consistent and correctly phrased for the empty file list state.

lib/I18n/translations/french.yaml (1)

17-17: French key/value change is good to merge.

STR_NO_FILES_FOUND now clearly matches the file-browser empty-state wording.

lib/I18n/translations/dutch.yaml (1)

17-17: Dutch translation change is consistent and accurate.

The new STR_NO_FILES_FOUND mapping cleanly reflects the updated UI terminology.

lib/I18n/translations/spanish.yaml (1)

17-17: Spanish localization update looks correct.

STR_NO_FILES_FOUND and its value are aligned with the intended file-browser empty-state text.

lib/I18n/translations/czech.yaml (1)

17-17: Czech translation is correctly updated.

The new key/value pair matches the PR’s file-centric empty-state behavior.

lib/I18n/translations/danish.yaml (1)

17-17: Danish localization change looks good.

STR_NO_FILES_FOUND is correctly translated and aligned with the updated empty-directory UI.

lib/I18n/translations/italian.yaml (1)

17-17: Italian translation update is correct and consistent.

The renamed key and text accurately represent the no-files empty state.

lib/I18n/translations/romanian.yaml (1)

17-17: LGTM!

The Romanian translation correctly reflects the change from "books" to "files" terminology, consistent with the file browser context.

lib/I18n/translations/portuguese.yaml (1)

17-17: LGTM!

The Portuguese (Brazil) translation accurately conveys "No file found" using appropriate terminology.

lib/I18n/translations/english.yaml (1)

17-17: LGTM!

The English base string correctly reflects that the file browser displays various file types, not just books.

lib/I18n/translations/finnish.yaml (1)

17-17: LGTM!

The Finnish translation is grammatically correct and consistent with the key rename.

lib/I18n/translations/catalan.yaml (1)

17-17: LGTM!

The Catalan translation accurately conveys the "no files found" message.

lib/I18n/translations/polish.yaml (1)

17-17: LGTM!

The Polish translation uses correct grammar and terminology for "no files found."

lib/I18n/translations/ukrainian.yaml (1)

17-17: LGTM!

The Ukrainian translation correctly conveys the "files not found" message.

src/activities/home/MyLibraryActivity.cpp (2)

260-260: LGTM!

Correctly uses the renamed STR_NO_FILES_FOUND key to display an accurate empty-state message in the file browser.


269-272: LGTM!

The conditional logic cleanly suppresses the Open, Up, and Down button hints when the directory is empty, while keeping the Back/Home hint functional. This follows the established pattern of intentionally omitting button hints when they are not actionable. Based on learnings from CalibreConnectActivity, this deliberate omission of hints in certain states is a known design decision.

lib/I18n/translations/german.yaml (1)

17-17: Looks good: German empty-state key/value is correctly updated.

Line 17 correctly uses STR_NO_FILES_FOUND with accurate localized text for the new empty-directory behavior.

lib/I18n/translations/russian.yaml (1)

17-17: Looks good: Russian empty-state key/value is correctly updated.

Line 17 correctly maps the renamed key STR_NO_FILES_FOUND to a proper Russian translation for the empty file list state.


📝 Walkthrough

Walkthrough

Translation key STR_NO_BOOKS_FOUND is systematically replaced with STR_NO_FILES_FOUND across 16 language translation files with updated message text. The MyLibraryActivity C++ file updated to reference the new key and suppress button labels when no files are present.

Changes

Cohort / File(s) Summary
Translation Updates
lib/I18n/translations/belarusian.yaml, catalan.yaml, czech.yaml, danish.yaml, dutch.yaml, english.yaml, finnish.yaml, french.yaml, german.yaml, italian.yaml, polish.yaml, portuguese.yaml, romanian.yaml, russian.yaml, spanish.yaml, swedish.yaml, ukrainian.yaml
Consistent replacement of translation key STR_NO_BOOKS_FOUND with STR_NO_FILES_FOUND across all supported languages, with corresponding message text updates reflecting the semantic shift from "books" to "files".
C++ Activity Update
src/activities/home/MyLibraryActivity.cpp
Updated to use new STR_NO_FILES_FOUND translation key and suppressed Open/Dir Up/Dir Down button labels (via empty strings to mapLabels) when file list is empty.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • osteotek
  • znelson
  • daveallie
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—hiding button hints in empty directories—which is the primary focus of the code modifications to MyLibraryActivity.cpp.
Description check ✅ Passed The description comprehensively covers all changes: button hint hiding logic, the NO_BOOKS_FOUND to NO_FILES_FOUND renaming, translation updates, and includes visual context via a comparison image.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@znelson znelson left a comment

Choose a reason for hiding this comment

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

Can't comment on the localization, but the button label logic makes sense to me

@daveallie daveallie merged commit 7668120 into crosspoint-reader:master Mar 1, 2026
8 checks passed
laird pushed a commit to laird/crosspoint-claw that referenced this pull request Mar 1, 2026
…int-reader#1253)

* **What is the goal of this PR?**

Increase accuracy of button hints and text description in the file
browser when viewing empty directory.

* **What changes are included?**

Adjusted button label hint rendering logic in file browser to hide the
"Open", "Up", and "Down" hints when the they are not available due to an
empty directory.

I also changed the NO_BOOKS_FOUND string to NO_FILES_FOUND and updated
translations. File browser shows more than just books so seeing "No
Books Found" really doesn't make sense.

Very Simple change, here is what that looks like on my device.

<img width="1318" height="879" alt="Untitled (7)"
src="https://github.com/user-attachments/assets/6416c8c8-795d-41a5-9b9f-28d2c26666a0"
/>

---

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
laird added a commit to laird/crosspoint-claw that referenced this pull request Mar 1, 2026
Cherry-picked upstream fixes and features applied via rescue-1.0.0 worktree:
- fix: properly implement requestUpdateAndWait() (crosspoint-reader#1218)
- fix: Hide unusable button hints in empty directory (crosspoint-reader#1253)
- fix: add missing keyboard metrics to Lyra3CoversTheme (crosspoint-reader#1101)
- fix: remove bookProgressBarHeight from Lyra3CoversTheme
- feat: replace picojpeg with JPEGDEC for JPEG decoding (crosspoint-reader#1136)
- feat: WIFI pill, feed log fix, JPEGDEC version string
- feat: Add git branch to version string (crosspoint-reader#1225)
- fix: navigate directly to QR code after DZ auto-connect
- perf: Removed unused ConfirmationActivity member (crosspoint-reader#1234)
- refactor: Simplify new setting introduction (crosspoint-reader#1086)
- fix: UI fonts, settings stack overflow, PULSR theme name
- fix: convert SettingsList to push_back (prevent stack overflow)

All commits built and verified on device (confirmed 1.1.0-dev+d1e786a).
@ariel-lindemann
Copy link
Contributor

@Levrk thank you for the contribution,

In the future would you please tag the translators, so we can give our input on the translations?

Or you can also leave them unchanged and we will see they need translating.

But the way it's done here there is the danger that we miss it completely and some translations might be wrong. At least the Romanian one I would have done differently. And also the German and French are techinically correct but not in line with the overall style of the translations. So you're introducing changes which are out of scope and the ones responsible aren't notified.

I'm sure you meant well and thank you for your work

@Levrk
Copy link
Contributor Author

Levrk commented Mar 2, 2026

@ariel-lindemann Absolutely, I will be more mindful of this moving forward. Is there a standard method to notify translators, or would I tag folks individually? Perhaps we should have an ongoing discussion post where PR's with translation updates can be linked for visibility.

@ariel-lindemann
Copy link
Contributor

Thanks @Levrk. There is no established method yet, but we are discussing it in #1203 if you want to follow or give your perspective. I think there's multiple viable solutions but it's important we agree on something

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.

4 participants