version-pill-react 1.5.1 → 1.6.1

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.js CHANGED
@@ -255,7 +255,7 @@ function VersionPill({
255
255
  }
256
256
  }, [projectId, baseUrl]);
257
257
  const submitIdea = (0, import_react.useCallback)(async () => {
258
- if (!ideaTitle.trim()) return;
258
+ if (!ideaTitle.trim() || !ideaAuthorEmail.trim()) return;
259
259
  setSubmittingIdea(true);
260
260
  setIdeaSubmitMessage(null);
261
261
  try {
@@ -266,7 +266,7 @@ function VersionPill({
266
266
  title: ideaTitle.trim(),
267
267
  description: ideaDescription.trim() || void 0,
268
268
  authorName: ideaAuthorName.trim() || void 0,
269
- authorEmail: ideaAuthorEmail.trim() || void 0
269
+ authorEmail: ideaAuthorEmail.trim()
270
270
  })
271
271
  });
272
272
  if (!response.ok) {
@@ -276,6 +276,8 @@ function VersionPill({
276
276
  setIdeaSubmitMessage({ type: "success", text: "Thanks! Your idea has been submitted." });
277
277
  setIdeaTitle("");
278
278
  setIdeaDescription("");
279
+ setIdeaAuthorName("");
280
+ setIdeaAuthorEmail("");
279
281
  setShowIdeaForm(false);
280
282
  fetchIdeas();
281
283
  } catch (err) {
@@ -289,10 +291,9 @@ function VersionPill({
289
291
  setIdeas((prev) => prev.map((i) => i.id === ideaId ? { ...i, votes: i.votes + 1 } : i));
290
292
  setVotedIdeas((prev) => new Set(prev).add(ideaId));
291
293
  try {
292
- await fetch(`${baseUrl}/api/ideas/${projectId}/vote`, {
294
+ await fetch(`${baseUrl}/api/vote/${ideaId}`, {
293
295
  method: "POST",
294
- headers: { "Content-Type": "application/json" },
295
- body: JSON.stringify({ ideaId })
296
+ headers: { "Content-Type": "application/json" }
296
297
  });
297
298
  } catch {
298
299
  setIdeas((prev) => prev.map((i) => i.id === ideaId ? { ...i, votes: i.votes - 1 } : i));
@@ -940,24 +941,22 @@ function VersionPill({
940
941
  padding: "12px 16px",
941
942
  marginBottom: 20,
942
943
  borderRadius: 999,
943
- border: `1px dashed ${isLight ? "#d4d4d8" : "#3f3f46"}`,
944
- background: "transparent",
945
- color: isLight ? "#71717a" : "#a1a1aa",
944
+ border: `1px solid ${isLight ? "#22c55e" : "rgba(34,197,94,0.4)"}`,
945
+ background: isLight ? "rgba(34,197,94,0.05)" : "rgba(34,197,94,0.08)",
946
+ color: "#22c55e",
946
947
  fontSize: 14,
947
948
  fontWeight: 500,
948
949
  cursor: "pointer",
949
950
  transition: "all 150ms"
950
951
  },
951
952
  onMouseEnter: (e) => {
952
- e.currentTarget.style.borderColor = isLight ? "#a1a1aa" : "#71717a";
953
- e.currentTarget.style.color = isLight ? "#52525b" : "#d4d4d8";
953
+ e.currentTarget.style.background = isLight ? "rgba(34,197,94,0.1)" : "rgba(34,197,94,0.15)";
954
954
  },
955
955
  onMouseLeave: (e) => {
956
- e.currentTarget.style.borderColor = isLight ? "#d4d4d8" : "#3f3f46";
957
- e.currentTarget.style.color = isLight ? "#71717a" : "#a1a1aa";
956
+ e.currentTarget.style.background = isLight ? "rgba(34,197,94,0.05)" : "rgba(34,197,94,0.08)";
958
957
  },
959
958
  children: [
960
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: 18 }, children: "\u{1F4A1}" }),
959
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: 16 }, children: "\u{1F4A1}" }),
961
960
  "Suggest a feature"
962
961
  ]
963
962
  }
@@ -968,12 +967,12 @@ function VersionPill({
968
967
  padding: 16,
969
968
  marginBottom: 20,
970
969
  borderRadius: 12,
971
- background: isLight ? "#f5f5f5" : "#151515",
970
+ background: isLight ? "#f9fafb" : "#151515",
972
971
  border: `1px solid ${isLight ? "#e5e5e5" : "#1f1f1f"}`
973
972
  },
974
973
  children: [
975
974
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 12 }, children: [
976
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontWeight: 600, color: isLight ? "#18181b" : "#fff" }, children: "Suggest a Feature" }),
975
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontWeight: 600, fontSize: 15, color: isLight ? "#18181b" : "#fff" }, children: "Suggest a Feature" }),
977
976
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
978
977
  "button",
979
978
  {
@@ -981,13 +980,7 @@ function VersionPill({
981
980
  setShowIdeaForm(false);
982
981
  setIdeaSubmitMessage(null);
983
982
  },
984
- style: {
985
- background: "transparent",
986
- border: "none",
987
- color: isLight ? "#71717a" : "#a1a1aa",
988
- cursor: "pointer",
989
- fontSize: 18
990
- },
983
+ style: { background: "transparent", border: "none", color: isLight ? "#71717a" : "#a1a1aa", cursor: "pointer", fontSize: 18 },
991
984
  children: "\xD7"
992
985
  }
993
986
  )
@@ -1003,7 +996,7 @@ function VersionPill({
1003
996
  width: "100%",
1004
997
  padding: "10px 12px",
1005
998
  marginBottom: 8,
1006
- borderRadius: 6,
999
+ borderRadius: 8,
1007
1000
  border: `1px solid ${isLight ? "#e5e5e5" : "#2a2a2a"}`,
1008
1001
  background: isLight ? "#fff" : "#0a0a0a",
1009
1002
  color: isLight ? "#18181b" : "#fff",
@@ -1024,7 +1017,7 @@ function VersionPill({
1024
1017
  width: "100%",
1025
1018
  padding: "10px 12px",
1026
1019
  marginBottom: 8,
1027
- borderRadius: 6,
1020
+ borderRadius: 8,
1028
1021
  border: `1px solid ${isLight ? "#e5e5e5" : "#2a2a2a"}`,
1029
1022
  background: isLight ? "#fff" : "#0a0a0a",
1030
1023
  color: isLight ? "#18181b" : "#fff",
@@ -1042,11 +1035,11 @@ function VersionPill({
1042
1035
  type: "text",
1043
1036
  value: ideaAuthorName,
1044
1037
  onChange: (e) => setIdeaAuthorName(e.target.value),
1045
- placeholder: "Name (optional)",
1038
+ placeholder: "Your name",
1046
1039
  style: {
1047
1040
  width: "100%",
1048
1041
  padding: "8px 12px",
1049
- borderRadius: 6,
1042
+ borderRadius: 8,
1050
1043
  border: `1px solid ${isLight ? "#e5e5e5" : "#2a2a2a"}`,
1051
1044
  background: isLight ? "#fff" : "#0a0a0a",
1052
1045
  color: isLight ? "#18181b" : "#fff",
@@ -1066,7 +1059,7 @@ function VersionPill({
1066
1059
  style: {
1067
1060
  width: "100%",
1068
1061
  padding: "8px 12px",
1069
- borderRadius: 6,
1062
+ borderRadius: 8,
1070
1063
  border: `1px solid ${isLight ? "#e5e5e5" : "#2a2a2a"}`,
1071
1064
  background: isLight ? "#fff" : "#0a0a0a",
1072
1065
  color: isLight ? "#18181b" : "#fff",
@@ -1080,7 +1073,7 @@ function VersionPill({
1080
1073
  ideaSubmitMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
1081
1074
  padding: "8px 12px",
1082
1075
  marginBottom: 12,
1083
- borderRadius: 6,
1076
+ borderRadius: 8,
1084
1077
  background: ideaSubmitMessage.type === "success" ? isLight ? "#dcfce7" : "#14532d" : isLight ? "#fee2e2" : "#450a0a",
1085
1078
  color: ideaSubmitMessage.type === "success" ? isLight ? "#166534" : "#86efac" : isLight ? "#dc2626" : "#fca5a5",
1086
1079
  fontSize: 13
@@ -1109,26 +1102,10 @@ function VersionPill({
1109
1102
  ]
1110
1103
  }
1111
1104
  ),
1112
- ideasArray.length === 0 && !showIdeaForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: "center", padding: 60, color: isLight ? "#71717a" : "#a1a1aa" }, children: [
1105
+ ideasArray.length === 0 && !showIdeaForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: 60, color: isLight ? "#71717a" : "#a1a1aa" }, children: [
1113
1106
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", style: { marginBottom: 12, opacity: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" }) }),
1114
1107
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 16, fontWeight: 500, marginBottom: 8 }, children: "No feature requests yet" }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1116
- "button",
1117
- {
1118
- onClick: () => setShowIdeaForm(true),
1119
- style: {
1120
- padding: "8px 20px",
1121
- borderRadius: 999,
1122
- border: "none",
1123
- background: "#22c55e",
1124
- color: "#fff",
1125
- fontSize: 14,
1126
- fontWeight: 500,
1127
- cursor: "pointer"
1128
- },
1129
- children: "Suggest a feature"
1130
- }
1131
- )
1108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 13, color: isLight ? "#a1a1aa" : "#525252" }, children: "Be the first to suggest one!" })
1132
1109
  ] }) : (() => {
1133
1110
  const statusOrder = ["under review", "planned", "in progress", "new", "shipped"];
1134
1111
  const grouped = {};