mirror of
https://github.com/outline/outline.git
synced 2026-11-30 17:10:36 +03:00
Change PaginatedDropdown to consume user store
`PaginatedDropdown` should consume user store directly, so the pagination and refresh can be encapsulated into one single component. TODO: Impl memoized options calculation for `PaginatedDropdown`
This commit is contained in:
1 parent
324f4b133d
commit
57b03936eb
2 files changed
+2
-22
No files matched your search
@@ -14,31 +14,11 @@ function UserFilter(props: Props) {
|
||||
const { t } = useTranslation();
|
||||
const { users } = useStores();
|
||||
|
||||
React.useEffect(() => {
|
||||
users.fetchPage({
|
||||
limit: 100,
|
||||
});
|
||||
}, [users]);
|
||||
|
||||
const options = React.useMemo(() => {
|
||||
const userOptions = users.all.map((user) => ({
|
||||
key: user.id,
|
||||
label: user.name,
|
||||
}));
|
||||
return [
|
||||
{
|
||||
key: "",
|
||||
label: t("Any author"),
|
||||
},
|
||||
...userOptions,
|
||||
];
|
||||
}, [users.all, t]);
|
||||
|
||||
return (
|
||||
<PaginatedDropdown
|
||||
options={options}
|
||||
activeKey={userId}
|
||||
onSelect={onSelect}
|
||||
users={users}
|
||||
defaultLabel={t("Any author")}
|
||||
selectedPrefix={`${t("Author")}:`}
|
||||
/>
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
"Dismiss": "Dismiss",
|
||||
"Back": "Back",
|
||||
"Documents": "Documents",
|
||||
"Any author": "Any author",
|
||||
"Results": "Results",
|
||||
"No results for {{query}}": "No results for {{query}}",
|
||||
"Logo": "Logo",
|
||||
@@ -543,7 +544,6 @@
|
||||
"Documents in collections you are able to access": "Documents in collections you are able to access",
|
||||
"All documents": "All documents",
|
||||
"Include documents that are in the archive": "Include documents that are in the archive",
|
||||
"Any author": "Any author",
|
||||
"Author": "Author",
|
||||
"We were unable to find the page you’re looking for.": "We were unable to find the page you’re looking for.",
|
||||
"No documents found for your search filters.": "No documents found for your search filters.",
|
||||
|
||||
Reference in new issue
Block a user