Skip to content

feat: add colorVariant, description, actionUrl/actionType/actionIcon to DashboardWidgetSchema#716

Merged
hotlong merged 2 commits into
mainfrom
copilot/enhance-dashboard-widget-schema
Feb 18, 2026
Merged

feat: add colorVariant, description, actionUrl/actionType/actionIcon to DashboardWidgetSchema#716
hotlong merged 2 commits into
mainfrom
copilot/enhance-dashboard-widget-schema

Conversation

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Extends DashboardWidgetSchema to support color-coded KPI cards, widget descriptions, and header action buttons.

Schema additions

  • WidgetColorVariantSchemaz.enum: default | blue | teal | orange | purple | success | warning | danger
  • WidgetActionTypeSchemaz.enum: url | modal | flow
  • DashboardWidgetSchema new optional fields:
    • description (I18nLabel) — subtext below widget title
    • colorVariant — accent color theming
    • actionUrl / actionType / actionIcon — header action button config
  • New exported types: WidgetColorVariant, WidgetActionType

All fields optional — fully backward compatible.

Usage

{
  title: 'Critical Bugs',
  description: 'P0/P1 bugs requiring attention',
  type: 'metric',
  colorVariant: 'danger',
  actionUrl: 'bug_triage_flow',
  actionType: 'flow',
  actionIcon: 'alert-triangle',
  object: 'bug',
  aggregate: 'count',
  layout: { x: 0, y: 0, w: 3, h: 2 },
}

Other

  • ROADMAP.md updated to mark this item complete
Original prompt

This section details on the original issue you should resolve

<issue_title>Spec:DashboardWidgetSchema 支持 colorVariant/actionUrl/description</issue_title>
<issue_description>仪表盘 KPI 卡等支持多色变体、操作按钮/外链、描述信息,须协议扩展。

目标

  • DashboardWidgetSchema 新增 colorVariant 属性:orange/teal/blue/purple/success/warning 等
  • 新增 description 字段:widget header 下方文字
  • 新增 actionUrl/actionType:widget 顶部右侧操作按钮(如外链)
  • 协议单测/文档更新,兼容性说明

详见分析 1.1

  • 类型:enhancement
  • 开发完成后请运行 test ��同步 Roadmap</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Feb 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 18, 2026 7:30am
spec Ready Ready Preview, Comment Feb 18, 2026 7:30am

Request Review

…to DashboardWidgetSchema

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add colorVariant and actionUrl to DashboardWidgetSchema feat: add colorVariant, description, actionUrl/actionType/actionIcon to DashboardWidgetSchema Feb 18, 2026
Copilot AI requested a review from hotlong February 18, 2026 06:14
@hotlong
hotlong marked this pull request as ready for review February 18, 2026 06:17
Copilot AI review requested due to automatic review settings February 18, 2026 06:17
@hotlong
hotlong merged commit 8555b62 into main Feb 18, 2026
3 of 5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends the DashboardWidgetSchema protocol in packages/spec to support color variants, widget descriptions, and header action button configuration for dashboard widgets.

Changes:

  • Added WidgetColorVariantSchema and WidgetActionTypeSchema, plus optional description, colorVariant, actionUrl, actionType, actionIcon fields on DashboardWidgetSchema.
  • Added vitest coverage for the new enums and widget fields.
  • Updated ROADMAP.md to mark the dashboard widget enhancement item as complete.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/spec/src/ui/dashboard.zod.ts Adds new enums/types and optional widget fields for color variants, description, and header actions.
packages/spec/src/ui/dashboard.test.ts Adds tests validating the new enums and new widget fields (including full-dashboard examples).
ROADMAP.md Marks the corresponding protocol enhancement task as completed.

Comment on lines +53 to +58
/** Action URL for the widget header action button */
actionUrl: z.string().optional().describe('URL or target for the widget action button'),

/** Action type for the widget header action button */
actionType: WidgetActionTypeSchema.optional().describe('Type of action for the widget action button'),

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

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

actionUrl and actionType are independent optionals right now, so the schema will accept partial configs (e.g., actionType without actionUrl, or actionUrl without actionType). If the action button requires both, consider adding a cross-field validation (e.g., via .superRefine) or defaulting actionType to 'url' when actionUrl is provided.

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +54
/** Action URL for the widget header action button */
actionUrl: z.string().optional().describe('URL or target for the widget action button'),

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

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

actionUrl is used as a generic action target (URL path, modal id, or flow name) but the current description still reads like it is always a URL. Consider updating the field description to explicitly document the expected format for each actionType (e.g., url => URL/path, modal => modalId, flow => flowName) to avoid client ambiguity.

Suggested change
/** Action URL for the widget header action button */
actionUrl: z.string().optional().describe('URL or target for the widget action button'),
/**
* Action target for the widget header action button.
* When actionType = "url", this should be a URL or relative path.
* When actionType = "modal", this should be a modalId.
* When actionType = "flow", this should be a flowName (machine name of the flow).
*/
actionUrl: z
.string()
.optional()
.describe('Action target: url → URL/path, modal → modalId, flow → flowName'),

Copilot uses AI. Check for mistakes.
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.

Spec:DashboardWidgetSchema 支持 colorVariant/actionUrl/description

3 participants