Skip to content

feat(status-effect-indicator): add status effect indicator component#454

Open
Railly wants to merge 1 commit intoTheOrcDev:mainfrom
Railly:feat/status-effect-indicator-290
Open

feat(status-effect-indicator): add status effect indicator component#454
Railly wants to merge 1 commit intoTheOrcDev:mainfrom
Railly:feat/status-effect-indicator-290

Conversation

@Railly
Copy link

@Railly Railly commented Nov 20, 2025

Summary

Implements the Status Effect Indicator component as requested in #290.

This component displays pixel art icons for various status effects (poison, freeze, burn, stun, heal, shield, speed, slow) with support for:

  • Duration timers
  • Stack counts
  • Intensity variants (weak, normal, strong)
  • Multiple sizes (sm, md, lg, xl)
  • Responsive design with 8-bit retro styling

Changes

  • ✨ Add StatusEffectIndicator component with 8 effect types
  • 🎨 Include custom pixel art SVG icons for each effect
  • 📄 Add status effects demo page with examples
  • 📝 Update component registry
  • 🎮 Add status effects section to gaming blocks page

Screenshots

The component includes examples for all effect types, sizes, and intensities as shown in the issue discussion.

Closes #290

Summary by CodeRabbit

New Features

  • Added 8-bit retro-styled Status Effect Indicator component for displaying game status effects (poison, freeze, burn, stun, heal, shield, speed, slow) with customizable sizes, duration badges, stack counters, and animation options
  • Integrated component into gaming blocks with demonstrations of Player Status Effects, Boss Debuffs, and Effect Types
  • Added dedicated showcase page for the Status Effect Indicator component

✏️ Tip: You can customize this high-level summary in your review settings.

- Add StatusEffectIndicator component with 8 effect types
- Include poison, freeze, burn, stun, heal, shield, speed, slow
- Support for duration, stacks, and intensity variants
- Add status effects block page and examples
- Update registry with new component

Closes TheOrcDev#290
@Railly Railly requested a review from TheOrcDev as a code owner November 20, 2025 05:28
@vercel
Copy link

vercel bot commented Nov 20, 2025

@Railly is attempting to deploy a commit to the 8bitcn Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Walkthrough

This PR introduces a new StatusEffectIndicator component for displaying pixel-art styled status effect badges. It includes the core UI component with multiple size and intensity variants, a demonstration block showcasing configurations, a dedicated page, integration into gaming blocks, and registry updates for component discovery.

Changes

Cohort / File(s) Change Summary
Core Status Effect Component
components/ui/8bit/status-effect-indicator.tsx
Introduces StatusEffect interface, statusEffectVariants styling config, StatusEffectIndicatorProps type, and helper functions for icon and color mapping. Implements StatusEffectBadge subcomponent and main StatusEffectIndicator component supporting size variants (sm/md/lg/xl), duration/stacks display, max effects limit, and retro animation.
Demo & Showcase
app/blocks/status-effects/status-effects.tsx, app/blocks/status-effects/page.tsx
Adds StatusEffectsBlock component with interactive controls (duration, stacks, animation, size, max effects toggles), demonstration sections for all effects vs. debuffs, size-specific previews, individual effect cards, intensity variations, and empty state. Creates corresponding Next.js page component with header and UI controls.
Gaming Blocks Integration
app/blocks/gaming/gaming.tsx
Imports StatusEffectIndicator and renders multiple Status Effects UI demonstration blocks (Player Status Effects, Boss Debuffs, All Effect Types) into GamingBlocks component.
Registry Updates
public/r/registry.json, public/r/status-effect-indicator.json, registry.json
Registers new status-effect-indicator component in registry manifest files with title, description, and references to component TSX and retro styling files.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant Page as StatusEffectsPage
    participant Block as StatusEffectsBlock
    participant Indicator as StatusEffectIndicator
    participant Badge as StatusEffectBadge

    User->>Page: Visits /blocks/status-effects
    Page->>Block: Renders StatusEffectsBlock
    Block->>Block: Initializes state (size, showDuration, showStacks, etc.)
    Block->>User: Displays global controls & demo sections
    User->>Block: Toggles size/duration/stacks/animation
    Block->>Block: Updates internal state
    Block->>Indicator: Re-renders with new props
    Indicator->>Indicator: Trims effects to maxEffects
    Indicator->>Badge: Renders StatusEffectBadge per effect
    Badge->>Badge: Computes icon & color from effect.type & intensity
    Badge->>User: Displays colored badge with optional indicators
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • StatusEffectIndicator component — Review logic for icon/color mapping, badge rendering, and effects trimming with maxEffects cap
  • StatusEffectsBlock demonstration — Verify interactive state management and multiple demo section configurations are correct
  • Integration into gaming.tsx — Confirm StatusEffectIndicator import and block rendering placement; note potential duplicate Status Effects panel entries that may need consolidation
  • Registry entries — Cross-check consistency between registry.json, public/r/registry.json, and public/r/status-effect-indicator.json file paths and metadata

Possibly related PRs

Suggested reviewers

  • TheOrcDev

Poem

🐰 Beep-boop, a rabbit hops by,

With poison, freeze, and flames that fly! ✨

Eight bits of retro, effects on display,

Status badges brighten the gaming day! 🎮

Stacks and durations dance in a row,

Pixel-art magic steals the show! 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 describes the main change: adding a new Status Effect Indicator component to the codebase.
Linked Issues check ✅ Passed All core requirements from #290 are met: component displays multiple status effect icons, includes unique pixel art icons for all 8 required effect types, supports customizable colors/sizes/styles, and maintains 8bitcn retro styling.
Out of Scope Changes check ✅ Passed The PR contains changes related to the Status Effect Indicator implementation plus demo/documentation additions in gaming blocks and a dedicated status effects page, which are appropriately scoped to #290.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

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: 2

🧹 Nitpick comments (1)
components/ui/8bit/status-effect-indicator.tsx (1)

686-701: Consider refactoring nested ternaries for better readability.

The nested ternary operators for indicatorSize and textSize could be replaced with a cleaner approach.

Consider this refactor:

-	const indicatorSize =
-		size === "sm"
-			? "w-5 h-5"
-			: size === "md"
-				? "w-6 h-6"
-				: size === "lg"
-					? "w-7 h-7"
-					: "w-8 h-8";
-	const textSize =
-		size === "sm"
-			? "text-[10px]"
-			: size === "md"
-				? "text-xs"
-				: size === "lg"
-					? "text-sm"
-					: "text-base";
+	const sizeMap = {
+		sm: { indicator: "w-5 h-5", text: "text-[10px]" },
+		md: { indicator: "w-6 h-6", text: "text-xs" },
+		lg: { indicator: "w-7 h-7", text: "text-sm" },
+		xl: { indicator: "w-8 h-8", text: "text-base" },
+	} as const;
+	
+	const { indicator: indicatorSize, text: textSize } = sizeMap[size ?? "md"];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b93d47 and b0fb8be.

📒 Files selected for processing (7)
  • app/blocks/gaming/gaming.tsx (2 hunks)
  • app/blocks/status-effects/page.tsx (1 hunks)
  • app/blocks/status-effects/status-effects.tsx (1 hunks)
  • components/ui/8bit/status-effect-indicator.tsx (1 hunks)
  • public/r/registry.json (1 hunks)
  • public/r/status-effect-indicator.json (1 hunks)
  • registry.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-26T15:29:11.988Z
Learnt from: BIT-zhaoyang
Repo: TheOrcDev/8bitcn-ui PR: 203
File: components/ui/8bit/navigation-menu.tsx:170-189
Timestamp: 2025-05-26T15:29:11.988Z
Learning: In components/ui/8bit/navigation-menu.tsx, the NavigationMenuIndicator component uses Radix Indicator directly instead of the ShadcnNavigationMenuIndicator wrapper because it needs to apply custom styling (`dark:bg-ring`) to the inner div element, which the shadcn wrapper doesn't provide an interface for.

Applied to files:

  • components/ui/8bit/status-effect-indicator.tsx
  • public/r/status-effect-indicator.json
🧬 Code graph analysis (4)
app/blocks/status-effects/status-effects.tsx (1)
components/ui/8bit/status-effect-indicator.tsx (2)
  • StatusEffect (10-24)
  • StatusEffectIndicator (759-826)
components/ui/8bit/status-effect-indicator.tsx (1)
lib/utils.ts (1)
  • cn (4-6)
app/blocks/status-effects/page.tsx (3)
app/docs/components/copy-command-button.tsx (1)
  • CopyCommandButton (13-37)
app/docs/components/open-in-v0-button.tsx (1)
  • OpenInV0Button (5-39)
app/blocks/status-effects/status-effects.tsx (1)
  • StatusEffectsBlock (75-346)
app/blocks/gaming/gaming.tsx (3)
app/docs/components/copy-command-button.tsx (1)
  • CopyCommandButton (13-37)
app/docs/components/open-in-v0-button.tsx (1)
  • OpenInV0Button (5-39)
components/ui/8bit/status-effect-indicator.tsx (1)
  • StatusEffectIndicator (759-826)
🔇 Additional comments (14)
registry.json (1)

1490-1509: LGTM! Registry entry follows the established pattern.

The new status-effect-indicator entry is well-structured with appropriate metadata and file references.

app/blocks/gaming/gaming.tsx (1)

376-454: LGTM! Comprehensive demo coverage.

The three demo sections effectively showcase player buffs, boss debuffs, and all effect types with appropriate configurations.

app/blocks/status-effects/status-effects.tsx (3)

12-73: LGTM! Sample data is comprehensive and well-organized.

The sample effects cover all 8 types with appropriate durations, stacks, and intensities. The debuff/buff filtering logic correctly categorizes effects.


75-95: LGTM! State management is clean and appropriate.

The interactive controls provide a good demonstration of the component's flexibility.


97-345: LGTM! Excellent demonstration structure.

The demo sections comprehensively cover all features: sizes, intensities, individual types, and edge cases like empty state.

public/r/registry.json (1)

1490-1509: LGTM! Public registry entry matches the root registry.

The entry is correctly structured and consistent with the root registry.json.

public/r/status-effect-indicator.json (1)

1-21: LGTM! Registry manifest is correctly structured.

The metadata file properly embeds the component code and stylesheet for registry consumption.

components/ui/8bit/status-effect-indicator.tsx (7)

32-37: Verify that icon sizes are appropriate for the use case.

The sizes are quite large:

  • sm: 64px (w-16)
  • md: 80px (w-20)
  • lg: 96px (w-24)
  • xl: 112px (w-28)

For typical status effect indicators in games, these might be too large. Consider if sizes like w-8/10/12/14 (32px/40px/48px/56px) would be more appropriate for most UI contexts.

Please verify with the design requirements whether these dimensions match the intended visual design.


57-616: LGTM! Excellent pixel art icons.

The custom SVG icons are well-crafted and fit the 8-bit aesthetic perfectly. The note on line 614 about intensity being unused is appropriate for future extensibility.


619-667: LGTM! Color scheme provides excellent contrast.

The strong background colors with white text ensure readability, and the intensity progression (600→700→800) is intuitive.


703-728: LGTM! Border styling correctly matches the 8-bit pattern.

The border implementation using border-y-4 and border-x-4 with separate divs correctly creates the 8-bit aesthetic, consistent with other components in the library.

Based on learnings


770-778: LGTM! Efficient memoization and early return.

The useMemo optimization for slicing effects and the early return for empty arrays are appropriate performance optimizations.


801-822: LGTM! Overflow indicator matches the 8-bit styling pattern.

The "+N" indicator correctly uses the same border approach and appropriately uses muted colors to distinguish it from actual effects.


10-24: LGTM! Exports are well-structured.

The component appropriately exports:

  • StatusEffect interface for type definitions
  • statusEffectVariants for customization
  • StatusEffectIndicatorProps for prop types
  • Main component as both named and default export

Keeping StatusEffectBadge internal is the correct design choice.

Also applies to: 759-759, 828-828

command="pnpm dlx shadcn@latest add @8bitcn/status-effect-indicator"
copyCommand="pnpm dlx shadcn@latest add @8bitcn/status-effect-indicator"
/>
<OpenInV0Button name="8bit-status-effects" className="w-fit" />
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

Fix the OpenInV0Button name to match the registry entry.

Same issue as in the status-effects page. The name should be "status-effect-indicator" to match the registry entry.

Apply this diff:

-            <OpenInV0Button name="8bit-status-effects" className="w-fit" />
+            <OpenInV0Button name="status-effect-indicator" className="w-fit" />
📝 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
<OpenInV0Button name="8bit-status-effects" className="w-fit" />
<OpenInV0Button name="status-effect-indicator" className="w-fit" />
🤖 Prompt for AI Agents
In app/blocks/gaming/gaming.tsx around line 369, the OpenInV0Button name prop is
incorrect; change the name from "8bit-status-effects" to
"status-effect-indicator" so it matches the registry entry, keeping the existing
className="w-fit" and other props unchanged.

command="pnpm dlx shadcn@latest add @8bitcn/status-effect-indicator"
copyCommand="pnpm dlx shadcn@latest add @8bitcn/status-effect-indicator"
/>
<OpenInV0Button name="8bit-status-effects" className="w-fit" />
Copy link

@coderabbitai coderabbitai bot Nov 20, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the OpenInV0Button name to match the registry entry.

The name prop should be "status-effect-indicator" to match the registry entry at line 1492 in registry.json, not "8bit-status-effects".

Apply this diff:

-            <OpenInV0Button name="8bit-status-effects" className="w-fit" />
+            <OpenInV0Button name="status-effect-indicator" className="w-fit" />
📝 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
<OpenInV0Button name="8bit-status-effects" className="w-fit" />
<OpenInV0Button name="status-effect-indicator" className="w-fit" />
🤖 Prompt for AI Agents
In app/blocks/status-effects/page.tsx around line 19 the OpenInV0Button is using
the wrong name prop ("8bit-status-effects"); update the name prop to
"status-effect-indicator" so it matches the registry entry (registry.json line
~1492), ensuring the component opens the correct registered block.

Copy link
Owner

Choose a reason for hiding this comment

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

@Railly is the rabbit confused? :D

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@TheOrcDev
Copy link
Owner

@Railly solve please conflicts so we can merge this thing!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status Effect Indicator Component

2 participants