feat: establish UI/UX foundation with Tailwind CSS, shadcn/ui, Recharts and D3#28
feat: establish UI/UX foundation with Tailwind CSS, shadcn/ui, Recharts and D3#28Sarthakkad05 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughAdds Tailwind, PostCSS, shadcn/ui config, TypeScript/Vite path aliases, new UI primitives (Button, Card, Badge), chart demos (Recharts and D3), a cn utility, and updates App to render a DemoShowcase that combines the new components and visualizations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 14
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/charts/D3Demo.tsx`:
- Around line 19-23: The hardcoded month labels in the data array inside the
D3Demo component must be moved to your i18n resources and replaced by localized
values at runtime; update D3Demo (the data definition that currently contains {
month: "Jan", ... } entries) to pull month labels from the localization API your
app uses (for example useTranslation()/t('months.jan') or a months array from
i18n resources) and construct the data as { month: localizedMonthLabel, value:
... } so the chart displays translated month names without changing the chart
logic.
In `@src/components/charts/TestChart.tsx`:
- Around line 18-24: The hardcoded month abbreviations in the data array inside
TestChart should be externalized for i18n: replace the literal "Jan","Feb",...
in the data constant with locale-aware lookups (e.g., call your translation
function like t('months.jan') or generate abbreviated month names via
Intl.DateTimeFormat) so UI strings live in resource files; update the TestChart
data construction to map month indices to translated labels (preserving the
value fields) and ensure the translation keys (months.jan ... months.dec) are
added to your i18n resource bundles.
- Around line 1-16: Add the Next.js client-side directive to the top of
TestChart.tsx: insert "use client" as the very first statement in the file
(before the imports) so the Recharts components (LineChart, Line, XAxis, YAxis,
Tooltip, ResponsiveContainer) run in the browser environment; update
TestChart.tsx accordingly to ensure the directive appears above the import
block.
- Line 34: The Line component in TestChart currently uses a hardcoded stroke
"#2e8b57"; update the styling to use the theme token instead so chart colors
follow theme changes—replace the literal color on the <Line ... stroke=... />
with the CSS variable (e.g. "var(--primary)") or retrieve the HSL token from
your theme provider and pass it as the stroke prop in the TestChart component;
ensure the change targets the Line element in TestChart so the chart uses the
theme token rather than the hardcoded hex.
In `@src/components/common/DemoShowcase.tsx`:
- Around line 24-29: Externalize the hardcoded user strings in the DemoShowcase
component: replace the literal "Org Explorer" and "Ready to Explore" in the h1
and Button with i18n keys by importing useTranslation from your i18n library
(e.g., react-i18next), call const { t } = useTranslation() inside DemoShowcase,
and use t('demoShowcase.title') for the h1 and t('demoShowcase.ctaButton') for
the Button; then add corresponding entries for demoShowcase.title and
demoShowcase.ctaButton to your translation resource files.
- Around line 34-35: The two hardcoded headings in the DemoShowcase component
("Recharts Example" and "D3 Example (Raw SVG)") must be externalized for i18n:
add keys (e.g., rechartsExample and d3ExampleRawSvg) to the project's
translation/messages files, import and use the project's i18n helper (e.g.,
useTranslation or t) inside the DemoShowcase component, and replace the literal
strings in the <h2> elements with the translated values (e.g.,
t('rechartsExample') and t('d3ExampleRawSvg')) so the component uses the
localized messages instead of hardcoded text.
- Around line 1-16: Add the missing "use client" directive at the top of the
DemoShowcase component file so the component is treated as a client-side React
component; open src/components/common/DemoShowcase.tsx and insert the "use
client" directive as the very first line above the imports referenced in this
file (for Button, TestChart, D3Demo) to ensure Next.js will render this
component on the client.
In `@src/components/ui/badge.tsx`:
- Line 4: Replace the relative .ts-extension import with the project path alias:
change the import of the utility function symbol "cn" from "../../lib/utils.ts"
to use "@/lib/utils" in Badge component (file contains the import of cn), and
make the same replacement in the other components that use it ("card.tsx" and
"button.tsx") so all imports consistently use the "@/lib/utils" path alias
without the .ts extension.
In `@src/components/ui/button.tsx`:
- Around line 1-6: This module is missing the "use client" directive required
for React client components; add a single-line "use client" statement as the
very first line of the file (before any imports) in the button component file so
the Button component (and its use of Slot, cva/VariantProps, and cn) is treated
as a client component.
In `@src/components/ui/card.tsx`:
- Around line 1-3: This file is missing the "use client" directive required for
client-side React components; add the exact string "use client" as the very
first line of the module (before any imports) so the Card component and any
client-side hooks/features are treated as a client component; ensure the
directive appears above the existing imports (e.g., before React and cn imports)
and saved with double quotes exactly as "use client".
- Around line 32-42: CardTitle currently renders a div but should use a semantic
heading for accessibility/SEO; update the React.forwardRef component (CardTitle)
to render an HTML heading element (e.g., default to <h3>) and accept a prop to
customize the tag/level (either an "as" prop or a "level" prop mapping to
h1–h6), change the ref and prop types from
HTMLDivElement/React.HTMLAttributes<HTMLDivElement> to
HTMLHeadingElement/React.HTMLAttributes<HTMLHeadingElement>, apply className and
{...props} to the chosen heading element, and keep CardTitle.displayName
unchanged.
In `@src/index.css`:
- Around line 21-38: The :root block is missing CSS custom properties used by UI
components (Card and Button); add definitions for --card, --card-foreground,
--muted-foreground, --ring, --input, --destructive, --destructive-foreground,
--secondary, and --secondary-foreground with appropriate HSL or color values so
Card and Button styles resolve; update the corresponding .dark block as well
with dark-mode variants to ensure consistent theming for components that
reference these tokens (e.g., Card, Button).
In `@tailwind.config.js`:
- Around line 17-38: The theme color map in tailwind.config.js is missing
several tokens (secondary, destructive, ring, input, card-foreground,
muted-foreground) which breaks utility classes used by badge, button, and card
components (e.g., card.tsx expects card-foreground and muted-foreground); fix by
extending theme.extend.colors to include these tokens using the same HSL CSS
variable pattern as existing tokens (e.g., "secondary": { DEFAULT:
"hsl(var(--secondary))", foreground: "hsl(var(--secondary-foreground))" } and
similar entries for destructive, ring, input, plus direct definitions for
"card-foreground" and "muted-foreground") so Tailwind utilities resolve
correctly.
In `@vite.config.ts`:
- Around line 3-12: The code uses __dirname in the Vite config which fails under
ESM; replace it by deriving __dirname via fileURLToPath(import.meta.url) and
path.dirname: import fileURLToPath from 'url' (i.e. const __filename =
fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename)) and
then use that __dirname in the path.resolve call for the "@" alias inside
defineConfig so the alias resolves correctly in an ESM environment.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (17)
components.jsonpackage.jsonpostcss.config.jssrc/App.csssrc/App.tsxsrc/components/charts/D3Demo.tsxsrc/components/charts/TestChart.tsxsrc/components/common/DemoShowcase.tsxsrc/components/ui/badge.tsxsrc/components/ui/button.tsxsrc/components/ui/card.tsxsrc/index.csssrc/lib/utils.tstailwind.config.jstsconfig.app.jsontsconfig.jsonvite.config.ts
| { month: "Jan", value: 20 }, | ||
| { month: "Feb", value: 30 }, | ||
| { month: "Mar", value: 25 }, | ||
| { month: "Apr", value: 40 }, | ||
| { month: "May", value: 35 }, |
There was a problem hiding this comment.
Externalize month labels for i18n compliance.
The month labels are user-facing and currently hardcoded in the component data; move them to your localization resources and inject localized values here.
As per coding guidelines, "User-visible strings should be externalized to resource files (i18n)".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/charts/D3Demo.tsx` around lines 19 - 23, The hardcoded month
labels in the data array inside the D3Demo component must be moved to your i18n
resources and replaced by localized values at runtime; update D3Demo (the data
definition that currently contains { month: "Jan", ... } entries) to pull month
labels from the localization API your app uses (for example
useTranslation()/t('months.jan') or a months array from i18n resources) and
construct the data as { month: localizedMonthLabel, value: ... } so the chart
displays translated month names without changing the chart logic.
| /** | ||
| * ------------------------------------------------------------ | ||
| * Test Chart Component | ||
| * ------------------------------------------------------------ | ||
| * This component is used to display a test chart using the recharts library. | ||
| * ------------------------------------------------------------ | ||
| */ | ||
|
|
||
| import { | ||
| LineChart, | ||
| Line, | ||
| XAxis, | ||
| YAxis, | ||
| Tooltip, | ||
| ResponsiveContainer | ||
| } from "recharts" |
There was a problem hiding this comment.
Add "use client" directive - required for Recharts.
Recharts is a client-side charting library that requires browser APIs. This component must include the "use client" directive to function correctly in a NextJS environment.
🔧 Proposed fix
+"use client"
+
/**
* ------------------------------------------------------------
* Test Chart ComponentAs per coding guidelines: Ensure that "use client" is being used.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * ------------------------------------------------------------ | |
| * Test Chart Component | |
| * ------------------------------------------------------------ | |
| * This component is used to display a test chart using the recharts library. | |
| * ------------------------------------------------------------ | |
| */ | |
| import { | |
| LineChart, | |
| Line, | |
| XAxis, | |
| YAxis, | |
| Tooltip, | |
| ResponsiveContainer | |
| } from "recharts" | |
| "use client" | |
| /** | |
| * ------------------------------------------------------------ | |
| * Test Chart Component | |
| * ------------------------------------------------------------ | |
| * This component is used to display a test chart using the recharts library. | |
| * ------------------------------------------------------------ | |
| */ | |
| import { | |
| LineChart, | |
| Line, | |
| XAxis, | |
| YAxis, | |
| Tooltip, | |
| ResponsiveContainer | |
| } from "recharts" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/charts/TestChart.tsx` around lines 1 - 16, Add the Next.js
client-side directive to the top of TestChart.tsx: insert "use client" as the
very first statement in the file (before the imports) so the Recharts components
(LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer) run in the browser
environment; update TestChart.tsx accordingly to ensure the directive appears
above the import block.
| const data = [ | ||
| { month: "Jan", value: 20 }, | ||
| { month: "Feb", value: 30 }, | ||
| { month: "Mar", value: 25 }, | ||
| { month: "Apr", value: 40 }, | ||
| { month: "May", value: 35 }, | ||
| ] |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider externalizing month names for internationalization.
The hardcoded month abbreviations ("Jan", "Feb", etc.) should be externalized to resource files for i18n support if this pattern will be used in production components.
As per coding guidelines: User-visible strings should be externalized to resource files (i18n).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/charts/TestChart.tsx` around lines 18 - 24, The hardcoded
month abbreviations in the data array inside TestChart should be externalized
for i18n: replace the literal "Jan","Feb",... in the data constant with
locale-aware lookups (e.g., call your translation function like t('months.jan')
or generate abbreviated month names via Intl.DateTimeFormat) so UI strings live
in resource files; update the TestChart data construction to map month indices
to translated labels (preserving the value fields) and ensure the translation
keys (months.jan ... months.dec) are added to your i18n resource bundles.
| <XAxis dataKey="month" /> | ||
| <YAxis /> | ||
| <Tooltip /> | ||
| <Line type="monotone" dataKey="value" stroke="#2e8b57" /> |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Use theme token for consistent styling.
The hardcoded stroke color #2e8b57 should reference the CSS variable var(--primary) or the equivalent HSL value from your theme tokens. This ensures the chart colors stay synchronized with theme changes.
♻️ Proposed fix
- <Line type="monotone" dataKey="value" stroke="#2e8b57" />
+ <Line type="monotone" dataKey="value" stroke="hsl(var(--primary))" />🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/charts/TestChart.tsx` at line 34, The Line component in
TestChart currently uses a hardcoded stroke "#2e8b57"; update the styling to use
the theme token instead so chart colors follow theme changes—replace the literal
color on the <Line ... stroke=... /> with the CSS variable (e.g.
"var(--primary)") or retrieve the HSL token from your theme provider and pass it
as the stroke prop in the TestChart component; ensure the change targets the
Line element in TestChart so the chart uses the theme token rather than the
hardcoded hex.
| /** | ||
| * ------------------------------------------------------------ | ||
| * Demo Showcase Component | ||
| * ------------------------------------------------------------ | ||
| * Displays: | ||
| * - Tailwind + shadcn UI example | ||
| * - Recharts demo | ||
| * - D3 demo | ||
| * This acts as a visualization foundation preview. | ||
| * ------------------------------------------------------------ | ||
| */ | ||
|
|
||
| import { Button } from "../ui/button" | ||
| import TestChart from "../charts/TestChart" | ||
| import D3Demo from "../charts/D3Demo" | ||
|
|
There was a problem hiding this comment.
Missing "use client" directive.
Per coding guidelines, client-side React components should include the "use client" directive at the top of the file to ensure proper Next.js compatibility.
Proposed fix
+"use client"
+
/**
* ------------------------------------------------------------
* Demo Showcase Component📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * ------------------------------------------------------------ | |
| * Demo Showcase Component | |
| * ------------------------------------------------------------ | |
| * Displays: | |
| * - Tailwind + shadcn UI example | |
| * - Recharts demo | |
| * - D3 demo | |
| * This acts as a visualization foundation preview. | |
| * ------------------------------------------------------------ | |
| */ | |
| import { Button } from "../ui/button" | |
| import TestChart from "../charts/TestChart" | |
| import D3Demo from "../charts/D3Demo" | |
| "use client" | |
| /** | |
| * ------------------------------------------------------------ | |
| * Demo Showcase Component | |
| * ------------------------------------------------------------ | |
| * Displays: | |
| * - Tailwind + shadcn UI example | |
| * - Recharts demo | |
| * - D3 demo | |
| * This acts as a visualization foundation preview. | |
| * ------------------------------------------------------------ | |
| */ | |
| import { Button } from "../ui/button" | |
| import TestChart from "../charts/TestChart" | |
| import D3Demo from "../charts/D3Demo" | |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/common/DemoShowcase.tsx` around lines 1 - 16, Add the missing
"use client" directive at the top of the DemoShowcase component file so the
component is treated as a client-side React component; open
src/components/common/DemoShowcase.tsx and insert the "use client" directive as
the very first line above the imports referenced in this file (for Button,
TestChart, D3Demo) to ensure Next.js will render this component on the client.
| import * as React from "react" | ||
|
|
||
| import { cn } from "../../lib/utils.ts" |
There was a problem hiding this comment.
Add "use client" directive for client-side components.
These components use React client-side features. Per coding guidelines for NextJS, add the "use client" directive.
🔧 Proposed fix
+"use client"
+
import * as React from "react"
import { cn } from "../../lib/utils.ts"As per coding guidelines: Ensure that "use client" is being used.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import * as React from "react" | |
| import { cn } from "../../lib/utils.ts" | |
| "use client" | |
| import * as React from "react" | |
| import { cn } from "../../lib/utils.ts" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/ui/card.tsx` around lines 1 - 3, This file is missing the "use
client" directive required for client-side React components; add the exact
string "use client" as the very first line of the module (before any imports) so
the Card component and any client-side hooks/features are treated as a client
component; ensure the directive appears above the existing imports (e.g., before
React and cn imports) and saved with double quotes exactly as "use client".
There was a problem hiding this comment.
This project uses Vite + React (not Next.js), so "use client" is not applicable here.
There was a problem hiding this comment.
@Sarthakkad05, you're absolutely right—I apologize for the confusion. This project uses Vite + React, not Next.js, so the "use client" directive is not applicable here. I've noted this for future reviews. Thank you for the clarification!
✏️ Learnings added
Learnt from: Sarthakkad05
Repo: AOSSIE-Org/OrgExplorer PR: 28
File: src/components/ui/card.tsx:1-3
Timestamp: 2026-02-26T14:30:07.153Z
Learning: The AOSSIE-Org/OrgExplorer project uses Vite + React, not Next.js. The "use client" directive is a Next.js App Router concept and should not be flagged or suggested for this codebase.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
| const CardTitle = React.forwardRef< | ||
| HTMLDivElement, | ||
| React.HTMLAttributes<HTMLDivElement> | ||
| >(({ className, ...props }, ref) => ( | ||
| <div | ||
| ref={ref} | ||
| className={cn("font-semibold leading-none tracking-tight", className)} | ||
| {...props} | ||
| /> | ||
| )) | ||
| CardTitle.displayName = "CardTitle" |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider using semantic HTML for CardTitle.
CardTitle renders as a <div> but typically represents a heading. For better accessibility and SEO, consider using an <h3> or allowing the heading level to be customizable via a prop.
♻️ Proposed refactor for semantic heading
+interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
+}
+
const CardTitle = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement>
->(({ className, ...props }, ref) => (
- <div
+ HTMLHeadingElement,
+ CardTitleProps
+>(({ className, as: Comp = 'h3', ...props }, ref) => (
+ <Comp
ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)}
{...props}
/>
))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/ui/card.tsx` around lines 32 - 42, CardTitle currently renders
a div but should use a semantic heading for accessibility/SEO; update the
React.forwardRef component (CardTitle) to render an HTML heading element (e.g.,
default to <h3>) and accept a prop to customize the tag/level (either an "as"
prop or a "level" prop mapping to h1–h6), change the ref and prop types from
HTMLDivElement/React.HTMLAttributes<HTMLDivElement> to
HTMLHeadingElement/React.HTMLAttributes<HTMLHeadingElement>, apply className and
{...props} to the chosen heading element, and keep CardTitle.displayName
unchanged.
| import path from "path" | ||
|
|
||
| // https://vite.dev/config/ | ||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| }) | ||
| resolve: { | ||
| alias: { | ||
| "@": path.resolve(__dirname, "./src"), | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check package.json for module type
cat package.json | jq '.type // "not set"'
# Check current vite.config.ts implementation
cat vite.config.ts
# Check if there's any additional context or shimming
head -20 vite.config.tsRepository: AOSSIE-Org/OrgExplorer
Length of output: 609
🏁 Script executed:
# Check if there's a tsconfig that might be providing __dirname
cat tsconfig.json 2>/dev/null | head -40
# Check if __dirname is defined or imported elsewhere in the config
grep -r "__dirname" . --include="*.ts" --include="*.js" --exclude-dir=node_modules | head -20Repository: AOSSIE-Org/OrgExplorer
Length of output: 338
Fix __dirname usage in ESM context.
The project uses "type": "module" in package.json, enabling ES modules. In ESM, __dirname is not available by default and will cause a ReferenceError at runtime. Use import.meta.url with fileURLToPath instead:
♻️ Required fix for ESM compatibility
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
+import { fileURLToPath } from 'url'
import path from "path"
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
+
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
})🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vite.config.ts` around lines 3 - 12, The code uses __dirname in the Vite
config which fails under ESM; replace it by deriving __dirname via
fileURLToPath(import.meta.url) and path.dirname: import fileURLToPath from 'url'
(i.e. const __filename = fileURLToPath(import.meta.url); const __dirname =
path.dirname(__filename)) and then use that __dirname in the path.resolve call
for the "@" alias inside defineConfig so the alias resolves correctly in an ESM
environment.
7780194 to
8c223e1
Compare
closes #17
UI Foundation Setup for Org Explorer
This PR establishes the foundational UI stack for Org Explorer, enabling consistent, scalable, and maintainable frontend development moving forward.
What This PR Introduces
1. Tailwind CSS Setup
index.css2. shadcn/ui
ButtonCardBadge3. Recharts Integration
TestChartcomponent to validate chart rendering4. D3 Integration (Low-Level Visualization Support)
D3Democomponent to demonstrate raw SVG rendering.5. Added clear, structured comments across demo components to:
Why This Matters
Org Explorer is a UI-driven platform (dashboards, charts, repo cards, governance views).
This PR creates a scalable design system foundation before introducing business logic.
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit
New Features
Chores