@bahmni/home-app 0.0.1-dev.378 → 0.0.1-dev.380

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