Hogwarts Logo
Hogwarts
FeaturesBlogPricingDocumentation

Command Palette

Search for a command to run...

10
Login

Build by Databayt, source code available on GitHub

  • Introduction
  • Pitch
  • MVP
  • PRD
  • Get Started
  • Architecture
  • Structure
  • Pattern
  • Stack
  • Icons
  • Dashboard
  • Rebound
  • Database
  • Attendance
  • Localhost
  • Contributing
  • Shared Economy
  • Competitors
  • Inspiration
  • Demo
  • Listings
  • Business

Platform Dashboard

PreviousNext

Role-based dashboard system providing personalized views for 8 user types with unified sections, role-specific metrics, and focused quick actions.

The Platform Dashboard provides role-based personalized views for 8 different user types. All dashboards follow a unified 6-section layout with role-specific content for relevant metrics, quick actions, and data visualizations.


Unified Section Order (All Dashboards)

#SectionComponentDescription
1Upcoming + WeatherUpcoming + WeatherRole-specific flip card with weather
2Quick LookQuickLookSectionUser-specific counts (no title)
3Quick ActionsQuickActionsSection4 focused actions per role
4Resource UsageResourceUsageSectionRole-specific metrics
5Invoice HistoryInvoiceHistorySectionRole-relevant invoices
6Financial OverviewFinancialOverviewSectionRole-relevant financial data + charts

Directory Structure

src/components/platform/dashboard/           # ~100 files
│
│ # Core Files
├── content.tsx                              # Role routing (main entry point)
├── client.tsx                               # Client wrapper component
├── actions.ts                               # Server actions (~80KB, ~3200 lines)
├── config.ts                                # Role mappings, icons, colors
├── validation.ts                            # Zod schemas
├── types.ts                                 # TypeScript interfaces
│
│ # Role-Based Dashboards
├── admin.tsx                                # Admin dashboard (server component)
├── admin-client.tsx                         # Admin dashboard (client component)
├── student.tsx                              # Student dashboard
├── teacher.tsx                              # Teacher dashboard
├── parent.tsx                               # Parent/Guardian dashboard
├── principal.tsx                            # Principal dashboard
├── accountant.tsx                           # Accountant dashboard
├── staff.tsx                                # Staff dashboard
│
│ # Unified Section Components (NEW)
├── section-heading.tsx                      # Unified section title styling
├── upcoming.tsx                             # Role-specific flip card (3D animation)
├── weather.tsx                              # Functional weather component
├── quick-look-section.tsx                   # User-specific counts (no title)
├── quick-actions.tsx                        # Quick actions grid
├── quick-actions-config.ts                  # Role-specific action definitions (4 per role)
├── resource-usage-section.tsx               # Role-specific usage metrics
├── invoice-history-section.tsx              # Role-relevant invoice history
├── financial-overview-section.tsx           # Role-relevant financial stats + charts
│
│ # Shared Widgets
├── metric-card.tsx                          # Key stat with icon and trend
├── activity-rings.tsx                       # Apple-style progress indicators
├── schedule-item.tsx                        # Timetable entries
├── announcement-card.tsx                    # School announcements
├── progress-card.tsx                        # Goal tracking with progress bar
├── chart-card.tsx                           # Chart container wrapper
├── empty-state.tsx                          # No data placeholder
│
│ # Chart Components
├── attendance-chart.tsx                     # Attendance trends over time
├── grade-chart.tsx                          # Grade distribution
├── revenue-chart.tsx                        # Revenue vs expenses comparison
├── performance-gauge.tsx                    # Single metric radial gauge
├── weekly-chart.tsx                         # Weekly bar chart
├── comparison-chart.tsx                     # Period comparison line chart
│
│ # Showcase Components
├── card-activity-goal.tsx                   # Activity goal card
├── card-chat.tsx                            # Chat card
├── card-cookie-settings.tsx                 # Cookie settings card
├── card-create-account.tsx                  # Create account card
├── card-exercise-minutes.tsx                # Exercise minutes card
├── card-forms.tsx                           # Forms card
├── card-metric.tsx                          # Metric display card
├── card-payment-method.tsx                  # Payment method card
├── card-payments.tsx                        # Payments history card
├── card-report-issue.tsx                    # Report issue card
├── card-share.tsx                           # Share card
├── card-showcase.tsx                        # Cards showcase entry
├── card-stats.tsx                           # Statistics card
├── card-team-members.tsx                    # Team members card
├── chart-area-stacked.tsx                   # Stacked area chart
├── chart-bar-mixed.tsx                      # Mixed bar chart
├── chart-interactive-bar.tsx                # Interactive bar chart
├── chart-line-multiple.tsx                  # Multiple line chart
├── chart-radar-simple.tsx                   # Simple radar chart
├── chart-radial-grid.tsx                    # Radial grid chart
├── chart-radial-shape.tsx                   # Radial shape chart
├── chart-radial-stacked.tsx                 # Stacked radial chart
├── chart-radial-text.tsx                    # Radial text chart
├── chart-showcase.tsx                       # Charts showcase entry
├── stat-apple-activity.tsx                  # Apple-style activity stat
├── stat-area-chart.tsx                      # Area chart stat
├── stat-badges.tsx                          # Badges stat
├── stat-borders.tsx                         # Bordered stat
├── stat-card-flip.tsx                       # Flip card stat
├── stat-cards.tsx                           # Multiple stat cards
├── stat-circular-links.tsx                  # Circular links stat
├── stat-circular.tsx                        # Circular stat
├── stat-currency-transfer.tsx               # Currency transfer stat
├── stat-dashboard.tsx                       # Dashboard stat
├── stat-links.tsx                           # Links stat
├── stat-progress.tsx                        # Progress stat
├── stat-segmented.tsx                       # Segmented stat
├── stat-showcase.tsx                        # Stats showcase entry
├── stat-status.tsx                          # Status stat
├── stat-trending.tsx                        # Trending stat
├── stat-usage.tsx                           # Usage stat
├── stat-weather.tsx                         # Weather stat
├── dashboard-showcase.tsx                   # Full showcase page
│
│ # Infrastructure
├── header.tsx                               # Dashboard header
├── loading.tsx                              # Loading skeleton
├── error-boundary.tsx                       # Error handling component
├── search-command.tsx                       # Command palette (⌘K)
├── notification-service.tsx                 # Notification service
├── project-switcher.tsx                     # Project/school switcher
├── section-columns.tsx                      # Section column layout
├── transactions-list.tsx                    # Transactions list
├── upgrade-card.tsx                         # Upgrade prompt card
├── info-card.tsx                            # Information card
├── delete-account.tsx                       # Delete account component
│
│ # Settings Subdirectory
└── settings/
    ├── content.tsx                          # Settings main content
    └── user-name-form.tsx                   # User name form

Role-Based Architecture

The dashboard uses a switch-case routing pattern in content.tsx:

switch (userRole) {
  case "STUDENT":
    return (
      <StudentDashboard user={user} dictionary={safeDict} locale={locale} />
    )
  case "TEACHER":
    return (
      <TeacherDashboard user={user} dictionary={safeDict} locale={locale} />
    )
  case "GUARDIAN":
    return <ParentDashboard user={user} dictionary={safeDict} locale={locale} />
  case "STAFF":
    return <StaffDashboard user={user} dictionary={safeDict} locale={locale} />
  case "ADMIN":
  case "DEVELOPER":
    return <AdminDashboard user={user} dictionary={safeDict} locale={locale} />
  case "PRINCIPAL":
    return (
      <PrincipalDashboard user={user} dictionary={safeDict} locale={locale} />
    )
  case "ACCOUNTANT":
    return (
      <AccountantDashboard user={user} dictionary={safeDict} locale={locale} />
    )
  default:
    return <DefaultDashboard user={user} dictionary={safeDict} />
}

Unified Section Components

SectionHeading

Unified section title styling for all dashboards.

interface SectionHeadingProps {
  title: string
  icon?: LucideIcon
  badge?: { label: string; variant?: string }
  action?: { label: string; href: string }
  description?: string
  className?: string
}

Upcoming (Flip Card)

Role-specific critical info with 3D flip animation:

RolePrimary ContentSecondary Content
StudentAssignments due (with overdue warnings)Next class info
TeacherNext class detailsPending grading, attendance due
ParentChildren's pending/overdue itemsUpcoming events for kids
StaffUrgent tasks, pending requestsToday's priorities
AccountantPending payments, overdue invoicesFinancial deadlines
PrincipalCritical alertsToday's priorities, strategic deadlines
AdminSystem alerts, pending approvalsUrgent notifications

Weather

Functional weather component with:

  • Current conditions (temp, humidity, wind, rain chance)
  • 6-day forecast strip
  • Refresh button
  • Mock data fallback

ResourceUsageSection

Role-specific usage metrics (4 metrics per role):

RoleMetrics
StudentAssignment Completion, Attendance Rate, Grade Average, Library Books
TeacherClasses Taught, Students Count, Pending Grading, Assignments Created
ParentChildren Enrolled, Attendance Avg, Pending Tasks, Upcoming Events
StaffTasks Completed, Requests Processed, Approvals Pending, Efficiency
AccountantCollection Rate, Invoices Processed, Outstanding, Payments Today
PrincipalSchool Capacity, Staff Utilization, Budget Usage, Satisfaction
AdminSystem Usage, Storage, Active Users, API Calls

InvoiceHistorySection

Role-based invoice visibility:

RoleTitleShows
StudentFee HistoryOwn fee invoices
TeacherExpense ClaimsExpense claims, reimbursements
ParentChildren's FeesFee invoices for all children
StaffExpense ReportsExpense reports, reimbursements
AccountantInvoice ManagementAll school invoices
PrincipalBudget InvoicesBudget-related invoices
AdminSystem InvoicesAll platform invoices

FinancialOverviewSection

Role-relevant financial metrics with optional charts:

RoleFinancial ViewChart
StudentPersonal fee status, payment dueNo
TeacherDepartment budget (if applicable)No
ParentCombined children's fee statusNo
StaffDepartment budget statusNo
AccountantFull dashboard (revenue, collection)Yes (Revenue Collection)
PrincipalSchool budget overviewYes (Monthly Budget)
AdminPlatform financial metricsYes (Platform Revenue)

Quick Actions by Role (4 Actions Each)

RoleActions
ADMINUsers, Settings, Reports, Analytics
DEVELOPERUsers, Settings, Reports, Analytics
PRINCIPALReports, Staff, Performance, Analytics
TEACHERAttendance, Grades, Assignments, Timetable
STUDENTAssignments, Grades, Timetable, Messages
GUARDIANChildren, Grades, Attendance, Messages
ACCOUNTANTInvoices, Fees, Reports, Receipts
STAFFTasks, Requests, Schedule, Directory

Dashboard Section Layouts

Admin Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherSystem alerts flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionUsers, Settings, Reports, Analytics
4Resource UsageResourceUsageSectionSystem Usage, Storage, Active Users, API Calls
5Invoice HistoryInvoiceHistorySectionAll platform invoices
6Financial OverviewFinancialOverviewSectionPlatform metrics with revenue chart

Student Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherAssignments due flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionAssignments, Grades, Timetable, Messages
4Resource UsageResourceUsageSectionAssignment Completion, Attendance, Grades, Library
5Invoice HistoryInvoiceHistorySectionFee History - own invoices
6Financial OverviewFinancialOverviewSectionPersonal fee status

Teacher Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherNext class flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionAttendance, Grades, Assignments, Timetable
4Resource UsageResourceUsageSectionClasses, Students, Grading, Assignments
5Invoice HistoryInvoiceHistorySectionExpense Claims - reimbursements
6Financial OverviewFinancialOverviewSectionDepartment budget

Principal Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherCritical alerts flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionReports, Staff, Performance, Analytics
4Resource UsageResourceUsageSectionCapacity, Staff, Budget, Satisfaction
5Invoice HistoryInvoiceHistorySectionBudget Invoices
6Financial OverviewFinancialOverviewSectionSchool budget with chart

Parent Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherChildren overview flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionChildren, Grades, Attendance, Messages
4Resource UsageResourceUsageSectionChildren, Attendance, Tasks, Events
5Invoice HistoryInvoiceHistorySectionChildren's Fees
6Financial OverviewFinancialOverviewSectionCombined fee status

Accountant Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherFinancial status flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionInvoices, Fees, Reports, Receipts
4Resource UsageResourceUsageSectionCollection, Invoices, Outstanding, Payments
5Invoice HistoryInvoiceHistorySectionInvoice Management
6Financial OverviewFinancialOverviewSectionFull dashboard with revenue chart

Staff Dashboard

#SectionComponents UsedDescription
1Upcoming + WeatherUpcoming + WeatherTasks flip card with weather
2Quick LookQuickLookSectionAnnouncements, Events, Notifications, Messages
3Quick ActionsQuickActionsSectionTasks, Requests, Schedule, Directory
4Resource UsageResourceUsageSectionTasks, Requests, Approvals, Efficiency
5Invoice HistoryInvoiceHistorySectionExpense Reports
6Financial OverviewFinancialOverviewSectionDepartment budget

Shared Widgets Reference

WidgetFilePropsDescription
SectionHeadingsection-heading.tsxtitle, icon?, badge?, action?, description?Unified section title styling
Upcomingupcoming.tsxrole, data?, locale, subdomainRole-specific flip card with 3D animation
Weatherweather.tsxcurrent?, forecast?, onRefresh?, isLoading?Functional weather component
MetricCardmetric-card.tsxtitle, value, iconName, iconColor, change, changeType, href, descriptionKey stat with icon, optional trend, and drill-down link
ActivityRingsactivity-rings.tsxactivities[], titleApple-style concentric progress rings
ScheduleItemschedule-item.tsxtime, title, subtitle, badge, badgeVariant, isActiveTimetable entry with status indicator
ProgressCardprogress-card.tsxtitle, current, total, unit, iconName, showPercentageGoal tracking with progress bar
AnnouncementCardannouncement-card.tsxtitle, content, date, prioritySchool announcement with priority styling
QuickActionsquick-actions.tsxactions[], localeRole-specific shortcut buttons
EmptyStateempty-state.tsxiconName, title, descriptionNo data placeholder
ChartCardchart-card.tsxtitle, childrenChart container wrapper
PerformanceGaugeperformance-gauge.tsxvalue, label, description, maxValue, colorRadial gauge for single metric
WeeklyActivityChartweekly-chart.tsxdata[], title, label, colorWeekly bar chart
ComparisonLineChartcomparison-chart.tsxdata[], title, description, currentLabel, previousLabelPeriod comparison line chart
RevenueChartrevenue-chart.tsxdata[], title, description, currencyRevenue vs expenses area chart

Server Actions

Dashboard data is fetched via server actions in actions.ts:

ActionReturnsUsed By
getDashboardSummary()All metrics aggregatedAdmin
getEnrollmentMetrics()Student countsAdmin, Principal
getAttendanceMetrics()Attendance ratesAdmin, Principal, Teacher
getStaffMetrics()Teacher countsAdmin, Principal
getAcademicPerformanceMetrics()GPA, exams, assignmentsPrincipal, Teacher
getAnnouncementsMetrics()Announcement countsAll roles
getClassesMetrics()Class counts, ratiosAdmin, Principal
getRecentActivities()Activity feedAdmin
getQuickActionsByRole()Role-specific actionsAll roles
getUpcomingDataByRole()Role-specific upcomingAll roles
getResourceUsageByRole()Role-specific metricsAll roles
getInvoicesByRole()Role-specific invoicesAll roles
getFinancialOverviewByRole()Role-specific financialsAll roles
getTeacherDashboardData()Teacher-specific dataTeacher
getStudentDashboardData()Student-specific dataStudent
getParentDashboardData()Parent-specific dataParent
getPrincipalDashboardData()Principal-specific dataPrincipal

Component Architecture Pattern

Each role-based dashboard follows the unified section structure:

export async function RoleDashboard({ user, dictionary, locale }: Props) {
  try {
    // 1. Get tenant context
    const { schoolId } = await getTenantContext()
    const school = await db.school.findUnique({ where: { id: schoolId } })
    const subdomain = school?.domain || ""
 
    // 2. Render unified sections
    return (
      <div className="space-y-6">
        {/* Section 1: Upcoming + Weather */}
        <div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
          <Upcoming role="ROLE" locale={locale} subdomain={subdomain} />
          <Weather />
        </div>
 
        {/* Section 2: Quick Look (no title) */}
        <QuickLookSection />
 
        {/* Section 3: Quick Actions */}
        <SectionHeading title="Quick Actions" icon={Zap} />
        <QuickActionsSection
          role="ROLE"
          locale={locale}
          subdomain={subdomain}
        />
 
        {/* Section 4: Resource Usage */}
        <ResourceUsageSection role="ROLE" />
 
        {/* Section 5: Invoice History */}
        <InvoiceHistorySection role="ROLE" />
 
        {/* Section 6: Financial Overview */}
        <FinancialOverviewSection role="ROLE" />
      </div>
    )
  } catch (error) {
    return <ErrorCard message={error.message} />
  }
}

Related Documentation

  • Dashboard - Admin
  • Dashboard - Principal
  • Dashboard - Teacher
  • Dashboard - Student
  • Dashboard - Parent
  • Dashboard - Accountant
  • Dashboard - Staff
  • Dashboard - Widgets
  • Dashboard - Charts
  • Dashboard - Actions
Entry PointsAuthentication

On This Page

Unified Section Order (All Dashboards)Directory StructureRole-Based ArchitectureUnified Section ComponentsSectionHeadingUpcoming (Flip Card)WeatherResourceUsageSectionInvoiceHistorySectionFinancialOverviewSectionQuick Actions by Role (4 Actions Each)Dashboard Section LayoutsAdmin DashboardStudent DashboardTeacher DashboardPrincipal DashboardParent DashboardAccountant DashboardStaff DashboardShared Widgets ReferenceServer ActionsComponent Architecture PatternRelated Documentation