-
-
Notifications
You must be signed in to change notification settings - Fork 255
Impove chapter/project leaders presentation #1772
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
rudransh-shrivastava
wants to merge
8
commits into
OWASP:main
from
rudransh-shrivastava:feature/improve-leaders-presentation
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b40862a
Add leaders presentation block in chapters and projects
rudransh-shrivastava 1d9e438
fix sonar issues
rudransh-shrivastava e9178fe
Merge branch 'main' into feature/improve-leaders-presentation
rudransh-shrivastava 9146e2c
Add leaders presentation block in chapters
rudransh-shrivastava f4408f0
Add tests for LeadersListBlock
rudransh-shrivastava fe0ce30
Merge branch 'main' into feature/improve-leaders-presentation
kasya a0edae1
increase width
rudransh-shrivastava 734be3f
Merge branch 'main' into feature/improve-leaders-presentation
kasya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,71 @@ | ||
| 'use client' | ||
| import { useQuery } from '@apollo/client' | ||
| import { IconProp } from '@fortawesome/fontawesome-svg-core' | ||
| import { useRouter } from 'next/navigation' | ||
| import FontAwesomeIconWrapper from 'wrappers/FontAwesomeIconWrapper' | ||
| import { GET_LEADER_DATA } from 'server/queries/userQueries' | ||
| import { LeadersListBlockProps } from 'types/leaders' | ||
| import { User } from 'types/user' | ||
| import AnchorTitle from 'components/AnchorTitle' | ||
| import SecondaryCard from 'components/SecondaryCard' | ||
| import UserCard from 'components/UserCard' | ||
|
|
||
| const LeadersListBlock = ({ | ||
| leaders, | ||
| label = 'Leaders', | ||
| icon, | ||
| }: { | ||
| leaders: LeadersListBlockProps | ||
| label?: string | ||
| icon?: IconProp | ||
| }) => { | ||
| const LeaderData = ({ username }: { username: string }) => { | ||
| const { data, loading, error } = useQuery(GET_LEADER_DATA, { | ||
| variables: { key: username }, | ||
| }) | ||
| const router = useRouter() | ||
|
|
||
| if (loading) return <p>Loading {username}...</p> | ||
| if (error) return <p>Error loading {username}'s data</p> | ||
|
|
||
| const user = data?.user | ||
|
|
||
| if (!user) { | ||
| return <p>No data available for {username}</p> | ||
| } | ||
|
|
||
| const handleButtonClick = (user: User) => { | ||
| router.push(`/members/${user.login}`) | ||
| } | ||
|
|
||
| return ( | ||
| <UserCard | ||
| avatar={user.avatarUrl} | ||
| button={{ | ||
| icon: <FontAwesomeIconWrapper icon="fa-solid fa-right-to-bracket" />, | ||
| label: 'View Profile', | ||
| onclick: () => handleButtonClick(user), | ||
| }} | ||
| className="h-64 w-40 bg-inherit" | ||
| company={user.company} | ||
| description={leaders[user.login]} | ||
| location={user.location} | ||
| name={user.name || username} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <SecondaryCard icon={icon} title={<AnchorTitle title={label} />}> | ||
| <div className="flex w-full flex-col items-center justify-around overflow-hidden md:flex-row"> | ||
| {Object.keys(leaders).map((username) => ( | ||
| <div key={username}> | ||
| <LeaderData username={username} /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </SecondaryCard> | ||
| ) | ||
| } | ||
|
|
||
| export default LeadersListBlock |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| export type LeadersListProps = { | ||
| leaders: string | ||
| } | ||
|
|
||
| // Maps username to certification strings (e.g., { arkid15r: 'CCSP, CISSP, CSSLP' }) | ||
| export type LeadersListBlockProps = { | ||
| [key: string]: string | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.