Skip to content

Commit

Permalink
✨ feat: 丰富 stage 的数据结构
Browse files Browse the repository at this point in the history
给stage 也添加 想法和痛点的数据
  • Loading branch information
arvinxx committed Apr 10, 2021
1 parent 705e67f commit 79f247a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 26 deletions.
22 changes: 18 additions & 4 deletions packages/journey-map/schema/journey-map.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"action",
"chance",
"emotion",
"painSpot",
"painPoint",
"stage",
"thought"
],
Expand Down Expand Up @@ -50,7 +50,7 @@
"emotion": {
"type": "number"
},
"painSpot": {
"painPoint": {
"type": "number"
},
"stage": {
Expand All @@ -66,7 +66,7 @@
"description": "用户行为类型",
"properties": {
"color": {
"description": "action 的颜色",
"description": "展示颜色",
"type": "string"
},
"description": {
Expand Down Expand Up @@ -112,12 +112,26 @@
"type": "array"
},
"color": {
"description": "该阶段的颜色",
"description": "展示颜色",
"type": "string"
},
"name": {
"description": "阶段名称",
"type": "string"
},
"painPoints": {
"description": "痛点",
"items": {
"type": "string"
},
"type": "array"
},
"thoughts": {
"description": "想法",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": ["actions", "name"],
Expand Down
32 changes: 16 additions & 16 deletions packages/journey-map/src/types/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,25 @@ export interface JourneyMapData<T extends string = string> {
actions: Record<T, UserAction[]>;
}

export interface CommonSection {
/**
* 展示颜色
*/
color?: string;
/**
* 想法
*/
thoughts?: string[];
/**
* 痛点
*/
painPoints?: string[];
}

/**
* 用户行为类型
*/
export interface UserAction {
export interface UserAction extends CommonSection {
/**
* 行为名称
*/
Expand All @@ -46,25 +61,10 @@ export interface UserAction {
* @TJS-type integer
*/
emotion?: number;

/**
* action 的颜色
*/
color?: string;
/**
* 说明
*/
description?: string;

/**
* 想法
*/
thoughts?: string[];

/**
* 痛点
*/
painPoints?: string[];
}

export type SectionType =
Expand Down
9 changes: 3 additions & 6 deletions packages/journey-map/src/types/yml.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
/**
* 阶段
*/
import type { Config, JourneyMapData, UserAction } from './type';
import type { CommonSection, Config, JourneyMapData, UserAction } from './type';

/**
* YML 的阶段类型
*/
interface YMLStage {
interface YMLStage extends CommonSection {
/**
* 阶段名称
*/
name: string;
/**
* 该阶段的颜色
*/
color?: string;

/**
* 该阶段所有用户行为
*/
Expand Down

0 comments on commit 79f247a

Please sign in to comment.