-
Notifications
You must be signed in to change notification settings - Fork 46
Global Search #624
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
Merged
Merged
Global Search #624
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e21783e
feat: add search input to top bar with localization support
omdxp 9c939c8
feat: implement search modal and enhance top bar with search function…
omdxp 284361b
feat: enhance search functionality and update contribution types for …
omdxp 926b66b
feat: add localized labels for search contributions, contributors, an…
omdxp 32c87a0
feat: update top bar to include a search button and improve modal dis…
omdxp aeacf86
refactor: update contribution, contributor, and project types for imp…
omdxp 7e05fb9
refactor: update search component to use entity models for improved t…
omdxp ec6df46
feat: enhance search component with loading state and localized messa…
omdxp a20f438
refactor: update import paths for project, contributor, and contribut…
omdxp 622a8cb
feat: add query parameters type to Search endpoint for enhanced reada…
omdxp c5aa5be
refactor: move keyboard event handling to Search component for better…
omdxp 7693ae4
feat: implement useSearchModal hook for improved modal handling in Se…
omdxp b4423aa
refactor: update logo import and adjust button sizes in TopBar for im…
omdxp 9769b26
refactor: rename contribute-card to contribution-card and update impo…
omdxp 7132657
refactor: update search component to use typed responses for projects…
omdxp 2917da6
refactor: update TopBar search input to be read-only and enhance clic…
omdxp 0277c2d
refactor: simplify results handling in Search component and initializ…
omdxp 920b065
refactor: move onKeyDown function inside useEffect for better encapsu…
omdxp 3af1e4e
refactor: update ContributorCard and TopBar components for consistenc…
omdxp 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { GetContributionsResponse } from "@dzcode.io/api/dist/contribution/types"; | ||
| import React from "react"; | ||
| import { Link } from "src/components/link"; | ||
| import { useLocale } from "src/components/locale"; | ||
| import { Markdown } from "src/components/markdown"; | ||
| import { getElapsedTime } from "src/utils/elapsed-time"; | ||
|
|
||
| export function ContributionCard({ | ||
| contribution, | ||
| compact = false, | ||
| }: { | ||
| contribution: GetContributionsResponse["contributions"][number]; | ||
| compact?: boolean; | ||
| }) { | ||
| const { localize } = useLocale(); | ||
|
|
||
| return ( | ||
| <div dir="ltr" className="card card-compact bg-base-300 flex-auto w-full max-w-xs sm:max-w-sm"> | ||
| <div className="card-body markdown"> | ||
| <div className="card-body"> | ||
| <h2 className="card-title"> | ||
| <Markdown content={contribution.title} /> | ||
| </h2> | ||
| <span className="flex-1" /> | ||
| {!compact && ( | ||
| <> | ||
| <span className="card-normal">{contribution.repository.project.name}</span> | ||
| <span className="card-normal"> | ||
| {contribution.repository.owner}/{contribution.repository.name} | ||
| </span> | ||
| </> | ||
| )} | ||
| <div className="card-actions justify-end mt-4 gap-4"> | ||
| {!compact && ( | ||
| <img className="w-6 h-6 rounded-full" src={contribution.contributor.avatarUrl} /> | ||
| )} | ||
| <div className="flex-1" /> | ||
| {contribution.activityCount > 0 && ( | ||
| <div className="flex flex-row"> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155" | ||
| /> | ||
| </svg> | ||
| <span className="">{contribution.activityCount}</span> | ||
| </div> | ||
| )} | ||
| {!compact && ( | ||
| <div className="flex flex-row"> | ||
| {getElapsedTime(contribution.updatedAt, localize("elapsed-time-suffixes"))} | ||
| </div> | ||
| )} | ||
| <Link href={contribution.url} className="link"> | ||
| {contribution.type === "ISSUE" | ||
| ? localize("contribute-read-issue") | ||
| : localize("contribute-review-changes")} | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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,82 @@ | ||
| import React from "react"; | ||
| import { Link } from "src/components/link"; | ||
| import { getContributorURL } from "src/utils/contributor"; | ||
| import { GetContributorsResponse } from "@dzcode.io/api/dist/contributor/types"; | ||
|
|
||
| export function ContributorCard({ | ||
| contributor, | ||
| compact = false, | ||
| onClick, | ||
| }: { | ||
| contributor: GetContributorsResponse["contributors"][number]; | ||
| compact?: boolean; | ||
| onClick?: () => void; | ||
| }) { | ||
| return ( | ||
| <Link | ||
| className="card bg-base-300 w-full sm:max-w-52 rounded-lg flex flex-row border-base-200 border-2 overflow-hidden" | ||
| href={getContributorURL(contributor)} | ||
| onClick={onClick} | ||
| > | ||
| <img | ||
| src={contributor.avatarUrl} | ||
| alt={contributor.name} | ||
| className="flex sm:hidden rounded-none size-28" | ||
| /> | ||
| <div className="flex-1 flex flex-col items-center"> | ||
| <div className="flex-1 flex flex-row sm:flex-col justify-start sm:justify-center items-center p-4 gap-4 w-full"> | ||
| <img | ||
| src={contributor.avatarUrl} | ||
| alt={contributor.name} | ||
| className="hidden sm:flex rounded-full size-20" | ||
| /> | ||
| <span className="card-title break-all">{contributor.name}</span> | ||
| </div> | ||
| {!compact && ( | ||
| <div className="flex flex-row gap-4 w-full justify-around bg-base-200 text-gray-500 p-2"> | ||
| <div className="flex flex-row gap-2"> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z" | ||
| /> | ||
| </svg> | ||
| {contributor.totalContributionScore} | ||
| </div> | ||
| <div className="divider divider-horizontal" /> | ||
| <div className="flex flex-row gap-2"> | ||
| {contributor.totalRepositoryCount} | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M3.75 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 3.75 9.375v-4.5ZM3.75 14.625c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5a1.125 1.125 0 0 1-1.125-1.125v-4.5ZM13.5 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 13.5 9.375v-4.5Z" | ||
| /> | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M6.75 6.75h.75v.75h-.75v-.75ZM6.75 16.5h.75v.75h-.75v-.75ZM16.5 6.75h.75v.75h-.75v-.75ZM13.5 13.5h.75v.75h-.75v-.75ZM13.5 19.5h.75v.75h-.75v-.75ZM19.5 13.5h.75v.75h-.75v-.75ZM19.5 19.5h.75v.75h-.75v-.75ZM16.5 16.5h.75v.75h-.75v-.75Z" | ||
| /> | ||
| </svg> | ||
| </div> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </Link> | ||
| ); | ||
| } | ||
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,85 @@ | ||
| import { GetProjectsResponse } from "@dzcode.io/api/dist/project/types"; | ||
| import React from "react"; | ||
| import { Link } from "src/components/link"; | ||
| import { getProjectURL } from "src/utils/project"; | ||
|
|
||
| export function ProjectCard({ | ||
| project, | ||
| compact = false, | ||
| onClick, | ||
| }: { | ||
| project: GetProjectsResponse["projects"][number]; | ||
| compact?: boolean; | ||
| onClick?: () => void; | ||
| }) { | ||
| return ( | ||
| <Link | ||
| href={getProjectURL(project)} | ||
| dir="ltr" | ||
| className="bg-base-300 w-full max-w-xs sm:max-w-sm flex flex-col rounded-lg border-base-200 border-2 overflow-hidden" | ||
| onClick={onClick} | ||
| > | ||
| <h2 className="card-title p-4">{project.name}</h2> | ||
| {!compact && ( | ||
| <> | ||
| <div className="flex-1" /> | ||
| <div className="flex flex-row gap-4 justify-around bg-base-200 text-gray-500 p-2"> | ||
| <div className="flex flex-row gap-2"> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z" | ||
| /> | ||
| </svg> | ||
| {project.totalRepoStars} | ||
| </div> | ||
| <div className="divider divider-horizontal" /> | ||
| <div className="flex flex-row gap-2"> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z" | ||
| /> | ||
| </svg> | ||
| {project.totalRepoScore} | ||
| </div> | ||
| <div className="divider divider-horizontal" /> | ||
| <div className="flex flex-row gap-2"> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| strokeWidth={1.5} | ||
| stroke="currentColor" | ||
| className="size-6" | ||
| > | ||
| <path | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" | ||
| /> | ||
| </svg> | ||
| {project.totalRepoContributorCount} | ||
| </div> | ||
| </div> | ||
| </> | ||
| )} | ||
| </Link> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.