@bahmni/home-app 0.0.1-dev.424 → 0.0.1-dev.425

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,111 +0,0 @@
1
- import { jsxs as c, jsx as e, Fragment as b } from "react/jsx-runtime";
2
- import { u as m, W as p, N as y, o as N, r as H, e as E, t as P, x as v, G, I as f, J as L, $ as O, K as S } from "./index-BvDaGccW.js";
3
- import "react";
4
- import { useQuery as T } from "@tanstack/react-query";
5
- const C = "AppTile-module_tile__-CBFh", B = "AppTile-module_label__6vslD", A = "AppTile-module_bottom__lcJiG", d = {
6
- tile: C,
7
- label: B,
8
- bottom: A
9
- }, M = ({ id: o, label: n, icon: s, url: l }) => {
10
- const { t } = m(), i = t(n);
11
- return /* @__PURE__ */ c(
12
- p,
13
- {
14
- href: l,
15
- className: d.tile,
16
- "aria-label": i,
17
- testId: `app-tile-${o}`,
18
- children: [
19
- /* @__PURE__ */ e("h2", { className: d.label, "aria-hidden": "true", children: i }),
20
- /* @__PURE__ */ c("div", { className: d.bottom, children: [
21
- /* @__PURE__ */ e(y, { name: s, id: o, size: N.X2, "aria-hidden": "true" }),
22
- /* @__PURE__ */ e(H, { size: 20, "aria-hidden": "true" })
23
- ] })
24
- ]
25
- }
26
- );
27
- }, x = "HomePageGrid-module_container__Kxfim", K = "HomePageGrid-module_tileGrid__X6-Bm", $ = "HomePageGrid-module_skeletonTile__U-1vu", k = "HomePageGrid-module_emptyState__xEwoK", F = "HomePageGrid-module_errorContainer__IKR3E", r = {
28
- container: x,
29
- tileGrid: K,
30
- skeletonTile: $,
31
- emptyState: k,
32
- errorContainer: F
33
- }, I = () => {
34
- const { t: o } = m(), {
35
- userPrivileges: n,
36
- isLoading: s,
37
- error: l
38
- } = E(), t = n?.map((a) => a.name) ?? null, {
39
- data: i = [],
40
- isLoading: u,
41
- isError: _,
42
- refetch: h
43
- } = T({
44
- queryKey: ["home-modules", t],
45
- queryFn: () => P("org.bahmni.home.dashboard", t),
46
- enabled: !s && l === null && t !== null
47
- });
48
- return s || u || t === null && !l ? /* @__PURE__ */ e(
49
- "div",
50
- {
51
- className: r.container,
52
- role: "status",
53
- "aria-label": o("HOME_LOADING_MODULES"),
54
- "aria-busy": "true",
55
- children: /* @__PURE__ */ e("div", { className: r.tileGrid, children: Array.from(
56
- { length: v },
57
- (a, g) => `skeleton-${g}`
58
- ).map((a) => /* @__PURE__ */ e(G, { className: r.skeletonTile }, a)) })
59
- }
60
- ) : l || _ ? /* @__PURE__ */ e(
61
- "div",
62
- {
63
- className: r.errorContainer,
64
- "data-testid": "home-error",
65
- role: "alert",
66
- children: /* @__PURE__ */ e(
67
- f,
68
- {
69
- kind: "error",
70
- lowContrast: !0,
71
- subtitle: o("HOME_ERROR_FETCH_CONFIG"),
72
- hideCloseButton: !1,
73
- onClose: () => void h()
74
- }
75
- )
76
- }
77
- ) : i.length === 0 ? /* @__PURE__ */ e("div", { className: r.emptyState, role: "status", children: o("HOME_NO_MODULES") }) : /* @__PURE__ */ e("div", { className: r.container, children: /* @__PURE__ */ e("div", { className: r.tileGrid, children: i.map((a) => /* @__PURE__ */ e(
78
- M,
79
- {
80
- id: a.id,
81
- label: a.translationKey ?? a.label,
82
- icon: a.icon,
83
- url: a.url
84
- },
85
- a.id
86
- )) }) });
87
- }, D = "HomePageHeader-module_locationSelector__foYmn", R = {
88
- locationSelector: D
89
- }, U = () => {
90
- const { t: o } = m();
91
- return /* @__PURE__ */ e(
92
- L,
93
- {
94
- ariaLabel: "Bahmni",
95
- brandPrefix: o("HOME_LABEL"),
96
- brandHref: "/",
97
- globalFeatures: [
98
- /* @__PURE__ */ e("div", { className: R.locationSelector, children: /* @__PURE__ */ e(S, {}) }, "location")
99
- ],
100
- userMenu: /* @__PURE__ */ e(O, {})
101
- }
102
- );
103
- }, j = "HomePage-module_homePageBody__0qtrS", q = {
104
- homePageBody: j
105
- }, X = () => /* @__PURE__ */ c(b, { children: [
106
- /* @__PURE__ */ e(U, {}),
107
- /* @__PURE__ */ e("main", { className: q.homePageBody, children: /* @__PURE__ */ e(I, {}) })
108
- ] });
109
- export {
110
- X as HomePage
111
- };