@echothink-ui/project 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +5 -0
  2. package/dist/components/ProjectActivityTimeline.d.ts +5 -0
  3. package/dist/components/ProjectAppDomainPanel.d.ts +8 -0
  4. package/dist/components/ProjectCard.d.ts +8 -0
  5. package/dist/components/ProjectCreateForm.d.ts +7 -0
  6. package/dist/components/ProjectDashboardTemplate.d.ts +11 -0
  7. package/dist/components/ProjectManagementPage.d.ts +17 -0
  8. package/dist/components/ProjectMembersPanel.d.ts +9 -0
  9. package/dist/components/ProjectModelConfigPanel.d.ts +9 -0
  10. package/dist/components/ProjectPermissionPanel.d.ts +9 -0
  11. package/dist/components/ProjectResourcePanel.d.ts +6 -0
  12. package/dist/components/ProjectScopeSelector.d.ts +7 -0
  13. package/dist/components/ProjectSettingsPanel.d.ts +6 -0
  14. package/dist/components/ProjectStatusSummary.d.ts +6 -0
  15. package/dist/components/ProjectSummaryPanel.d.ts +5 -0
  16. package/dist/components/ProjectTab.d.ts +3 -0
  17. package/dist/components/ProjectTabGroup.d.ts +12 -0
  18. package/dist/components/ProjectTable.d.ts +9 -0
  19. package/dist/index.cjs +2112 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.css +2059 -0
  22. package/dist/index.css.map +1 -0
  23. package/dist/index.d.ts +21 -0
  24. package/dist/index.js +2098 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/types.d.ts +99 -0
  27. package/dist/utils.d.ts +288 -0
  28. package/package.json +45 -0
  29. package/src/components/ProjectActivityTimeline.test.tsx +43 -0
  30. package/src/components/ProjectActivityTimeline.tsx +118 -0
  31. package/src/components/ProjectAppDomainPanel.tsx +147 -0
  32. package/src/components/ProjectCard.tsx +117 -0
  33. package/src/components/ProjectCreateForm.test.tsx +45 -0
  34. package/src/components/ProjectCreateForm.tsx +176 -0
  35. package/src/components/ProjectDashboardTemplate.tsx +107 -0
  36. package/src/components/ProjectManagementPage.tsx +112 -0
  37. package/src/components/ProjectMembersPanel.tsx +181 -0
  38. package/src/components/ProjectModelConfigPanel.tsx +294 -0
  39. package/src/components/ProjectPermissionPanel.tsx +174 -0
  40. package/src/components/ProjectResourcePanel.tsx +154 -0
  41. package/src/components/ProjectScopeSelector.test.tsx +50 -0
  42. package/src/components/ProjectScopeSelector.tsx +92 -0
  43. package/src/components/ProjectSettingsPanel.test.tsx +25 -0
  44. package/src/components/ProjectSettingsPanel.tsx +244 -0
  45. package/src/components/ProjectStatusSummary.tsx +165 -0
  46. package/src/components/ProjectSummaryPanel.test.tsx +37 -0
  47. package/src/components/ProjectSummaryPanel.tsx +85 -0
  48. package/src/components/ProjectTab.tsx +8 -0
  49. package/src/components/ProjectTabGroup.tsx +38 -0
  50. package/src/components/ProjectTable.tsx +138 -0
  51. package/src/index.test.tsx +337 -0
  52. package/src/index.tsx +41 -0
  53. package/src/styles.css +2431 -0
  54. package/src/types.ts +111 -0
  55. package/src/utils.ts +96 -0
package/src/types.ts ADDED
@@ -0,0 +1,111 @@
1
+ import type * as React from "react";
2
+ import type {
3
+ EthAction,
4
+ EthOperationalStatus,
5
+ SurfaceComponentProps
6
+ } from "@echothink-ui/core";
7
+
8
+ export type ProjectHealthStatus = "healthy" | "warning" | "critical";
9
+
10
+ export interface ProjectSummary extends Record<string, unknown> {
11
+ id: string;
12
+ name: string;
13
+ status: EthOperationalStatus;
14
+ description?: React.ReactNode;
15
+ ownerLabel?: React.ReactNode;
16
+ updatedAt?: React.ReactNode;
17
+ appDomainsCount?: number;
18
+ openTasksCount?: number;
19
+ healthStatus?: ProjectHealthStatus;
20
+ }
21
+
22
+ export interface ProjectStatusSummaryData {
23
+ byStatus: Partial<Record<EthOperationalStatus, number>>;
24
+ healthyPercent: number;
25
+ blockedCount: number;
26
+ }
27
+
28
+ export interface ProjectCreateValues {
29
+ name: string;
30
+ description?: string;
31
+ ownerLabel?: string;
32
+ template: string;
33
+ }
34
+
35
+ export interface ProjectSettings {
36
+ name?: string;
37
+ description?: string;
38
+ members?: Array<{ id: string; label: React.ReactNode; role?: string }>;
39
+ permissionMode?: string;
40
+ defaultRole?: string;
41
+ modelProvider?: string;
42
+ model?: string;
43
+ }
44
+
45
+ export interface ProjectScope extends Record<string, unknown> {
46
+ id: string;
47
+ label: React.ReactNode;
48
+ kind: "project" | "app-domain" | "resource";
49
+ status?: EthOperationalStatus;
50
+ }
51
+
52
+ export interface ProjectResource extends Record<string, unknown> {
53
+ id: string;
54
+ kind: string;
55
+ label: React.ReactNode;
56
+ status?: EthOperationalStatus;
57
+ updatedAt?: React.ReactNode;
58
+ }
59
+
60
+ export interface ProjectActivityEvent {
61
+ id: string;
62
+ timestamp: string;
63
+ actor?: React.ReactNode;
64
+ kind: string;
65
+ summary: React.ReactNode;
66
+ details?: React.ReactNode;
67
+ }
68
+
69
+ export interface ProjectMember extends Record<string, unknown> {
70
+ id: string;
71
+ label: React.ReactNode;
72
+ role: string;
73
+ avatar?: string;
74
+ status?: EthOperationalStatus;
75
+ }
76
+
77
+ export type ProjectPermissionEntity = string | { id: string; label: React.ReactNode };
78
+
79
+ export interface ProjectAppDomainInstance extends Record<string, unknown> {
80
+ id: string;
81
+ appDomainLabel: React.ReactNode;
82
+ status: EthOperationalStatus;
83
+ health?: ProjectHealthStatus;
84
+ }
85
+
86
+ export interface ProjectModelProvider {
87
+ id: string;
88
+ label: string;
89
+ models?: Array<{ id: string; label: string }>;
90
+ }
91
+
92
+ export interface ProjectModelConfig {
93
+ provider?: string;
94
+ model?: string;
95
+ params?: {
96
+ temperature?: number;
97
+ topP?: number;
98
+ maxTokens?: number;
99
+ };
100
+ }
101
+
102
+ export type ProjectBaseProps = Omit<
103
+ SurfaceComponentProps,
104
+ "actions" | "children" | "items" | "metadata" | "onChange" | "onSelect" | "onSubmit"
105
+ > & {
106
+ children?: React.ReactNode;
107
+ };
108
+
109
+ export type ProjectActionProps = {
110
+ actions?: EthAction[];
111
+ };
package/src/utils.ts ADDED
@@ -0,0 +1,96 @@
1
+ import type { EthOperationalStatus, EthSeverity } from "@echothink-ui/core";
2
+ import type {
3
+ ProjectHealthStatus,
4
+ ProjectBaseProps,
5
+ ProjectPermissionEntity,
6
+ ProjectStatusSummaryData,
7
+ ProjectSummary
8
+ } from "./types";
9
+
10
+ export function classNames(...values: Array<string | false | null | undefined>) {
11
+ return values.filter(Boolean).join(" ");
12
+ }
13
+
14
+ export function healthToStatus(health?: ProjectHealthStatus): EthOperationalStatus {
15
+ if (health === "critical") return "failed";
16
+ if (health === "warning") return "warning";
17
+ return "synced";
18
+ }
19
+
20
+ export function healthLabel(health?: ProjectHealthStatus) {
21
+ if (health === "critical") return "Critical";
22
+ if (health === "warning") return "Warning";
23
+ return "Healthy";
24
+ }
25
+
26
+ export function statusToSeverity(status: EthOperationalStatus): EthSeverity {
27
+ if (["failed", "blocked", "approval-required"].includes(status)) return "danger";
28
+ if (["warning", "stale", "pending-approval"].includes(status)) return "warning";
29
+ if (["succeeded", "completed", "synced", "active"].includes(status)) return "success";
30
+ if (["inactive", "not-started", "paused"].includes(status)) return "neutral";
31
+ return "info";
32
+ }
33
+
34
+ export function summarizeProjects(projects: ProjectSummary[]): ProjectStatusSummaryData {
35
+ const byStatus: ProjectStatusSummaryData["byStatus"] = {};
36
+ let healthyCount = 0;
37
+ let blockedCount = 0;
38
+
39
+ for (const project of projects) {
40
+ byStatus[project.status] = (byStatus[project.status] ?? 0) + 1;
41
+ if (
42
+ project.healthStatus === "healthy" ||
43
+ ["completed", "succeeded", "synced", "active"].includes(project.status)
44
+ ) {
45
+ healthyCount += 1;
46
+ }
47
+ if (["blocked", "failed", "approval-required"].includes(project.status)) {
48
+ blockedCount += 1;
49
+ }
50
+ }
51
+
52
+ return {
53
+ byStatus,
54
+ healthyPercent: projects.length ? Math.round((healthyCount / projects.length) * 100) : 0,
55
+ blockedCount
56
+ };
57
+ }
58
+
59
+ export function entityId(entity: ProjectPermissionEntity) {
60
+ return typeof entity === "string" ? entity : entity.id;
61
+ }
62
+
63
+ export function entityLabel(entity: ProjectPermissionEntity) {
64
+ return typeof entity === "string" ? entity : entity.label;
65
+ }
66
+
67
+ export function permissionKey(
68
+ subject: ProjectPermissionEntity,
69
+ resource: ProjectPermissionEntity,
70
+ action: ProjectPermissionEntity
71
+ ) {
72
+ return `${entityId(subject)}:${entityId(resource)}:${entityId(action)}`;
73
+ }
74
+
75
+ export function formatNumber(value: number | undefined) {
76
+ return new Intl.NumberFormat("en-US").format(value ?? 0);
77
+ }
78
+
79
+ export function projectHtmlProps(props: ProjectBaseProps) {
80
+ const {
81
+ title,
82
+ subtitle,
83
+ description,
84
+ eyebrow,
85
+ density,
86
+ status,
87
+ severity,
88
+ loading,
89
+ empty,
90
+ error,
91
+ footer,
92
+ children,
93
+ ...htmlProps
94
+ } = props;
95
+ return htmlProps;
96
+ }