@powerhousedao/vetra-builder-package 0.0.19 → 0.0.21
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/Header.js +2 -2
- package/dist/editors/builder-team-editor/components/MembersSection.d.ts +1 -6
- package/dist/editors/builder-team-editor/components/MembersSection.js +39 -111
- package/dist/editors/builder-team-editor/components/PackageForm.js +7 -75
- package/dist/editors/builder-team-editor/components/PackageItem.js +28 -85
- 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/SpaceForm.js +1 -1
- package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +2 -1
- package/dist/editors/builder-team-editor/components/SpaceItem.js +5 -4
- 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 +22 -5
- 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 +65 -40
- 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/style.css +302 -28
- 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 +34 -11
- package/dist/subgraphs/vetra-builders/schema.js +2 -14
- package/package.json +1 -1
|
@@ -1,24 +1,11 @@
|
|
|
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
|
-
`;
|
|
5
|
+
import { getProfile, searchProfileOptions, getProfileOption, } from "../services/renown-api.js";
|
|
6
|
+
import { truncateAddress } from "../utils/format.js";
|
|
18
7
|
export function MembersSection({ members, onAddMember, onRemoveMember, }) {
|
|
19
8
|
const [selectedProfile, setSelectedProfile] = useState(null);
|
|
20
|
-
// Cache of profiles from the last search to avoid refetching on select
|
|
21
|
-
const [profilesCache, setProfilesCache] = useState(new Map());
|
|
22
9
|
const handleAddMember = () => {
|
|
23
10
|
if (selectedProfile) {
|
|
24
11
|
const success = onAddMember({
|
|
@@ -32,120 +19,61 @@ export function MembersSection({ members, onAddMember, onRemoveMember, }) {
|
|
|
32
19
|
}
|
|
33
20
|
}
|
|
34
21
|
};
|
|
35
|
-
|
|
22
|
+
// Check if the selected profile is already a member
|
|
23
|
+
const existingMember = selectedProfile
|
|
24
|
+
? members.find((m) => m.phid === selectedProfile.documentId)
|
|
25
|
+
: null;
|
|
26
|
+
const handleUpdateMember = () => {
|
|
27
|
+
if (selectedProfile && existingMember) {
|
|
28
|
+
// Remove the old member and add the updated one
|
|
29
|
+
onRemoveMember(existingMember.id);
|
|
30
|
+
onAddMember({
|
|
31
|
+
phid: selectedProfile.documentId,
|
|
32
|
+
ethAddress: selectedProfile.ethAddress,
|
|
33
|
+
name: selectedProfile.username,
|
|
34
|
+
profileImage: selectedProfile.userImage,
|
|
35
|
+
});
|
|
36
|
+
setSelectedProfile(null);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsxs("div", { className: "px-6 py-5 border-b border-gray-200 bg-gray-50", children: [_jsx("h3", { className: "text-xl font-bold text-gray-900", children: "Team Members" }), _jsx("p", { className: "text-sm text-gray-600 mt-1", children: "Manage team access and permissions" })] }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "space-y-5", children: [_jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-3", children: [_jsx(PHIDField, { name: "memberProfile", label: "Search for team member", value: selectedProfile?.documentId ?? undefined, initialOptions: selectedProfile
|
|
36
40
|
? [
|
|
37
41
|
{
|
|
38
42
|
value: selectedProfile.documentId,
|
|
39
43
|
title: selectedProfile.username,
|
|
40
|
-
description: selectedProfile.ethAddress,
|
|
44
|
+
description: truncateAddress(selectedProfile.ethAddress),
|
|
41
45
|
path: {
|
|
42
|
-
text: `${config.renownProfileBasePath}/${selectedProfile.
|
|
43
|
-
url: `${config.renownProfileBasePath}/${selectedProfile.
|
|
46
|
+
text: `${config.renownProfileBasePath}/${selectedProfile.documentId}`,
|
|
47
|
+
url: `${config.renownProfileBasePath}/${selectedProfile.documentId}`,
|
|
44
48
|
},
|
|
49
|
+
icon: "Person",
|
|
45
50
|
},
|
|
46
51
|
]
|
|
47
|
-
: [], allowUris: false, autoComplete: true, fetchOptionsCallback: async (
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
searchString: userInput,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
// Update the cache with the search results
|
|
55
|
-
const newCache = new Map(profilesCache);
|
|
56
|
-
data.getProfiles.forEach((profile) => {
|
|
57
|
-
newCache.set(profile.documentId, {
|
|
58
|
-
documentId: profile.documentId,
|
|
59
|
-
ethAddress: profile.ethAddress,
|
|
60
|
-
username: profile.username,
|
|
61
|
-
userImage: profile.userImage,
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
setProfilesCache(newCache);
|
|
65
|
-
return data.getProfiles.map((profile) => ({
|
|
66
|
-
id: profile.documentId,
|
|
67
|
-
title: profile.username,
|
|
68
|
-
value: profile.documentId,
|
|
69
|
-
description: profile.ethAddress,
|
|
70
|
-
path: {
|
|
71
|
-
text: `${config.renownProfileBasePath}/${profile.username}`,
|
|
72
|
-
url: `${config.renownProfileBasePath}/${profile.username}`,
|
|
73
|
-
},
|
|
74
|
-
}));
|
|
75
|
-
}, fetchSelectedOptionCallback: async (value) => {
|
|
76
|
-
// First check cache
|
|
77
|
-
const cachedProfile = profilesCache.get(value);
|
|
78
|
-
if (cachedProfile) {
|
|
79
|
-
setSelectedProfile(cachedProfile);
|
|
80
|
-
return {
|
|
81
|
-
title: cachedProfile.username,
|
|
82
|
-
value: cachedProfile.documentId,
|
|
83
|
-
description: cachedProfile.ethAddress,
|
|
84
|
-
path: {
|
|
85
|
-
text: `${config.renownProfileBasePath}/${cachedProfile.username}`,
|
|
86
|
-
url: `${config.renownProfileBasePath}/${cachedProfile.username}`,
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// If not in cache, fetch by searching for the documentId
|
|
91
|
-
// Note: This is a fallback that may not work perfectly
|
|
92
|
-
// Ideally the API would support querying by documentId directly
|
|
93
|
-
const data = await graphqlClient.request(SEARCH_PROFILES_QUERY, {
|
|
94
|
-
input: {
|
|
95
|
-
driveId: "renown-profiles",
|
|
96
|
-
searchString: value,
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
const profile = data.getProfiles.find((p) => p.documentId === value) ||
|
|
100
|
-
data.getProfiles[0];
|
|
101
|
-
if (!profile) {
|
|
102
|
-
return;
|
|
52
|
+
: [], allowUris: false, autoComplete: true, fetchOptionsCallback: searchProfileOptions, fetchSelectedOptionCallback: async (value) => {
|
|
53
|
+
const profile = await getProfile(value);
|
|
54
|
+
if (profile) {
|
|
55
|
+
setSelectedProfile(profile);
|
|
103
56
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ethAddress: profile.ethAddress,
|
|
107
|
-
username: profile.username,
|
|
108
|
-
userImage: profile.userImage,
|
|
109
|
-
};
|
|
110
|
-
setSelectedProfile(profileData);
|
|
111
|
-
// Update cache
|
|
112
|
-
const newCache = new Map(profilesCache);
|
|
113
|
-
newCache.set(profile.documentId, profileData);
|
|
114
|
-
setProfilesCache(newCache);
|
|
115
|
-
return {
|
|
116
|
-
title: profile.username,
|
|
117
|
-
value: profile.documentId,
|
|
118
|
-
description: profile.ethAddress,
|
|
119
|
-
path: {
|
|
120
|
-
text: `${config.renownProfileBasePath}/${profile.username}`,
|
|
121
|
-
url: `${config.renownProfileBasePath}/${profile.username}`,
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}, onChange: (value) => {
|
|
57
|
+
return getProfileOption(value);
|
|
58
|
+
}, onChange: async (value) => {
|
|
125
59
|
if (!value) {
|
|
126
60
|
setSelectedProfile(null);
|
|
127
61
|
return;
|
|
128
62
|
}
|
|
129
|
-
|
|
130
|
-
const profile = profilesCache.get(value);
|
|
63
|
+
const profile = await getProfile(value);
|
|
131
64
|
if (profile) {
|
|
132
65
|
setSelectedProfile(profile);
|
|
133
66
|
}
|
|
134
|
-
}, variant: "withValueTitleAndDescription", required: false, viewMode: "edition", placeholder: "Enter username or ENS name" }), _jsx("div", { className: "flex justify-end", children: _jsx(Button, { onClick: handleAddMember, disabled: !selectedProfile, children: "Add Member" }) })] }) }), _jsx("div", { className: "space-y-
|
|
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 () => {
|
|
135
68
|
if (member.phid) {
|
|
136
|
-
const profile =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
userImage: member.profileImage ?? undefined,
|
|
141
|
-
};
|
|
142
|
-
setSelectedProfile(profile);
|
|
143
|
-
// Update cache
|
|
144
|
-
const newCache = new Map(profilesCache);
|
|
145
|
-
newCache.set(member.phid, profile);
|
|
146
|
-
setProfilesCache(newCache);
|
|
69
|
+
const profile = await getProfile(member.phid);
|
|
70
|
+
if (profile) {
|
|
71
|
+
setSelectedProfile(profile);
|
|
72
|
+
}
|
|
147
73
|
}
|
|
148
|
-
}, children: [_jsxs("div", { className: "flex items-center gap-
|
|
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) => {
|
|
149
77
|
e.stopPropagation();
|
|
150
78
|
onRemoveMember(member.id);
|
|
151
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-
|
|
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", children: [_jsx(Button, { color: "light", onClick: onCancel, children: "Cancel" }), _jsx(Button, { onClick: handleSave, disabled: !selectedPhid || !spaceId, children: "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,99 +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-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
id: pkg.documentId,
|
|
53
|
-
title: pkg.name,
|
|
54
|
-
value: pkg.documentId,
|
|
55
|
-
description: pkg.description,
|
|
56
|
-
path: {
|
|
57
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
58
|
-
url: `${config.vetraPackageBasePath}/${pkg.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
|
|
13
|
+
? [
|
|
14
|
+
{
|
|
15
|
+
value: selectedPackage.phid,
|
|
16
|
+
description: selectedPackage.description ?? "",
|
|
17
|
+
path: {
|
|
18
|
+
text: `${config.vetraPackageBasePath}/${selectedPackage.phid}`,
|
|
19
|
+
url: `${config.vetraPackageBasePath}/${selectedPackage.phid}`,
|
|
20
|
+
},
|
|
21
|
+
title: selectedPackage.title ?? "",
|
|
22
|
+
icon: "PackageManager",
|
|
59
23
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, fetchSelectedOptionCallback: async (value) => {
|
|
64
|
-
const data = await graphqlClient.request(SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY, {
|
|
65
|
-
documentIds: [value],
|
|
66
|
-
});
|
|
67
|
-
const pkg = data.vetraPackages[0];
|
|
68
|
-
if (!pkg) {
|
|
24
|
+
]
|
|
25
|
+
: [], value: selectedPackage.phid ?? undefined, onChange: async (phid) => {
|
|
26
|
+
if (!phid) {
|
|
69
27
|
return;
|
|
70
28
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setDisplayedPkg(newSelectedPackage);
|
|
83
|
-
// Update the entry immediately when refresh is clicked
|
|
84
|
-
// onSave(newSelectedPackage);
|
|
85
|
-
return {
|
|
86
|
-
title: pkg.name,
|
|
87
|
-
value: pkg.documentId,
|
|
88
|
-
description: pkg.description,
|
|
89
|
-
path: {
|
|
90
|
-
text: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
91
|
-
url: `${config.vetraPackageBasePath}/${pkg.name}`,
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}, onSelect: (e) => {
|
|
95
|
-
console.log(e.target);
|
|
96
|
-
}, variant: "withValueTitleAndDescription", required: true, viewMode: "edition", placeholder: "Enter package name" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: onCancel, children: "Cancel" }), _jsx(Button, { onClick: handleSave, disabled: !selectedPackage, children: "Save Changes" })] })] }) }) }));
|
|
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);
|
|
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"] }) })] })] }) }) }));
|
|
97
40
|
}
|
|
98
|
-
return (_jsx("div", { className: "p-
|
|
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"] }) })] })] }) }));
|
|
99
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-
|
|
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-
|
|
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
|
}
|
|
@@ -7,5 +7,5 @@ export function SpaceForm({ initialTitle = "", initialDescription = "", onSave,
|
|
|
7
7
|
const handleSave = () => {
|
|
8
8
|
onSave(title, description);
|
|
9
9
|
};
|
|
10
|
-
return (
|
|
10
|
+
return (_jsxs("div", { className: "p-5 bg-gray-50 rounded-lg border border-gray-300 shadow-sm mb-5", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", 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 4v16m8-8H4" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Create New Space" })] }), _jsx(Form, { onSubmit: (e) => e.preventDefault(), children: _jsxs("div", { className: "space-y-4", children: [_jsx(StringField, { name: "spaceTitle", label: "Space Title", value: title, onChange: (e) => setTitle(e.target.value), placeholder: "Enter space title" }), _jsx(StringField, { name: "spaceDescription", label: "Description (optional)", value: description, onChange: (e) => setDescription(e.target.value), placeholder: "Enter space description" }), _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: !title.trim(), 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" }) }), saveButtonText] }) })] })] }) })] }));
|
|
11
11
|
}
|