Danvas
Danvas
DashboardSupportWelcome

👤 USER DOCS

User Guides

Getting Started

Getting StartedDashboard & OnboardingApp Settings

Tutorials

Tutorial: Setting Up Shift Tasks & ClosersTutorial: Managing Incidents in the InboxTutorial: Tracking Compliance & Sync StatusTutorial: Operational Workflows with the AI AssistantTutorial: Building & Deploying Custom Checklists

Daily Operations (Staff)

Shift Workspace & TasksService Day SetupDaily Line-UpStaff Service Day ReportsForms

Communication & Chat

Messages & AnnouncementsUnified Operations InboxAI Assistant

Manager & Admin Guides

Daily Line-Up SetupStaff SchedulingManaging LocationsNPS and Guest FeedbackCouponsContacts and Guest HistoryManager CloseoutsDaily Line-Up & ComplianceAnalyticsIncident ReportingWhistleblower Concerns & FeedbackAdmin Tools

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewExplanation: AI Integration & Tenant SecurityExplanation: Dynamic Forms Engine DesignExplanation: Compliance Ledger DesignExplanation: Live Sync & Data FreshnessData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainUnified Operations InboxLive Sync Data FreshnessToast Sync PipelineNotifications DomainCoupons and Guest NPSAudit Log & Compliance ArchitectureDesign Audit FindingsAI Chat IntegrationAnalytics & Tips Integration

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & Offline ShellScreenshots

API Reference

API Reference

Endpoints

POS Sales APIOptimization Data APISchedule Shifts APIEmployee Export APIReports APIIncidents APIAI Chat APIPush Notifications APIWebhooks APICron API

Contributing

ContributingCode Examples

Security

Security & Compliance

Release Notes

What's New

Components

Custom components built on top of the design system

This page documents custom components that extend the base design system.

StarRating

The StarRating component displays rating values using the design system's ember color palette, replacing emoji-based stars for consistency and accessibility.

Usage

import { StarRating } from "@/components/star-rating";

// Display a 4 out of 5 rating
<StarRating value={4} />

// Display with custom max (e.g., 3 stars)
<StarRating value={2} max={3} />

// Display with custom className
<StarRating value={5} className="text-lg" />

Props

PropTypeDefaultDescription
valuenumber | null | undefined—Number of filled stars (0–5)
maxnumber5Total number of stars to render
classNamestring—Additional CSS classes

Behavior

  • Null/Zero Handling: If value is null, undefined, or 0, renders a dash (—) in muted foreground color
  • Clamping: Values are clamped between 0 and max
  • Rounding: Non-integer values are rounded to nearest integer
  • Design Tokens: Uses --ember color for filled stars, --muted-foreground for empty stars

Design System Compliance

This component addresses FINDING-007 from the design audit:

  • ✅ Uses Lucide StarIcon instead of emoji (⭐)
  • ✅ Applies design token text-ember for filled state
  • ✅ Applies text-muted-foreground/30 for empty state
  • ✅ Consistent sizing via size-3.5 (14px)
  • ✅ Fill state via fill-ember and fill-transparent

Implementation

// Location: apps/app/src/app/(authenticated)/reports/components/star-rating.tsx
import { StarIcon } from "lucide-react";
import { cn } from "@repo/design-system/lib/utils";

interface StarRatingProps {
  value: number | null | undefined;
  max?: number;
  className?: string;
}

export function StarRating({ value, max = 5, className }: StarRatingProps) {
  const filled = Math.max(0, Math.min(Math.round(value ?? 0), max));

  if (filled === 0) {
    return <span className={cn("text-muted-foreground", className)}>—</span>;
  }

  return (
    <span className={cn("inline-flex items-center gap-0.5", className)}>
      {Array.from({ length: max }, (_, i) => (
        <StarIcon
          key={i}
          className={cn(
            "size-3.5",
            i < filled
              ? "fill-ember text-ember"
              : "fill-transparent text-muted-foreground/30"
          )}
        />
      ))}
    </span>
  );
}

Related Components

  • Badge: For status chips and category labels
  • Card: For containing rating displays in report cards

Interactive Primitives Showcase

Below you can preview and interactively play with some of the core UI primitives from @repo/design-system:

BUTTON PLAYGROUND
Variant
Size
BADGE PLAYGROUND
DEFAULT
Variant
SPINNER PLAYGROUND
Size
LOGO PLAYGROUND

Related

Form Patterns

PWA & Offline

Design System

Loading Skeletons

Architecture pattern for loading states and skeleton components

PWA & Offline Shell

Installable Danvas shell with safe offline recovery

On this page

StarRatingUsagePropsBehaviorDesign System ComplianceImplementationRelated ComponentsInteractive Primitives ShowcaseRelated