@archiva/archiva-nextjs 0.1.9 → 0.2.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.
@@ -79,11 +79,11 @@ function formatTimestamp(timestamp, format = "default") {
79
79
  });
80
80
  }
81
81
  function eventToTimelineItem(event, getActorAvatar) {
82
- const actorId = event.actorId || "unknown";
83
- const userName = actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId;
84
- const userHandle = userName;
82
+ const actorId = event.actorId;
83
+ const userName = actorId ? actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId : "Unknown Actor";
84
+ const userHandle = actorId || "unknown";
85
85
  const initials = userName.charAt(0).toUpperCase();
86
- const actorAvatarOrIcon = getActorAvatar ? getActorAvatar(actorId) : void 0;
86
+ const actorAvatarOrIcon = actorId && getActorAvatar ? getActorAvatar(actorId) : void 0;
87
87
  let actorAvatar = void 0;
88
88
  let actorIcon = void 0;
89
89
  if (typeof actorAvatarOrIcon === "string") {
@@ -91,7 +91,7 @@ function eventToTimelineItem(event, getActorAvatar) {
91
91
  } else if (actorAvatarOrIcon) {
92
92
  actorIcon = actorAvatarOrIcon;
93
93
  }
94
- if (!actorAvatar && !actorIcon) {
94
+ if (!actorAvatar && !actorIcon && actorId) {
95
95
  actorAvatar = "https://www.gravatar.com/avatar?d=mp";
96
96
  }
97
97
  const action = event.action.charAt(0).toUpperCase() + event.action.slice(1);
@@ -383,8 +383,8 @@ function Timeline({
383
383
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { flex: 1, minWidth: 0 }, children: useActivityLayout ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "start", justifyContent: "space-between", gap: "1rem" }, children: [
384
384
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
385
385
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
386
- item.actorDisplay && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.actorDisplay }),
387
- item.userHandle && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontSize: "0.75rem", color: "#6b7280" }, children: [
386
+ item.actorDisplay ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.actorDisplay }) : item.userName ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.userName }) : null,
387
+ item.userHandle && item.userHandle !== "unknown" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontSize: "0.75rem", color: "#6b7280" }, children: [
388
388
  "@",
389
389
  item.userHandle.toLowerCase()
390
390
  ] })
@@ -34,11 +34,11 @@ function formatTimestamp(timestamp, format = "default") {
34
34
  });
35
35
  }
36
36
  function eventToTimelineItem(event, getActorAvatar) {
37
- const actorId = event.actorId || "unknown";
38
- const userName = actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId;
39
- const userHandle = userName;
37
+ const actorId = event.actorId;
38
+ const userName = actorId ? actorId.includes(":") ? actorId.split(":")[1] || actorId : actorId : "Unknown Actor";
39
+ const userHandle = actorId || "unknown";
40
40
  const initials = userName.charAt(0).toUpperCase();
41
- const actorAvatarOrIcon = getActorAvatar ? getActorAvatar(actorId) : void 0;
41
+ const actorAvatarOrIcon = actorId && getActorAvatar ? getActorAvatar(actorId) : void 0;
42
42
  let actorAvatar = void 0;
43
43
  let actorIcon = void 0;
44
44
  if (typeof actorAvatarOrIcon === "string") {
@@ -46,7 +46,7 @@ function eventToTimelineItem(event, getActorAvatar) {
46
46
  } else if (actorAvatarOrIcon) {
47
47
  actorIcon = actorAvatarOrIcon;
48
48
  }
49
- if (!actorAvatar && !actorIcon) {
49
+ if (!actorAvatar && !actorIcon && actorId) {
50
50
  actorAvatar = "https://www.gravatar.com/avatar?d=mp";
51
51
  }
52
52
  const action = event.action.charAt(0).toUpperCase() + event.action.slice(1);
@@ -338,8 +338,8 @@ function Timeline({
338
338
  /* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: 0 }, children: useActivityLayout ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "start", justifyContent: "space-between", gap: "1rem" }, children: [
339
339
  /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
340
340
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
341
- item.actorDisplay && /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.actorDisplay }),
342
- item.userHandle && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.75rem", color: "#6b7280" }, children: [
341
+ item.actorDisplay ? /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.actorDisplay }) : item.userName ? /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: item.userName }) : null,
342
+ item.userHandle && item.userHandle !== "unknown" && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.75rem", color: "#6b7280" }, children: [
343
343
  "@",
344
344
  item.userHandle.toLowerCase()
345
345
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archiva/archiva-nextjs",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Archiva Next.js SDK - Server Actions and Timeline Component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",