Skip to content

feat: establish UI/UX foundation with Tailwind CSS, shadcn/ui, Recharts and D3#28

Closed
Sarthakkad05 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Sarthakkad05:feat/ui-foundation-v2
Closed

feat: establish UI/UX foundation with Tailwind CSS, shadcn/ui, Recharts and D3#28
Sarthakkad05 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Sarthakkad05:feat/ui-foundation-v2

Conversation

@Sarthakkad05
Copy link
Contributor

@Sarthakkad05 Sarthakkad05 commented Feb 26, 2026

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.

Screenshot 2026-02-17 at 6 43 30 PM

What This PR Introduces

1. Tailwind CSS Setup

  • Utility-first styling for rapid and consistent UI development
  • Centralized theme tokens in index.css
  • Basic design tokens aligned with AOSSIE branding (green + yellow)

2. shadcn/ui

  • Added core reusable components:
    • Button
    • Card
    • Badge
  • We can add this components with just one command now

3. Recharts Integration

  • Installed and configured for data visualization
  • Added a small TestChart component to validate chart rendering
  • Confirms compatibility with Tailwind and layout system

4. D3 Integration (Low-Level Visualization Support)

  • Installed and configured D3 with TypeScript support
  • Added a D3Demo component to demonstrate raw SVG rendering.

5. Added clear, structured comments across demo components to:

  • Explain architectural intent
  • Help future contributors understand visualization setup
  • Maintain consistency when extending charts or UI primitives

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

  • [x ] My code follows the project's code style and conventions
  • [ x] I have made corresponding changes to the documentation
  • [ x] My changes generate no new warnings or errors
  • [x ] I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • [ x] I have read the Contributing Guidelines

⚠️ AI Notice - Important!

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

    • Interactive chart visualizations added (D3 and Recharts demos) and a Demo Showcase page.
    • New styled UI components: Button, Card, Badge with variant support.
    • Utility for Tailwind-aware class merging (cn).
  • Chores

    • Added Tailwind/PostCSS configuration and related tooling.
    • Registered icon library, theming tokens, and module path aliases for simplified imports.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Warning

Rate limit exceeded

@Sarthakkad05 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 8c223e1 and 7780194.

📒 Files selected for processing (2)
  • src/index.css
  • tailwind.config.js

Walkthrough

Adds 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

Cohort / File(s) Summary
Configuration & Tooling
components.json, postcss.config.js, tailwind.config.js, tsconfig.json, tsconfig.app.json, vite.config.ts
Adds shadcn/ui config, PostCSS/Tailwind setup, Tailwind theme tokens and animate plugin, and TypeScript/Vite path alias (@src) plus ESM __dirname/__filename handling.
Dependencies
package.json
Adds runtime deps (d3, recharts, lucide-react, class-variance-authority, clsx, @radix-ui/react-slot, tailwind-merge, tailwindcss-animate), updates @types, and adds dev deps for Tailwind/PostCSS toolchain.
Styling & Utilities
src/index.css, src/App.css, src/lib/utils.ts
Replaces global CSS with Tailwind directives and CSS variable tokens (light/dark), simplifies App root styles, and introduces cn() util combining clsx + tailwind-merge.
UI Components
src/components/ui/button.tsx, src/components/ui/card.tsx, src/components/ui/badge.tsx
Adds shadcn-style UI primitives: Button (variants/sizes, asChild), Card (CardHeader/Title/Description/Content/Footer), and Badge (variants) using cva and cn.
Chart Components
src/components/charts/TestChart.tsx, src/components/charts/D3Demo.tsx
Adds a Recharts-based responsive LineChart and a D3-based SVG line chart demo with scales, axes, and path rendering.
App Integration & Pages
src/App.tsx, src/components/common/DemoShowcase.tsx
Replaces App's static heading with DemoShowcase that lays out header, Recharts demo card, and D3 demo card to showcase new components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

Typescript Lang

Suggested reviewers

  • Zahnentferner

Poem

🐰 I hopped in with Tailwind in my paw,
Buttons, cards, and charts to show and awe,
D3 lines curve and Recharts hum,
Tokens set, the UI's begun —
A tiny rabbit cheers, hop, hurrah! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: establishing a UI/UX foundation with specific technology choices (Tailwind CSS, shadcn/ui, Recharts, D3).
Linked Issues check ✅ Passed All core objectives from issue #17 are met: Tailwind CSS configured, shadcn/ui integrated with reusable components (Button, Card, Badge), Recharts and D3 installed with demo components, and a DemoShowcase page consolidating all demonstrations.
Out of Scope Changes check ✅ Passed All changes are scoped to establishing the UI foundation; there are no business logic, API integration, or unrelated modifications outside the feature objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/XL and removed size/XL labels Feb 26, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1cfc3e7 and 0a22d02.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • components.json
  • package.json
  • postcss.config.js
  • src/App.css
  • src/App.tsx
  • src/components/charts/D3Demo.tsx
  • src/components/charts/TestChart.tsx
  • src/components/common/DemoShowcase.tsx
  • src/components/ui/badge.tsx
  • src/components/ui/button.tsx
  • src/components/ui/card.tsx
  • src/index.css
  • src/lib/utils.ts
  • tailwind.config.js
  • tsconfig.app.json
  • tsconfig.json
  • vite.config.ts

Comment on lines +19 to +23
{ month: "Jan", value: 20 },
{ month: "Feb", value: 30 },
{ month: "Mar", value: 25 },
{ month: "Apr", value: 40 },
{ month: "May", value: 35 },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines +1 to +16
/**
* ------------------------------------------------------------
* 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"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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 Component

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.

Suggested change
/**
* ------------------------------------------------------------
* 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.

Comment on lines +18 to +24
const data = [
{ month: "Jan", value: 20 },
{ month: "Feb", value: 30 },
{ month: "Mar", value: 25 },
{ month: "Apr", value: 40 },
{ month: "May", value: 35 },
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Comment on lines +1 to +16
/**
* ------------------------------------------------------------
* 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"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
/**
* ------------------------------------------------------------
* 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.

Comment on lines +1 to +3
import * as React from "react"

import { cn } from "../../lib/utils.ts"
Copy link

@coderabbitai coderabbitai bot Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project uses Vite + React (not Next.js), so "use client" is not applicable here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Comment on lines +32 to +42
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"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Comment on lines 3 to 12
import path from "path"

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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.ts

Repository: 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 -20

Repository: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Establish UI & Visualization Foundation for Org Explorer

1 participant