-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
KostyalBalint
committed
Jan 6, 2025
1 parent
f831c67
commit 0757081
Showing
9 changed files
with
96 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { FC } from "react"; | ||
import { UsersQuery, useUsersQuery } from "@/generated/graphql.tsx"; | ||
import { Skeleton } from "@mui/material"; | ||
import { MultiSelect } from "@/components/MultiSelect.tsx"; | ||
|
||
type ArrayElement<ArrayType extends readonly unknown[]> = | ||
ArrayType extends readonly (infer ElementType)[] ? ElementType : never; | ||
|
||
type ContributorsSelectorProp = { | ||
selectedUsers: string[]; | ||
onChange: (value: UsersQuery["users"]) => void; | ||
}; | ||
|
||
export const ContributorsSelector: FC<ContributorsSelectorProp> = (props) => { | ||
const { data, loading } = useUsersQuery(); | ||
|
||
if (loading) return <Skeleton variant="rounded" width={200} height={10} />; | ||
if (!data) return "Failed to load users"; | ||
|
||
return ( | ||
<MultiSelect<ArrayElement<UsersQuery["users"]>> | ||
label="Közreműködők" | ||
items={data.users} | ||
value={data.users.filter((user) => props.selectedUsers.includes(user.id))} | ||
getItemLabel={(item) => item.name} | ||
getItemKey={(item) => item.id} | ||
onChange={props.onChange} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { User } from "@/generated/graphql.tsx"; | ||
import { Avatar, Typography } from "@mui/material"; | ||
|
||
export const CreatedByItem = ({ | ||
user, | ||
}: { | ||
user: Pick<User, "avatarUrl" | "name">; | ||
}) => { | ||
return ( | ||
<> | ||
<Avatar | ||
src={user.avatarUrl ?? undefined} | ||
sx={{ height: 24, width: 24 }} | ||
/> | ||
<Typography variant="body2" sx={{ color: "text.secondary" }}> | ||
{user.name} | ||
</Typography> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters