-
Notifications
You must be signed in to change notification settings - Fork 2
Add user file quota display in header #16
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,11 +36,68 @@ | |||||||||||||||||
| // UI properties | ||||||||||||||||||
| let showDropdown = $state(false); | ||||||||||||||||||
| let uploading = $state(false); | ||||||||||||||||||
| let quotaWarning: string | null = $state(null); | ||||||||||||||||||
|
|
||||||||||||||||||
| // UI elements | ||||||||||||||||||
| let dropdownRef: HTMLDivElement | undefined = $state(); | ||||||||||||||||||
| let partitionLabelRef: HTMLLabelElement | undefined = $state(); | ||||||||||||||||||
| let partitionButtonRef: HTMLButtonElement | undefined = $state(); | ||||||||||||||||||
| let fileInputRef: HTMLInputElement | undefined = $state(); | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Check if quota is infinite (-1 means infinite) | ||||||||||||||||||
| */ | ||||||||||||||||||
| let isQuotaInfinite = $derived( | ||||||||||||||||||
| indexerData.userInfo?.file_quota === -1 | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Calculate remaining upload slots based on quota | ||||||||||||||||||
| * Returns Infinity if quota is infinite, otherwise returns remaining slots (minimum 0) | ||||||||||||||||||
| */ | ||||||||||||||||||
| let remainingQuota = $derived( | ||||||||||||||||||
| isQuotaInfinite | ||||||||||||||||||
| ? Infinity | ||||||||||||||||||
| : Math.max(0, (indexerData.userInfo?.file_quota ?? 0) - (indexerData.userInfo?.total_files ?? 0)) | ||||||||||||||||||
|
Comment on lines
+59
to
+61
|
||||||||||||||||||
| isQuotaInfinite | |
| ? Infinity | |
| : Math.max(0, (indexerData.userInfo?.file_quota ?? 0) - (indexerData.userInfo?.total_files ?? 0)) | |
| indexerData.userInfo == null | |
| ? Infinity | |
| : isQuotaInfinite | |
| ? Infinity | |
| : Math.max(0, (indexerData.userInfo.file_quota ?? 0) - (indexerData.userInfo.total_files ?? 0)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * This file contains all the types related to user information. | ||
| * @author Generated for LINAGORA | ||
| */ | ||
|
|
||
| import { ListFormat } from "typescript"; | ||
|
|
||
| /** | ||
| * Represents user information (from the GET /users/info endpoint) | ||
| */ | ||
| export interface UserInfo { | ||
| id: string; | ||
| display_name: string; | ||
| is_admin: boolean; | ||
| memberships: ListFormat; | ||
| file_count: number; | ||
|
Comment on lines
+6
to
+16
|
||
| pending_files: number; | ||
| total_files: number; | ||
| file_quota: number; // -1 means infinite quota | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.