fixed some role based logic bugs; fixed ui parts
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
This commit is contained in:
@@ -6,18 +6,31 @@ import { Icons } from "../icons";
|
||||
|
||||
function CategorySelect(props: Partial<ComboboxProps>) {
|
||||
const { data: categories } = api.category.getMany.useQuery();
|
||||
const initialValue = categories?.find(
|
||||
(c) => c.id === props?.initialValue,
|
||||
)?.slug;
|
||||
|
||||
return (
|
||||
<Combobox
|
||||
{...(props as ComboboxProps)}
|
||||
initialValue={initialValue}
|
||||
messageUi={{
|
||||
select: "Kategorie auswählen...",
|
||||
selectIcon: Icons.category,
|
||||
placeholder: "Kategorie suchen...",
|
||||
empty: "Keine Kategorien gefunden",
|
||||
}}
|
||||
onSelect={(value) => {
|
||||
const id = categories?.find((c) => {
|
||||
return c.slug === value;
|
||||
})?.id!;
|
||||
props?.onSelect?.(id);
|
||||
}}
|
||||
data={
|
||||
categories?.map(({ name, slug }) => ({ label: name, value: slug })) ??
|
||||
[]
|
||||
categories?.map(({ name, slug }) => ({
|
||||
label: name,
|
||||
value: slug,
|
||||
})) ?? []
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user