-
Notifications
You must be signed in to change notification settings - Fork 59
[#398] COMPONENTS - Added reusable issue fetcher pane #429
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
Open
Jomak-x
wants to merge
3
commits into
main
Choose a base branch
from
jakob/issue-fetcher-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
102 changes: 102 additions & 0 deletions
102
apps/blade/src/app/_components/issues/issue-fetcher-pane-playground.tsx
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,102 @@ | ||
| "use client"; | ||
|
|
||
| import { useState } from "react"; | ||
|
|
||
| import type { | ||
| IssueFetcherPaneData, | ||
| IssueFetcherPaneIssue, | ||
| } from "~/app/_components/issues/issue-fetcher-pane"; | ||
| import { IssueFetcherPane } from "~/app/_components/issues/issue-fetcher-pane"; | ||
|
|
||
| export function IssueFetcherPanePlayground() { | ||
| const [issues, setIssues] = useState<IssueFetcherPaneIssue[]>([]); | ||
| const [fetcherData, setFetcherData] = useState<IssueFetcherPaneData | null>( | ||
| null, | ||
| ); | ||
| const isReady = fetcherData !== null; | ||
|
|
||
| return ( | ||
| <div className="space-y-6"> | ||
| <IssueFetcherPane setIssues={setIssues} onDataChange={setFetcherData} /> | ||
|
|
||
| <section className="rounded-lg border bg-card p-4"> | ||
| <div className="mb-3 flex flex-wrap items-center justify-between gap-2"> | ||
| <h3 className="text-base font-semibold">Playground View</h3> | ||
| {isReady && ( | ||
| <span className="text-sm text-muted-foreground"> | ||
| Showing {issues.length} issue(s) | ||
| </span> | ||
| )} | ||
| </div> | ||
|
|
||
| {!isReady ? ( | ||
| <p className="text-sm text-muted-foreground"> | ||
| Waiting for fetcher state... | ||
| </p> | ||
| ) : fetcherData.isLoading ? ( | ||
| <p className="text-sm text-muted-foreground">Loading issues...</p> | ||
| ) : fetcherData.error ? ( | ||
| <p className="text-sm text-destructive">{fetcherData.error}</p> | ||
| ) : issues.length === 0 ? ( | ||
| <p className="text-sm text-muted-foreground"> | ||
| No issues match the current filters. | ||
| </p> | ||
| ) : ( | ||
| <div className="space-y-3"> | ||
| {issues.map((issue) => ( | ||
| <article key={issue.id} className="rounded-md border p-3"> | ||
| <div className="mb-1 flex flex-wrap items-center gap-2"> | ||
| <h4 className="font-medium">{issue.name}</h4> | ||
| <span className="rounded bg-muted px-2 py-0.5 text-xs"> | ||
| {issue.status} | ||
| </span> | ||
| <span className="rounded bg-muted px-2 py-0.5 text-xs"> | ||
| {issue.priority} | ||
| </span> | ||
| {issue.event && ( | ||
| <span className="rounded bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-700"> | ||
| EVENT-LINKED | ||
| </span> | ||
| )} | ||
| {fetcherData.blockedParentIds.has(issue.id) && ( | ||
| <span className="rounded bg-red-100 px-2 py-0.5 text-xs font-semibold text-red-700"> | ||
| BLOCKED | ||
| </span> | ||
| )} | ||
| </div> | ||
|
|
||
| <p className="mb-2 text-sm text-muted-foreground"> | ||
| {issue.description} | ||
| </p> | ||
|
|
||
| <div className="grid gap-1 text-xs text-muted-foreground sm:grid-cols-2 lg:grid-cols-3"> | ||
| <p> | ||
| <strong>Team:</strong>{" "} | ||
| {fetcherData.roleNameById.get(issue.team) ?? issue.team} | ||
| </p> | ||
| <p> | ||
| <strong>Due:</strong>{" "} | ||
| {issue.date ? new Date(issue.date).toLocaleString() : "N/A"} | ||
| </p> | ||
| <p> | ||
| <strong>Subtask:</strong> {issue.parent ? "Yes" : "No"} | ||
| </p> | ||
| <p> | ||
| <strong>Visible To:</strong> {issue.teamVisibility.length}{" "} | ||
| role(s) | ||
| </p> | ||
| <p> | ||
| <strong>Assignees:</strong> {issue.userAssignments.length} | ||
| </p> | ||
| <p> | ||
| <strong>ID:</strong> {issue.id} | ||
| </p> | ||
| </div> | ||
| </article> | ||
| ))} | ||
| </div> | ||
| )} | ||
| </section> | ||
| </div> | ||
| ); | ||
| } | ||
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.