-
-
Notifications
You must be signed in to change notification settings - Fork 448
Display the file age in preview panel #3579
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
Display the file age in preview panel #3579
Conversation
This comment has been minimized.
This comment has been minimized.
📝 Walkthrough""" WalkthroughA new option to display file age in the preview panel was introduced to the Explorer plugin. This includes a settings checkbox, localization support, view model and settings property, and logic to compute and show relative file age (e.g., "Today", "X days ago") alongside file timestamps. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ExplorerSettings.xaml
participant SettingsViewModel
participant Settings
participant PreviewPanel
User->>ExplorerSettings.xaml: Toggles "File Age" checkbox
ExplorerSettings.xaml->>SettingsViewModel: Updates ShowFileAgeInPreviewPanel
SettingsViewModel->>Settings: Sets ShowFileAgeInPreviewPanel
User->>PreviewPanel: Opens preview for a file
PreviewPanel->>Settings: Reads ShowFileAgeInPreviewPanel
alt ShowFileAgeInPreviewPanel is true
PreviewPanel->>PreviewPanel: Calls GetFileAge()
PreviewPanel->>User: Displays "File Age - Timestamp"
else ShowFileAgeInPreviewPanel is false
PreviewPanel->>User: Displays "Timestamp" only
end
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (5)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
Plugins/Flow.Launcher.Plugin.Explorer/Languages/ar.xaml (1)
134-134
: Minor formatting inconsistency.Consider removing this extra blank line to maintain consistency with the English localization file format.
-
Plugins/Flow.Launcher.Plugin.Explorer/Languages/nb.xaml (1)
134-134
: Minor formatting inconsistency.Consider removing this extra blank line to maintain consistency with the English localization file format.
-
Plugins/Flow.Launcher.Plugin.Explorer/Languages/ko.xaml (1)
134-134
: Minor formatting inconsistency.Consider removing this extra blank line to maintain consistency with the English localization file format.
-
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs (1)
97-134
: Well-implemented relative time calculation with minor optimization opportunity.The
GetDiffTimeString
method handles various time scenarios correctly:
- Future dates are properly detected
- Day, month, and year calculations account for partial periods
- Singular/plural localization is handled appropriately
However, consider extracting the month and year calculation logic into separate methods to improve readability:
+ private int CalculateMonthsDifference(DateTime from, DateTime to) + { + int monthsDiff = (to.Year - from.Year) * 12 + to.Month - from.Month; + if (to.Day < from.Day) + monthsDiff--; + return monthsDiff; + } + + private int CalculateYearsDifference(DateTime from, DateTime to) + { + int yearsDiff = to.Year - from.Year; + if (to.Month < from.Month || (to.Month == from.Month && to.Day < from.Day)) + yearsDiff--; + return yearsDiff; + } + private string GetDiffTimeString(DateTime fileDateTime) { DateTime now = DateTime.Now; TimeSpan difference = now - fileDateTime; if (fileDateTime > now) return Api.GetTranslation("plugin_explorer_previewpanel_diff_time_future"); if (difference.TotalDays < 1) return Api.GetTranslation("plugin_explorer_previewpanel_diff_time_today"); if (difference.TotalDays < 30) { int days = (int)difference.TotalDays; return days == 1 ? Api.GetTranslation("plugin_explorer_previewpanel_diff_time_day_one") : string.Format(Api.GetTranslation("plugin_explorer_previewpanel_diff_time_day_plural"), days); } - int monthsDiff = (now.Year - fileDateTime.Year) * 12 + now.Month - fileDateTime.Month; - if (now.Day < fileDateTime.Day) - monthsDiff--; + int monthsDiff = CalculateMonthsDifference(fileDateTime, now); if (monthsDiff < 12) { return monthsDiff == 1 ? Api.GetTranslation("plugin_explorer_previewpanel_diff_time_month_one") : string.Format(Api.GetTranslation("plugin_explorer_previewpanel_diff_time_month_plural"), monthsDiff); } - int yearsDiff = now.Year - fileDateTime.Year; - if (now.Month < fileDateTime.Month || (now.Month == fileDateTime.Month && now.Day < fileDateTime.Day)) - yearsDiff--; + int yearsDiff = CalculateYearsDifference(fileDateTime, now); return yearsDiff == 1 ? Api.GetTranslation("plugin_explorer_previewpanel_diff_time_year_one") : string.Format(Api.GetTranslation("plugin_explorer_previewpanel_diff_time_year_plural"), yearsDiff); }🧰 Tools
🪛 GitHub Check: Check Spelling
[warning] 112-112:
previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 106-106:
previewpanel
is not a recognized word. (unrecognized-spelling)🪛 GitHub Actions: Check Spelling
[warning] 106-106:
previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 112-112:
previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 113-113:
previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 123-123:
previewpanel
is not a recognized word. (unrecognized-spelling)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (27)
Plugins/Flow.Launcher.Plugin.Explorer/Languages/ar.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/cs.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/da.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/de.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/es-419.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/es.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/fr.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/he.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/it.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/ja.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/ko.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/nb.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/nl.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/pl.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-pt.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/sk.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/sr.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/tr.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/uk-UA.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/vi.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/zh-cn.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Languages/zh-tw.xaml
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
(1 hunks)Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
(5 hunks)
🧰 Additional context used
🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
[warning] 137-137: opendir
is not a recognized word. (unrecognized-spelling)
[warning] 152-152: opendir
is not a recognized word. (unrecognized-spelling)
[warning] 177-177: drv
is not a recognized word. (unrecognized-spelling)
[warning] 178-178: drv
is not a recognized word. (unrecognized-spelling)
[warning] 179-179: totalspace
is not a recognized word. (unrecognized-spelling)
[warning] 180-180: drv
is not a recognized word. (unrecognized-spelling)
[warning] 180-180: drv
is not a recognized word. (unrecognized-spelling)
[warning] 248-248: openresultfolder
is not a recognized word. (unrecognized-spelling)
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
[warning] 106-106: previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 112-112: previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 113-113: previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 123-123: previewpanel
is not a recognized word. (unrecognized-spelling)
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
[warning] 112-112:
previewpanel
is not a recognized word. (unrecognized-spelling)
[warning] 106-106:
previewpanel
is not a recognized word. (unrecognized-spelling)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: gitStream.cm
🔇 Additional comments (29)
Plugins/Flow.Launcher.Plugin.Explorer/Languages/de.xaml (1)
126-133
: LGTM! Well-structured German localization additions.The relative time translations are grammatically correct and follow proper German conventions. The singular/plural forms are handled appropriately, and the placeholder usage is consistent.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/cs.xaml (1)
127-134
: LGTM! Proper Czech localization implementation.The Czech translations follow correct grammar rules and declension patterns. The time expressions are natural and consistent with Czech language conventions.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-pt.xaml (1)
126-133
: LGTM! Accurate Portuguese localization.The Portuguese translations are grammatically correct and appropriate for the pt-pt locale. The relative time expressions follow proper Portuguese conventions.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/vi.xaml (1)
126-133
: LGTM! Consistent Vietnamese localization.The Vietnamese translations follow the established pattern and appear to use appropriate Vietnamese expressions for relative time. The structure is consistent with other language files.
Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs (1)
290-290
: LGTM! Correct API integration for localization support.The addition of
Context.API
parameter to the PreviewPanel constructor properly enables localization support for the relative time display feature. This follows good dependency injection practices and maintains the lazy initialization pattern.Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (1)
128-135
: Excellent localization support for relative time expressions!The new English localization strings are well-structured and comprehensive, covering all necessary time expressions for the file age display feature. The key naming convention is consistent and descriptive.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/ar.xaml (1)
126-133
: Good Arabic localization with consistent key structure.The Arabic translations properly support the relative time expressions and maintain consistency with the English key structure. The translations appear to use appropriate Arabic temporal expressions.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/nb.xaml (1)
126-133
: Well-implemented Norwegian localization.The Norwegian translations maintain the consistent key structure and use appropriate Norwegian temporal expressions for relative time display.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/ko.xaml (1)
126-133
: Excellent Korean localization with proper temporal expressions.The Korean translations maintain the consistent key structure across all language files and use appropriate Korean temporal expressions. The implementation properly supports the file age display feature in Korean locales.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/es-419.xaml (1)
126-133
: Approve Spanish localization for preview panel relative time displayThe newly added Spanish strings for relative time differences (“Hoy”, “Hace 1 día”, “Hace {0} días”, etc.) are correctly defined, keys are consistent with other languages, and placeholders and accents are properly handled.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/nl.xaml (1)
126-133
: Approve Dutch localization for preview panel relative time displayThe Dutch translations for relative time expressions (“Vandaag”, “1 dag geleden”, “{0} dagen geleden”, etc.) are accurately provided, keys match the pattern used in other resource files, and placeholders are correctly placed.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/zh-cn.xaml (1)
126-133
: Approve Simplified Chinese localization for preview panel relative time displayThe new Simplified Chinese strings (“今天”, “1 天前”, “{0} 天前”, etc.) correctly cover the relative time cases, follow the established key naming, and use placeholders appropriately.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/da.xaml (1)
126-133
: Approve Danish localization for preview panel relative time displayThe Danish entries (“I dag”, “For 1 dag siden”, “For {0} dage siden”, etc.) are correctly translated, follow the consistent key naming, and properly include placeholders.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/zh-tw.xaml (1)
126-133
: Approve Traditional Chinese localization for preview panel relative time displayThe Traditional Chinese strings (“今天”, “1 天前”, “{0} 天前”, etc.) are accurate, keys align with other languages, and placeholders are correctly formatted.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/es.xaml (1)
126-133
: Localization additions for relative file age are complete and consistentThe Spanish resource file includes all eight required keys for the preview panel’s relative time display (
today
,1 day ago
,days plural
,future
,1 month ago
,months plural
,1 year ago
,years plural
) with correct placeholders. The key names align exactly with those used in other language files and in the code.Plugins/Flow.Launcher.Plugin.Explorer/Languages/ja.xaml (1)
126-133
: Japanese localization for relative time strings is accurateAll necessary keys for displaying file age are present, and the Japanese translations correctly reflect singular/plural forms and future dates. Key naming matches the implementation in
PreviewPanel.xaml.cs
.Plugins/Flow.Launcher.Plugin.Explorer/Languages/pt-br.xaml (1)
126-133
: Portuguese relative time resource keys are correctly addedThe Brazilian Portuguese file now contains the full set of
plugin_explorer_previewpanel_diff_time_*
entries required by the preview panel feature. Placeholders and key names are consistent with other locales and code expectations.Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml (1)
126-133
: Russian localization entries for file age are complete and consistentThe Russian resource dictionary includes all eight
diff_time
keys with appropriate pluralization patterns and placeholders. They align with the keys referenced in the preview panel logic.Plugins/Flow.Launcher.Plugin.Explorer/Languages/he.xaml (1)
126-133
: Hebrew localization for relative time display is correctAll required
plugin_explorer_previewpanel_diff_time_*
keys have been added with correct Hebrew translations and placeholders. Key names are consistent with the rest of the codebase.Plugins/Flow.Launcher.Plugin.Explorer/Languages/uk-UA.xaml (1)
126-133
: Localization entries for relative time are well-formed and consistent.The new keys
plugin_explorer_previewpanel_diff_time_*
and their Ukrainian translations are correctly structured, follow the existing naming convention, and align with other language resource files.Plugins/Flow.Launcher.Plugin.Explorer/Languages/fr.xaml (1)
126-133
: French localization for relative time is accurate.The added keys and translations (e.g., "Aujourd'hui", "Il y a {0} jours") are correctly formatted, follow the naming pattern, and match the implementation requirements.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/sk.xaml (1)
126-133
: Slovak relative-time entries are correct.The new localization strings (
Dnes
,Pred {0} dňami
, etc.) are properly translated, use the correct key naming, and mirror the pattern in other languages.Plugins/Flow.Launcher.Plugin.Explorer/Languages/sr.xaml (1)
126-133
: Serbian diff-time translations look good.All eight new entries (
Данас
,Пре {0} дана
, etc.) are syntactically correct, consistently named, and fit the existing resource structure.Plugins/Flow.Launcher.Plugin.Explorer/Languages/tr.xaml (1)
126-133
: Turkish relative-time strings are properly added.The keys and translations (
Bugün
,{0} gün önce
, etc.) adhere to project conventions, are correctly escaped, and align with parallel entries in other languages.Plugins/Flow.Launcher.Plugin.Explorer/Languages/pl.xaml (1)
126-134
: LGTM! Well-structured Polish localization additions.The Polish translations for relative time expressions are properly formatted and follow the established naming conventions. The singular/plural forms are grammatically correct and the placeholder formatting is consistent.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/it.xaml (1)
126-134
: LGTM! Accurate Italian localization additions.The Italian translations for relative time expressions are well-crafted with proper grammar for singular/plural forms. The translations are natural and follow the established resource key conventions.
Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs (3)
56-61
: LGTM! Clean constructor enhancement.The constructor properly accepts and stores the
IPublicAPI
parameter, enabling localization support for the new relative time feature.
71-76
: LGTM! Enhanced date display with relative time.The logic correctly prepends relative time descriptions to the formatted date/time strings, providing users with both human-friendly relative time and precise timestamps.
Also applies to: 81-86
106-106
:❓ Verification inconclusive
Address spell check warnings for resource key names.
The spell checker flags "previewpanel" as unrecognized, but this is part of the established resource key naming convention for the Explorer plugin.
Consider adding these terms to the spell checker's dictionary or ignore list:
Alternatively, if this is a one-time issue, the warnings can be safely ignored as they are false positives for valid resource key identifiers.
Also applies to: 112-112, 113-113, 123-123
🏁 Script executed:
#!/bin/bash # Check if there's a spell checker configuration file to add exceptions fd -g "*spell*" -g "*.json" -g "*.yml" -g "*.yaml" -g "*.txt"Length of output: 314
Verify and update spell checker dictionary for resource keys
No spell checker config file (e.g. cspell.json, spelling.yml) was detected in the repo. Please:
- Identify which spell-checker tool/config your project uses.
- Add these terms to its dictionary or ignore list:
• previewpanel
• plugin_explorer_previewpanel_diff_time_today
• plugin_explorer_previewpanel_diff_time_yesterday
• plugin_explorer_previewpanel_diff_added
• plugin_explorer_previewpanel_diff_removed- Or, if these warnings are one-off false positives, you may safely ignore them.
Affected locations:
- Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs – lines 106, 112, 113, 123
🧰 Tools
🪛 GitHub Check: Check Spelling
[warning] 106-106:
previewpanel
is not a recognized word. (unrecognized-spelling)🪛 GitHub Actions: Check Spelling
[warning] 106-106:
previewpanel
is not a recognized word. (unrecognized-spelling)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello. Thanks for your contribution.
-
You only need to add the strings in English; no translation is necessary. (As far as I know, translations added here probably won't be reflected anyway. Since we use Crowdin, any translations added here likely won’t be applied or will be overwritten.) This translation contains some inaccuracies based on my review. (If AI translation was used, you should double-check whether the expressions are actually used in real contexts.) It would be better to remove all translations except English.
-
This feature should have an on/off toggle. (There might be requests like "I want to disable this.")
Hi, thanks for the review! I'll be working on the changes! |
30cc371
to
90ad72c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🥷 Code experts: Jack251970, jjw24 Jack251970, jjw24 have most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Jack251970 There are no issues functionally or UI-wise. If the code looks fine to you, it should be good to merge. |
This comment has been minimized.
This comment has been minimized.
@onesounds Improved code quality and supported translation for preview information. If you think it is good to go, please merge it. |
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
@01Dri Thanks for your work👍 |
Thankss! It's my first contribution to an open source project!! |
@01Dri I am grateful for your contribution! |
What's the PR
Example
Todo