@industry-theme/alexandria-panels 0.1.36 → 0.1.38

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.
@@ -934,9 +934,9 @@ const LocalProjectsPanelContent = ({
934
934
  const [showSearch, setShowSearch] = useState(defaultShowSearch);
935
935
  const [isAdding, setIsAdding] = useState(false);
936
936
  const [isScanning, setIsScanning] = useState(false);
937
+ const [scanStatus, setScanStatus] = useState("");
937
938
  const [selectedEntry, setSelectedEntry] = useState(null);
938
939
  const [windowStates, setWindowStates] = useState(/* @__PURE__ */ new Map());
939
- const [sortByOrg, setSortByOrg] = useState(false);
940
940
  const handleToggleSearch = useCallback(() => {
941
941
  if (defaultShowSearch) return;
942
942
  setShowSearch((prev) => {
@@ -1086,13 +1086,24 @@ const LocalProjectsPanelContent = ({
1086
1086
  };
1087
1087
  const handleScanForRepos = async () => {
1088
1088
  setIsScanning(true);
1089
+ setScanStatus("Scanning for repositories...");
1090
+ const startTime = Date.now();
1091
+ const minDuration = 800;
1089
1092
  try {
1090
1093
  await context.refresh("repository", "alexandriaRepositories");
1094
+ const elapsed = Date.now() - startTime;
1095
+ const remaining = Math.max(0, minDuration - elapsed);
1096
+ const count = discoveredRepositories.length;
1097
+ setScanStatus(count > 0 ? `Found ${count} ${count === 1 ? "repository" : "repositories"}` : "Scan complete");
1091
1098
  events.emit(createPanelEvent$7(`${PANEL_ID$f}:scan-completed`, {
1092
- discoveredCount: discoveredRepositories.length
1099
+ discoveredCount: count
1093
1100
  }));
1101
+ await new Promise((resolve) => setTimeout(resolve, remaining));
1102
+ setTimeout(() => setScanStatus(""), 1500);
1094
1103
  } catch (error) {
1095
1104
  console.error("Failed to scan for repositories:", error);
1105
+ setScanStatus("Scan failed");
1106
+ setTimeout(() => setScanStatus(""), 2e3);
1096
1107
  } finally {
1097
1108
  setIsScanning(false);
1098
1109
  }
@@ -1119,7 +1130,6 @@ const LocalProjectsPanelContent = ({
1119
1130
  return haystack.includes(normalizedFilter);
1120
1131
  });
1121
1132
  return filtered.sort((a, b) => {
1122
- var _a2, _b2;
1123
1133
  if (!a.isDiscovered && b.isDiscovered) return -1;
1124
1134
  if (a.isDiscovered && !b.isDiscovered) return 1;
1125
1135
  if (a.lastOpenedAt && !b.lastOpenedAt) return -1;
@@ -1129,15 +1139,9 @@ const LocalProjectsPanelContent = ({
1129
1139
  const bTime = new Date(b.lastOpenedAt).getTime();
1130
1140
  if (aTime !== bTime) return bTime - aTime;
1131
1141
  }
1132
- if (sortByOrg) {
1133
- const aOrg = (((_a2 = a.github) == null ? void 0 : _a2.owner) ?? "").toLowerCase();
1134
- const bOrg = (((_b2 = b.github) == null ? void 0 : _b2.owner) ?? "").toLowerCase();
1135
- const orgCompare = aOrg.localeCompare(bOrg);
1136
- if (orgCompare !== 0) return orgCompare;
1137
- }
1138
1142
  return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
1139
1143
  });
1140
- }, [allRepositories, normalizedFilter, sortByOrg]);
1144
+ }, [allRepositories, normalizedFilter]);
1141
1145
  const baseContainerStyle = {
1142
1146
  display: "flex",
1143
1147
  flexDirection: "column",
@@ -1272,29 +1276,21 @@ const LocalProjectsPanelContent = ({
1272
1276
  }
1273
1277
  )
1274
1278
  ] }),
1279
+ scanStatus && /* @__PURE__ */ jsx(
1280
+ "div",
1281
+ {
1282
+ style: {
1283
+ padding: "0 12px",
1284
+ fontSize: `${theme.fontSizes[1]}px`,
1285
+ color: theme.colors.textSecondary,
1286
+ fontFamily: theme.fonts.body,
1287
+ whiteSpace: "nowrap",
1288
+ fontStyle: "italic"
1289
+ },
1290
+ children: scanStatus
1291
+ }
1292
+ ),
1275
1293
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0" }, children: [
1276
- /* @__PURE__ */ jsx(
1277
- "button",
1278
- {
1279
- onClick: () => setSortByOrg(!sortByOrg),
1280
- title: sortByOrg ? "Sort by: Last opened, then organization" : "Sort by: Last opened, then name",
1281
- style: {
1282
- padding: "0 12px",
1283
- height: "40px",
1284
- borderRadius: "0",
1285
- border: "none",
1286
- backgroundColor: theme.colors.backgroundSecondary,
1287
- color: sortByOrg ? theme.colors.primary : theme.colors.textSecondary,
1288
- cursor: "pointer",
1289
- display: "flex",
1290
- alignItems: "center",
1291
- justifyContent: "center",
1292
- transition: "all 0.15s",
1293
- flexShrink: 0
1294
- },
1295
- children: sortByOrg ? /* @__PURE__ */ jsx(Building2, { size: 16 }) : /* @__PURE__ */ jsx(FolderGit2, { size: 16 })
1296
- }
1297
- ),
1298
1294
  /* @__PURE__ */ jsx(
1299
1295
  "button",
1300
1296
  {
@@ -1392,6 +1388,19 @@ const LocalProjectsPanelContent = ({
1392
1388
  },
1393
1389
  children: allRepositories.length
1394
1390
  }
1391
+ ),
1392
+ scanStatus && /* @__PURE__ */ jsx(
1393
+ "span",
1394
+ {
1395
+ style: {
1396
+ fontSize: `${theme.fontSizes[1]}px`,
1397
+ color: theme.colors.textSecondary,
1398
+ paddingLeft: "12px",
1399
+ fontFamily: theme.fonts.body,
1400
+ fontStyle: "italic"
1401
+ },
1402
+ children: scanStatus
1403
+ }
1395
1404
  )
1396
1405
  ] }),
1397
1406
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0" }, children: [
@@ -1417,28 +1426,6 @@ const LocalProjectsPanelContent = ({
1417
1426
  children: /* @__PURE__ */ jsx(Search, { size: 16 })
1418
1427
  }
1419
1428
  ),
1420
- /* @__PURE__ */ jsx(
1421
- "button",
1422
- {
1423
- onClick: () => setSortByOrg(!sortByOrg),
1424
- title: sortByOrg ? "Sort by: Last opened, then organization" : "Sort by: Last opened, then name",
1425
- style: {
1426
- padding: "0 12px",
1427
- height: "40px",
1428
- borderRadius: "0",
1429
- border: "none",
1430
- backgroundColor: theme.colors.backgroundSecondary,
1431
- color: sortByOrg ? theme.colors.primary : theme.colors.textSecondary,
1432
- cursor: "pointer",
1433
- display: "flex",
1434
- alignItems: "center",
1435
- justifyContent: "center",
1436
- transition: "all 0.15s",
1437
- flexShrink: 0
1438
- },
1439
- children: sortByOrg ? /* @__PURE__ */ jsx(Building2, { size: 16 }) : /* @__PURE__ */ jsx(FolderGit2, { size: 16 })
1440
- }
1441
- ),
1442
1429
  /* @__PURE__ */ jsx(
1443
1430
  "button",
1444
1431
  {