Repository navigation
feat: complete the components barrel for sibling apps (#259) #262
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
ayushsingh82
wants to merge
6
commits into
NEARBuilders:main
Choose a base branch
from
ayushsingh82:feat/259-components-barrel
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
6 commits
Select commit
Hold shift + click to select a range
1b90097
feat: complete the components barrel for sibling apps (#259)
ayushsingh82 8140f68
refactor(ui): keep only shadcn components in ui/, move design system …
ayushsingh82 560b51f
fix(ui): satisfy biome import order, formatting and a11y rules
ayushsingh82 5c51fc3
Merge branch 'main' into feat/259-components-barrel
elliotBraem 06ce0a1
Merge upstream/main into feat/259-components-barrel
ayushsingh82 9cccc49
Merge remote-tracking branch 'origin/feat/259-components-barrel' into…
ayushsingh82 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
| import type { ReactNode } from "react"; | ||
|
|
||
| export function InfoRow({ | ||
| label, | ||
| value, | ||
| mono, | ||
| }: { | ||
| label: string; | ||
| value: ReactNode; | ||
| mono?: boolean; | ||
| }) { | ||
| return ( | ||
| // oxlint-disable-next-line shadcn/no-arbitrary-values -- fixed label column beside flexible value; grid-template-columns has no scale equivalent | ||
| <div className="grid grid-cols-[100px_1fr] gap-4 rounded-sm border border-border bg-muted px-3.5 py-2.5 items-center"> | ||
| <span className="text-muted-foreground text-2xs font-bold uppercase tracking-wider"> | ||
| {label} | ||
| </span> | ||
| <span className={`text-foreground text-13 break-all ${mono ? "font-mono text-xs" : ""}`}> | ||
| {value} | ||
| </span> | ||
| </div> | ||
| ); | ||
| } | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,86 @@ | ||
| import { Check, Circle, XCircle } from "lucide-react"; | ||
| import { useCallback, useState } from "react"; | ||
| import { Spinner } from "@/components/ui/spinner"; | ||
|
|
||
| export type StepState = "pending" | "running" | "success" | "failed"; | ||
|
|
||
| export interface Step { | ||
| label: string; | ||
| state: StepState; | ||
| error?: string; | ||
| blocking?: boolean; | ||
| } | ||
|
|
||
| export function StepIcon({ state }: { state: StepState }) { | ||
| switch (state) { | ||
| case "running": | ||
| return <Spinner className="h-3.5 w-3.5 text-muted-foreground shrink-0 mt-px" />; | ||
| case "success": | ||
| return <Check className="h-3.5 w-3.5 text-brand-cyan shrink-0 mt-px" />; | ||
| case "failed": | ||
| return <XCircle className="h-3.5 w-3.5 text-destructive shrink-0 mt-px" />; | ||
| default: | ||
| return <Circle className="h-3.5 w-3.5 text-border shrink-0 mt-px" />; | ||
| } | ||
| } | ||
|
|
||
| export function StepList({ steps }: { steps: Step[] }) { | ||
| return ( | ||
| <> | ||
| {steps.map((step, i) => ( | ||
| <div key={i} className="flex items-start gap-3"> | ||
| <StepIcon state={step.state} /> | ||
| <div className="flex-1 min-w-0"> | ||
| <div className="flex items-center gap-2"> | ||
| <span | ||
| className={`text-xs ${step.state === "failed" ? "text-destructive" : "text-foreground"}`} | ||
| > | ||
| {step.label} | ||
| </span> | ||
| {step.blocking === false && ( | ||
| <span className="text-3xs text-muted-foreground uppercase tracking-wide"> | ||
| non-blocking | ||
| </span> | ||
| )} | ||
| </div> | ||
| {step.error && ( | ||
| <p className="text-xs text-destructive mt-0.5 break-all">{step.error}</p> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export function useStepper(stepLabels: readonly { label: string; blocking?: boolean }[]) { | ||
| const [steps, setSteps] = useState<Step[]>( | ||
| stepLabels.map((s) => ({ ...s, state: "pending" as StepState })), | ||
| ); | ||
|
|
||
| const updateStep = useCallback((index: number, state: StepState, error?: string) => { | ||
| setSteps((prev) => prev.map((s, i) => (i === index ? { ...s, state, error } : s))); | ||
| }, []); | ||
|
|
||
| const resetSteps = useCallback(() => { | ||
| setSteps(stepLabels.map((s) => ({ ...s, state: "pending" as StepState }))); | ||
| }, [stepLabels]); | ||
|
|
||
| const runStep = useCallback( | ||
| async <T,>(index: number, fn: () => Promise<T>): Promise<T | undefined> => { | ||
| updateStep(index, "running"); | ||
| try { | ||
| const value = await fn(); | ||
| updateStep(index, "success"); | ||
| return value; | ||
| } catch (err) { | ||
| const msg = err instanceof Error ? err.message : String(err); | ||
| updateStep(index, "failed", msg); | ||
| return undefined; | ||
| } | ||
| }, | ||
| [updateStep], | ||
| ); | ||
|
|
||
| return { steps, updateStep, resetSteps, runStep }; | ||
| } |
File renamed without changes.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove anything from /ui that isn't a shadcn component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Append any shadcn components here that feedback app needs -- this may mean doing a full shadcn init to grab all components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elliotBraem done in 8140f68: the non-shadcn components (info-row, back-button, data-table, markdown, stepper, etc.) moved out of
ui/intocomponents/common/, and the barrel and all imports are updated. PR: #262There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elliotBraem added the missing shadcn components (accordion, alert, alert-dialog, calendar, command, drawer, popover, switch, slider, pagination, input-group, combobox and more) and exported them from the barrel in 8140f68. PR: #262