- Notifications
You must be signed in to change notification settings - Fork1k
feat: add user filter to templates page to filter by template author#19561
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
c659df8
8c0ed0b
85bb44b
08e5cb6
7f4754c
a16545c
c80dc12
a76100e
4ec6776
6032ee6
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import { API } from "api/api"; | ||
import type { Organization } from "api/typesGenerated"; | ||
import { Avatar } from "components/Avatar/Avatar"; | ||
import { | ||
Filter, | ||
MenuSkeleton, | ||
type UseFilterResult, | ||
} from "components/Filter/Filter"; | ||
import { useFilterMenu } from "components/Filter/menu"; | ||
import { | ||
SelectFilter, | ||
type SelectFilterOption, | ||
} from "components/Filter/SelectFilter"; | ||
import { useDashboard } from "modules/dashboard/useDashboard"; | ||
import type { FC } from "react"; | ||
import { | ||
DEFAULT_USER_FILTER_WIDTH, | ||
type UserFilterMenu, | ||
UserMenu, | ||
} from "../../components/Filter/UserFilter"; | ||
interface TemplatesFilterProps { | ||
filter:UseFilterResult; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Much better. Thank you! | ||
error?: unknown; | ||
userMenu?: UserFilterMenu; | ||
} | ||
export const TemplatesFilter: FC<TemplatesFilterProps> = ({ | ||
filter, | ||
error, | ||
userMenu, | ||
}) => { | ||
const { showOrganizations } = useDashboard(); | ||
const width = showOrganizations ? DEFAULT_USER_FILTER_WIDTH : undefined; | ||
const organizationMenu = useFilterMenu({ | ||
onChange: (option) => | ||
filter.update({ ...filter.values, organization: option?.value }), | ||
@@ -50,15 +65,23 @@ export const TemplatesFilter: FC<TemplatesFilterProps> = ({ | ||
filter={filter} | ||
error={error} | ||
options={ | ||
<> | ||
{userMenu && <UserMenu width={width} menu={userMenu} />} | ||
rafrdz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<SelectFilter | ||
placeholder="All organizations" | ||
label="Select an organization" | ||
options={organizationMenu.searchOptions} | ||
selectedOption={organizationMenu.selectedOption ?? undefined} | ||
rafrdz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
onSelect={organizationMenu.selectOption} | ||
/> | ||
</> | ||
} | ||
optionsSkeleton={ | ||
<> | ||
{userMenu && <MenuSkeleton />} | ||
<MenuSkeleton /> | ||
</> | ||
} | ||
/> | ||
); | ||
}; | ||
Uh oh!
There was an error while loading.Please reload this page.