Skip to content

[PB-5671]: Add folder size and file count to item details dialog#1811

Merged
terrerox merged 5 commits intofeature/automatic-trash-disposalfrom
feature/folder-details
Feb 26, 2026
Merged

[PB-5671]: Add folder size and file count to item details dialog#1811
terrerox merged 5 commits intofeature/automatic-trash-disposalfrom
feature/folder-details

Conversation

@terrerox
Copy link
Copy Markdown
Contributor

@terrerox terrerox commented Jan 13, 2026

Description

  • Upgrade @internxt/sdk to 1.12.1 to support folder statistics
  • Add getFolderStats service method to fetch folder metadata
  • Display folder size and file count in item details modal
  • Implement parallel data fetching with Promise.all for better performance
  • Add proper error handling for folder stats with graceful degradation
  • Refactor getDetailsData to reduce cognitive complexity
  • Extract helper functions for location fetching and size calculation
  • Add i18n support for file count with pluralization (7 languages)
  • Update skeleton loading state to show numberOfFiles only for folders
  • Fix field ordering: type/numberOfFiles before size based on item type
  • Add proper TypeScript types for FolderStatsResponse and ItemType

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Additional Notes

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jan 13, 2026

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2de2431
Status: ✅  Deploy successful!
Preview URL: https://e14cad8f.drive-web.pages.dev
Branch Preview URL: https://feature-folder-details.drive-web.pages.dev

View logs

);
};

async function getFolderStatsOrUndefined(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙃 not add the return types at the function name, for that we have types :)

Copy link
Copy Markdown
Contributor Author

@terrerox terrerox Jan 14, 2026

Choose a reason for hiding this comment

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

I changed the approach, but I still need to return undefined if the item is not a folder. That way, Promise.all won’t trigger a request for it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

he means that this function name should be just getFolderStats instead of getFolderStatsOrUndefined @terrerox

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, my bad 😅. I fixed it

return newStorageService.getFolderStats(itemUuid).catch(() => undefined);
}

function calculateItemSize(item: DriveItemDetails, folderStats: FolderStatsResponse | undefined): string | undefined {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: remember to use arrow functions

Comment on lines +831 to +835
"fileCount_one": "{{count}} файл",
"fileCount_few": "{{count}} файла",
"fileCount_many": "{{count}} файлов",
"fileCount_other": "{{count}} файлов",
"fileCountMoreThan1000": "Более 1000 файлов"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove unused translations

Copy link
Copy Markdown
Contributor Author

@terrerox terrerox Jan 14, 2026

Choose a reason for hiding this comment

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

They are actually used, Russian uses 4 plural forms:

  • _one: for numbers ending in 1 (except 11): 1 файл, 21 файл, 101 файл
  • _few: for numbers ending in 2-4 (except 12-14): 2 файла, 3 файла, 22 файла
  • _many: for numbers ending in 0, 5-9, and 11-14: 5 файлов, 11 файлов, 100 файлов
  • _other: fallback for any other cases

i18next will dynamically choose it according the count value

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah, good to know 💯

@terrerox terrerox self-assigned this Jan 14, 2026
@terrerox terrerox requested a review from CandelR January 14, 2026 13:31
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

This pull request has been inactive for 30 days. Is it still in progress? If so, please leave a comment or make an update to keep it open. Otherwise, it will be closed automatically in 15 days.

@terrerox terrerox changed the base branch from feature/automatic-trash-column-date to master February 18, 2026 14:43
@terrerox terrerox changed the base branch from master to feature/automatic-trash-column-date February 18, 2026 14:43
@github-actions github-actions Bot removed the stalled label Feb 19, 2026
Base automatically changed from feature/automatic-trash-column-date to feature/automatic-trash-disposal February 26, 2026 12:30
@terrerox terrerox merged commit e798fff into feature/automatic-trash-disposal Feb 26, 2026
4 of 5 checks passed
@terrerox terrerox deleted the feature/folder-details branch February 26, 2026 12:31
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.

3 participants