version-pill-react 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +22 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -116,6 +116,8 @@ function VersionPill({
|
|
|
116
116
|
const [ideaAuthorEmail, setIdeaAuthorEmail] = useState("");
|
|
117
117
|
const [submittingIdea, setSubmittingIdea] = useState(false);
|
|
118
118
|
const [ideaSubmitMessage, setIdeaSubmitMessage] = useState(null);
|
|
119
|
+
const [allowIdeas, setAllowIdeas] = useState(true);
|
|
120
|
+
const [allowVoting, setAllowVoting] = useState(true);
|
|
119
121
|
const [roadmapView, setRoadmapView] = useState("board");
|
|
120
122
|
const [isMobile, setIsMobile] = useState(false);
|
|
121
123
|
const [votedIdeas, setVotedIdeas] = useState(/* @__PURE__ */ new Set());
|
|
@@ -165,6 +167,10 @@ function VersionPill({
|
|
|
165
167
|
const response = await fetch(`${baseUrl}/api/roadmap/${projectId}`);
|
|
166
168
|
if (!response.ok) return;
|
|
167
169
|
const data = await response.json();
|
|
170
|
+
if (data.project) {
|
|
171
|
+
setAllowIdeas(data.project.allowIdeas ?? true);
|
|
172
|
+
setAllowVoting(data.project.allowVoting ?? true);
|
|
173
|
+
}
|
|
168
174
|
if (data.columns && data.items) {
|
|
169
175
|
setRoadmapColumns(data.columns);
|
|
170
176
|
setRoadmapItems(data.items);
|
|
@@ -217,7 +223,7 @@ function VersionPill({
|
|
|
217
223
|
}
|
|
218
224
|
}, [projectId, baseUrl]);
|
|
219
225
|
const submitIdea = useCallback(async () => {
|
|
220
|
-
if (!ideaTitle.trim()
|
|
226
|
+
if (!ideaTitle.trim()) return;
|
|
221
227
|
setSubmittingIdea(true);
|
|
222
228
|
setIdeaSubmitMessage(null);
|
|
223
229
|
try {
|
|
@@ -605,6 +611,7 @@ function VersionPill({
|
|
|
605
611
|
" \xB7 ",
|
|
606
612
|
new Date(version.date).toLocaleDateString()
|
|
607
613
|
] }),
|
|
614
|
+
version.heroImageUrl && /* @__PURE__ */ jsx("div", { style: { marginBottom: 12, borderRadius: 8, overflow: "hidden", border: `1px solid ${isLight ? "#e5e5e5" : "#1f1f1f"}` }, children: /* @__PURE__ */ jsx("img", { src: version.heroImageUrl, alt: version.title, style: { width: "100%", display: "block" } }) }),
|
|
608
615
|
version.description && /* @__PURE__ */ jsx("p", { style: { fontSize: 15, color: isLight ? "#52525b" : "#a1a1aa", margin: "0 0 12px 0", lineHeight: 1.6 }, children: version.description }),
|
|
609
616
|
version.features && version.features.length > 0 && /* @__PURE__ */ jsx("ul", { style: { margin: 0, paddingLeft: 0, listStyle: "none" }, children: version.features.map((feature, i) => /* @__PURE__ */ jsxs("li", { style: { display: "flex", alignItems: "flex-start", gap: 10, fontSize: 14, color: isLight ? "#52525b" : "#a1a1aa", marginBottom: 6, lineHeight: 1.5 }, children: [
|
|
610
617
|
/* @__PURE__ */ jsx("span", { style: { color: "#22c55e", fontSize: 14, marginTop: 2 }, children: "\u2713" }),
|
|
@@ -619,7 +626,14 @@ function VersionPill({
|
|
|
619
626
|
flexShrink: 0
|
|
620
627
|
} }),
|
|
621
628
|
task.title
|
|
622
|
-
] }, i)) })
|
|
629
|
+
] }, i)) }),
|
|
630
|
+
version.tags && version.tags.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginTop: 10 }, children: version.tags.map((tag, i) => /* @__PURE__ */ jsx("span", { style: {
|
|
631
|
+
padding: "2px 8px",
|
|
632
|
+
fontSize: 11,
|
|
633
|
+
borderRadius: 999,
|
|
634
|
+
background: isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.08)",
|
|
635
|
+
color: isLight ? "#71717a" : "#a1a1aa"
|
|
636
|
+
}, children: tag }, i)) })
|
|
623
637
|
] }, idx);
|
|
624
638
|
}),
|
|
625
639
|
versionsArray.length > 10 && /* @__PURE__ */ jsx(
|
|
@@ -890,7 +904,7 @@ function VersionPill({
|
|
|
890
904
|
}) })
|
|
891
905
|
] }) }),
|
|
892
906
|
activeTab === "ideas" && /* @__PURE__ */ jsxs("div", { style: { maxWidth: 640, width: "100%", overflowY: "auto", flex: 1 }, children: [
|
|
893
|
-
!showIdeaForm ? /* @__PURE__ */ jsxs(
|
|
907
|
+
allowIdeas && !showIdeaForm ? /* @__PURE__ */ jsxs(
|
|
894
908
|
"button",
|
|
895
909
|
{
|
|
896
910
|
onClick: () => setShowIdeaForm(true),
|
|
@@ -1044,7 +1058,7 @@ function VersionPill({
|
|
|
1044
1058
|
"button",
|
|
1045
1059
|
{
|
|
1046
1060
|
onClick: submitIdea,
|
|
1047
|
-
disabled: submittingIdea || !ideaTitle.trim()
|
|
1061
|
+
disabled: submittingIdea || !ideaTitle.trim(),
|
|
1048
1062
|
style: {
|
|
1049
1063
|
width: "100%",
|
|
1050
1064
|
padding: "10px 16px",
|
|
@@ -1054,8 +1068,8 @@ function VersionPill({
|
|
|
1054
1068
|
color: "#fff",
|
|
1055
1069
|
fontSize: 14,
|
|
1056
1070
|
fontWeight: 500,
|
|
1057
|
-
cursor: submittingIdea || !ideaTitle.trim()
|
|
1058
|
-
opacity: submittingIdea || !ideaTitle.trim()
|
|
1071
|
+
cursor: submittingIdea || !ideaTitle.trim() ? "not-allowed" : "pointer",
|
|
1072
|
+
opacity: submittingIdea || !ideaTitle.trim() ? 0.6 : 1,
|
|
1059
1073
|
transition: "opacity 150ms"
|
|
1060
1074
|
},
|
|
1061
1075
|
children: submittingIdea ? "Submitting..." : "Submit Idea"
|
|
@@ -1118,8 +1132,8 @@ function VersionPill({
|
|
|
1118
1132
|
/* @__PURE__ */ jsxs(
|
|
1119
1133
|
"button",
|
|
1120
1134
|
{
|
|
1121
|
-
onClick: () => voteIdea(idea.id),
|
|
1122
|
-
disabled: hasVoted,
|
|
1135
|
+
onClick: () => allowVoting && voteIdea(idea.id),
|
|
1136
|
+
disabled: hasVoted || !allowVoting,
|
|
1123
1137
|
style: {
|
|
1124
1138
|
display: "flex",
|
|
1125
1139
|
flexDirection: "column",
|