fix(files): the Storage tab drops its user picker — every user already has a row and a menu
The list holds every user, files or not, so the picker above it only repeated a row's Edit quota. The empty text names what the list holds: users.
This commit is contained in:
@@ -24,7 +24,6 @@ import { Input } from "./ui/Input";
|
||||
import { CheckRow } from "./ui/NativeControls";
|
||||
import { LoadingState, StateMessage } from "./ui/QueryState";
|
||||
import { SURFACE } from "./ui/surfaces";
|
||||
import UserPicker from "./UserPicker";
|
||||
|
||||
// The admin Users page's "Storage" tab: the disk in three numbers, every user's footprint against
|
||||
// their own limit (the quota editor), and every user's downloads. Both lists are tables with aligned
|
||||
@@ -163,26 +162,6 @@ export function QuotaModal({
|
||||
);
|
||||
}
|
||||
|
||||
// Pick ANY user to set a download quota for — even one who hasn't downloaded anything yet (the
|
||||
// footprint list below only shows users who already have files).
|
||||
function QuotaUserPicker({ onPick }: { onPick: (u: { id: number; email: string }) => void }) {
|
||||
const { t } = useTranslation();
|
||||
const users = useQuery({ queryKey: qk.adminUsers(), queryFn: api.adminUsers });
|
||||
const list = users.data ?? [];
|
||||
return (
|
||||
<div className="w-full sm:w-72">
|
||||
<UserPicker
|
||||
users={list}
|
||||
loading={users.isLoading}
|
||||
error={users.isError}
|
||||
onRetry={() => void users.refetch()}
|
||||
onPick={(u) => onPick({ id: u.id, email: u.email })}
|
||||
label={t("downloads.admin.quotaPickPlaceholder")}
|
||||
placeholder={t("downloads.admin.quotaPickPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export function StorageTab() {
|
||||
const { t, i18n } = useTranslation();
|
||||
const lang = i18n.language;
|
||||
@@ -395,10 +374,6 @@ export function StorageTab() {
|
||||
)}
|
||||
|
||||
<Section card title={t("downloads.admin.perUser")}>
|
||||
{/* Set a quota for any user, regardless of whether they've downloaded anything. */}
|
||||
<div className="mb-3 flex justify-end">
|
||||
<QuotaUserPicker onPick={setQuotaFor} />
|
||||
</div>
|
||||
{storage.isError && !s ? (
|
||||
<StateMessage tone="error" onRetry={() => void storage.refetch()}>
|
||||
{t("common.loadError")}
|
||||
@@ -415,7 +390,7 @@ export function StorageTab() {
|
||||
keyboardNav
|
||||
fixedLayout
|
||||
rowProps={(u) => userMenu.triggerProps(u)}
|
||||
emptyText={t("downloads.admin.noFootprint")}
|
||||
emptyText={t("downloads.admin.noUsers")}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -188,8 +188,7 @@
|
||||
"unlimited": "Unlimited (bypass storage limit)",
|
||||
"reset": "Reset to default",
|
||||
"save": "Save",
|
||||
"quotaPickPlaceholder": "Set a user's quota…",
|
||||
"noFootprint": "No downloads yet.",
|
||||
"noUsers": "No users yet.",
|
||||
"allDownloads": "Every download",
|
||||
"columns": {
|
||||
"user": "User",
|
||||
|
||||
@@ -188,8 +188,7 @@
|
||||
"unlimited": "Korlátlan (tárhelykorlát kikapcsolása)",
|
||||
"reset": "Visszaállítás alapértékre",
|
||||
"save": "Mentés",
|
||||
"quotaPickPlaceholder": "Kvóta beállítása egy felhasználónak…",
|
||||
"noFootprint": "Még nincs letöltés.",
|
||||
"noUsers": "Még nincs felhasználó.",
|
||||
"allDownloads": "Minden letöltés",
|
||||
"columns": {
|
||||
"user": "Felhasználó",
|
||||
|
||||
Reference in New Issue
Block a user