version-pill-react 1.6.1 → 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 CHANGED
@@ -7,6 +7,9 @@ interface Version {
7
7
  description?: string | null;
8
8
  emoji?: string | null;
9
9
  features?: string[];
10
+ tags?: string[];
11
+ isActive?: boolean;
12
+ heroImageUrl?: string | null;
10
13
  date: string | number;
11
14
  tasks?: {
12
15
  title: string;
@@ -31,12 +34,15 @@ interface Idea {
31
34
  status: string;
32
35
  votes: number;
33
36
  hasVoted?: boolean;
37
+ adminResponse?: string | null;
34
38
  }
35
39
  interface ProjectInfo {
36
40
  name: string;
37
41
  slug: string;
38
42
  icon?: string | null;
39
43
  currentVersion?: string | null;
44
+ allowIdeas?: boolean;
45
+ allowVoting?: boolean;
40
46
  }
41
47
  interface ChangelogAPIResponse {
42
48
  project: ProjectInfo;
@@ -58,7 +64,10 @@ interface RoadmapBoardColumn {
58
64
  name: string;
59
65
  }
60
66
  interface RoadmapAPIResponse {
61
- project: ProjectInfo;
67
+ project: ProjectInfo & {
68
+ allowIdeas?: boolean;
69
+ allowVoting?: boolean;
70
+ };
62
71
  columns?: RoadmapBoardColumn[];
63
72
  items?: RoadmapBoardItem[];
64
73
  tasks?: RoadmapTask[] | {
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ interface Version {
7
7
  description?: string | null;
8
8
  emoji?: string | null;
9
9
  features?: string[];
10
+ tags?: string[];
11
+ isActive?: boolean;
12
+ heroImageUrl?: string | null;
10
13
  date: string | number;
11
14
  tasks?: {
12
15
  title: string;
@@ -31,12 +34,15 @@ interface Idea {
31
34
  status: string;
32
35
  votes: number;
33
36
  hasVoted?: boolean;
37
+ adminResponse?: string | null;
34
38
  }
35
39
  interface ProjectInfo {
36
40
  name: string;
37
41
  slug: string;
38
42
  icon?: string | null;
39
43
  currentVersion?: string | null;
44
+ allowIdeas?: boolean;
45
+ allowVoting?: boolean;
40
46
  }
41
47
  interface ChangelogAPIResponse {
42
48
  project: ProjectInfo;
@@ -58,7 +64,10 @@ interface RoadmapBoardColumn {
58
64
  name: string;
59
65
  }
60
66
  interface RoadmapAPIResponse {
61
- project: ProjectInfo;
67
+ project: ProjectInfo & {
68
+ allowIdeas?: boolean;
69
+ allowVoting?: boolean;
70
+ };
62
71
  columns?: RoadmapBoardColumn[];
63
72
  items?: RoadmapBoardItem[];
64
73
  tasks?: RoadmapTask[] | {
package/dist/index.js CHANGED
@@ -154,6 +154,8 @@ function VersionPill({
154
154
  const [ideaAuthorEmail, setIdeaAuthorEmail] = (0, import_react.useState)("");
155
155
  const [submittingIdea, setSubmittingIdea] = (0, import_react.useState)(false);
156
156
  const [ideaSubmitMessage, setIdeaSubmitMessage] = (0, import_react.useState)(null);
157
+ const [allowIdeas, setAllowIdeas] = (0, import_react.useState)(true);
158
+ const [allowVoting, setAllowVoting] = (0, import_react.useState)(true);
157
159
  const [roadmapView, setRoadmapView] = (0, import_react.useState)("board");
158
160
  const [isMobile, setIsMobile] = (0, import_react.useState)(false);
159
161
  const [votedIdeas, setVotedIdeas] = (0, import_react.useState)(/* @__PURE__ */ new Set());
@@ -203,6 +205,10 @@ function VersionPill({
203
205
  const response = await fetch(`${baseUrl}/api/roadmap/${projectId}`);
204
206
  if (!response.ok) return;
205
207
  const data = await response.json();
208
+ if (data.project) {
209
+ setAllowIdeas(data.project.allowIdeas ?? true);
210
+ setAllowVoting(data.project.allowVoting ?? true);
211
+ }
206
212
  if (data.columns && data.items) {
207
213
  setRoadmapColumns(data.columns);
208
214
  setRoadmapItems(data.items);
@@ -255,7 +261,7 @@ function VersionPill({
255
261
  }
256
262
  }, [projectId, baseUrl]);
257
263
  const submitIdea = (0, import_react.useCallback)(async () => {
258
- if (!ideaTitle.trim() || !ideaAuthorEmail.trim()) return;
264
+ if (!ideaTitle.trim()) return;
259
265
  setSubmittingIdea(true);
260
266
  setIdeaSubmitMessage(null);
261
267
  try {
@@ -264,7 +270,7 @@ function VersionPill({
264
270
  headers: { "Content-Type": "application/json" },
265
271
  body: JSON.stringify({
266
272
  title: ideaTitle.trim(),
267
- description: ideaDescription.trim() || void 0,
273
+ description: ideaDescription.trim() || "",
268
274
  authorName: ideaAuthorName.trim() || void 0,
269
275
  authorEmail: ideaAuthorEmail.trim()
270
276
  })
@@ -643,6 +649,7 @@ function VersionPill({
643
649
  " \xB7 ",
644
650
  new Date(version.date).toLocaleDateString()
645
651
  ] }),
652
+ version.heroImageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { marginBottom: 12, borderRadius: 8, overflow: "hidden", border: `1px solid ${isLight ? "#e5e5e5" : "#1f1f1f"}` }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: version.heroImageUrl, alt: version.title, style: { width: "100%", display: "block" } }) }),
646
653
  version.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { fontSize: 15, color: isLight ? "#52525b" : "#a1a1aa", margin: "0 0 12px 0", lineHeight: 1.6 }, children: version.description }),
647
654
  version.features && version.features.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: { margin: 0, paddingLeft: 0, listStyle: "none" }, children: version.features.map((feature, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { style: { display: "flex", alignItems: "flex-start", gap: 10, fontSize: 14, color: isLight ? "#52525b" : "#a1a1aa", marginBottom: 6, lineHeight: 1.5 }, children: [
648
655
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { color: "#22c55e", fontSize: 14, marginTop: 2 }, children: "\u2713" }),
@@ -657,7 +664,14 @@ function VersionPill({
657
664
  flexShrink: 0
658
665
  } }),
659
666
  task.title
660
- ] }, i)) })
667
+ ] }, i)) }),
668
+ version.tags && version.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginTop: 10 }, children: version.tags.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: {
669
+ padding: "2px 8px",
670
+ fontSize: 11,
671
+ borderRadius: 999,
672
+ background: isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.08)",
673
+ color: isLight ? "#71717a" : "#a1a1aa"
674
+ }, children: tag }, i)) })
661
675
  ] }, idx);
662
676
  }),
663
677
  versionsArray.length > 10 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -928,7 +942,7 @@ function VersionPill({
928
942
  }) })
929
943
  ] }) }),
930
944
  activeTab === "ideas" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { maxWidth: 640, width: "100%", overflowY: "auto", flex: 1 }, children: [
931
- !showIdeaForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
945
+ allowIdeas && !showIdeaForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
932
946
  "button",
933
947
  {
934
948
  onClick: () => setShowIdeaForm(true),
@@ -1082,7 +1096,7 @@ function VersionPill({
1082
1096
  "button",
1083
1097
  {
1084
1098
  onClick: submitIdea,
1085
- disabled: submittingIdea || !ideaTitle.trim() || !ideaAuthorEmail.trim(),
1099
+ disabled: submittingIdea || !ideaTitle.trim(),
1086
1100
  style: {
1087
1101
  width: "100%",
1088
1102
  padding: "10px 16px",
@@ -1092,8 +1106,8 @@ function VersionPill({
1092
1106
  color: "#fff",
1093
1107
  fontSize: 14,
1094
1108
  fontWeight: 500,
1095
- cursor: submittingIdea || !ideaTitle.trim() || !ideaAuthorEmail.trim() ? "not-allowed" : "pointer",
1096
- opacity: submittingIdea || !ideaTitle.trim() || !ideaAuthorEmail.trim() ? 0.6 : 1,
1109
+ cursor: submittingIdea || !ideaTitle.trim() ? "not-allowed" : "pointer",
1110
+ opacity: submittingIdea || !ideaTitle.trim() ? 0.6 : 1,
1097
1111
  transition: "opacity 150ms"
1098
1112
  },
1099
1113
  children: submittingIdea ? "Submitting..." : "Submit Idea"
@@ -1156,8 +1170,8 @@ function VersionPill({
1156
1170
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1157
1171
  "button",
1158
1172
  {
1159
- onClick: () => voteIdea(idea.id),
1160
- disabled: hasVoted,
1173
+ onClick: () => allowVoting && voteIdea(idea.id),
1174
+ disabled: hasVoted || !allowVoting,
1161
1175
  style: {
1162
1176
  display: "flex",
1163
1177
  flexDirection: "column",