@powerhousedao/vetra-builder-package 0.0.20 → 0.0.22
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.
- package/dist/document-models/builder-team/gen/document-model.js +40 -18
- package/dist/document-models/builder-team/gen/packages/actions.d.ts +6 -2
- package/dist/document-models/builder-team/gen/packages/creators.d.ts +3 -2
- package/dist/document-models/builder-team/gen/packages/creators.js +1 -0
- package/dist/document-models/builder-team/gen/packages/object.d.ts +2 -1
- package/dist/document-models/builder-team/gen/packages/object.js +4 -1
- package/dist/document-models/builder-team/gen/packages/operations.d.ts +2 -1
- package/dist/document-models/builder-team/gen/reducer.js +8 -0
- package/dist/document-models/builder-team/gen/schema/types.d.ts +9 -14
- package/dist/document-models/builder-team/gen/schema/zod.d.ts +3 -1
- package/dist/document-models/builder-team/gen/schema/zod.js +13 -0
- package/dist/document-models/builder-team/gen/spaces/actions.d.ts +6 -2
- package/dist/document-models/builder-team/gen/spaces/creators.d.ts +3 -2
- package/dist/document-models/builder-team/gen/spaces/creators.js +1 -0
- package/dist/document-models/builder-team/gen/spaces/object.d.ts +2 -1
- package/dist/document-models/builder-team/gen/spaces/object.js +4 -1
- package/dist/document-models/builder-team/gen/spaces/operations.d.ts +2 -1
- package/dist/document-models/builder-team/index.d.ts +2 -0
- package/dist/document-models/builder-team/src/reducers/packages.js +21 -0
- package/dist/document-models/builder-team/src/reducers/spaces.js +16 -0
- package/dist/editors/builder-team-editor/components/MembersSection.d.ts +1 -6
- package/dist/editors/builder-team-editor/components/MembersSection.js +24 -88
- package/dist/editors/builder-team-editor/components/PackageForm.js +7 -75
- package/dist/editors/builder-team-editor/components/PackageItem.js +22 -83
- package/dist/editors/builder-team-editor/components/PackagesTable.d.ts +9 -0
- package/dist/editors/builder-team-editor/components/PackagesTable.js +80 -0
- package/dist/editors/builder-team-editor/components/ProfileSection.js +2 -2
- package/dist/editors/builder-team-editor/components/QuickStats.js +2 -1
- package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +2 -1
- package/dist/editors/builder-team-editor/components/SpaceItem.js +4 -3
- package/dist/editors/builder-team-editor/components/SpacesSection.d.ts +3 -1
- package/dist/editors/builder-team-editor/components/SpacesSection.js +19 -3
- package/dist/editors/builder-team-editor/components/SpacesTable.d.ts +11 -0
- package/dist/editors/builder-team-editor/components/SpacesTable.js +71 -0
- package/dist/editors/builder-team-editor/config.d.ts +1 -0
- package/dist/editors/builder-team-editor/config.js +1 -0
- package/dist/editors/builder-team-editor/editor.js +7 -1
- package/dist/editors/builder-team-editor/hooks/usePackageHandlers.js +0 -1
- package/dist/editors/builder-team-editor/services/renown-api.d.ts +21 -0
- package/dist/editors/builder-team-editor/services/renown-api.js +63 -0
- package/dist/editors/builder-team-editor/services/vetra-api.d.ts +31 -0
- package/dist/editors/builder-team-editor/services/vetra-api.js +70 -0
- package/dist/editors/builder-team-editor/types/index.d.ts +33 -0
- package/dist/editors/builder-team-editor/types/index.js +1 -0
- package/dist/editors/builder-team-editor/utils/format.d.ts +7 -0
- package/dist/editors/builder-team-editor/utils/format.js +13 -0
- package/dist/editors/builder-team-editor/utils/graphql.d.ts +7 -0
- package/dist/editors/builder-team-editor/utils/graphql.js +55 -0
- package/dist/powerhouse.manifest.json +3 -3
- package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.d.ts +2 -0
- package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +73 -48
- package/dist/processors/vetra-builder-relational-db-processor/database-helpers.d.ts +5 -4
- package/dist/processors/vetra-builder-relational-db-processor/factory.js +0 -1
- package/dist/processors/vetra-builder-relational-db-processor/index.js +0 -1
- package/dist/processors/vetra-builder-relational-db-processor/migrations.d.ts +3 -2
- package/dist/style.css +74 -6
- package/dist/subgraphs/builder-team/resolvers.js +48 -4
- package/dist/subgraphs/builder-team/schema.js +21 -14
- package/dist/subgraphs/vetra-builders/resolvers.js +36 -12
- package/dist/subgraphs/vetra-builders/schema.js +2 -14
- package/package.json +1 -1
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Form, PHIDField } from "@powerhousedao/document-engineering";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { GraphQLClient } from "graphql-request";
|
|
5
4
|
import { config } from "../config.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
query ($input: GetProfilesInput!) {
|
|
9
|
-
getProfiles(input: $input) {
|
|
10
|
-
documentId
|
|
11
|
-
ethAddress
|
|
12
|
-
updatedAt
|
|
13
|
-
userImage
|
|
14
|
-
username
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const GET_PROFILE_QUERY = `
|
|
19
|
-
query ($input: GetProfileInput!) {
|
|
20
|
-
getProfile(input: $input) {
|
|
21
|
-
documentId
|
|
22
|
-
ethAddress
|
|
23
|
-
updatedAt
|
|
24
|
-
userImage
|
|
25
|
-
username
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
5
|
+
import { getProfile, searchProfileOptions, getProfileOption, } from "../services/renown-api.js";
|
|
6
|
+
import { truncateAddress } from "../utils/format.js";
|
|
29
7
|
export function MembersSection({ members, onAddMember, onRemoveMember, }) {
|
|
30
8
|
const [selectedProfile, setSelectedProfile] = useState(null);
|
|
31
9
|
const handleAddMember = () => {
|
|
@@ -63,81 +41,39 @@ export function MembersSection({ members, onAddMember, onRemoveMember, }) {
|
|
|
63
41
|
{
|
|
64
42
|
value: selectedProfile.documentId,
|
|
65
43
|
title: selectedProfile.username,
|
|
66
|
-
description: selectedProfile.ethAddress,
|
|
44
|
+
description: truncateAddress(selectedProfile.ethAddress),
|
|
67
45
|
path: {
|
|
68
|
-
text: `${config.renownProfileBasePath}/${selectedProfile.
|
|
69
|
-
url: `${config.renownProfileBasePath}/${selectedProfile.
|
|
46
|
+
text: `${config.renownProfileBasePath}/${selectedProfile.documentId}`,
|
|
47
|
+
url: `${config.renownProfileBasePath}/${selectedProfile.documentId}`,
|
|
70
48
|
},
|
|
49
|
+
icon: "Person",
|
|
71
50
|
},
|
|
72
51
|
]
|
|
73
|
-
: [], allowUris: false, autoComplete: true, fetchOptionsCallback: async (
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
searchString: userInput,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
return data.getProfiles.map((profile) => ({
|
|
81
|
-
id: profile.documentId,
|
|
82
|
-
title: profile.username,
|
|
83
|
-
value: profile.documentId,
|
|
84
|
-
description: profile.ethAddress,
|
|
85
|
-
path: {
|
|
86
|
-
text: `${config.renownProfileBasePath}/${profile.username}`,
|
|
87
|
-
url: `${config.renownProfileBasePath}/${profile.username}`,
|
|
88
|
-
},
|
|
89
|
-
}));
|
|
90
|
-
}, fetchSelectedOptionCallback: async (value) => {
|
|
91
|
-
try {
|
|
92
|
-
const data = await graphqlClient.request(GET_PROFILE_QUERY, {
|
|
93
|
-
input: {
|
|
94
|
-
id: value,
|
|
95
|
-
driveId: "renown-profiles",
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
const profile = data.getProfile;
|
|
99
|
-
if (!profile) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const profileData = {
|
|
103
|
-
documentId: profile.documentId,
|
|
104
|
-
ethAddress: profile.ethAddress,
|
|
105
|
-
username: profile.username,
|
|
106
|
-
userImage: profile.userImage,
|
|
107
|
-
};
|
|
108
|
-
// Update the selected profile state with fresh data
|
|
109
|
-
setSelectedProfile(profileData);
|
|
110
|
-
return {
|
|
111
|
-
title: profile.username,
|
|
112
|
-
value: profile.documentId,
|
|
113
|
-
description: profile.ethAddress,
|
|
114
|
-
path: {
|
|
115
|
-
text: `${config.renownProfileBasePath}/${profile.username}`,
|
|
116
|
-
url: `${config.renownProfileBasePath}/${profile.username}`,
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
console.error("Failed to fetch selected profile:", error);
|
|
122
|
-
return undefined;
|
|
52
|
+
: [], allowUris: false, autoComplete: true, fetchOptionsCallback: searchProfileOptions, fetchSelectedOptionCallback: async (value) => {
|
|
53
|
+
const profile = await getProfile(value);
|
|
54
|
+
if (profile) {
|
|
55
|
+
setSelectedProfile(profile);
|
|
123
56
|
}
|
|
124
|
-
|
|
57
|
+
return getProfileOption(value);
|
|
58
|
+
}, onChange: async (value) => {
|
|
125
59
|
if (!value) {
|
|
126
60
|
setSelectedProfile(null);
|
|
127
61
|
return;
|
|
128
62
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
63
|
+
const profile = await getProfile(value);
|
|
64
|
+
if (profile) {
|
|
65
|
+
setSelectedProfile(profile);
|
|
66
|
+
}
|
|
67
|
+
}, variant: "withValueTitleAndDescription", required: false, viewMode: "edition", placeholder: "Enter username or ENS name" }), _jsx("div", { className: "flex justify-end", children: existingMember ? (_jsx(Button, { onClick: handleUpdateMember, disabled: !selectedProfile, children: "Update Member" })) : (_jsx(Button, { onClick: handleAddMember, disabled: !selectedProfile, children: "Add Member" })) })] }) }), _jsx("div", { className: "space-y-3", children: members.length > 0 ? (members.map((member) => (_jsxs("div", { className: "flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 hover:shadow-sm transition-all cursor-pointer group", onClick: async () => {
|
|
132
68
|
if (member.phid) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
userImage: member.profileImage ?? undefined,
|
|
138
|
-
});
|
|
69
|
+
const profile = await getProfile(member.phid);
|
|
70
|
+
if (profile) {
|
|
71
|
+
setSelectedProfile(profile);
|
|
72
|
+
}
|
|
139
73
|
}
|
|
140
|
-
}, children: [_jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [member.profileImage ? (_jsx("img", { src: member.profileImage, alt: member.name || "Profile", className: "w-12 h-12 rounded-full object-cover flex-shrink-0 ring-2 ring-gray-200 group-hover:ring-gray-300 transition-all" })) : (_jsx("div", { className: "w-12 h-12 rounded-full bg-gray-300 flex items-center justify-center flex-shrink-0 ring-2 ring-gray-200 group-hover:ring-gray-300 transition-all", children: _jsx("span", { className: "text-gray-700 text-base font-bold", children: (member.name ||
|
|
74
|
+
}, children: [_jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [member.profileImage ? (_jsx("img", { src: member.profileImage, alt: member.name || "Profile", className: "w-12 h-12 rounded-full object-cover flex-shrink-0 ring-2 ring-gray-200 group-hover:ring-gray-300 transition-all" })) : (_jsx("div", { className: "w-12 h-12 rounded-full bg-gray-300 flex items-center justify-center flex-shrink-0 ring-2 ring-gray-200 group-hover:ring-gray-300 transition-all", children: _jsx("span", { className: "text-gray-700 text-base font-bold", children: (member.name ||
|
|
75
|
+
member.ethAddress ||
|
|
76
|
+
"?")[0].toUpperCase() }) })), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "text-base font-semibold text-gray-900 mb-0.5", children: member.name || "Unknown" }), _jsx("div", { className: "text-xs font-mono text-gray-600 truncate mb-1", children: truncateAddress(member.ethAddress || "") }), member.phid && (_jsxs("a", { href: `${config.renownProfileBasePath}/${member.phid}`, className: "text-xs text-gray-600 hover:text-gray-900 hover:underline inline-flex items-center gap-1", onClick: (e) => e.stopPropagation(), children: [_jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }), "View Profile"] }))] })] }), _jsx(Button, { color: "red", size: "sm", onClick: (e) => {
|
|
141
77
|
e.stopPropagation();
|
|
142
78
|
onRemoveMember(member.id);
|
|
143
79
|
}, children: "Remove" })] }, member.id)))) : (_jsx("p", { className: "text-sm text-gray-500", children: "No team members added yet" })) })] }) })] }));
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Form, PHIDField, } from "@powerhousedao/document-engineering";
|
|
3
|
-
import { GraphQLClient } from "graphql-request";
|
|
4
3
|
import { useState } from "react";
|
|
5
|
-
import {
|
|
6
|
-
const graphqlClient = new GraphQLClient(config.vetraGraphqlEndpoint);
|
|
7
|
-
const SEARCH_PACKAGES_QUERY = `
|
|
8
|
-
query SearchPackages($search: String!) {
|
|
9
|
-
vetraPackages(search: $search) {
|
|
10
|
-
authorName
|
|
11
|
-
name
|
|
12
|
-
githubUrl
|
|
13
|
-
documentId
|
|
14
|
-
description
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY = `
|
|
19
|
-
query SearchPackagesByDocumentId($documentIds: [PHID!]) {
|
|
20
|
-
vetraPackages(documentId_in: $documentIds) {
|
|
21
|
-
authorName
|
|
22
|
-
name
|
|
23
|
-
githubUrl
|
|
24
|
-
documentId
|
|
25
|
-
description
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
4
|
+
import { getPackage, searchPackageOptions, getPackageOption, packageDataToPackageInfo } from "../services/vetra-api.js";
|
|
29
5
|
export function PackageForm({ spaceId, onSave, onCancel }) {
|
|
30
6
|
const [selectedPhid, setSelectedPhid] = useState("");
|
|
31
7
|
const [packageInfo, setPackageInfo] = useState(null);
|
|
@@ -35,58 +11,14 @@ export function PackageForm({ spaceId, onSave, onCancel }) {
|
|
|
35
11
|
setPackageInfo(null);
|
|
36
12
|
}
|
|
37
13
|
};
|
|
38
|
-
return (_jsxs("div", { className: "bg-white rounded-lg shadow-md border border-gray-300 mb-4", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" }) }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Add Package" })] }) }), _jsx("div", { className: "p-6", children: _jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-4", children: [_jsx(PHIDField, { name:
|
|
14
|
+
return (_jsxs("div", { className: "bg-white rounded-lg shadow-md border border-gray-300 mb-4", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" }) }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Add Package" })] }) }), _jsx("div", { className: "p-6", children: _jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-4", children: [_jsx(PHIDField, { name: `packageId-${spaceId}`, label: "Package Name", value: selectedPhid, onChange: async (phid) => {
|
|
39
15
|
setSelectedPhid(phid);
|
|
40
16
|
// Fetch the full package info when a selection is made
|
|
41
17
|
if (phid) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
.then((data) => {
|
|
47
|
-
if (data.vetraPackages.length > 0) {
|
|
48
|
-
const pkg = data.vetraPackages[0];
|
|
49
|
-
setPackageInfo({
|
|
50
|
-
id: "", // Will be set by handleAddPackage
|
|
51
|
-
phid: pkg.documentId,
|
|
52
|
-
title: pkg.name,
|
|
53
|
-
description: pkg.description,
|
|
54
|
-
github: pkg.githubUrl || null,
|
|
55
|
-
npm: null,
|
|
56
|
-
vetraDriveUrl: null,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
18
|
+
const pkg = await getPackage(phid);
|
|
19
|
+
if (pkg) {
|
|
20
|
+
setPackageInfo(packageDataToPackageInfo(pkg));
|
|
21
|
+
}
|
|
60
22
|
}
|
|
61
|
-
}, allowUris: true, autoComplete: true, initialOptions: [], fetchOptionsCallback:
|
|
62
|
-
const data = await graphqlClient.request(SEARCH_PACKAGES_QUERY, { search: userInput });
|
|
63
|
-
const options = data.vetraPackages.map((pkg) => ({
|
|
64
|
-
id: pkg.documentId,
|
|
65
|
-
title: pkg.name,
|
|
66
|
-
value: pkg.documentId,
|
|
67
|
-
description: pkg.description,
|
|
68
|
-
path: {
|
|
69
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
70
|
-
url: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
71
|
-
},
|
|
72
|
-
}));
|
|
73
|
-
console.log(options);
|
|
74
|
-
return options;
|
|
75
|
-
}, fetchSelectedOptionCallback: async (value) => {
|
|
76
|
-
const data = await graphqlClient.request(SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY, {
|
|
77
|
-
documentIds: [value],
|
|
78
|
-
});
|
|
79
|
-
const options = data.vetraPackages.map((pkg) => ({
|
|
80
|
-
id: pkg.documentId,
|
|
81
|
-
title: pkg.name,
|
|
82
|
-
value: pkg.documentId,
|
|
83
|
-
description: pkg.description,
|
|
84
|
-
path: {
|
|
85
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
86
|
-
url: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
87
|
-
},
|
|
88
|
-
}));
|
|
89
|
-
const entry = options[0];
|
|
90
|
-
return entry;
|
|
91
|
-
}, variant: "withValueTitleAndDescription", required: true, viewMode: "edition", placeholder: "Enter package name" }), _jsxs("div", { className: "flex justify-end space-x-3 pt-2", children: [_jsx(Button, { color: "light", onClick: onCancel, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), "Cancel"] }) }), _jsx(Button, { onClick: handleSave, disabled: !selectedPhid || !spaceId, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }), "Add Package"] }) })] })] }) }) })] }));
|
|
23
|
+
}, allowUris: true, autoComplete: true, initialOptions: [], fetchOptionsCallback: searchPackageOptions, fetchSelectedOptionCallback: getPackageOption, variant: "withValueTitleAndDescription", required: true, viewMode: "edition", placeholder: "Enter package name" }), _jsxs("div", { className: "flex justify-end space-x-3 pt-2", children: [_jsx(Button, { color: "light", onClick: onCancel, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), "Cancel"] }) }), _jsx(Button, { onClick: handleSave, disabled: !selectedPhid || !spaceId, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }), "Add Package"] }) })] })] }) }) })] }));
|
|
92
24
|
}
|
|
@@ -1,103 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Form, PHIDField, } from "@powerhousedao/document-engineering";
|
|
3
|
-
import { GraphQLClient } from "graphql-request";
|
|
2
|
+
import { Button, Form, PHIDField, Icon, } from "@powerhousedao/document-engineering";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { config } from "../config.js";
|
|
6
|
-
|
|
7
|
-
const SEARCH_PACKAGES_QUERY = `
|
|
8
|
-
query SearchPackages($search: String!) {
|
|
9
|
-
vetraPackages(search: $search) {
|
|
10
|
-
authorName
|
|
11
|
-
name
|
|
12
|
-
githubUrl
|
|
13
|
-
documentId
|
|
14
|
-
npmUrl
|
|
15
|
-
documentId
|
|
16
|
-
description
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
const SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY = `
|
|
21
|
-
query SearchPackagesByDocumentId($documentIds: [PHID!]) {
|
|
22
|
-
vetraPackages(documentId_in: $documentIds) {
|
|
23
|
-
authorName
|
|
24
|
-
name
|
|
25
|
-
githubUrl
|
|
26
|
-
documentId
|
|
27
|
-
npmUrl
|
|
28
|
-
documentId
|
|
29
|
-
description
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
5
|
+
import { getPackage, searchPackageOptions, getPackageOption, packageDataToPackageInfo } from "../services/vetra-api.js";
|
|
33
6
|
export function PackageItem({ pkg, isEditing, onEdit, onDelete, onSave, onCancel, }) {
|
|
34
|
-
const [packages, setPackages] = useState([]);
|
|
35
|
-
const [displayedPkg, setDisplayedPkg] = useState(pkg);
|
|
36
7
|
const [selectedPackage, setSelectedPackage] = useState(pkg);
|
|
37
8
|
const handleSave = () => {
|
|
38
9
|
onSave(selectedPackage);
|
|
39
10
|
};
|
|
40
11
|
if (isEditing) {
|
|
41
|
-
return (_jsx("div", { className: "p-4 bg-gray-50 rounded-lg border border-gray-300 shadow-sm", children: _jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-3", children: [_jsx(PHIDField, { name:
|
|
12
|
+
return (_jsx("div", { className: "p-4 bg-gray-50 rounded-lg border border-gray-300 shadow-sm", children: _jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-3", children: [_jsx(PHIDField, { name: `packageName-${pkg.id}`, label: "Package Name", initialOptions: selectedPackage.phid
|
|
42
13
|
? [
|
|
43
14
|
{
|
|
44
|
-
value:
|
|
45
|
-
description:
|
|
15
|
+
value: selectedPackage.phid,
|
|
16
|
+
description: selectedPackage.description ?? "",
|
|
46
17
|
path: {
|
|
47
|
-
text: `${config.vetraPackageBasePath}/${
|
|
48
|
-
url: `${config.vetraPackageBasePath}/${
|
|
18
|
+
text: `${config.vetraPackageBasePath}/${selectedPackage.phid}`,
|
|
19
|
+
url: `${config.vetraPackageBasePath}/${selectedPackage.phid}`,
|
|
49
20
|
},
|
|
50
|
-
title:
|
|
21
|
+
title: selectedPackage.title ?? "",
|
|
22
|
+
icon: "PackageManager",
|
|
51
23
|
},
|
|
52
24
|
]
|
|
53
|
-
: [], value:
|
|
54
|
-
|
|
55
|
-
const options = data.vetraPackages.map((pkg) => ({
|
|
56
|
-
id: pkg.documentId,
|
|
57
|
-
title: pkg.name,
|
|
58
|
-
value: pkg.documentId,
|
|
59
|
-
description: pkg.description,
|
|
60
|
-
path: {
|
|
61
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
62
|
-
url: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
63
|
-
},
|
|
64
|
-
}));
|
|
65
|
-
console.log(options);
|
|
66
|
-
return options;
|
|
67
|
-
}, fetchSelectedOptionCallback: async (value) => {
|
|
68
|
-
const data = await graphqlClient.request(SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY, {
|
|
69
|
-
documentIds: [value],
|
|
70
|
-
});
|
|
71
|
-
const pkg = data.vetraPackages[0];
|
|
72
|
-
if (!pkg) {
|
|
25
|
+
: [], value: selectedPackage.phid ?? undefined, onChange: async (phid) => {
|
|
26
|
+
if (!phid) {
|
|
73
27
|
return;
|
|
74
28
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
setSelectedPackage(newSelectedPackage);
|
|
86
|
-
setDisplayedPkg(newSelectedPackage);
|
|
87
|
-
// Update the entry immediately when refresh is clicked
|
|
88
|
-
// onSave(newSelectedPackage);
|
|
89
|
-
return {
|
|
90
|
-
title: pkg.name,
|
|
91
|
-
value: pkg.documentId,
|
|
92
|
-
description: pkg.description,
|
|
93
|
-
path: {
|
|
94
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
95
|
-
url: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}, onSelect: (e) => {
|
|
99
|
-
console.log(e.target);
|
|
29
|
+
const pkg = await getPackage(phid);
|
|
30
|
+
if (pkg) {
|
|
31
|
+
setSelectedPackage(packageDataToPackageInfo(pkg, selectedPackage.id));
|
|
32
|
+
}
|
|
33
|
+
}, allowUris: true, autoComplete: true, fetchOptionsCallback: searchPackageOptions, fetchSelectedOptionCallback: async (value) => {
|
|
34
|
+
const pkg = await getPackage(value);
|
|
35
|
+
if (pkg) {
|
|
36
|
+
setSelectedPackage(packageDataToPackageInfo(pkg, selectedPackage.id));
|
|
37
|
+
}
|
|
38
|
+
return getPackageOption(value);
|
|
100
39
|
}, variant: "withValueTitleAndDescription", required: true, viewMode: "edition", placeholder: "Enter package name" }), _jsxs("div", { className: "flex justify-end space-x-3 pt-2", children: [_jsx(Button, { color: "light", onClick: onCancel, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), "Cancel"] }) }), _jsx(Button, { onClick: handleSave, disabled: !selectedPackage, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), "Save Changes"] }) })] })] }) }) }));
|
|
101
40
|
}
|
|
102
|
-
return (_jsx("div", { className: "p-4 bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md hover:border-gray-300 transition-all group", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 mb-1", children: [_jsx(
|
|
41
|
+
return (_jsx("div", { className: "p-4 bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md hover:border-gray-300 transition-all group", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 mb-1", children: [_jsx(Icon, { name: "PackageManager", size: "16px", color: "rgb(75 85 99)" }), _jsx("span", { className: "font-semibold text-gray-900 truncate", children: pkg.title || "Untitled Package" })] }), pkg.description && (_jsx("p", { className: "text-sm text-gray-600 ml-6 leading-relaxed", children: pkg.description })), pkg.phid && (_jsxs("a", { href: `${config.vetraPackageBasePath}/${pkg.phid}`, className: "text-xs text-gray-600 hover:text-gray-900 hover:underline ml-6 mt-1.5 inline-flex items-center gap-1 group/link", target: "_blank", rel: "noopener noreferrer", children: [_jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }), "View Package"] }))] }), _jsxs("div", { className: "flex space-x-2 ml-4", children: [_jsx(Button, { color: "light", size: "sm", onClick: onEdit, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) }), "Edit"] }) }), _jsx(Button, { color: "red", size: "sm", onClick: onDelete, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }), "Remove"] }) })] })] }) }));
|
|
103
42
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VetraPackageInfo } from "../../../document-models/builder-team/index.js";
|
|
2
|
+
interface PackagesTableProps {
|
|
3
|
+
packages: VetraPackageInfo[];
|
|
4
|
+
onEdit: (packageId: string) => void;
|
|
5
|
+
onDelete: (packageId: string) => void;
|
|
6
|
+
onReorder: (packageIds: string[], targetIndex: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function PackagesTable({ packages, onEdit, onDelete, onReorder, }: PackagesTableProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ObjectSetTable, Icon } from "@powerhousedao/document-engineering";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { config } from "../config.js";
|
|
5
|
+
export function PackagesTable({ packages, onEdit, onDelete, onReorder, }) {
|
|
6
|
+
const columns = useMemo(() => [
|
|
7
|
+
{
|
|
8
|
+
field: "title",
|
|
9
|
+
title: "Package Name",
|
|
10
|
+
type: "string",
|
|
11
|
+
width: "250px",
|
|
12
|
+
renderHeader: () => _jsx("div", { className: "px-4", children: "Package Name" }),
|
|
13
|
+
renderCell: (value, context) => {
|
|
14
|
+
const pkg = context.row;
|
|
15
|
+
return (_jsxs("div", { className: "flex items-center gap-2 px-4", children: [_jsx(Icon, { name: "PackageManager", size: "16px", color: "rgb(75 85 99)" }), _jsx("span", { className: "font-medium text-gray-900", children: value || "Untitled Package" })] }));
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
field: "description",
|
|
20
|
+
title: "Description",
|
|
21
|
+
type: "string",
|
|
22
|
+
width: "300px",
|
|
23
|
+
renderHeader: () => _jsx("div", { className: "px-4", children: "Description" }),
|
|
24
|
+
renderCell: (value) => {
|
|
25
|
+
return (_jsx("div", { className: "px-4", children: _jsx("span", { className: "text-sm text-gray-600 line-clamp-2", children: value || "—" }) }));
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
field: "phid",
|
|
30
|
+
title: "PHID",
|
|
31
|
+
type: "phid",
|
|
32
|
+
width: "200px",
|
|
33
|
+
renderHeader: () => _jsx("div", { className: "px-4", children: "PHID" }),
|
|
34
|
+
renderCell: (value) => {
|
|
35
|
+
if (!value)
|
|
36
|
+
return _jsx("div", { className: "px-4", children: _jsx("span", { className: "text-gray-400", children: "\u2014" }) });
|
|
37
|
+
return (_jsx("div", { className: "px-4", children: _jsxs("code", { className: "text-xs bg-gray-100 px-2 py-1 rounded font-mono text-gray-700", children: [value.slice(0, 16), "..."] }) }));
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
field: "phid",
|
|
42
|
+
title: "Links",
|
|
43
|
+
type: "string",
|
|
44
|
+
width: "120px",
|
|
45
|
+
align: "center",
|
|
46
|
+
renderHeader: () => _jsx("div", { className: "px-4", children: "Links" }),
|
|
47
|
+
renderCell: (value, context) => {
|
|
48
|
+
const pkg = context.row;
|
|
49
|
+
const hasLinks = pkg.phid || pkg.github || pkg.vetraDriveUrl;
|
|
50
|
+
if (!hasLinks) {
|
|
51
|
+
return _jsx("div", { className: "px-4", children: _jsx("span", { className: "text-gray-400", children: "\u2014" }) });
|
|
52
|
+
}
|
|
53
|
+
return (_jsxs("div", { className: "flex items-center gap-2 justify-center px-4", children: [pkg.phid && (_jsx("a", { href: `${config.vetraPackageBasePath}/${pkg.phid}`, className: "text-gray-700 hover:text-gray-900", target: "_blank", rel: "noopener noreferrer", title: "View Package", onClick: (e) => e.stopPropagation(), children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) })), pkg.github && (_jsx("a", { href: pkg.github, className: "text-gray-700 hover:text-gray-900", target: "_blank", rel: "noopener noreferrer", title: "View GitHub", onClick: (e) => e.stopPropagation(), children: _jsx(Icon, { name: "Github", size: "16px" }) })), pkg.vetraDriveUrl && (() => {
|
|
54
|
+
// Extract driveId from vetraDriveUrl (e.g., "/d/vetra-builder-package" -> "vetra-builder-package")
|
|
55
|
+
const driveId = pkg.vetraDriveUrl.replace(/^\/d\//, '');
|
|
56
|
+
return (_jsxs(_Fragment, { children: [_jsx("a", { href: pkg.vetraDriveUrl, className: "text-gray-700 hover:text-gray-900", target: "_blank", rel: "noopener noreferrer", title: "View Vetra Drive", onClick: (e) => e.stopPropagation(), children: _jsx(Icon, { name: "Drive", size: "16px" }) }), _jsx("a", { href: `${window.location.origin}/?driveUrl=${driveId}`, className: "text-gray-700 hover:text-gray-900", target: "_blank", rel: "noopener noreferrer", title: "Connect to Drive", onClick: (e) => e.stopPropagation(), children: _jsx(Icon, { name: "ConnectSmall", size: "16px" }) })] }));
|
|
57
|
+
})()] }));
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
], []);
|
|
61
|
+
return (_jsx("div", { className: "w-full packages-table", children: _jsx(ObjectSetTable, { data: packages, columns: columns, allowRowSelection: false, showRowNumbers: false, width: "100%", minRowHeight: 56, onReorder: (rows, targetIndex) => {
|
|
62
|
+
const packageIds = rows.map((row) => row.id);
|
|
63
|
+
onReorder(packageIds, targetIndex);
|
|
64
|
+
}, actions: {
|
|
65
|
+
secondary: [
|
|
66
|
+
{
|
|
67
|
+
label: "Edit Package",
|
|
68
|
+
callback: ({ row }) => {
|
|
69
|
+
onEdit(row.id);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Remove",
|
|
74
|
+
callback: ({ row }) => {
|
|
75
|
+
onDelete(row.id);
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
} }) }));
|
|
80
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Form, StringField, UrlField } from "@powerhousedao/document-engineering";
|
|
2
|
+
import { Button, Form, StringField, UrlField, Icon } from "@powerhousedao/document-engineering";
|
|
3
3
|
export function ProfileSection({ profile, isEditing, onSetProfileName, onSetSlug, onSetDescription, onSetLogo, onUpdateSocials, onClose, }) {
|
|
4
|
-
return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(
|
|
4
|
+
return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { name: "People", size: "24px", color: "rgb(75 85 99)" }), _jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Profile Information" }), _jsx("p", { className: "text-sm text-gray-600 mt-0.5", children: "Manage your builder profile details" })] })] }) }), _jsx("div", { className: "p-6", children: isEditing ? (_jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-6", children: [_jsx(StringField, { name: "profileName", label: "Profile Name", value: profile.name, onChange: (e) => onSetProfileName(e.target.value), placeholder: "Enter your profile name", description: "Your public display name" }), _jsx(StringField, { name: "slug", label: "Slug", value: profile.slug, onChange: (e) => onSetSlug(e.target.value), placeholder: "your-slug", description: "Unique identifier for your profile (used in URLs)" }), _jsx(StringField, { name: "description", label: "Description", value: profile.description || "", onChange: (e) => onSetDescription(e.target.value), placeholder: "Tell us about yourself and your work", description: "Brief description of your work and interests" }), _jsx(UrlField, { name: "logo", label: "Logo URL", value: profile.logo || "", onChange: (e) => onSetLogo(e.target.value), placeholder: "https://example.com/logo.png", description: "URL to your profile logo image" }), _jsxs("div", { className: "space-y-4 pt-4 border-t border-gray-200", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Social Links" })] }), _jsx(UrlField, { name: "github", label: "GitHub", value: profile.socials.github || "", onChange: (e) => onUpdateSocials({ ...profile.socials, github: e.target.value }), placeholder: "https://github.com/username" }), _jsx(UrlField, { name: "website", label: "Website", value: profile.socials.website || "", onChange: (e) => onUpdateSocials({ ...profile.socials, website: e.target.value }), placeholder: "https://your-website.com" }), _jsx(UrlField, { name: "x", label: "X (Twitter)", value: profile.socials.xProfile || "", onChange: (e) => onUpdateSocials({ ...profile.socials, x: e.target.value }), placeholder: "https://x.com/username" })] }), _jsxs("div", { className: "flex justify-end space-x-3 pt-4", children: [_jsx(Button, { color: "light", onClick: onClose, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), "Cancel"] }) }), _jsx(Button, { onClick: onClose, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), "Save Changes"] }) })] })] }) })) : (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Name" }), _jsx("p", { className: "text-base font-medium text-gray-900", children: profile.name || "Not set" })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Slug" }), _jsx("p", { className: "text-base font-medium text-gray-900", children: profile.slug ? `@${profile.slug}` : "Not set" })] })] }), profile.description && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Description" }), _jsx("p", { className: "text-base text-gray-900 leading-relaxed", children: profile.description })] })), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3", children: "Social Links" }), _jsxs("div", { className: "flex flex-wrap gap-3", children: [profile.socials.github && (_jsxs("a", { href: profile.socials.github, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-2 px-3 py-2 bg-white rounded-lg border border-gray-300 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:border-gray-400 transition-colors", children: [_jsx("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { fillRule: "evenodd", d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z", clipRule: "evenodd" }) }), "GitHub"] })), profile.socials.website && (_jsxs("a", { href: profile.socials.website, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-2 px-3 py-2 bg-white rounded-lg border border-gray-300 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:border-gray-400 transition-colors", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" }) }), "Website"] })), profile.socials.xProfile && (_jsxs("a", { href: profile.socials.xProfile, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-2 px-3 py-2 bg-white rounded-lg border border-gray-300 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:border-gray-400 transition-colors", children: [_jsx("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) }), "X (Twitter)"] })), !profile.socials.github && !profile.socials.website && !profile.socials.xProfile && (_jsx("span", { className: "text-gray-500 text-sm italic", children: "No social links added" }))] })] })] })) })] }));
|
|
5
5
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@powerhousedao/document-engineering";
|
|
2
3
|
export function QuickStats({ spaces, members }) {
|
|
3
4
|
const totalPackages = spaces.reduce((total, space) => total + space.packages.length, 0);
|
|
4
|
-
return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Quick Stats" })] }) }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" }) }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Spaces" })] }), _jsx("span", { className: "text-2xl font-bold text-gray-900", children: spaces.length })] }), _jsxs("div", { className: "flex justify-between items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(
|
|
5
|
+
return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Quick Stats" })] }) }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" }) }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Spaces" })] }), _jsx("span", { className: "text-2xl font-bold text-gray-900", children: spaces.length })] }), _jsxs("div", { className: "flex justify-between items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { name: "PackageManager", size: "20px", color: "rgb(75 85 99)" }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Total Packages" })] }), _jsx("span", { className: "text-2xl font-bold text-gray-900", children: totalPackages })] }), _jsxs("div", { className: "flex justify-between items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }) }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Team Members" })] }), _jsx("span", { className: "text-2xl font-bold text-gray-900", children: members.length })] })] }) })] }));
|
|
5
6
|
}
|
|
@@ -16,6 +16,7 @@ interface SpaceItemProps {
|
|
|
16
16
|
onDeletePackage: (packageId: string) => void;
|
|
17
17
|
onSavePackage: (packageInfo: VetraPackageInfo) => void;
|
|
18
18
|
onCancelPackageEdit: () => void;
|
|
19
|
+
onReorderPackages: (packageIds: string[], targetIndex: number) => void;
|
|
19
20
|
}
|
|
20
|
-
export declare function SpaceItem({ space, isEditing, editingSpaceTitle, editingSpaceDescription, editingPackageId, onEdit, onDelete, onSaveEdit, onCancelEdit, onSetEditingTitle, onSetEditingDescription, onAddPackage, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, }: SpaceItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function SpaceItem({ space, isEditing, editingSpaceTitle, editingSpaceDescription, editingPackageId, onEdit, onDelete, onSaveEdit, onCancelEdit, onSetEditingTitle, onSetEditingDescription, onAddPackage, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, onReorderPackages, }: SpaceItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Form, StringField } from "@powerhousedao/document-engineering";
|
|
2
|
+
import { Button, Form, StringField, Icon } from "@powerhousedao/document-engineering";
|
|
3
3
|
import { PackageItem } from "./PackageItem.js";
|
|
4
|
+
import { PackagesTable } from "./PackagesTable.js";
|
|
4
5
|
function EditSpaceForm({ title, description, onTitleChange, onDescriptionChange, onSave, onCancel, }) {
|
|
5
6
|
return (_jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-4", children: [_jsx(StringField, { name: "editingSpaceTitle", label: "Space Title", value: title, onChange: (e) => onTitleChange(e.target.value), placeholder: "Enter space title" }), _jsx(StringField, { name: "editingSpaceDescription", label: "Description (optional)", value: description, onChange: (e) => onDescriptionChange(e.target.value), placeholder: "Enter space description" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: onCancel, children: "Cancel" }), _jsx(Button, { onClick: onSave, disabled: !title.trim(), children: "Save Changes" })] })] }) }));
|
|
6
7
|
}
|
|
7
|
-
export function SpaceItem({ space, isEditing, editingSpaceTitle, editingSpaceDescription, editingPackageId, onEdit, onDelete, onSaveEdit, onCancelEdit, onSetEditingTitle, onSetEditingDescription, onAddPackage, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, }) {
|
|
8
|
+
export function SpaceItem({ space, isEditing, editingSpaceTitle, editingSpaceDescription, editingPackageId, onEdit, onDelete, onSaveEdit, onCancelEdit, onSetEditingTitle, onSetEditingDescription, onAddPackage, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, onReorderPackages, }) {
|
|
8
9
|
if (isEditing) {
|
|
9
10
|
return (_jsx("div", { className: "bg-gray-50 border border-gray-300 rounded-lg p-5 shadow-sm", children: _jsx(EditSpaceForm, { title: editingSpaceTitle, description: editingSpaceDescription, onTitleChange: onSetEditingTitle, onDescriptionChange: onSetEditingDescription, onSave: onSaveEdit, onCancel: onCancelEdit }) }));
|
|
10
11
|
}
|
|
11
|
-
return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-lg p-5 shadow-sm hover:shadow-md transition-all group", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 mb-1", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900 truncate", children: space.title })] }), space.description && (_jsx("p", { className: "text-sm text-gray-600 mt-1 leading-relaxed", children: space.description })), _jsxs("div", { className: "flex items-center gap-1.5 mt-2", children: [_jsx(
|
|
12
|
+
return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-lg p-5 shadow-sm hover:shadow-md transition-all group", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 mb-1", children: [_jsx("svg", { className: "w-5 h-5 text-gray-600 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900 truncate", children: space.title })] }), space.description && (_jsx("p", { className: "text-sm text-gray-600 mt-1 leading-relaxed", children: space.description })), _jsxs("div", { className: "flex items-center gap-1.5 mt-2", children: [_jsx(Icon, { name: "PackageManager", size: "16px", color: "rgb(156 163 175)" }), _jsxs("span", { className: "text-xs font-medium text-gray-500", children: [space.packages.length, " package", space.packages.length !== 1 ? "s" : ""] })] })] }), _jsxs("div", { className: "flex space-x-2 ml-4", children: [_jsx(Button, { color: "light", size: "sm", onClick: onEdit, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) }), "Edit"] }) }), _jsx(Button, { color: "light", size: "sm", onClick: () => onAddPackage(space.id), children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }), "Add Package"] }) }), _jsx(Button, { color: "red", size: "sm", onClick: onDelete, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }), "Delete"] }) })] })] }), space.packages.length > 0 ? (_jsxs("div", { className: "mt-4 pt-4 border-t border-gray-200", children: [_jsx("div", { className: "mb-3 flex items-center justify-between", children: _jsx("h4", { className: "text-sm font-semibold text-gray-700", children: "Packages" }) }), editingPackageId ? (_jsx("div", { className: "space-y-2", children: space.packages.map((pkg) => (_jsx(PackageItem, { pkg: pkg, isEditing: editingPackageId === pkg.id, onEdit: () => onEditPackage(pkg.id), onDelete: () => onDeletePackage(pkg.id), onSave: (selectedPackage) => onSavePackage(selectedPackage), onCancel: onCancelPackageEdit }, pkg.id))) })) : (_jsx(PackagesTable, { packages: space.packages, onEdit: onEditPackage, onDelete: onDeletePackage, onReorder: onReorderPackages }))] })) : (_jsx("div", { className: "mt-4 pt-4 border-t border-gray-200 text-center py-6", children: _jsx("p", { className: "text-sm text-gray-500", children: "No packages in this space yet" }) }))] }));
|
|
12
13
|
}
|