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 { CheckRow } from "./ui/NativeControls";
|
||||||
import { LoadingState, StateMessage } from "./ui/QueryState";
|
import { LoadingState, StateMessage } from "./ui/QueryState";
|
||||||
import { SURFACE } from "./ui/surfaces";
|
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
|
// 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
|
// 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() {
|
export function StorageTab() {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const lang = i18n.language;
|
const lang = i18n.language;
|
||||||
@@ -395,10 +374,6 @@ export function StorageTab() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Section card title={t("downloads.admin.perUser")}>
|
<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 ? (
|
{storage.isError && !s ? (
|
||||||
<StateMessage tone="error" onRetry={() => void storage.refetch()}>
|
<StateMessage tone="error" onRetry={() => void storage.refetch()}>
|
||||||
{t("common.loadError")}
|
{t("common.loadError")}
|
||||||
@@ -415,7 +390,7 @@ export function StorageTab() {
|
|||||||
keyboardNav
|
keyboardNav
|
||||||
fixedLayout
|
fixedLayout
|
||||||
rowProps={(u) => userMenu.triggerProps(u)}
|
rowProps={(u) => userMenu.triggerProps(u)}
|
||||||
emptyText={t("downloads.admin.noFootprint")}
|
emptyText={t("downloads.admin.noUsers")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -188,8 +188,7 @@
|
|||||||
"unlimited": "Unlimited (bypass storage limit)",
|
"unlimited": "Unlimited (bypass storage limit)",
|
||||||
"reset": "Reset to default",
|
"reset": "Reset to default",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"quotaPickPlaceholder": "Set a user's quota…",
|
"noUsers": "No users yet.",
|
||||||
"noFootprint": "No downloads yet.",
|
|
||||||
"allDownloads": "Every download",
|
"allDownloads": "Every download",
|
||||||
"columns": {
|
"columns": {
|
||||||
"user": "User",
|
"user": "User",
|
||||||
|
|||||||
@@ -188,8 +188,7 @@
|
|||||||
"unlimited": "Korlátlan (tárhelykorlát kikapcsolása)",
|
"unlimited": "Korlátlan (tárhelykorlát kikapcsolása)",
|
||||||
"reset": "Visszaállítás alapértékre",
|
"reset": "Visszaállítás alapértékre",
|
||||||
"save": "Mentés",
|
"save": "Mentés",
|
||||||
"quotaPickPlaceholder": "Kvóta beállítása egy felhasználónak…",
|
"noUsers": "Még nincs felhasználó.",
|
||||||
"noFootprint": "Még nincs letöltés.",
|
|
||||||
"allDownloads": "Minden letöltés",
|
"allDownloads": "Minden letöltés",
|
||||||
"columns": {
|
"columns": {
|
||||||
"user": "Felhasználó",
|
"user": "Felhasználó",
|
||||||
|
|||||||
Reference in New Issue
Block a user