@principal-ade/code-quality-panels 0.1.3 → 0.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RepositoryQualityGridPanel.d.ts","sourceRoot":"","sources":["../../src/panels/RepositoryQualityGridPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsMpD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+BAAoC,CAAC"}
1
+ {"version":3,"file":"RepositoryQualityGridPanel.d.ts","sourceRoot":"","sources":["../../src/panels/RepositoryQualityGridPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAyXpD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+BAAoC,CAAC"}
@@ -824,7 +824,7 @@ function checkFileExistsInTree(treeData, targetPath) {
824
824
  return filePath.endsWith(normalizedTarget) || filePath === normalizedTarget;
825
825
  });
826
826
  }
827
- const CommandLine = ({ command, theme }) => {
827
+ const CommandLine$1 = ({ command, theme }) => {
828
828
  const [copied, setCopied] = React2__default.useState(false);
829
829
  const handleCopy = async () => {
830
830
  try {
@@ -1026,7 +1026,7 @@ const QualityEmptyState = ({
1026
1026
  }
1027
1027
  ),
1028
1028
  /* @__PURE__ */ jsx(
1029
- CommandLine,
1029
+ CommandLine$1,
1030
1030
  {
1031
1031
  command: "npm install -g @principal-ai/quality-lens-cli",
1032
1032
  theme
@@ -1068,7 +1068,7 @@ const QualityEmptyState = ({
1068
1068
  ]
1069
1069
  }
1070
1070
  ),
1071
- /* @__PURE__ */ jsx(CommandLine, { command: "quality-lens list", theme })
1071
+ /* @__PURE__ */ jsx(CommandLine$1, { command: "quality-lens list", theme })
1072
1072
  ] }),
1073
1073
  /* @__PURE__ */ jsxs("div", { children: [
1074
1074
  /* @__PURE__ */ jsxs(
@@ -1105,7 +1105,7 @@ const QualityEmptyState = ({
1105
1105
  ]
1106
1106
  }
1107
1107
  ),
1108
- /* @__PURE__ */ jsx(CommandLine, { command: "quality-lens init", theme })
1108
+ /* @__PURE__ */ jsx(CommandLine$1, { command: "quality-lens init", theme })
1109
1109
  ] }),
1110
1110
  /* @__PURE__ */ jsxs(
1111
1111
  "div",
@@ -1723,51 +1723,258 @@ function RepositoryQualityGrid({
1723
1723
  }
1724
1724
  );
1725
1725
  }
1726
- const mockRepositories = [
1727
- {
1728
- id: "platform",
1729
- name: "platform",
1730
- packages: [
1731
- {
1732
- name: "@org/core",
1733
- version: "2.0.0",
1734
- metrics: { tests: 94, deadCode: 4, linting: 98, formatting: 100, types: 97, documentation: 90 }
1726
+ const CommandLine = ({ command, theme }) => {
1727
+ const [copied, setCopied] = React2__default.useState(false);
1728
+ const handleCopy = async () => {
1729
+ try {
1730
+ await navigator.clipboard.writeText(command);
1731
+ setCopied(true);
1732
+ setTimeout(() => setCopied(false), 2e3);
1733
+ } catch {
1734
+ console.log("Copy:", command);
1735
+ }
1736
+ };
1737
+ return /* @__PURE__ */ jsxs(
1738
+ "div",
1739
+ {
1740
+ style: {
1741
+ display: "flex",
1742
+ alignItems: "center",
1743
+ justifyContent: "space-between",
1744
+ gap: 12,
1745
+ padding: "10px 14px",
1746
+ borderRadius: 6,
1747
+ backgroundColor: theme.colors.background,
1748
+ border: `1px solid ${theme.colors.border}`,
1749
+ fontFamily: "monospace",
1750
+ fontSize: 13
1735
1751
  },
1736
- {
1737
- name: "@org/ui-components",
1738
- version: "2.0.0",
1739
- metrics: { tests: 85, deadCode: 8, linting: 95, formatting: 98, types: 92, documentation: 80 }
1752
+ children: [
1753
+ /* @__PURE__ */ jsx("code", { style: { color: theme.colors.text }, children: command }),
1754
+ /* @__PURE__ */ jsx(
1755
+ "button",
1756
+ {
1757
+ onClick: handleCopy,
1758
+ style: {
1759
+ display: "flex",
1760
+ alignItems: "center",
1761
+ justifyContent: "center",
1762
+ padding: 4,
1763
+ border: "none",
1764
+ backgroundColor: "transparent",
1765
+ color: theme.colors.textMuted,
1766
+ cursor: "pointer"
1767
+ },
1768
+ title: "Copy command",
1769
+ children: copied ? /* @__PURE__ */ jsx(Check, { size: 16, color: theme.colors.success }) : /* @__PURE__ */ jsx(Copy, { size: 16 })
1770
+ }
1771
+ )
1772
+ ]
1773
+ }
1774
+ );
1775
+ };
1776
+ const RepositoryQualityEmptyState = ({ theme }) => {
1777
+ return /* @__PURE__ */ jsxs(
1778
+ "div",
1779
+ {
1780
+ style: {
1781
+ display: "flex",
1782
+ flexDirection: "column",
1783
+ alignItems: "center",
1784
+ justifyContent: "center",
1785
+ padding: 40,
1786
+ gap: 24,
1787
+ height: "100%",
1788
+ minHeight: 400
1740
1789
  },
1741
- {
1742
- name: "@org/hooks",
1743
- version: "2.0.0",
1744
- metrics: { tests: 88, deadCode: 6, linting: 96, formatting: 100, types: 94, documentation: 85 }
1745
- }
1746
- ]
1747
- },
1748
- {
1749
- id: "backend",
1750
- name: "backend-services",
1751
- packages: [
1752
- {
1753
- name: "backend-services",
1754
- version: "1.5.0",
1755
- metrics: { tests: 80, deadCode: 15, linting: 90, formatting: 95, types: 85, documentation: 72 }
1756
- }
1757
- ]
1758
- },
1759
- {
1760
- id: "docs",
1761
- name: "documentation-site",
1762
- packages: [
1763
- {
1764
- name: "documentation-site",
1765
- version: "1.0.0",
1766
- metrics: { tests: 45, deadCode: 25, linting: 75, formatting: 85, types: 60, documentation: 95 }
1767
- }
1768
- ]
1769
- }
1770
- ];
1790
+ children: [
1791
+ /* @__PURE__ */ jsx(
1792
+ "div",
1793
+ {
1794
+ style: {
1795
+ display: "flex",
1796
+ alignItems: "center",
1797
+ justifyContent: "center",
1798
+ width: 64,
1799
+ height: 64,
1800
+ borderRadius: 16,
1801
+ backgroundColor: theme.colors.surface,
1802
+ border: `1px solid ${theme.colors.border}`
1803
+ },
1804
+ children: /* @__PURE__ */ jsx(Hexagon, { size: 32, color: theme.colors.textMuted })
1805
+ }
1806
+ ),
1807
+ /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", maxWidth: 400 }, children: [
1808
+ /* @__PURE__ */ jsx(
1809
+ "h3",
1810
+ {
1811
+ style: {
1812
+ margin: "0 0 8px 0",
1813
+ fontSize: 18,
1814
+ fontWeight: 600,
1815
+ color: theme.colors.text
1816
+ },
1817
+ children: "No Quality Metrics"
1818
+ }
1819
+ ),
1820
+ /* @__PURE__ */ jsx(
1821
+ "p",
1822
+ {
1823
+ style: {
1824
+ margin: 0,
1825
+ fontSize: 14,
1826
+ color: theme.colors.textMuted,
1827
+ lineHeight: 1.5
1828
+ },
1829
+ children: "Configure the Quality Lens GitHub Action on your repositories to track code quality metrics across your projects."
1830
+ }
1831
+ )
1832
+ ] }),
1833
+ /* @__PURE__ */ jsxs(
1834
+ "div",
1835
+ {
1836
+ style: {
1837
+ display: "flex",
1838
+ flexDirection: "column",
1839
+ gap: 16,
1840
+ padding: 20,
1841
+ borderRadius: 8,
1842
+ backgroundColor: theme.colors.surface,
1843
+ border: `1px solid ${theme.colors.border}`,
1844
+ width: "100%",
1845
+ maxWidth: 400
1846
+ },
1847
+ children: [
1848
+ /* @__PURE__ */ jsxs(
1849
+ "div",
1850
+ {
1851
+ style: {
1852
+ display: "flex",
1853
+ alignItems: "center",
1854
+ gap: 10,
1855
+ marginBottom: 4
1856
+ },
1857
+ children: [
1858
+ /* @__PURE__ */ jsx(Terminal, { size: 20, color: theme.colors.text }),
1859
+ /* @__PURE__ */ jsx(
1860
+ "h4",
1861
+ {
1862
+ style: {
1863
+ margin: 0,
1864
+ fontSize: 15,
1865
+ fontWeight: 600,
1866
+ color: theme.colors.text
1867
+ },
1868
+ children: "Get Started"
1869
+ }
1870
+ )
1871
+ ]
1872
+ }
1873
+ ),
1874
+ /* @__PURE__ */ jsxs("div", { children: [
1875
+ /* @__PURE__ */ jsxs(
1876
+ "div",
1877
+ {
1878
+ style: {
1879
+ display: "flex",
1880
+ alignItems: "center",
1881
+ gap: 8,
1882
+ marginBottom: 8,
1883
+ fontSize: 13,
1884
+ color: theme.colors.textMuted
1885
+ },
1886
+ children: [
1887
+ /* @__PURE__ */ jsx(
1888
+ "span",
1889
+ {
1890
+ style: {
1891
+ display: "flex",
1892
+ alignItems: "center",
1893
+ justifyContent: "center",
1894
+ width: 20,
1895
+ height: 20,
1896
+ borderRadius: "50%",
1897
+ backgroundColor: theme.colors.primary,
1898
+ color: theme.colors.background,
1899
+ fontSize: 11,
1900
+ fontWeight: 600
1901
+ },
1902
+ children: "1"
1903
+ }
1904
+ ),
1905
+ /* @__PURE__ */ jsx("span", { children: "Install the CLI" })
1906
+ ]
1907
+ }
1908
+ ),
1909
+ /* @__PURE__ */ jsx(
1910
+ CommandLine,
1911
+ {
1912
+ command: "npm install -g @principal-ai/quality-lens-cli",
1913
+ theme
1914
+ }
1915
+ )
1916
+ ] }),
1917
+ /* @__PURE__ */ jsxs("div", { children: [
1918
+ /* @__PURE__ */ jsxs(
1919
+ "div",
1920
+ {
1921
+ style: {
1922
+ display: "flex",
1923
+ alignItems: "center",
1924
+ gap: 8,
1925
+ marginBottom: 8,
1926
+ fontSize: 13,
1927
+ color: theme.colors.textMuted
1928
+ },
1929
+ children: [
1930
+ /* @__PURE__ */ jsx(
1931
+ "span",
1932
+ {
1933
+ style: {
1934
+ display: "flex",
1935
+ alignItems: "center",
1936
+ justifyContent: "center",
1937
+ width: 20,
1938
+ height: 20,
1939
+ borderRadius: "50%",
1940
+ backgroundColor: theme.colors.primary,
1941
+ color: theme.colors.background,
1942
+ fontSize: 11,
1943
+ fontWeight: 600
1944
+ },
1945
+ children: "2"
1946
+ }
1947
+ ),
1948
+ /* @__PURE__ */ jsx("span", { children: "Initialize in each repository" })
1949
+ ]
1950
+ }
1951
+ ),
1952
+ /* @__PURE__ */ jsx(CommandLine, { command: "quality-lens init", theme })
1953
+ ] }),
1954
+ /* @__PURE__ */ jsxs(
1955
+ "div",
1956
+ {
1957
+ style: {
1958
+ display: "flex",
1959
+ alignItems: "center",
1960
+ gap: 6,
1961
+ paddingTop: 8,
1962
+ fontSize: 13,
1963
+ color: theme.colors.textMuted
1964
+ },
1965
+ children: [
1966
+ /* @__PURE__ */ jsx(ChevronRight, { size: 14 }),
1967
+ /* @__PURE__ */ jsx("span", { children: "Commit, push, and quality data will appear after CI runs" })
1968
+ ]
1969
+ }
1970
+ )
1971
+ ]
1972
+ }
1973
+ )
1974
+ ]
1975
+ }
1976
+ );
1977
+ };
1771
1978
  const RepositoryQualityGridPanelContent = ({
1772
1979
  context,
1773
1980
  events
@@ -1775,18 +1982,14 @@ const RepositoryQualityGridPanelContent = ({
1775
1982
  var _a;
1776
1983
  const { theme } = useTheme();
1777
1984
  const qualitySlice = context.getSlice("repositoriesQuality");
1778
- const hasQualitySlice = context.hasSlice("repositoriesQuality");
1779
1985
  const isLoading = (qualitySlice == null ? void 0 : qualitySlice.loading) ?? false;
1780
1986
  const repositories = React2__default.useMemo(() => {
1781
1987
  var _a2;
1782
1988
  if ((_a2 = qualitySlice == null ? void 0 : qualitySlice.data) == null ? void 0 : _a2.repositories) {
1783
1989
  return qualitySlice.data.repositories;
1784
1990
  }
1785
- if (hasQualitySlice) {
1786
- return [];
1787
- }
1788
- return mockRepositories;
1789
- }, [(_a = qualitySlice == null ? void 0 : qualitySlice.data) == null ? void 0 : _a.repositories, hasQualitySlice]);
1991
+ return [];
1992
+ }, [(_a = qualitySlice == null ? void 0 : qualitySlice.data) == null ? void 0 : _a.repositories]);
1790
1993
  const handleItemClick = (item) => {
1791
1994
  events.emit({
1792
1995
  type: "principal-ade.repository-quality-grid:item:click",
@@ -1850,17 +2053,7 @@ const RepositoryQualityGridPanelContent = ({
1850
2053
  },
1851
2054
  children: "Loading repository quality metrics..."
1852
2055
  }
1853
- ) : repositories.length === 0 ? /* @__PURE__ */ jsx(
1854
- "div",
1855
- {
1856
- style: {
1857
- padding: 40,
1858
- textAlign: "center",
1859
- color: theme.colors.textMuted
1860
- },
1861
- children: "No repositories with quality metrics found."
1862
- }
1863
- ) : /* @__PURE__ */ jsx(
2056
+ ) : repositories.length === 0 ? /* @__PURE__ */ jsx(RepositoryQualityEmptyState, { theme }) : /* @__PURE__ */ jsx(
1864
2057
  RepositoryQualityGrid,
1865
2058
  {
1866
2059
  repositories,