@fonderie/react-admin-screens 1.3.1 → 1.4.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.cjs CHANGED
@@ -1752,7 +1752,11 @@ function UsersScreen({
1752
1752
  openUserId ? { id: openUserId } : null
1753
1753
  );
1754
1754
  const plans = useSubscriptionIndex(billingClient);
1755
- const list = (0, import_react_admin11.useAdminUsers)(client, { limit: pageSize });
1755
+ const [showDeleted, setShowDeleted] = (0, import_react6.useState)(false);
1756
+ const list = (0, import_react_admin11.useAdminUsers)(client, {
1757
+ limit: pageSize,
1758
+ ...showDeleted ? { deleted: true } : {}
1759
+ });
1756
1760
  const { user, isLoading, error, suspend, unsuspend, revokeSessions } = (0, import_react_admin11.useAdminUser)(
1757
1761
  client,
1758
1762
  selected ?? {}
@@ -1810,7 +1814,35 @@ function UsersScreen({
1810
1814
  disabled: list.isLoading,
1811
1815
  children: "Refresh"
1812
1816
  }
1813
- )
1817
+ ),
1818
+ !selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1819
+ "fieldset",
1820
+ {
1821
+ style: {
1822
+ display: "flex",
1823
+ gap: 6,
1824
+ border: "none",
1825
+ margin: "0 0 0 auto",
1826
+ padding: 0,
1827
+ minWidth: 0
1828
+ },
1829
+ "aria-label": "Which accounts",
1830
+ children: [false, true].map((d) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1831
+ "button",
1832
+ {
1833
+ type: "button",
1834
+ "aria-pressed": showDeleted === d,
1835
+ onClick: () => setShowDeleted(d),
1836
+ style: {
1837
+ ...showDeleted === d ? styles.buttonPrimary : styles.button,
1838
+ height: 28
1839
+ },
1840
+ children: d ? "Deleted" : "Active"
1841
+ },
1842
+ String(d)
1843
+ ))
1844
+ }
1845
+ ) : null
1814
1846
  ]
1815
1847
  }
1816
1848
  ),
@@ -1924,7 +1956,14 @@ function UsersScreen({
1924
1956
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { style: styles.td, children: new Date(user.createdAt).toLocaleString() })
1925
1957
  ] })
1926
1958
  ] }) }),
1927
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
1959
+ user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.notice, marginTop: 12 }, role: "status", children: [
1960
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
1961
+ "Deleted on ",
1962
+ new Date(user.deletedAt).toLocaleString(),
1963
+ "."
1964
+ ] }),
1965
+ " The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
1966
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
1928
1967
  user.suspended ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1929
1968
  "button",
1930
1969
  {
@@ -1965,46 +2004,48 @@ function UsersScreen({
1965
2004
  }
1966
2005
  )
1967
2006
  ] }) : null,
1968
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Live sessions" }),
1969
- sessions.sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: sessions.sessions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
1970
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
1971
- " ",
1972
- (0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
1973
- (0, import_client.describeLocation)(s.location),
1974
- " "
1975
- ] }) : null,
1976
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
1977
- " ",
1978
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
1979
- "since ",
1980
- new Date(s.createdAt).toLocaleString()
1981
- ] })
1982
- ] }, s.id)) }),
1983
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
1984
- history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
1985
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
1986
- " ",
1987
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
1988
- " ",
1989
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
1990
- " ",
1991
- (0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
1992
- e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2007
+ !user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2008
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Live sessions" }),
2009
+ sessions.sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: sessions.sessions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
2010
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
1993
2011
  " ",
1994
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
1995
- ] }) : null,
1996
- " ",
1997
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
1998
- ] }, e.id)) }),
1999
- history.hasMore && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2000
- "button",
2001
- {
2002
- type: "button",
2003
- style: { ...styles.button, marginTop: 8 },
2004
- onClick: () => void history.loadMore(),
2005
- children: "Load more"
2006
- }
2007
- ) : null
2012
+ (0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
2013
+ (0, import_client.describeLocation)(s.location),
2014
+ " "
2015
+ ] }) : null,
2016
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
2017
+ " ",
2018
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
2019
+ "since ",
2020
+ new Date(s.createdAt).toLocaleString()
2021
+ ] })
2022
+ ] }, s.id)) }),
2023
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
2024
+ history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
2025
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
2026
+ " ",
2027
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
2028
+ " ",
2029
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
2030
+ " ",
2031
+ (0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
2032
+ e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2033
+ " ",
2034
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
2035
+ ] }) : null,
2036
+ " ",
2037
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
2038
+ ] }, e.id)) }),
2039
+ history.hasMore && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2040
+ "button",
2041
+ {
2042
+ type: "button",
2043
+ style: { ...styles.button, marginTop: 8 },
2044
+ onClick: () => void history.loadMore(),
2045
+ children: "Load more"
2046
+ }
2047
+ ) : null
2048
+ ] }) : null
2008
2049
  ] }) : null
2009
2050
  ] });
2010
2051
  }