@serhii.olishevskyi/docs 1.2.23 → 1.2.25
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/{UserPopoverComponent-RAEPOSIE.mjs → UserPopoverComponent-VFSZ5ZO2.mjs} +1 -1
- package/dist/index.d.mts +94 -114
- package/dist/index.d.ts +94 -114
- package/dist/index.js +1881 -1914
- package/dist/index.mjs +1798 -1860
- package/package.json +1 -1
- package/dist/{chunk-4NEOJ5KZ.mjs → chunk-VFNVP7VE.mjs} +1 -1
package/dist/index.js
CHANGED
|
@@ -1539,15 +1539,15 @@ var init_TranslatableTooltipComponent = __esm({
|
|
|
1539
1539
|
});
|
|
1540
1540
|
|
|
1541
1541
|
// src/context/LocalizationProvider.tsx
|
|
1542
|
-
var
|
|
1542
|
+
var import_react11, import_react_i18next4, import_moment_with_locales, import_jsx_runtime12, DEFAULT_DATETIME_FORMATS, DEFAULT_DATE_FORMATS, DEFAULT_TIME_FORMATS, LocalizationContext, LocalizationProvider, useLocalization;
|
|
1543
1543
|
var init_LocalizationProvider = __esm({
|
|
1544
1544
|
"src/context/LocalizationProvider.tsx"() {
|
|
1545
1545
|
"use strict";
|
|
1546
|
-
|
|
1546
|
+
import_react11 = require("react");
|
|
1547
1547
|
import_react_i18next4 = require("react-i18next");
|
|
1548
1548
|
import_moment_with_locales = __toESM(require("moment/min/moment-with-locales"));
|
|
1549
1549
|
init_SupabaseProvider();
|
|
1550
|
-
|
|
1550
|
+
import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1551
1551
|
DEFAULT_DATETIME_FORMATS = {
|
|
1552
1552
|
uk: "DD.MM.YYYY, HH:mm",
|
|
1553
1553
|
de: "DD.MM.YYYY, HH:mm",
|
|
@@ -1572,14 +1572,14 @@ var init_LocalizationProvider = __esm({
|
|
|
1572
1572
|
fr: "HH:mm:ss",
|
|
1573
1573
|
it: "HH:mm:ss"
|
|
1574
1574
|
};
|
|
1575
|
-
LocalizationContext = (0,
|
|
1575
|
+
LocalizationContext = (0, import_react11.createContext)(void 0);
|
|
1576
1576
|
LocalizationProvider = ({ children }) => {
|
|
1577
1577
|
const supabase = useSupabase();
|
|
1578
1578
|
const { i18n: i18n2 } = (0, import_react_i18next4.useTranslation)();
|
|
1579
|
-
const [languages, setLanguages] = (0,
|
|
1580
|
-
const [isLoadingLangs, setIsLoadingLangs] = (0,
|
|
1581
|
-
const [languagesError, setLanguagesError] = (0,
|
|
1582
|
-
(0,
|
|
1579
|
+
const [languages, setLanguages] = (0, import_react11.useState)([]);
|
|
1580
|
+
const [isLoadingLangs, setIsLoadingLangs] = (0, import_react11.useState)(true);
|
|
1581
|
+
const [languagesError, setLanguagesError] = (0, import_react11.useState)(null);
|
|
1582
|
+
(0, import_react11.useEffect)(() => {
|
|
1583
1583
|
let isMounted = true;
|
|
1584
1584
|
const fetchLanguages = async () => {
|
|
1585
1585
|
try {
|
|
@@ -1641,7 +1641,7 @@ var init_LocalizationProvider = __esm({
|
|
|
1641
1641
|
const changeLanguage = async (lang) => {
|
|
1642
1642
|
await i18n2.changeLanguage(lang);
|
|
1643
1643
|
};
|
|
1644
|
-
const value = (0,
|
|
1644
|
+
const value = (0, import_react11.useMemo)(
|
|
1645
1645
|
() => ({
|
|
1646
1646
|
currentLang,
|
|
1647
1647
|
languages,
|
|
@@ -1658,10 +1658,10 @@ var init_LocalizationProvider = __esm({
|
|
|
1658
1658
|
}),
|
|
1659
1659
|
[currentLang, languages, isLoadingLangs, languagesError]
|
|
1660
1660
|
);
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
1661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LocalizationContext.Provider, { value, children });
|
|
1662
1662
|
};
|
|
1663
1663
|
useLocalization = () => {
|
|
1664
|
-
const context = (0,
|
|
1664
|
+
const context = (0, import_react11.useContext)(LocalizationContext);
|
|
1665
1665
|
if (!context) {
|
|
1666
1666
|
throw new Error("useLocalization must be used within a LocalizationProvider");
|
|
1667
1667
|
}
|
|
@@ -1671,15 +1671,15 @@ var init_LocalizationProvider = __esm({
|
|
|
1671
1671
|
});
|
|
1672
1672
|
|
|
1673
1673
|
// src/context/ThemeProvider.tsx
|
|
1674
|
-
var
|
|
1674
|
+
var import_react12, import_material6, import_jsx_runtime13, DEFAULT_LIGHT_COLORS, DEFAULT_DARK_COLORS, INITIAL_THEME_CONFIG, buildMuiTheme, ThemeContext, THEME_STORAGE_KEY, THEME_MODE_STORAGE_KEY, ThemeProvider, useAppTheme;
|
|
1675
1675
|
var init_ThemeProvider = __esm({
|
|
1676
1676
|
"src/context/ThemeProvider.tsx"() {
|
|
1677
1677
|
"use strict";
|
|
1678
|
-
|
|
1679
|
-
|
|
1678
|
+
import_react12 = require("react");
|
|
1679
|
+
import_material6 = require("@mui/material");
|
|
1680
1680
|
init_AuthProvider();
|
|
1681
1681
|
init_SupabaseProvider();
|
|
1682
|
-
|
|
1682
|
+
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1683
1683
|
DEFAULT_LIGHT_COLORS = {
|
|
1684
1684
|
primary: "#1976d2",
|
|
1685
1685
|
secondary: "#9c27b0",
|
|
@@ -1724,7 +1724,7 @@ var init_ThemeProvider = __esm({
|
|
|
1724
1724
|
buildMuiTheme = (config) => {
|
|
1725
1725
|
const currentMode = config.mode;
|
|
1726
1726
|
const currentColors = config.colors?.[currentMode] || (currentMode === "light" ? DEFAULT_LIGHT_COLORS : DEFAULT_DARK_COLORS);
|
|
1727
|
-
return (0,
|
|
1727
|
+
return (0, import_material6.createTheme)({
|
|
1728
1728
|
palette: {
|
|
1729
1729
|
mode: currentMode,
|
|
1730
1730
|
primary: {
|
|
@@ -1809,14 +1809,14 @@ var init_ThemeProvider = __esm({
|
|
|
1809
1809
|
}
|
|
1810
1810
|
});
|
|
1811
1811
|
};
|
|
1812
|
-
ThemeContext = (0,
|
|
1812
|
+
ThemeContext = (0, import_react12.createContext)(void 0);
|
|
1813
1813
|
THEME_STORAGE_KEY = "docsua_custom_theme_config";
|
|
1814
1814
|
THEME_MODE_STORAGE_KEY = "docsua_custom_theme_mode";
|
|
1815
1815
|
ThemeProvider = ({ children }) => {
|
|
1816
1816
|
const supabase = useSupabase();
|
|
1817
1817
|
const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
|
|
1818
1818
|
const userId = user?.id;
|
|
1819
|
-
const [themeConfig, setThemeConfig] = (0,
|
|
1819
|
+
const [themeConfig, setThemeConfig] = (0, import_react12.useState)(() => {
|
|
1820
1820
|
const saved = localStorage.getItem(THEME_STORAGE_KEY);
|
|
1821
1821
|
if (saved) {
|
|
1822
1822
|
try {
|
|
@@ -1826,7 +1826,7 @@ var init_ThemeProvider = __esm({
|
|
|
1826
1826
|
}
|
|
1827
1827
|
return INITIAL_THEME_CONFIG;
|
|
1828
1828
|
});
|
|
1829
|
-
(0,
|
|
1829
|
+
(0, import_react12.useEffect)(() => {
|
|
1830
1830
|
if (isAuthLoading) return;
|
|
1831
1831
|
if (isAuthenticated && userId) {
|
|
1832
1832
|
const fetchActiveTheme = async () => {
|
|
@@ -1860,7 +1860,7 @@ var init_ThemeProvider = __esm({
|
|
|
1860
1860
|
localStorage.removeItem(THEME_MODE_STORAGE_KEY);
|
|
1861
1861
|
}
|
|
1862
1862
|
}, [isAuthenticated, isAuthLoading, userId]);
|
|
1863
|
-
(0,
|
|
1863
|
+
(0, import_react12.useEffect)(() => {
|
|
1864
1864
|
if (isAuthenticated) {
|
|
1865
1865
|
localStorage.setItem(THEME_STORAGE_KEY, JSON.stringify(themeConfig));
|
|
1866
1866
|
localStorage.setItem(THEME_MODE_STORAGE_KEY, themeConfig.mode);
|
|
@@ -1873,21 +1873,21 @@ var init_ThemeProvider = __esm({
|
|
|
1873
1873
|
const toggleTheme = () => {
|
|
1874
1874
|
setMode(mode === "light" ? "dark" : "light");
|
|
1875
1875
|
};
|
|
1876
|
-
const theme = (0,
|
|
1876
|
+
const theme = (0, import_react12.useMemo)(() => buildMuiTheme(themeConfig), [themeConfig]);
|
|
1877
1877
|
const displayState = {
|
|
1878
|
-
isMobile: (0,
|
|
1879
|
-
isTablet: (0,
|
|
1880
|
-
isDesktop: (0,
|
|
1881
|
-
isWideDesktop: (0,
|
|
1882
|
-
isSuperWideDesktop: (0,
|
|
1878
|
+
isMobile: (0, import_material6.useMediaQuery)(theme.breakpoints.down("sm")),
|
|
1879
|
+
isTablet: (0, import_material6.useMediaQuery)(theme.breakpoints.between("sm", "md")),
|
|
1880
|
+
isDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.between("md", "lg")),
|
|
1881
|
+
isWideDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.between("lg", "xl")),
|
|
1882
|
+
isSuperWideDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.up("xl"))
|
|
1883
1883
|
};
|
|
1884
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ThemeContext.Provider, { value: { mode, toggleTheme, setMode, theme, themeConfig, setThemeConfig, displayState }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material6.ThemeProvider, { theme, children: [
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material6.CssBaseline, {}),
|
|
1886
1886
|
children
|
|
1887
1887
|
] }) });
|
|
1888
1888
|
};
|
|
1889
1889
|
useAppTheme = () => {
|
|
1890
|
-
const context = (0,
|
|
1890
|
+
const context = (0, import_react12.useContext)(ThemeContext);
|
|
1891
1891
|
if (!context) {
|
|
1892
1892
|
throw new Error("useAppTheme should be used within the ThemeProvider");
|
|
1893
1893
|
}
|
|
@@ -1897,63 +1897,63 @@ var init_ThemeProvider = __esm({
|
|
|
1897
1897
|
});
|
|
1898
1898
|
|
|
1899
1899
|
// src/context/BreadcrumbProvider.tsx
|
|
1900
|
-
var
|
|
1900
|
+
var import_react13, import_jsx_runtime14, BreadcrumbContext, BreadcrumbProvider, useBreadcrumb;
|
|
1901
1901
|
var init_BreadcrumbProvider = __esm({
|
|
1902
1902
|
"src/context/BreadcrumbProvider.tsx"() {
|
|
1903
1903
|
"use strict";
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
BreadcrumbContext = (0,
|
|
1904
|
+
import_react13 = require("react");
|
|
1905
|
+
import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1906
|
+
BreadcrumbContext = (0, import_react13.createContext)({
|
|
1907
1907
|
breadcrumbTitles: {},
|
|
1908
1908
|
setBreadcrumbTitle: () => {
|
|
1909
1909
|
}
|
|
1910
1910
|
});
|
|
1911
1911
|
BreadcrumbProvider = ({ children }) => {
|
|
1912
|
-
const [breadcrumbTitles, setBreadcrumbTitles] = (0,
|
|
1912
|
+
const [breadcrumbTitles, setBreadcrumbTitles] = (0, import_react13.useState)({});
|
|
1913
1913
|
const setBreadcrumbTitle = (path, title) => {
|
|
1914
1914
|
setBreadcrumbTitles((prev) => {
|
|
1915
1915
|
if (prev[path] === title) return prev;
|
|
1916
1916
|
return { ...prev, [path]: title };
|
|
1917
1917
|
});
|
|
1918
1918
|
};
|
|
1919
|
-
return /* @__PURE__ */ (0,
|
|
1919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BreadcrumbContext.Provider, { value: { breadcrumbTitles, setBreadcrumbTitle }, children });
|
|
1920
1920
|
};
|
|
1921
|
-
useBreadcrumb = () => (0,
|
|
1921
|
+
useBreadcrumb = () => (0, import_react13.useContext)(BreadcrumbContext);
|
|
1922
1922
|
}
|
|
1923
1923
|
});
|
|
1924
1924
|
|
|
1925
1925
|
// src/context/ToastProvider.tsx
|
|
1926
|
-
var
|
|
1926
|
+
var import_react14, import_material7, import_jsx_runtime15, ToastContext, ToastProvider, useToast;
|
|
1927
1927
|
var init_ToastProvider = __esm({
|
|
1928
1928
|
"src/context/ToastProvider.tsx"() {
|
|
1929
1929
|
"use strict";
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
ToastContext = (0,
|
|
1930
|
+
import_react14 = require("react");
|
|
1931
|
+
import_material7 = require("@mui/material");
|
|
1932
|
+
import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1933
|
+
ToastContext = (0, import_react14.createContext)(void 0);
|
|
1934
1934
|
ToastProvider = ({ children }) => {
|
|
1935
|
-
const [toast, setToast] = (0,
|
|
1936
|
-
const showToast = (0,
|
|
1935
|
+
const [toast, setToast] = (0, import_react14.useState)(null);
|
|
1936
|
+
const showToast = (0, import_react14.useCallback)((text, type = "info") => {
|
|
1937
1937
|
setToast({ text, type });
|
|
1938
1938
|
}, []);
|
|
1939
|
-
const hideToast = (0,
|
|
1939
|
+
const hideToast = (0, import_react14.useCallback)(() => {
|
|
1940
1940
|
setToast(null);
|
|
1941
1941
|
}, []);
|
|
1942
|
-
const contextValue = (0,
|
|
1942
|
+
const contextValue = (0, import_react14.useMemo)(() => ({
|
|
1943
1943
|
showToast,
|
|
1944
1944
|
hideToast
|
|
1945
1945
|
}), [showToast, hideToast]);
|
|
1946
|
-
return /* @__PURE__ */ (0,
|
|
1946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ToastContext.Provider, { value: contextValue, children: [
|
|
1947
1947
|
children,
|
|
1948
|
-
/* @__PURE__ */ (0,
|
|
1949
|
-
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1949
|
+
import_material7.Snackbar,
|
|
1950
1950
|
{
|
|
1951
1951
|
open: Boolean(toast),
|
|
1952
1952
|
autoHideDuration: 3500,
|
|
1953
1953
|
onClose: hideToast,
|
|
1954
1954
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1955
|
-
children: /* @__PURE__ */ (0,
|
|
1956
|
-
|
|
1955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1956
|
+
import_material7.Alert,
|
|
1957
1957
|
{
|
|
1958
1958
|
severity: toast?.type || "info",
|
|
1959
1959
|
variant: "filled",
|
|
@@ -1966,7 +1966,7 @@ var init_ToastProvider = __esm({
|
|
|
1966
1966
|
] });
|
|
1967
1967
|
};
|
|
1968
1968
|
useToast = () => {
|
|
1969
|
-
const context = (0,
|
|
1969
|
+
const context = (0, import_react14.useContext)(ToastContext);
|
|
1970
1970
|
if (!context) {
|
|
1971
1971
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1972
1972
|
}
|
|
@@ -1976,27 +1976,27 @@ var init_ToastProvider = __esm({
|
|
|
1976
1976
|
});
|
|
1977
1977
|
|
|
1978
1978
|
// src/context/ConfirmationProvider.tsx
|
|
1979
|
-
var
|
|
1979
|
+
var import_react15, import_material8, import_icons_material, import_jsx_runtime16, ConfirmContext, SEVERITY_ICONS, ConfirmationProvider, useConfirmation;
|
|
1980
1980
|
var init_ConfirmationProvider = __esm({
|
|
1981
1981
|
"src/context/ConfirmationProvider.tsx"() {
|
|
1982
1982
|
"use strict";
|
|
1983
|
-
|
|
1984
|
-
|
|
1983
|
+
import_react15 = require("react");
|
|
1984
|
+
import_material8 = require("@mui/material");
|
|
1985
1985
|
import_icons_material = require("@mui/icons-material");
|
|
1986
1986
|
init_TranslateText();
|
|
1987
|
-
|
|
1988
|
-
ConfirmContext = (0,
|
|
1987
|
+
import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1988
|
+
ConfirmContext = (0, import_react15.createContext)(null);
|
|
1989
1989
|
SEVERITY_ICONS = {
|
|
1990
|
-
error: /* @__PURE__ */ (0,
|
|
1991
|
-
warning: /* @__PURE__ */ (0,
|
|
1992
|
-
info: /* @__PURE__ */ (0,
|
|
1993
|
-
success: /* @__PURE__ */ (0,
|
|
1990
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.Error, { color: "error", sx: { fontSize: 40 } }),
|
|
1991
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.WarningAmberOutlined, { color: "warning", sx: { fontSize: 40 } }),
|
|
1992
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.InfoOutlined, { color: "info", sx: { fontSize: 40 } }),
|
|
1993
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.CheckCircleOutlined, { color: "success", sx: { fontSize: 40 } })
|
|
1994
1994
|
};
|
|
1995
1995
|
ConfirmationProvider = ({ overrideNamespace, children }) => {
|
|
1996
|
-
const [open, setOpen] = (0,
|
|
1997
|
-
const [options, setOptions] = (0,
|
|
1998
|
-
const [resolver, setResolver] = (0,
|
|
1999
|
-
const confirm = (0,
|
|
1996
|
+
const [open, setOpen] = (0, import_react15.useState)(false);
|
|
1997
|
+
const [options, setOptions] = (0, import_react15.useState)(null);
|
|
1998
|
+
const [resolver, setResolver] = (0, import_react15.useState)(null);
|
|
1999
|
+
const confirm = (0, import_react15.useCallback)((opts) => {
|
|
2000
2000
|
setOptions(opts);
|
|
2001
2001
|
setOpen(true);
|
|
2002
2002
|
return new Promise((resolve) => {
|
|
@@ -2010,10 +2010,10 @@ var init_ConfirmationProvider = __esm({
|
|
|
2010
2010
|
}
|
|
2011
2011
|
};
|
|
2012
2012
|
const severityType = options?.type || "info";
|
|
2013
|
-
return /* @__PURE__ */ (0,
|
|
2013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ConfirmContext.Provider, { value: { confirm }, children: [
|
|
2014
2014
|
children,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2016
|
-
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2016
|
+
import_material8.Dialog,
|
|
2017
2017
|
{
|
|
2018
2018
|
open,
|
|
2019
2019
|
onClose: () => handleClose("cancel"),
|
|
@@ -2022,38 +2022,38 @@ var init_ConfirmationProvider = __esm({
|
|
|
2022
2022
|
disableEnforceFocus: true,
|
|
2023
2023
|
disableRestoreFocus: true,
|
|
2024
2024
|
children: [
|
|
2025
|
-
/* @__PURE__ */ (0,
|
|
2025
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material8.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1.5, pb: 1 }, children: [
|
|
2026
2026
|
SEVERITY_ICONS[severityType],
|
|
2027
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.Box, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Confirmation" }) })
|
|
2028
2028
|
] }),
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2030
|
-
/* @__PURE__ */ (0,
|
|
2031
|
-
(options?.showCancelButton ?? true) && /* @__PURE__ */ (0,
|
|
2032
|
-
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.DialogContent, { sx: { py: 2 }, dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.DialogContentText, { color: "text.secondary", children: options?.message }) }),
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material8.DialogActions, { sx: { pt: 2, px: 2, justifyContent: "flex-end", gap: 1 }, children: [
|
|
2031
|
+
(options?.showCancelButton ?? true) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2032
|
+
import_material8.Button,
|
|
2033
2033
|
{
|
|
2034
2034
|
onClick: () => handleClose("cancel"),
|
|
2035
2035
|
color: "inherit",
|
|
2036
2036
|
variant: "text",
|
|
2037
|
-
children: options?.cancelText || /* @__PURE__ */ (0,
|
|
2037
|
+
children: options?.cancelText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Cancel" })
|
|
2038
2038
|
}
|
|
2039
2039
|
),
|
|
2040
|
-
options?.showNoButton && /* @__PURE__ */ (0,
|
|
2041
|
-
|
|
2040
|
+
options?.showNoButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2041
|
+
import_material8.Button,
|
|
2042
2042
|
{
|
|
2043
2043
|
onClick: () => handleClose("no"),
|
|
2044
2044
|
color: "inherit",
|
|
2045
2045
|
variant: "outlined",
|
|
2046
|
-
children: options?.noText || /* @__PURE__ */ (0,
|
|
2046
|
+
children: options?.noText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "No" })
|
|
2047
2047
|
}
|
|
2048
2048
|
),
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2050
|
-
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2050
|
+
import_material8.Button,
|
|
2051
2051
|
{
|
|
2052
2052
|
onClick: () => handleClose("yes"),
|
|
2053
2053
|
color: options?.confirmColor || (severityType === "error" ? "error" : "primary"),
|
|
2054
2054
|
variant: "contained",
|
|
2055
2055
|
autoFocus: true,
|
|
2056
|
-
children: options?.confirmText || /* @__PURE__ */ (0,
|
|
2056
|
+
children: options?.confirmText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Yes" })
|
|
2057
2057
|
}
|
|
2058
2058
|
)
|
|
2059
2059
|
] })
|
|
@@ -2063,7 +2063,7 @@ var init_ConfirmationProvider = __esm({
|
|
|
2063
2063
|
] });
|
|
2064
2064
|
};
|
|
2065
2065
|
useConfirmation = () => {
|
|
2066
|
-
const context = (0,
|
|
2066
|
+
const context = (0, import_react15.useContext)(ConfirmContext);
|
|
2067
2067
|
if (!context) {
|
|
2068
2068
|
throw new Error("useConfirm must be used within a ConfirmProvider");
|
|
2069
2069
|
}
|
|
@@ -2073,23 +2073,23 @@ var init_ConfirmationProvider = __esm({
|
|
|
2073
2073
|
});
|
|
2074
2074
|
|
|
2075
2075
|
// src/context/AppSettingsProvider.tsx
|
|
2076
|
-
var
|
|
2076
|
+
var import_react16, import_jsx_runtime17, DEFAULT_SETTINGS, AppSettingsContext, AppSettingsProvider, useAppSettings;
|
|
2077
2077
|
var init_AppSettingsProvider = __esm({
|
|
2078
2078
|
"src/context/AppSettingsProvider.tsx"() {
|
|
2079
2079
|
"use strict";
|
|
2080
|
-
|
|
2080
|
+
import_react16 = require("react");
|
|
2081
2081
|
init_SupabaseProvider();
|
|
2082
|
-
|
|
2082
|
+
import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2083
2083
|
DEFAULT_SETTINGS = {
|
|
2084
2084
|
max_group_members: 100
|
|
2085
2085
|
};
|
|
2086
|
-
AppSettingsContext = (0,
|
|
2086
|
+
AppSettingsContext = (0, import_react16.createContext)(void 0);
|
|
2087
2087
|
AppSettingsProvider = ({ children }) => {
|
|
2088
2088
|
const supabase = useSupabase();
|
|
2089
|
-
const [settings, setSettings] = (0,
|
|
2090
|
-
const [loading, setLoading] = (0,
|
|
2091
|
-
const [error, setError] = (0,
|
|
2092
|
-
const fetchSettings = (0,
|
|
2089
|
+
const [settings, setSettings] = (0, import_react16.useState)(DEFAULT_SETTINGS);
|
|
2090
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
2091
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
2092
|
+
const fetchSettings = (0, import_react16.useCallback)(async () => {
|
|
2093
2093
|
try {
|
|
2094
2094
|
setLoading(true);
|
|
2095
2095
|
setError(null);
|
|
@@ -2109,16 +2109,16 @@ var init_AppSettingsProvider = __esm({
|
|
|
2109
2109
|
setLoading(false);
|
|
2110
2110
|
}
|
|
2111
2111
|
}, []);
|
|
2112
|
-
(0,
|
|
2112
|
+
(0, import_react16.useEffect)(() => {
|
|
2113
2113
|
fetchSettings();
|
|
2114
2114
|
}, [fetchSettings]);
|
|
2115
|
-
const getSetting = (0,
|
|
2115
|
+
const getSetting = (0, import_react16.useCallback)((key, defaultValue) => {
|
|
2116
2116
|
if (key in settings && settings[key] !== null && settings[key] !== void 0) {
|
|
2117
2117
|
return settings[key];
|
|
2118
2118
|
}
|
|
2119
2119
|
return defaultValue;
|
|
2120
2120
|
}, [settings]);
|
|
2121
|
-
return /* @__PURE__ */ (0,
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2122
2122
|
AppSettingsContext.Provider,
|
|
2123
2123
|
{
|
|
2124
2124
|
value: {
|
|
@@ -2133,7 +2133,7 @@ var init_AppSettingsProvider = __esm({
|
|
|
2133
2133
|
);
|
|
2134
2134
|
};
|
|
2135
2135
|
useAppSettings = () => {
|
|
2136
|
-
const context = (0,
|
|
2136
|
+
const context = (0, import_react16.useContext)(AppSettingsContext);
|
|
2137
2137
|
if (!context) {
|
|
2138
2138
|
throw new Error("useAppSettings should be used within the AppSettingsProvider");
|
|
2139
2139
|
}
|
|
@@ -2157,29 +2157,29 @@ var init_user_types = __esm({
|
|
|
2157
2157
|
});
|
|
2158
2158
|
|
|
2159
2159
|
// src/context/UserSettingsProvider.tsx
|
|
2160
|
-
var
|
|
2160
|
+
var import_react17, import_jsx_runtime18, UserSettingsContext, UserSettingsProvider, useUserSettings;
|
|
2161
2161
|
var init_UserSettingsProvider = __esm({
|
|
2162
2162
|
"src/context/UserSettingsProvider.tsx"() {
|
|
2163
2163
|
"use strict";
|
|
2164
|
-
|
|
2164
|
+
import_react17 = require("react");
|
|
2165
2165
|
init_user_types();
|
|
2166
2166
|
init_ThemeProvider();
|
|
2167
2167
|
init_AuthProvider();
|
|
2168
2168
|
init_SupabaseProvider();
|
|
2169
|
-
|
|
2170
|
-
UserSettingsContext = (0,
|
|
2169
|
+
import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2170
|
+
UserSettingsContext = (0, import_react17.createContext)(void 0);
|
|
2171
2171
|
UserSettingsProvider = ({ children }) => {
|
|
2172
2172
|
const supabase = useSupabase();
|
|
2173
2173
|
const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
|
|
2174
2174
|
const userId = user?.id;
|
|
2175
|
-
const [settings, setSettings] = (0,
|
|
2175
|
+
const [settings, setSettings] = (0, import_react17.useState)({
|
|
2176
2176
|
id: "",
|
|
2177
2177
|
...defaultUserSettings
|
|
2178
2178
|
});
|
|
2179
|
-
const [loading, setLoading] = (0,
|
|
2180
|
-
const [error, setError] = (0,
|
|
2181
|
-
const [activeChatUserId, setActiveChatUserId] = (0,
|
|
2182
|
-
const fetchSettings = (0,
|
|
2179
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
2180
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
2181
|
+
const [activeChatUserId, setActiveChatUserId] = (0, import_react17.useState)(null);
|
|
2182
|
+
const fetchSettings = (0, import_react17.useCallback)(async () => {
|
|
2183
2183
|
if (isAuthLoading) return;
|
|
2184
2184
|
if (!isAuthenticated || !userId) {
|
|
2185
2185
|
setSettings({ id: "", ...defaultUserSettings });
|
|
@@ -2232,10 +2232,10 @@ var init_UserSettingsProvider = __esm({
|
|
|
2232
2232
|
setLoading(false);
|
|
2233
2233
|
}
|
|
2234
2234
|
}, [isAuthenticated, isAuthLoading, userId]);
|
|
2235
|
-
(0,
|
|
2235
|
+
(0, import_react17.useEffect)(() => {
|
|
2236
2236
|
fetchSettings();
|
|
2237
2237
|
}, [fetchSettings]);
|
|
2238
|
-
const toggleSidebar = (0,
|
|
2238
|
+
const toggleSidebar = (0, import_react17.useCallback)(
|
|
2239
2239
|
async (open) => {
|
|
2240
2240
|
const isExplicitBoolean = typeof open === "boolean";
|
|
2241
2241
|
const nextState = isExplicitBoolean ? open : !settings.sidebar_open;
|
|
@@ -2251,7 +2251,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2251
2251
|
},
|
|
2252
2252
|
[settings.sidebar_open, userId]
|
|
2253
2253
|
);
|
|
2254
|
-
const toggleChat = (0,
|
|
2254
|
+
const toggleChat = (0, import_react17.useCallback)(
|
|
2255
2255
|
async (open) => {
|
|
2256
2256
|
const isExplicitBoolean = typeof open === "boolean";
|
|
2257
2257
|
const nextState = isExplicitBoolean ? open : !settings.chat_open;
|
|
@@ -2267,7 +2267,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2267
2267
|
},
|
|
2268
2268
|
[settings.chat_open, userId]
|
|
2269
2269
|
);
|
|
2270
|
-
const openChatWithUser = (0,
|
|
2270
|
+
const openChatWithUser = (0, import_react17.useCallback)(
|
|
2271
2271
|
async (targetUserId) => {
|
|
2272
2272
|
setActiveChatUserId(targetUserId);
|
|
2273
2273
|
if (!settings.chat_open) {
|
|
@@ -2276,7 +2276,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2276
2276
|
},
|
|
2277
2277
|
[settings.chat_open, toggleChat]
|
|
2278
2278
|
);
|
|
2279
|
-
const setLanguage = (0,
|
|
2279
|
+
const setLanguage = (0, import_react17.useCallback)(
|
|
2280
2280
|
async (newLanguage) => {
|
|
2281
2281
|
const previousLanguage = settings.language;
|
|
2282
2282
|
setSettings((prev) => ({ ...prev, language: newLanguage }));
|
|
@@ -2291,7 +2291,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2291
2291
|
},
|
|
2292
2292
|
[settings.language, userId]
|
|
2293
2293
|
);
|
|
2294
|
-
const setThemeMode = (0,
|
|
2294
|
+
const setThemeMode = (0, import_react17.useCallback)(
|
|
2295
2295
|
async (newMode) => {
|
|
2296
2296
|
const previousMode = settings.theme_mode;
|
|
2297
2297
|
setSettings((prev) => ({ ...prev, theme_mode: newMode }));
|
|
@@ -2307,7 +2307,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2307
2307
|
},
|
|
2308
2308
|
[settings.theme_mode, userId]
|
|
2309
2309
|
);
|
|
2310
|
-
return /* @__PURE__ */ (0,
|
|
2310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2311
2311
|
UserSettingsContext.Provider,
|
|
2312
2312
|
{
|
|
2313
2313
|
value: {
|
|
@@ -2327,7 +2327,7 @@ var init_UserSettingsProvider = __esm({
|
|
|
2327
2327
|
);
|
|
2328
2328
|
};
|
|
2329
2329
|
useUserSettings = () => {
|
|
2330
|
-
const context = (0,
|
|
2330
|
+
const context = (0, import_react17.useContext)(UserSettingsContext);
|
|
2331
2331
|
if (!context) {
|
|
2332
2332
|
throw new Error("useUserSettings should be used within the UserSettingsProvider");
|
|
2333
2333
|
}
|
|
@@ -2337,17 +2337,17 @@ var init_UserSettingsProvider = __esm({
|
|
|
2337
2337
|
});
|
|
2338
2338
|
|
|
2339
2339
|
// src/context/PublicThemeProvider.tsx
|
|
2340
|
-
var
|
|
2340
|
+
var import_react18, import_material9, import_jsx_runtime19, PublicThemeProvider;
|
|
2341
2341
|
var init_PublicThemeProvider = __esm({
|
|
2342
2342
|
"src/context/PublicThemeProvider.tsx"() {
|
|
2343
2343
|
"use strict";
|
|
2344
|
-
|
|
2345
|
-
|
|
2344
|
+
import_react18 = require("react");
|
|
2345
|
+
import_material9 = require("@mui/material");
|
|
2346
2346
|
init_ThemeProvider();
|
|
2347
|
-
|
|
2347
|
+
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2348
2348
|
PublicThemeProvider = ({ children }) => {
|
|
2349
|
-
const publicTheme = (0,
|
|
2350
|
-
return /* @__PURE__ */ (0,
|
|
2349
|
+
const publicTheme = (0, import_react18.useMemo)(() => buildMuiTheme(INITIAL_THEME_CONFIG), []);
|
|
2350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material9.ThemeProvider, { theme: publicTheme, children });
|
|
2351
2351
|
};
|
|
2352
2352
|
}
|
|
2353
2353
|
});
|
|
@@ -2402,34 +2402,89 @@ var init_context = __esm({
|
|
|
2402
2402
|
}
|
|
2403
2403
|
});
|
|
2404
2404
|
|
|
2405
|
+
// src/UI/components/buttons/CopyClipboardButtonComponent.tsx
|
|
2406
|
+
var import_react23, import_material16, import_Check3, import_ContentCopy3, import_jsx_runtime26, CopyClipboardButtonComponent;
|
|
2407
|
+
var init_CopyClipboardButtonComponent = __esm({
|
|
2408
|
+
"src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
|
|
2409
|
+
"use strict";
|
|
2410
|
+
import_react23 = require("react");
|
|
2411
|
+
import_material16 = require("@mui/material");
|
|
2412
|
+
import_Check3 = __toESM(require("@mui/icons-material/Check"));
|
|
2413
|
+
import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
2414
|
+
init_TranslatableTooltipComponent();
|
|
2415
|
+
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2416
|
+
CopyClipboardButtonComponent = ({
|
|
2417
|
+
overrideNamespace,
|
|
2418
|
+
textToCopy,
|
|
2419
|
+
copyTooltipText = "Copy",
|
|
2420
|
+
copiedTooltipText = "Copied",
|
|
2421
|
+
namespace = "form_components",
|
|
2422
|
+
resetDelay = 2e3,
|
|
2423
|
+
onCopySuccess,
|
|
2424
|
+
size = "small",
|
|
2425
|
+
sx,
|
|
2426
|
+
...iconButtonProps
|
|
2427
|
+
}) => {
|
|
2428
|
+
const [copied, setCopied] = (0, import_react23.useState)(false);
|
|
2429
|
+
const handleCopy = async (e) => {
|
|
2430
|
+
e.stopPropagation();
|
|
2431
|
+
if (!textToCopy) return;
|
|
2432
|
+
try {
|
|
2433
|
+
await navigator.clipboard.writeText(textToCopy);
|
|
2434
|
+
setCopied(true);
|
|
2435
|
+
if (onCopySuccess) {
|
|
2436
|
+
onCopySuccess(textToCopy);
|
|
2437
|
+
}
|
|
2438
|
+
setTimeout(() => {
|
|
2439
|
+
setCopied(false);
|
|
2440
|
+
}, resetDelay);
|
|
2441
|
+
} catch (error) {
|
|
2442
|
+
console.error("Failed to copy text to clipboard:", error);
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2446
|
+
import_material16.IconButton,
|
|
2447
|
+
{
|
|
2448
|
+
size,
|
|
2449
|
+
onClick: handleCopy,
|
|
2450
|
+
disabled: !textToCopy || iconButtonProps.disabled,
|
|
2451
|
+
sx: { p: 0.25, ...sx },
|
|
2452
|
+
...iconButtonProps,
|
|
2453
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
|
|
2454
|
+
}
|
|
2455
|
+
) }) });
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
});
|
|
2459
|
+
|
|
2405
2460
|
// src/UI/components/data.display/UserStatusChipComponent.tsx
|
|
2406
|
-
var
|
|
2461
|
+
var import_material18, import_InfoOutlined, import_jsx_runtime28, UserStatusChipComponent;
|
|
2407
2462
|
var init_UserStatusChipComponent = __esm({
|
|
2408
2463
|
"src/UI/components/data.display/UserStatusChipComponent.tsx"() {
|
|
2409
2464
|
"use strict";
|
|
2410
|
-
|
|
2465
|
+
import_material18 = require("@mui/material");
|
|
2411
2466
|
import_InfoOutlined = __toESM(require("@mui/icons-material/InfoOutlined"));
|
|
2412
2467
|
init_context();
|
|
2413
|
-
|
|
2468
|
+
import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2414
2469
|
UserStatusChipComponent = ({ overrideNamespace, state }) => {
|
|
2415
2470
|
const confirm = useConfirmation();
|
|
2416
2471
|
const handleShowReason = async (e) => {
|
|
2417
2472
|
e.stopPropagation();
|
|
2418
2473
|
if (!state.locked_reason) return;
|
|
2419
2474
|
await confirm({
|
|
2420
|
-
title: /* @__PURE__ */ (0,
|
|
2475
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
|
|
2421
2476
|
message: state.locked_reason,
|
|
2422
2477
|
type: "info",
|
|
2423
|
-
confirmText: /* @__PURE__ */ (0,
|
|
2478
|
+
confirmText: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
|
|
2424
2479
|
showNoButton: false,
|
|
2425
2480
|
showCancelButton: false
|
|
2426
2481
|
});
|
|
2427
2482
|
};
|
|
2428
2483
|
if (state.profile_archived) {
|
|
2429
|
-
return /* @__PURE__ */ (0,
|
|
2430
|
-
|
|
2484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2485
|
+
import_material18.Chip,
|
|
2431
2486
|
{
|
|
2432
|
-
label: /* @__PURE__ */ (0,
|
|
2487
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
|
|
2433
2488
|
color: "default",
|
|
2434
2489
|
size: "small",
|
|
2435
2490
|
variant: "filled"
|
|
@@ -2437,10 +2492,10 @@ var init_UserStatusChipComponent = __esm({
|
|
|
2437
2492
|
);
|
|
2438
2493
|
}
|
|
2439
2494
|
if (state.profile_locked) {
|
|
2440
|
-
return /* @__PURE__ */ (0,
|
|
2441
|
-
|
|
2495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2496
|
+
import_material18.Chip,
|
|
2442
2497
|
{
|
|
2443
|
-
label: /* @__PURE__ */ (0,
|
|
2498
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
|
|
2444
2499
|
color: "error",
|
|
2445
2500
|
size: "small",
|
|
2446
2501
|
variant: "filled"
|
|
@@ -2448,30 +2503,30 @@ var init_UserStatusChipComponent = __esm({
|
|
|
2448
2503
|
);
|
|
2449
2504
|
}
|
|
2450
2505
|
if (state.excluded) {
|
|
2451
|
-
return /* @__PURE__ */ (0,
|
|
2452
|
-
|
|
2506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2507
|
+
import_material18.Chip,
|
|
2453
2508
|
{
|
|
2454
|
-
label: /* @__PURE__ */ (0,
|
|
2509
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
|
|
2455
2510
|
size: "small"
|
|
2456
2511
|
}
|
|
2457
2512
|
);
|
|
2458
2513
|
}
|
|
2459
2514
|
if (state.locked) {
|
|
2460
|
-
return /* @__PURE__ */ (0,
|
|
2461
|
-
|
|
2515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2516
|
+
import_material18.Chip,
|
|
2462
2517
|
{
|
|
2463
|
-
label: /* @__PURE__ */ (0,
|
|
2518
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
|
|
2464
2519
|
color: "error",
|
|
2465
2520
|
size: "small",
|
|
2466
2521
|
onDelete: state.locked_reason ? handleShowReason : void 0,
|
|
2467
|
-
deleteIcon: state.locked_reason ? /* @__PURE__ */ (0,
|
|
2522
|
+
deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material18.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
|
|
2468
2523
|
}
|
|
2469
2524
|
);
|
|
2470
2525
|
}
|
|
2471
|
-
return /* @__PURE__ */ (0,
|
|
2472
|
-
|
|
2526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2527
|
+
import_material18.Chip,
|
|
2473
2528
|
{
|
|
2474
|
-
label: /* @__PURE__ */ (0,
|
|
2529
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
|
|
2475
2530
|
color: "success",
|
|
2476
2531
|
size: "small",
|
|
2477
2532
|
variant: "outlined"
|
|
@@ -2482,38 +2537,38 @@ var init_UserStatusChipComponent = __esm({
|
|
|
2482
2537
|
});
|
|
2483
2538
|
|
|
2484
2539
|
// src/UI/components/data.display/UserRoleChipComponent.tsx
|
|
2485
|
-
var
|
|
2540
|
+
var import_material19, import_jsx_runtime29, UserRoleChipComponent;
|
|
2486
2541
|
var init_UserRoleChipComponent = __esm({
|
|
2487
2542
|
"src/UI/components/data.display/UserRoleChipComponent.tsx"() {
|
|
2488
2543
|
"use strict";
|
|
2489
|
-
|
|
2544
|
+
import_material19 = require("@mui/material");
|
|
2490
2545
|
init_context();
|
|
2491
|
-
|
|
2546
|
+
import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2492
2547
|
UserRoleChipComponent = ({ overrideNamespace, role }) => {
|
|
2493
2548
|
switch (role) {
|
|
2494
2549
|
case "superadmin":
|
|
2495
|
-
return /* @__PURE__ */ (0,
|
|
2496
|
-
|
|
2550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2551
|
+
import_material19.Chip,
|
|
2497
2552
|
{
|
|
2498
|
-
label: /* @__PURE__ */ (0,
|
|
2553
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
|
|
2499
2554
|
color: "error",
|
|
2500
2555
|
size: "small"
|
|
2501
2556
|
}
|
|
2502
2557
|
);
|
|
2503
2558
|
case "admin":
|
|
2504
|
-
return /* @__PURE__ */ (0,
|
|
2505
|
-
|
|
2559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2560
|
+
import_material19.Chip,
|
|
2506
2561
|
{
|
|
2507
|
-
label: /* @__PURE__ */ (0,
|
|
2562
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
|
|
2508
2563
|
color: "primary",
|
|
2509
2564
|
size: "small"
|
|
2510
2565
|
}
|
|
2511
2566
|
);
|
|
2512
2567
|
default:
|
|
2513
|
-
return /* @__PURE__ */ (0,
|
|
2514
|
-
|
|
2568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2569
|
+
import_material19.Chip,
|
|
2515
2570
|
{
|
|
2516
|
-
label: /* @__PURE__ */ (0,
|
|
2571
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
|
|
2517
2572
|
variant: "outlined",
|
|
2518
2573
|
size: "small"
|
|
2519
2574
|
}
|
|
@@ -2523,73 +2578,18 @@ var init_UserRoleChipComponent = __esm({
|
|
|
2523
2578
|
}
|
|
2524
2579
|
});
|
|
2525
2580
|
|
|
2526
|
-
// src/UI/components/buttons/CopyClipboardButtonComponent.tsx
|
|
2527
|
-
var import_react20, import_material13, import_Check3, import_ContentCopy3, import_jsx_runtime23, CopyClipboardButtonComponent;
|
|
2528
|
-
var init_CopyClipboardButtonComponent = __esm({
|
|
2529
|
-
"src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
|
|
2530
|
-
"use strict";
|
|
2531
|
-
import_react20 = require("react");
|
|
2532
|
-
import_material13 = require("@mui/material");
|
|
2533
|
-
import_Check3 = __toESM(require("@mui/icons-material/Check"));
|
|
2534
|
-
import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
2535
|
-
init_TranslatableTooltipComponent();
|
|
2536
|
-
import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2537
|
-
CopyClipboardButtonComponent = ({
|
|
2538
|
-
overrideNamespace,
|
|
2539
|
-
textToCopy,
|
|
2540
|
-
copyTooltipText = "Copy",
|
|
2541
|
-
copiedTooltipText = "Copied",
|
|
2542
|
-
namespace = "form_components",
|
|
2543
|
-
resetDelay = 2e3,
|
|
2544
|
-
onCopySuccess,
|
|
2545
|
-
size = "small",
|
|
2546
|
-
sx,
|
|
2547
|
-
...iconButtonProps
|
|
2548
|
-
}) => {
|
|
2549
|
-
const [copied, setCopied] = (0, import_react20.useState)(false);
|
|
2550
|
-
const handleCopy = async (e) => {
|
|
2551
|
-
e.stopPropagation();
|
|
2552
|
-
if (!textToCopy) return;
|
|
2553
|
-
try {
|
|
2554
|
-
await navigator.clipboard.writeText(textToCopy);
|
|
2555
|
-
setCopied(true);
|
|
2556
|
-
if (onCopySuccess) {
|
|
2557
|
-
onCopySuccess(textToCopy);
|
|
2558
|
-
}
|
|
2559
|
-
setTimeout(() => {
|
|
2560
|
-
setCopied(false);
|
|
2561
|
-
}, resetDelay);
|
|
2562
|
-
} catch (error) {
|
|
2563
|
-
console.error("Failed to copy text to clipboard:", error);
|
|
2564
|
-
}
|
|
2565
|
-
};
|
|
2566
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2567
|
-
import_material13.IconButton,
|
|
2568
|
-
{
|
|
2569
|
-
size,
|
|
2570
|
-
onClick: handleCopy,
|
|
2571
|
-
disabled: !textToCopy || iconButtonProps.disabled,
|
|
2572
|
-
sx: { p: 0.25, ...sx },
|
|
2573
|
-
...iconButtonProps,
|
|
2574
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
|
|
2575
|
-
}
|
|
2576
|
-
) }) });
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
});
|
|
2580
|
-
|
|
2581
2581
|
// src/UI/components/data.display/UserPopoverComponent.tsx
|
|
2582
2582
|
var UserPopoverComponent_exports = {};
|
|
2583
2583
|
__export(UserPopoverComponent_exports, {
|
|
2584
2584
|
UserPopoverComponent: () => UserPopoverComponent,
|
|
2585
2585
|
default: () => UserPopoverComponent_default
|
|
2586
2586
|
});
|
|
2587
|
-
var
|
|
2587
|
+
var import_react25, import_material20, import_icons_material2, import_jsx_runtime30, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
|
|
2588
2588
|
var init_UserPopoverComponent = __esm({
|
|
2589
2589
|
"src/UI/components/data.display/UserPopoverComponent.tsx"() {
|
|
2590
2590
|
"use strict";
|
|
2591
|
-
|
|
2592
|
-
|
|
2591
|
+
import_react25 = require("react");
|
|
2592
|
+
import_material20 = require("@mui/material");
|
|
2593
2593
|
import_icons_material2 = require("@mui/icons-material");
|
|
2594
2594
|
init_UserStatusChipComponent();
|
|
2595
2595
|
init_UserRoleChipComponent();
|
|
@@ -2599,11 +2599,11 @@ var init_UserPopoverComponent = __esm({
|
|
|
2599
2599
|
init_UserSettingsProvider();
|
|
2600
2600
|
init_TranslatableTooltipComponent();
|
|
2601
2601
|
init_session_service();
|
|
2602
|
-
|
|
2602
|
+
import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2603
2603
|
useUserStatus = (supabase, userId, open) => {
|
|
2604
|
-
const [lastSeenAt, setLastSeenAt] = (0,
|
|
2605
|
-
const [loading, setLoading] = (0,
|
|
2606
|
-
(0,
|
|
2604
|
+
const [lastSeenAt, setLastSeenAt] = (0, import_react25.useState)(null);
|
|
2605
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
2606
|
+
(0, import_react25.useEffect)(() => {
|
|
2607
2607
|
if (!userId || !open) {
|
|
2608
2608
|
setLastSeenAt(null);
|
|
2609
2609
|
setLoading(false);
|
|
@@ -2652,13 +2652,13 @@ var init_UserPopoverComponent = __esm({
|
|
|
2652
2652
|
const { activeCompanyId, membership: currentMembership } = useAuth();
|
|
2653
2653
|
const { openChatWithUser } = useUserSettings();
|
|
2654
2654
|
const { formatDate, formatRelativeTime } = useLocalization();
|
|
2655
|
-
const [profileData, setProfileData] = (0,
|
|
2656
|
-
const [membershipData, setMembershipData] = (0,
|
|
2657
|
-
const [avatarUrl, setAvatarUrl] = (0,
|
|
2658
|
-
const [coverUrl, setCoverUrl] = (0,
|
|
2659
|
-
const [loading, setLoading] = (0,
|
|
2655
|
+
const [profileData, setProfileData] = (0, import_react25.useState)(null);
|
|
2656
|
+
const [membershipData, setMembershipData] = (0, import_react25.useState)(null);
|
|
2657
|
+
const [avatarUrl, setAvatarUrl] = (0, import_react25.useState)(null);
|
|
2658
|
+
const [coverUrl, setCoverUrl] = (0, import_react25.useState)(null);
|
|
2659
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
2660
2660
|
const { lastSeenAt, isOnline } = useUserStatus(supabase, userId, open);
|
|
2661
|
-
(0,
|
|
2661
|
+
(0, import_react25.useEffect)(() => {
|
|
2662
2662
|
if (!open || !userId || !activeCompanyId) return;
|
|
2663
2663
|
let isMounted = true;
|
|
2664
2664
|
setLoading(true);
|
|
@@ -2704,7 +2704,7 @@ var init_UserPopoverComponent = __esm({
|
|
|
2704
2704
|
}, [open, userId, currentMembership?.id, activeCompanyId]);
|
|
2705
2705
|
const getStatusChip = () => {
|
|
2706
2706
|
if (!profileData) return null;
|
|
2707
|
-
return /* @__PURE__ */ (0,
|
|
2707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
|
|
2708
2708
|
};
|
|
2709
2709
|
const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
|
|
2710
2710
|
if (isOnline2) return "success";
|
|
@@ -2725,8 +2725,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2725
2725
|
return "inherit";
|
|
2726
2726
|
};
|
|
2727
2727
|
const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
|
|
2728
|
-
return /* @__PURE__ */ (0,
|
|
2729
|
-
|
|
2728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2729
|
+
import_material20.Popover,
|
|
2730
2730
|
{
|
|
2731
2731
|
open,
|
|
2732
2732
|
anchorEl,
|
|
@@ -2744,9 +2744,9 @@ var init_UserPopoverComponent = __esm({
|
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
2746
|
},
|
|
2747
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
2748
|
-
/* @__PURE__ */ (0,
|
|
2749
|
-
|
|
2747
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2749
|
+
import_material20.Box,
|
|
2750
2750
|
{
|
|
2751
2751
|
sx: {
|
|
2752
2752
|
position: "relative",
|
|
@@ -2755,8 +2755,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2755
2755
|
bgcolor: "action.selected"
|
|
2756
2756
|
},
|
|
2757
2757
|
children: [
|
|
2758
|
-
coverUrl && /* @__PURE__ */ (0,
|
|
2759
|
-
|
|
2758
|
+
coverUrl && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2759
|
+
import_material20.Box,
|
|
2760
2760
|
{
|
|
2761
2761
|
component: "img",
|
|
2762
2762
|
src: coverUrl,
|
|
@@ -2771,8 +2771,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
2773
|
),
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2775
|
-
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2775
|
+
import_material20.IconButton,
|
|
2776
2776
|
{
|
|
2777
2777
|
size: "small",
|
|
2778
2778
|
onClick: onClose,
|
|
@@ -2789,16 +2789,16 @@ var init_UserPopoverComponent = __esm({
|
|
|
2789
2789
|
transform: "scale(1.1)"
|
|
2790
2790
|
}
|
|
2791
2791
|
},
|
|
2792
|
-
children: /* @__PURE__ */ (0,
|
|
2792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Close, { fontSize: "small" })
|
|
2793
2793
|
}
|
|
2794
2794
|
)
|
|
2795
2795
|
]
|
|
2796
2796
|
}
|
|
2797
2797
|
),
|
|
2798
|
-
/* @__PURE__ */ (0,
|
|
2799
|
-
/* @__PURE__ */ (0,
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2801
|
-
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { p: 2, pt: 0 }, children: [
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2801
|
+
import_material20.Badge,
|
|
2802
2802
|
{
|
|
2803
2803
|
overlap: "circular",
|
|
2804
2804
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -2834,8 +2834,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2834
2834
|
}
|
|
2835
2835
|
}
|
|
2836
2836
|
},
|
|
2837
|
-
children: /* @__PURE__ */ (0,
|
|
2838
|
-
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2838
|
+
import_material20.Avatar,
|
|
2839
2839
|
{
|
|
2840
2840
|
src: avatarUrl || coverUrl || void 0,
|
|
2841
2841
|
sx: {
|
|
@@ -2853,54 +2853,54 @@ var init_UserPopoverComponent = __esm({
|
|
|
2853
2853
|
)
|
|
2854
2854
|
}
|
|
2855
2855
|
),
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
2857
|
-
/* @__PURE__ */ (0,
|
|
2858
|
-
membershipData?.employee_post && /* @__PURE__ */ (0,
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
|
|
2858
|
+
membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
|
|
2859
2859
|
] })
|
|
2860
2860
|
] }),
|
|
2861
|
-
/* @__PURE__ */ (0,
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
|
|
2862
2862
|
getStatusChip(),
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
|
|
2864
2864
|
] }),
|
|
2865
|
-
/* @__PURE__ */ (0,
|
|
2866
|
-
/* @__PURE__ */ (0,
|
|
2867
|
-
/* @__PURE__ */ (0,
|
|
2868
|
-
/* @__PURE__ */ (0,
|
|
2869
|
-
/* @__PURE__ */ (0,
|
|
2870
|
-
/* @__PURE__ */ (0,
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Divider, { sx: { my: 1.5 } }),
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
|
|
2871
2871
|
":",
|
|
2872
2872
|
" ",
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
2874
|
-
] }) : /* @__PURE__ */ (0,
|
|
2873
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
|
|
2874
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
|
|
2875
2875
|
] }),
|
|
2876
|
-
profileData.email && /* @__PURE__ */ (0,
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2876
|
+
profileData.email && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Email, { fontSize: "small" }),
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
|
|
2880
2880
|
] }),
|
|
2881
|
-
membershipData?.employee_post && /* @__PURE__ */ (0,
|
|
2882
|
-
/* @__PURE__ */ (0,
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
2884
|
-
/* @__PURE__ */ (0,
|
|
2881
|
+
membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Work, { fontSize: "small" }),
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
|
|
2885
2885
|
] }),
|
|
2886
|
-
profileData.phone && /* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2888
|
-
/* @__PURE__ */ (0,
|
|
2886
|
+
profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
|
|
2889
2889
|
] }),
|
|
2890
|
-
profileData.birthday && /* @__PURE__ */ (0,
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2890
|
+
profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
|
|
2893
2893
|
] }),
|
|
2894
|
-
membershipData?.created_at && /* @__PURE__ */ (0,
|
|
2895
|
-
/* @__PURE__ */ (0,
|
|
2896
|
-
/* @__PURE__ */ (0,
|
|
2897
|
-
/* @__PURE__ */ (0,
|
|
2894
|
+
membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Typography, { variant: "body2", color: "text.primary", children: [
|
|
2897
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
|
|
2898
2898
|
": ",
|
|
2899
2899
|
formatDate(membershipData.created_at)
|
|
2900
2900
|
] })
|
|
2901
2901
|
] }),
|
|
2902
|
-
profileData.description && /* @__PURE__ */ (0,
|
|
2903
|
-
|
|
2902
|
+
profileData.description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2903
|
+
import_material20.Typography,
|
|
2904
2904
|
{
|
|
2905
2905
|
variant: "caption",
|
|
2906
2906
|
color: "text.secondary",
|
|
@@ -2915,28 +2915,28 @@ var init_UserPopoverComponent = __esm({
|
|
|
2915
2915
|
}
|
|
2916
2916
|
)
|
|
2917
2917
|
] }),
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
2921
|
-
/* @__PURE__ */ (0,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2923
|
-
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Divider, { sx: { my: 1 } }),
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2923
|
+
import_material20.IconButton,
|
|
2924
2924
|
{
|
|
2925
2925
|
size: "small",
|
|
2926
2926
|
color: "primary",
|
|
2927
2927
|
disabled: !canChat,
|
|
2928
2928
|
onClick: () => membershipData && openChatWithUser(membershipData.id),
|
|
2929
|
-
children: /* @__PURE__ */ (0,
|
|
2929
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
|
|
2930
2930
|
}
|
|
2931
2931
|
) })
|
|
2932
2932
|
] })
|
|
2933
2933
|
] })
|
|
2934
|
-
] }) : /* @__PURE__ */ (0,
|
|
2935
|
-
|
|
2934
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2935
|
+
import_material20.Typography,
|
|
2936
2936
|
{
|
|
2937
2937
|
color: "error",
|
|
2938
2938
|
variant: "body2",
|
|
2939
|
-
children: /* @__PURE__ */ (0,
|
|
2939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
|
|
2940
2940
|
}
|
|
2941
2941
|
) })
|
|
2942
2942
|
}
|
|
@@ -2953,19 +2953,43 @@ __export(index_exports, {
|
|
|
2953
2953
|
AppSettingsProvider: () => AppSettingsProvider,
|
|
2954
2954
|
AuthProvider: () => AuthProvider,
|
|
2955
2955
|
BreadcrumbProvider: () => BreadcrumbProvider,
|
|
2956
|
+
ButtonComponent: () => ButtonComponent,
|
|
2957
|
+
CheckboxComponent: () => CheckboxComponent,
|
|
2958
|
+
CollapsedContainerComponent: () => CollapsedContainerComponent,
|
|
2956
2959
|
ConfirmationProvider: () => ConfirmationProvider,
|
|
2960
|
+
CopyClipboardButtonComponent: () => CopyClipboardButtonComponent,
|
|
2961
|
+
EmailInputComponent: () => EmailInputComponent,
|
|
2962
|
+
ErrorAlertComponent: () => ErrorAlertComponent,
|
|
2963
|
+
ExpandableNoteComponent: () => ExpandableNoteComponent,
|
|
2964
|
+
FilterContainerComponent: () => FilterContainerComponent,
|
|
2957
2965
|
Hooks: () => Hooks,
|
|
2958
2966
|
LocalizationProvider: () => LocalizationProvider,
|
|
2967
|
+
MyAvatarComponent: () => MyAvatarComponent,
|
|
2968
|
+
NumberInputComponent: () => NumberInputComponent,
|
|
2969
|
+
PageComponent: () => PageComponent,
|
|
2970
|
+
PageLinkComponent: () => PageLinkComponent,
|
|
2971
|
+
ProtectedLanguageSelector: () => LanguageSelector,
|
|
2959
2972
|
Providers: () => Providers,
|
|
2973
|
+
PublicLanguageSelector: () => PublicLanguageSelector,
|
|
2974
|
+
RefreshButtonComponent: () => RefreshButtonComponent,
|
|
2975
|
+
SearchComponent: () => SearchComponent,
|
|
2976
|
+
SelectComponent: () => SelectComponent,
|
|
2960
2977
|
Services: () => Services,
|
|
2961
2978
|
SupabaseProvider: () => SupabaseProvider,
|
|
2979
|
+
SwitchComponent: () => SwitchComponent,
|
|
2980
|
+
TextFieldComponent: () => TextFieldComponent,
|
|
2962
2981
|
ThemeProvider: () => ThemeProvider,
|
|
2963
2982
|
ToastProvider: () => ToastProvider,
|
|
2983
|
+
TranslatableTooltipComponent: () => TranslatableTooltipComponent,
|
|
2964
2984
|
TranslateProvider: () => TranslateProvider,
|
|
2965
2985
|
TranslateText: () => TranslateText,
|
|
2966
2986
|
TranslationEditProvider: () => TranslationEditProvider,
|
|
2967
|
-
|
|
2987
|
+
UrlComponent: () => UrlComponent,
|
|
2988
|
+
UserAvatarComponent: () => UserAvatarComponent,
|
|
2989
|
+
UserPopoverComponent: () => UserPopoverComponent,
|
|
2990
|
+
UserRoleChipComponent: () => UserRoleChipComponent,
|
|
2968
2991
|
UserSettingsProvider: () => UserSettingsProvider,
|
|
2992
|
+
UserStatusChipComponent: () => UserStatusChipComponent,
|
|
2969
2993
|
Utils: () => Utils,
|
|
2970
2994
|
defaultUserSettings: () => defaultUserSettings,
|
|
2971
2995
|
initI18n: () => initI18n,
|
|
@@ -3417,248 +3441,54 @@ var NumberInputComponent = ({
|
|
|
3417
3441
|
);
|
|
3418
3442
|
};
|
|
3419
3443
|
|
|
3420
|
-
// src/UI/components/inputs/
|
|
3444
|
+
// src/UI/components/inputs/EmailInputComponent.tsx
|
|
3421
3445
|
var import_react10 = require("react");
|
|
3422
|
-
var import_material6 = require("@mui/material");
|
|
3423
|
-
var import_Link = __toESM(require("@mui/icons-material/Link"));
|
|
3424
|
-
var import_Launch2 = __toESM(require("@mui/icons-material/Launch"));
|
|
3425
|
-
var import_ContentCopy2 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
3426
|
-
var import_Check2 = __toESM(require("@mui/icons-material/Check"));
|
|
3427
|
-
var import_EditNote = __toESM(require("@mui/icons-material/EditNote"));
|
|
3428
|
-
var import_Lock2 = __toESM(require("@mui/icons-material/Lock"));
|
|
3429
|
-
init_TranslateText();
|
|
3430
3446
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
value,
|
|
3447
|
+
var EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
3448
|
+
var EmailInputComponent = ({
|
|
3449
|
+
value = "",
|
|
3435
3450
|
onChange,
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
const currentTitle = typeof value === "object" && value !== null ? value.title || "" : "";
|
|
3453
|
-
const getFormattedUrl = (val) => {
|
|
3454
|
-
if (!val) return "";
|
|
3455
|
-
const trimmed = val.trim();
|
|
3456
|
-
if (trimmed.match(/^[a-zA-Z]+:\/\//)) {
|
|
3457
|
-
return trimmed;
|
|
3451
|
+
onBlur,
|
|
3452
|
+
error: externalError,
|
|
3453
|
+
helperText: externalHelperText,
|
|
3454
|
+
invalidEmailError = "Invalid email address",
|
|
3455
|
+
disableValidation = false,
|
|
3456
|
+
onValidationChange,
|
|
3457
|
+
...props
|
|
3458
|
+
}) => {
|
|
3459
|
+
const [internalError, setInternalError] = (0, import_react10.useState)(null);
|
|
3460
|
+
const validateEmail = (val) => {
|
|
3461
|
+
if (disableValidation) return true;
|
|
3462
|
+
const stringVal = String(val ?? "").trim();
|
|
3463
|
+
if (!stringVal) {
|
|
3464
|
+
setInternalError(null);
|
|
3465
|
+
onValidationChange?.(true);
|
|
3466
|
+
return true;
|
|
3458
3467
|
}
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
const handleUrlChange = (newUrl) => {
|
|
3465
|
-
onChange?.({ url: newUrl, title: currentTitle });
|
|
3466
|
-
};
|
|
3467
|
-
const handleTitleChange = (newTitle) => {
|
|
3468
|
-
onChange?.({ url: currentUrl, title: newTitle });
|
|
3469
|
-
};
|
|
3470
|
-
const handleCopy = (e) => {
|
|
3471
|
-
e.stopPropagation();
|
|
3472
|
-
if (!finalUrl) return;
|
|
3473
|
-
navigator.clipboard.writeText(finalUrl);
|
|
3474
|
-
setCopied(true);
|
|
3475
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
3468
|
+
const isValid = EMAIL_REGEX.test(stringVal);
|
|
3469
|
+
const errorMessage = isValid ? null : invalidEmailError;
|
|
3470
|
+
setInternalError(errorMessage);
|
|
3471
|
+
onValidationChange?.(isValid);
|
|
3472
|
+
return isValid;
|
|
3476
3473
|
};
|
|
3477
|
-
const
|
|
3478
|
-
e.
|
|
3479
|
-
if (
|
|
3480
|
-
|
|
3474
|
+
const handleChange = (e) => {
|
|
3475
|
+
const newValue = e.target.value;
|
|
3476
|
+
if (internalError) {
|
|
3477
|
+
validateEmail(newValue);
|
|
3481
3478
|
}
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
if (isViewMode && finalUrl) {
|
|
3485
|
-
handleOpenLink(e);
|
|
3479
|
+
if (onChange) {
|
|
3480
|
+
onChange(e);
|
|
3486
3481
|
}
|
|
3487
3482
|
};
|
|
3488
|
-
const
|
|
3489
|
-
e.
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
setAnchorEl(null);
|
|
3494
|
-
};
|
|
3495
|
-
const isTitlePopoverOpen = Boolean(anchorEl);
|
|
3496
|
-
const displayHelperText = error ? helperText : description || helperText;
|
|
3497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
3498
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3499
|
-
import_material6.TextField,
|
|
3500
|
-
{
|
|
3501
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace, children: label }),
|
|
3502
|
-
type: isViewMode ? "text" : "url",
|
|
3503
|
-
value: isViewMode ? displayLabelText : currentUrl,
|
|
3504
|
-
onChange: (e) => handleUrlChange(e.target.value),
|
|
3505
|
-
required,
|
|
3506
|
-
error,
|
|
3507
|
-
disabled,
|
|
3508
|
-
margin: "dense",
|
|
3509
|
-
helperText: displayHelperText,
|
|
3510
|
-
fullWidth,
|
|
3511
|
-
placeholder: "example.com",
|
|
3512
|
-
sx: {
|
|
3513
|
-
"& .MuiInputLabel-asterisk": {
|
|
3514
|
-
color: "red",
|
|
3515
|
-
fontSize: "1.5rem"
|
|
3516
|
-
},
|
|
3517
|
-
"& .MuiInputBase-input": {
|
|
3518
|
-
color: isViewMode && finalUrl ? "primary.main" : void 0,
|
|
3519
|
-
textDecoration: isViewMode && finalUrl ? "underline" : "none",
|
|
3520
|
-
cursor: isViewMode && finalUrl ? "pointer" : void 0,
|
|
3521
|
-
fontWeight: isViewMode && finalUrl ? 500 : void 0
|
|
3522
|
-
},
|
|
3523
|
-
...sx
|
|
3524
|
-
},
|
|
3525
|
-
slotProps: {
|
|
3526
|
-
htmlInput: {
|
|
3527
|
-
readOnly,
|
|
3528
|
-
onClick: handleInputClick
|
|
3529
|
-
},
|
|
3530
|
-
input: {
|
|
3531
|
-
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Link.default, { fontSize: "small", color: isViewMode && finalUrl ? "primary" : "action" }) }),
|
|
3532
|
-
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material6.InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
|
|
3533
|
-
!isViewMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: currentTitle ? `Title: "${currentTitle}"` : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set link title" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3534
|
-
import_material6.IconButton,
|
|
3535
|
-
{
|
|
3536
|
-
size: "small",
|
|
3537
|
-
onClick: handleOpenTitleMenu,
|
|
3538
|
-
color: currentTitle ? "primary" : "default",
|
|
3539
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_EditNote.default, { fontSize: "small" })
|
|
3540
|
-
}
|
|
3541
|
-
) }),
|
|
3542
|
-
finalUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copied!" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copy link" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.IconButton, { size: "small", onClick: handleCopy, color: copied ? "success" : "default", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Check2.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ContentCopy2.default, { fontSize: "small" }) }) }),
|
|
3543
|
-
isViewMode && showLock && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3544
|
-
import_material6.IconButton,
|
|
3545
|
-
{
|
|
3546
|
-
size: "small",
|
|
3547
|
-
disabled: true,
|
|
3548
|
-
edge: "end",
|
|
3549
|
-
"aria-label": "locked input",
|
|
3550
|
-
sx: {
|
|
3551
|
-
"&.Mui-disabled": {
|
|
3552
|
-
color: "text.secondary"
|
|
3553
|
-
}
|
|
3554
|
-
},
|
|
3555
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Lock2.default, { fontSize: "small" })
|
|
3556
|
-
}
|
|
3557
|
-
) }),
|
|
3558
|
-
finalUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Open link" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.IconButton, { size: "small", onClick: handleOpenLink, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Launch2.default, { fontSize: "small", color: isViewMode ? "primary" : "action" }) }) })
|
|
3559
|
-
] })
|
|
3560
|
-
}
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
3563
|
-
),
|
|
3564
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3565
|
-
import_material6.Popover,
|
|
3566
|
-
{
|
|
3567
|
-
open: isTitlePopoverOpen,
|
|
3568
|
-
anchorEl,
|
|
3569
|
-
onClose: handleCloseTitleMenu,
|
|
3570
|
-
anchorOrigin: {
|
|
3571
|
-
vertical: "bottom",
|
|
3572
|
-
horizontal: "right"
|
|
3573
|
-
},
|
|
3574
|
-
transformOrigin: {
|
|
3575
|
-
vertical: "top",
|
|
3576
|
-
horizontal: "right"
|
|
3577
|
-
},
|
|
3578
|
-
slotProps: {
|
|
3579
|
-
paper: { sx: { p: 2, width: 280 } }
|
|
3580
|
-
},
|
|
3581
|
-
children: [
|
|
3582
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Typography, { variant: "subtitle2", sx: { mb: 1, fontWeight: "bold" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Link Title (Anchor)" }) }),
|
|
3583
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material6.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1.5, display: "block" }, children: [
|
|
3584
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Specify the text to display instead of the URL address" }),
|
|
3585
|
-
":"
|
|
3586
|
-
] }),
|
|
3587
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3588
|
-
import_material6.TextField,
|
|
3589
|
-
{
|
|
3590
|
-
size: "small",
|
|
3591
|
-
fullWidth: true,
|
|
3592
|
-
placeholder: "e.g. Instruction",
|
|
3593
|
-
value: currentTitle,
|
|
3594
|
-
onChange: (e) => handleTitleChange(e.target.value),
|
|
3595
|
-
autoFocus: true,
|
|
3596
|
-
onKeyDown: (e) => {
|
|
3597
|
-
if (e.key === "Enter") {
|
|
3598
|
-
e.preventDefault();
|
|
3599
|
-
handleCloseTitleMenu();
|
|
3600
|
-
}
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
),
|
|
3604
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Box, { sx: { display: "flex", justifyContent: "flex-end", mt: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Button, { size: "small", variant: "contained", onClick: handleCloseTitleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Done" }) }) })
|
|
3605
|
-
]
|
|
3606
|
-
}
|
|
3607
|
-
)
|
|
3608
|
-
] });
|
|
3609
|
-
}
|
|
3610
|
-
|
|
3611
|
-
// src/UI/index.ts
|
|
3612
|
-
init_TranslatableTooltipComponent();
|
|
3613
|
-
|
|
3614
|
-
// src/UI/components/inputs/EmailInputComponent.tsx
|
|
3615
|
-
var import_react11 = require("react");
|
|
3616
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3617
|
-
var EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
3618
|
-
var EmailInputComponent = ({
|
|
3619
|
-
value = "",
|
|
3620
|
-
onChange,
|
|
3621
|
-
onBlur,
|
|
3622
|
-
error: externalError,
|
|
3623
|
-
helperText: externalHelperText,
|
|
3624
|
-
invalidEmailError = "Invalid email address",
|
|
3625
|
-
disableValidation = false,
|
|
3626
|
-
onValidationChange,
|
|
3627
|
-
...props
|
|
3628
|
-
}) => {
|
|
3629
|
-
const [internalError, setInternalError] = (0, import_react11.useState)(null);
|
|
3630
|
-
const validateEmail = (val) => {
|
|
3631
|
-
if (disableValidation) return true;
|
|
3632
|
-
const stringVal = String(val ?? "").trim();
|
|
3633
|
-
if (!stringVal) {
|
|
3634
|
-
setInternalError(null);
|
|
3635
|
-
onValidationChange?.(true);
|
|
3636
|
-
return true;
|
|
3637
|
-
}
|
|
3638
|
-
const isValid = EMAIL_REGEX.test(stringVal);
|
|
3639
|
-
const errorMessage = isValid ? null : invalidEmailError;
|
|
3640
|
-
setInternalError(errorMessage);
|
|
3641
|
-
onValidationChange?.(isValid);
|
|
3642
|
-
return isValid;
|
|
3643
|
-
};
|
|
3644
|
-
const handleChange = (e) => {
|
|
3645
|
-
const newValue = e.target.value;
|
|
3646
|
-
if (internalError) {
|
|
3647
|
-
validateEmail(newValue);
|
|
3648
|
-
}
|
|
3649
|
-
if (onChange) {
|
|
3650
|
-
onChange(e);
|
|
3651
|
-
}
|
|
3652
|
-
};
|
|
3653
|
-
const handleBlur = (e) => {
|
|
3654
|
-
validateEmail(e.target.value);
|
|
3655
|
-
if (onBlur) {
|
|
3656
|
-
onBlur(e);
|
|
3657
|
-
}
|
|
3483
|
+
const handleBlur = (e) => {
|
|
3484
|
+
validateEmail(e.target.value);
|
|
3485
|
+
if (onBlur) {
|
|
3486
|
+
onBlur(e);
|
|
3487
|
+
}
|
|
3658
3488
|
};
|
|
3659
3489
|
const hasError = Boolean(externalError || internalError);
|
|
3660
3490
|
const displayHelperText = externalHelperText || internalError || void 0;
|
|
3661
|
-
return /* @__PURE__ */ (0,
|
|
3491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3662
3492
|
TextFieldComponent,
|
|
3663
3493
|
{
|
|
3664
3494
|
type: "email",
|
|
@@ -3672,1284 +3502,1025 @@ var EmailInputComponent = ({
|
|
|
3672
3502
|
);
|
|
3673
3503
|
};
|
|
3674
3504
|
|
|
3675
|
-
// src/UI/components/
|
|
3676
|
-
var
|
|
3677
|
-
var
|
|
3505
|
+
// src/UI/components/inputs/SearchComponent.tsx
|
|
3506
|
+
var import_react20 = require("react");
|
|
3507
|
+
var import_react_i18next5 = require("react-i18next");
|
|
3508
|
+
var import_material10 = require("@mui/material");
|
|
3509
|
+
var import_Translate4 = __toESM(require("@mui/icons-material/Translate"));
|
|
3510
|
+
var import_Clear2 = __toESM(require("@mui/icons-material/Clear"));
|
|
3678
3511
|
init_context();
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
avatarUrl = "",
|
|
3692
|
-
displayName = "",
|
|
3693
|
-
employeePost = "",
|
|
3694
|
-
size = 40,
|
|
3695
|
-
disableBorder = false,
|
|
3696
|
-
disableShadow = false,
|
|
3697
|
-
disablePopover = false,
|
|
3698
|
-
disableTooltip = false,
|
|
3699
|
-
sx = {}
|
|
3700
|
-
}) => {
|
|
3701
|
-
const supabase = useSupabase();
|
|
3702
|
-
const [anchorEl, setAnchorEl] = (0, import_react22.useState)(null);
|
|
3703
|
-
const [hasInteracted, setHasInteracted] = (0, import_react22.useState)(false);
|
|
3704
|
-
const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react22.useState)(null);
|
|
3705
|
-
const canShowPopover = !disablePopover && Boolean(userId);
|
|
3706
|
-
(0, import_react22.useEffect)(() => {
|
|
3707
|
-
let isMounted = true;
|
|
3708
|
-
const resolveAvatar = async () => {
|
|
3709
|
-
if (!avatarUrl) {
|
|
3710
|
-
if (isMounted) setResolvedAvatarUrl(null);
|
|
3711
|
-
return;
|
|
3712
|
-
}
|
|
3713
|
-
if (!avatarUrl.startsWith("http") && !avatarUrl.startsWith("data:")) {
|
|
3714
|
-
try {
|
|
3715
|
-
const { data } = await supabase.storage.from("user-media").createSignedUrl(avatarUrl, 3600);
|
|
3716
|
-
if (isMounted) {
|
|
3717
|
-
setResolvedAvatarUrl(data?.signedUrl || null);
|
|
3718
|
-
}
|
|
3719
|
-
} catch (err) {
|
|
3720
|
-
console.error("Error resolving signed url for avatar:", err);
|
|
3721
|
-
if (isMounted) setResolvedAvatarUrl(null);
|
|
3722
|
-
}
|
|
3723
|
-
} else {
|
|
3724
|
-
if (isMounted) setResolvedAvatarUrl(avatarUrl);
|
|
3725
|
-
}
|
|
3726
|
-
};
|
|
3727
|
-
resolveAvatar();
|
|
3512
|
+
init_translation_service();
|
|
3513
|
+
init_TranslationDialog();
|
|
3514
|
+
init_TranslatableTooltipComponent();
|
|
3515
|
+
|
|
3516
|
+
// src/hooks/useDebounce.ts
|
|
3517
|
+
var import_react19 = require("react");
|
|
3518
|
+
function useDebounce(value, delay = 500) {
|
|
3519
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react19.useState)(value);
|
|
3520
|
+
(0, import_react19.useEffect)(() => {
|
|
3521
|
+
const timer = setTimeout(() => {
|
|
3522
|
+
setDebouncedValue(value);
|
|
3523
|
+
}, delay);
|
|
3728
3524
|
return () => {
|
|
3729
|
-
|
|
3525
|
+
clearTimeout(timer);
|
|
3730
3526
|
};
|
|
3731
|
-
}, [
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3527
|
+
}, [value, delay]);
|
|
3528
|
+
return debouncedValue;
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
// src/UI/components/inputs/SearchComponent.tsx
|
|
3532
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3533
|
+
var SearchComponent = ({
|
|
3534
|
+
overrideNamespace,
|
|
3535
|
+
label = "",
|
|
3536
|
+
value = "",
|
|
3537
|
+
onChange,
|
|
3538
|
+
onClear,
|
|
3539
|
+
placeholderKey,
|
|
3540
|
+
clearTooltip = "Clear",
|
|
3541
|
+
debounceDelay = 500,
|
|
3542
|
+
onDebounceChange,
|
|
3543
|
+
slotProps,
|
|
3544
|
+
...restProps
|
|
3545
|
+
}) => {
|
|
3546
|
+
const supabase = useSupabase();
|
|
3547
|
+
const namespace = useTranslationNamespace();
|
|
3548
|
+
const { t, i18n: i18n2 } = (0, import_react_i18next5.useTranslation)(namespace);
|
|
3549
|
+
const { isTranslationMode } = useTranslationEdit();
|
|
3550
|
+
const [isDialogOpen, setIsDialogOpen] = (0, import_react20.useState)(false);
|
|
3551
|
+
const [localValue, setLocalValue] = (0, import_react20.useState)(String(value ?? ""));
|
|
3552
|
+
const debouncedValue = useDebounce(localValue, debounceDelay);
|
|
3553
|
+
(0, import_react20.useEffect)(() => {
|
|
3554
|
+
setLocalValue(String(value ?? ""));
|
|
3555
|
+
}, [value]);
|
|
3556
|
+
(0, import_react20.useEffect)(() => {
|
|
3557
|
+
if (onDebounceChange) {
|
|
3558
|
+
onDebounceChange(debouncedValue);
|
|
3559
|
+
}
|
|
3560
|
+
if (onChange && debouncedValue !== String(value ?? "")) {
|
|
3561
|
+
const syntheticEvent = {
|
|
3562
|
+
target: { value: debouncedValue },
|
|
3563
|
+
currentTarget: { value: debouncedValue }
|
|
3564
|
+
};
|
|
3565
|
+
onChange(syntheticEvent);
|
|
3740
3566
|
}
|
|
3567
|
+
}, [debouncedValue]);
|
|
3568
|
+
const hasValue = localValue.length > 0;
|
|
3569
|
+
const handleChange = (e) => {
|
|
3570
|
+
setLocalValue(e.target.value);
|
|
3741
3571
|
};
|
|
3742
|
-
const
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3572
|
+
const handleClear = (e) => {
|
|
3573
|
+
e.stopPropagation();
|
|
3574
|
+
setLocalValue("");
|
|
3575
|
+
if (onClear) {
|
|
3576
|
+
onClear();
|
|
3577
|
+
}
|
|
3578
|
+
if (onChange) {
|
|
3579
|
+
const syntheticEvent = {
|
|
3580
|
+
...e,
|
|
3581
|
+
target: { ...e.target, value: "" },
|
|
3582
|
+
currentTarget: { ...e.currentTarget, value: "" }
|
|
3583
|
+
};
|
|
3584
|
+
onChange(syntheticEvent);
|
|
3746
3585
|
}
|
|
3747
|
-
setAnchorEl(null);
|
|
3748
3586
|
};
|
|
3749
|
-
const
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
width: size,
|
|
3764
|
-
height: size,
|
|
3765
|
-
fontSize: size * 0.4,
|
|
3766
|
-
fontWeight: 600,
|
|
3767
|
-
bgcolor: "primary.main",
|
|
3768
|
-
color: "primary.contrastText",
|
|
3769
|
-
cursor: canShowPopover ? "pointer" : void 0,
|
|
3770
|
-
transition: "transform 0.2s ease, box-shadow 0.2s ease",
|
|
3771
|
-
border: disableBorder ? "none" : "2px solid",
|
|
3772
|
-
borderColor: "background.paper",
|
|
3773
|
-
boxShadow: disableShadow ? "none" : 2,
|
|
3774
|
-
"&:hover": {
|
|
3775
|
-
transform: canShowPopover ? "scale(1.05)" : "none"
|
|
3776
|
-
},
|
|
3777
|
-
...sx
|
|
3778
|
-
},
|
|
3779
|
-
children: !resolvedAvatarUrl && initials
|
|
3780
|
-
}
|
|
3781
|
-
) }),
|
|
3782
|
-
canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react22.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3783
|
-
LazyUserPopover,
|
|
3784
|
-
{
|
|
3785
|
-
userId,
|
|
3786
|
-
anchorEl,
|
|
3787
|
-
open: isPopoverOpen,
|
|
3788
|
-
onClose: handleClose
|
|
3789
|
-
}
|
|
3790
|
-
) })
|
|
3791
|
-
] });
|
|
3792
|
-
};
|
|
3793
|
-
|
|
3794
|
-
// src/UI/index.ts
|
|
3795
|
-
init_CopyClipboardButtonComponent();
|
|
3796
|
-
init_UserRoleChipComponent();
|
|
3797
|
-
init_UserStatusChipComponent();
|
|
3798
|
-
init_UserPopoverComponent();
|
|
3799
|
-
|
|
3800
|
-
// src/UI/components/data.display/MyAvatarComponent.tsx
|
|
3801
|
-
var import_react23 = require("react");
|
|
3802
|
-
var import_material16 = require("@mui/material");
|
|
3803
|
-
init_context();
|
|
3804
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3805
|
-
var getInitials2 = (name) => {
|
|
3806
|
-
if (!name) return "?";
|
|
3807
|
-
const parts = name.trim().split(" ");
|
|
3808
|
-
if (parts.length >= 2) {
|
|
3809
|
-
return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
|
|
3810
|
-
}
|
|
3811
|
-
return name[0].toUpperCase();
|
|
3812
|
-
};
|
|
3813
|
-
var MyAvatarComponent = ({
|
|
3814
|
-
size = 40,
|
|
3815
|
-
disableBorder = false,
|
|
3816
|
-
disableShadow = false,
|
|
3817
|
-
disablePopover = false,
|
|
3818
|
-
sx = {}
|
|
3819
|
-
}) => {
|
|
3820
|
-
const { profile: userProfile, loading: isLoading } = useAuth();
|
|
3821
|
-
const [anchorEl, setAnchorEl] = (0, import_react23.useState)(null);
|
|
3822
|
-
const handlePopoverOpen = (event) => {
|
|
3823
|
-
if (!disablePopover) {
|
|
3824
|
-
setAnchorEl(event.currentTarget);
|
|
3587
|
+
const translatedPlaceholder = placeholderKey ? t(placeholderKey) : void 0;
|
|
3588
|
+
const handleSaveTranslations = async (newValues, contextHint) => {
|
|
3589
|
+
if (!placeholderKey) return;
|
|
3590
|
+
const upsertData = Object.entries(newValues).map(([langCode, text]) => ({
|
|
3591
|
+
lang_code: langCode,
|
|
3592
|
+
namespace,
|
|
3593
|
+
key: placeholderKey,
|
|
3594
|
+
value: text,
|
|
3595
|
+
context_hint: contextHint
|
|
3596
|
+
}));
|
|
3597
|
+
const { error } = await supabase.from("translations").upsert(upsertData, { onConflict: "lang_code,namespace,key" });
|
|
3598
|
+
if (error) {
|
|
3599
|
+
alert("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0456\u0434 \u0447\u0430\u0441 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043D\u0438\u0445");
|
|
3600
|
+
throw error;
|
|
3825
3601
|
}
|
|
3602
|
+
await translationService.incrementVersion(supabase, namespace, Object.keys(newValues));
|
|
3603
|
+
Object.entries(newValues).forEach(([langCode, text]) => {
|
|
3604
|
+
i18n2.addResource(langCode, namespace, placeholderKey, text);
|
|
3605
|
+
});
|
|
3826
3606
|
};
|
|
3827
|
-
const
|
|
3828
|
-
|
|
3607
|
+
const renderEndAdornment = () => {
|
|
3608
|
+
const rawInputProps = slotProps?.input;
|
|
3609
|
+
const isInputObject = typeof rawInputProps === "object" && rawInputProps !== null;
|
|
3610
|
+
const existingEndAdornment = isInputObject && "endAdornment" in rawInputProps ? rawInputProps.endAdornment : void 0;
|
|
3611
|
+
if (!hasValue && (!isTranslationMode || !placeholderKey)) {
|
|
3612
|
+
return existingEndAdornment;
|
|
3613
|
+
}
|
|
3614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3615
|
+
existingEndAdornment,
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material10.InputAdornment, { position: "end", children: [
|
|
3617
|
+
hasValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3618
|
+
import_material10.IconButton,
|
|
3619
|
+
{
|
|
3620
|
+
size: "small",
|
|
3621
|
+
onClick: handleClear,
|
|
3622
|
+
edge: "end",
|
|
3623
|
+
"aria-label": "clear input",
|
|
3624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Clear2.default, { fontSize: "small" })
|
|
3625
|
+
}
|
|
3626
|
+
) }),
|
|
3627
|
+
isTranslationMode && placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material10.Tooltip, { title: `Translate placeholder: "${placeholderKey}"`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3628
|
+
import_material10.IconButton,
|
|
3629
|
+
{
|
|
3630
|
+
size: "small",
|
|
3631
|
+
onClick: (e) => {
|
|
3632
|
+
e.preventDefault();
|
|
3633
|
+
e.stopPropagation();
|
|
3634
|
+
setIsDialogOpen(true);
|
|
3635
|
+
},
|
|
3636
|
+
sx: {
|
|
3637
|
+
color: "#d97706",
|
|
3638
|
+
backgroundColor: "rgba(254, 243, 199, 0.6)",
|
|
3639
|
+
border: "1px dashed #f59e0b",
|
|
3640
|
+
p: "3px",
|
|
3641
|
+
ml: 0.5,
|
|
3642
|
+
"&:hover": {
|
|
3643
|
+
backgroundColor: "#fef08a"
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Translate4.default, { fontSize: "small" })
|
|
3647
|
+
}
|
|
3648
|
+
) })
|
|
3649
|
+
] })
|
|
3650
|
+
] });
|
|
3829
3651
|
};
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
import_material16.Skeleton,
|
|
3834
|
-
{
|
|
3835
|
-
variant: "circular",
|
|
3836
|
-
width: size,
|
|
3837
|
-
height: size,
|
|
3838
|
-
sx: { display: "inline-block", flexShrink: 0, ...sx }
|
|
3839
|
-
}
|
|
3840
|
-
);
|
|
3841
|
-
}
|
|
3842
|
-
const initials = getInitials2(userProfile?.display_name || "");
|
|
3843
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
3844
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3845
|
-
import_material16.Avatar,
|
|
3652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3653
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3654
|
+
import_material10.TextField,
|
|
3846
3655
|
{
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
transition: "transform 0.2s ease, box-shadow 0.2s ease",
|
|
3860
|
-
border: disableBorder ? "none" : "2px solid",
|
|
3861
|
-
borderColor: "background.paper",
|
|
3862
|
-
boxShadow: disableShadow ? "none" : 2,
|
|
3863
|
-
"&:hover": {
|
|
3864
|
-
transform: disablePopover ? "none" : "scale(1.05)"
|
|
3865
|
-
},
|
|
3866
|
-
...sx
|
|
3867
|
-
},
|
|
3868
|
-
children: !userProfile?.avatar_url && initials
|
|
3656
|
+
...restProps,
|
|
3657
|
+
label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
|
|
3658
|
+
value: localValue,
|
|
3659
|
+
onChange: handleChange,
|
|
3660
|
+
placeholder: translatedPlaceholder,
|
|
3661
|
+
slotProps: {
|
|
3662
|
+
...slotProps,
|
|
3663
|
+
input: {
|
|
3664
|
+
...slotProps?.input,
|
|
3665
|
+
endAdornment: renderEndAdornment()
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3869
3668
|
}
|
|
3870
3669
|
),
|
|
3871
|
-
|
|
3872
|
-
|
|
3670
|
+
placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3671
|
+
TranslationDialog,
|
|
3873
3672
|
{
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
horizontal: "center"
|
|
3880
|
-
},
|
|
3881
|
-
transformOrigin: {
|
|
3882
|
-
vertical: "top",
|
|
3883
|
-
horizontal: "center"
|
|
3884
|
-
},
|
|
3885
|
-
onClose: handlePopoverClose,
|
|
3886
|
-
disableRestoreFocus: true,
|
|
3887
|
-
disableAutoFocus: true,
|
|
3888
|
-
disableEnforceFocus: true,
|
|
3889
|
-
sx: {
|
|
3890
|
-
pointerEvents: "none",
|
|
3891
|
-
mt: 1
|
|
3892
|
-
},
|
|
3893
|
-
slotProps: {
|
|
3894
|
-
paper: {
|
|
3895
|
-
sx: {
|
|
3896
|
-
p: 1.5,
|
|
3897
|
-
borderRadius: 2,
|
|
3898
|
-
boxShadow: 3
|
|
3899
|
-
}
|
|
3900
|
-
}
|
|
3901
|
-
},
|
|
3902
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material16.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5 }, children: [
|
|
3903
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material16.Typography, { variant: "subtitle2", sx: { fontWeight: 600 }, children: userProfile?.display_name }),
|
|
3904
|
-
userProfile?.email && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material16.Typography, { variant: "caption", color: "text.secondary", children: userProfile.email })
|
|
3905
|
-
] })
|
|
3673
|
+
open: isDialogOpen,
|
|
3674
|
+
onClose: () => setIsDialogOpen(false),
|
|
3675
|
+
translationKey: placeholderKey,
|
|
3676
|
+
namespace,
|
|
3677
|
+
onSave: handleSaveTranslations
|
|
3906
3678
|
}
|
|
3907
3679
|
)
|
|
3908
3680
|
] });
|
|
3909
3681
|
};
|
|
3910
3682
|
|
|
3911
|
-
// src/
|
|
3912
|
-
var
|
|
3913
|
-
var
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3683
|
+
// src/UI/components/inputs/SelectComponent.tsx
|
|
3684
|
+
var import_material11 = require("@mui/material");
|
|
3685
|
+
var import_Close = __toESM(require("@mui/icons-material/Close"));
|
|
3686
|
+
init_context();
|
|
3687
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3688
|
+
var SelectComponent = ({
|
|
3689
|
+
overrideNamespace,
|
|
3690
|
+
label,
|
|
3691
|
+
value,
|
|
3692
|
+
options,
|
|
3693
|
+
onChange,
|
|
3694
|
+
id = "translated-select",
|
|
3695
|
+
fullWidth,
|
|
3696
|
+
size = "medium",
|
|
3697
|
+
multiple = false,
|
|
3698
|
+
withCheckboxes = false,
|
|
3699
|
+
clearable = true,
|
|
3700
|
+
maxSelect,
|
|
3701
|
+
disabled,
|
|
3702
|
+
maxDisplayedTags = 2,
|
|
3703
|
+
helperText,
|
|
3704
|
+
defaultValueOnClear,
|
|
3705
|
+
sx,
|
|
3706
|
+
...restProps
|
|
3707
|
+
}) => {
|
|
3708
|
+
const labelId = `${id}-label`;
|
|
3709
|
+
const safeValue = multiple ? Array.isArray(value) ? value : [] : value ?? "";
|
|
3710
|
+
const selectedArray = multiple ? safeValue : [];
|
|
3711
|
+
const isLimitReached = Boolean(multiple && maxSelect && selectedArray.length >= maxSelect);
|
|
3712
|
+
const hasValue = multiple ? selectedArray.length > 0 : safeValue !== "" && safeValue !== null && safeValue !== void 0;
|
|
3713
|
+
const handleChange = (event, child) => {
|
|
3714
|
+
if (multiple && maxSelect) {
|
|
3715
|
+
const newValue = event.target.value;
|
|
3716
|
+
if (newValue.length > maxSelect) {
|
|
3717
|
+
return;
|
|
3939
3718
|
}
|
|
3940
|
-
}
|
|
3941
|
-
|
|
3942
|
-
}, []);
|
|
3943
|
-
const handleClick = (event) => {
|
|
3944
|
-
setAnchorEl(event.currentTarget);
|
|
3719
|
+
}
|
|
3720
|
+
onChange?.(event, child);
|
|
3945
3721
|
};
|
|
3946
|
-
const
|
|
3947
|
-
|
|
3722
|
+
const handleClear = (e) => {
|
|
3723
|
+
e.stopPropagation();
|
|
3724
|
+
if (!onChange) return;
|
|
3725
|
+
const emptyValue = multiple ? [] : "";
|
|
3726
|
+
const targetValue = defaultValueOnClear !== void 0 ? defaultValueOnClear : emptyValue;
|
|
3727
|
+
const syntheticEvent = {
|
|
3728
|
+
target: {
|
|
3729
|
+
value: targetValue,
|
|
3730
|
+
name: restProps.name
|
|
3731
|
+
}
|
|
3732
|
+
};
|
|
3733
|
+
onChange(syntheticEvent, null);
|
|
3948
3734
|
};
|
|
3949
|
-
const
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3735
|
+
const renderValueHandler = (selected) => {
|
|
3736
|
+
if (!multiple) return void 0;
|
|
3737
|
+
const currentSelected = selected;
|
|
3738
|
+
if (currentSelected.length === 0) return null;
|
|
3739
|
+
const selectedOptions = options.filter((opt) => currentSelected.includes(opt.value));
|
|
3740
|
+
const visibleLabels = selectedOptions.slice(0, maxDisplayedTags).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value));
|
|
3741
|
+
const hiddenCount = selectedOptions.length - maxDisplayedTags;
|
|
3742
|
+
if (hiddenCount > 0) {
|
|
3743
|
+
return `${visibleLabels.join(", ")} (+${hiddenCount})`;
|
|
3744
|
+
}
|
|
3745
|
+
return visibleLabels.join(", ");
|
|
3953
3746
|
};
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
{
|
|
3964
|
-
onClick: handleClick,
|
|
3965
|
-
size: "small",
|
|
3966
|
-
"aria-controls": open ? "language-menu" : void 0,
|
|
3967
|
-
"aria-haspopup": "true",
|
|
3968
|
-
"aria-expanded": open ? "true" : void 0,
|
|
3969
|
-
sx: {
|
|
3970
|
-
p: 1,
|
|
3971
|
-
borderRadius: 2,
|
|
3972
|
-
transition: "background-color 0.2s",
|
|
3973
|
-
"&:hover": {
|
|
3974
|
-
backgroundColor: "action.hover"
|
|
3975
|
-
}
|
|
3976
|
-
},
|
|
3977
|
-
children: currentLang?.svg_flag && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3978
|
-
import_material17.Box,
|
|
3747
|
+
const isSmall = size === "small";
|
|
3748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3749
|
+
import_material11.Tooltip,
|
|
3750
|
+
{
|
|
3751
|
+
title: multiple ? Array.isArray(value) ? options.filter((opt) => value.includes(opt.value)).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ") : "" : options.find((opt) => opt.value === value)?.label ?? String(value ?? ""),
|
|
3752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material11.FormControl, { fullWidth, size, sx: { mt: 1 }, children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.InputLabel, { id: labelId, size: isSmall ? "small" : "medium", children: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace, children: label }) : label }),
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3755
|
+
import_material11.Select,
|
|
3979
3756
|
{
|
|
3757
|
+
labelId,
|
|
3758
|
+
id,
|
|
3759
|
+
value: safeValue,
|
|
3760
|
+
label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
|
|
3761
|
+
size,
|
|
3762
|
+
multiple,
|
|
3763
|
+
disabled,
|
|
3764
|
+
onChange: handleChange,
|
|
3765
|
+
renderValue: multiple ? renderValueHandler : void 0,
|
|
3766
|
+
...restProps,
|
|
3767
|
+
endAdornment: clearable && hasValue && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.InputAdornment, { position: "end", sx: { mr: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3768
|
+
import_material11.IconButton,
|
|
3769
|
+
{
|
|
3770
|
+
size: "small",
|
|
3771
|
+
onClick: handleClear,
|
|
3772
|
+
"aria-label": "clear selection",
|
|
3773
|
+
edge: "end",
|
|
3774
|
+
sx: { p: 0.5 },
|
|
3775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Close.default, { fontSize: "small" })
|
|
3776
|
+
}
|
|
3777
|
+
) }) : null,
|
|
3980
3778
|
sx: {
|
|
3981
|
-
|
|
3982
|
-
height:
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
boxShadow: "0 0 2px rgba(0,0,0,0.3)",
|
|
3987
|
-
display: "flex",
|
|
3988
|
-
alignItems: "center",
|
|
3989
|
-
justifyContent: "center",
|
|
3990
|
-
"& svg": { width: "100%", height: "100%", display: "block", objectFit: "cover" }
|
|
3991
|
-
},
|
|
3992
|
-
dangerouslySetInnerHTML: { __html: currentLang.svg_flag }
|
|
3993
|
-
}
|
|
3994
|
-
)
|
|
3995
|
-
}
|
|
3996
|
-
) }),
|
|
3997
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3998
|
-
import_material17.Menu,
|
|
3999
|
-
{
|
|
4000
|
-
id: "language-menu",
|
|
4001
|
-
anchorEl,
|
|
4002
|
-
open,
|
|
4003
|
-
onClose: handleClose,
|
|
4004
|
-
slotProps: {
|
|
4005
|
-
paper: {
|
|
4006
|
-
elevation: 3,
|
|
4007
|
-
sx: {
|
|
4008
|
-
mt: 1,
|
|
4009
|
-
minWidth: 150,
|
|
4010
|
-
borderRadius: 2
|
|
4011
|
-
}
|
|
4012
|
-
}
|
|
4013
|
-
},
|
|
4014
|
-
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
4015
|
-
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
4016
|
-
children: languages.map((lang) => {
|
|
4017
|
-
const isSelected = lang.code === currentLangCode;
|
|
4018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4019
|
-
import_material17.MenuItem,
|
|
4020
|
-
{
|
|
4021
|
-
selected: isSelected,
|
|
4022
|
-
onClick: () => handleSelectLanguage(lang.code),
|
|
4023
|
-
sx: {
|
|
3779
|
+
// 1. Задаем фиксированную высоту для всего контейнера инпута
|
|
3780
|
+
height: isSmall ? "40px" : "56px",
|
|
3781
|
+
minHeight: isSmall ? "40px" : "56px",
|
|
3782
|
+
// 2. Выравниваем внутренний класс текстового поля
|
|
3783
|
+
"& .MuiSelect-select": {
|
|
4024
3784
|
display: "flex",
|
|
4025
3785
|
alignItems: "center",
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
3786
|
+
boxSizing: "border-box",
|
|
3787
|
+
height: "100%",
|
|
3788
|
+
minHeight: "100% !important",
|
|
3789
|
+
py: 0,
|
|
3790
|
+
lineHeight: "normal",
|
|
3791
|
+
overflow: "hidden",
|
|
3792
|
+
textOverflow: "ellipsis",
|
|
3793
|
+
whiteSpace: "nowrap",
|
|
3794
|
+
paddingRight: clearable && hasValue ? "64px !important" : "32px !important"
|
|
4029
3795
|
},
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
"& svg": { width: "100%", height: "100%", display: "block" }
|
|
4042
|
-
},
|
|
4043
|
-
dangerouslySetInnerHTML: { __html: lang.svg_flag }
|
|
4044
|
-
}
|
|
4045
|
-
),
|
|
4046
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
|
|
4047
|
-
]
|
|
3796
|
+
// 3. Корректируем иконку стрелки выпадающего списка
|
|
3797
|
+
"& .MuiSelect-icon": {
|
|
3798
|
+
top: "calc(50% - 12px)"
|
|
3799
|
+
},
|
|
3800
|
+
// 4. Корректируем расположение иконки очистки
|
|
3801
|
+
"& .MuiInputAdornment-root": {
|
|
3802
|
+
maxHeight: "100%",
|
|
3803
|
+
height: "100%",
|
|
3804
|
+
alignItems: "center"
|
|
3805
|
+
},
|
|
3806
|
+
...sx
|
|
4048
3807
|
},
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
3808
|
+
children: options.map((option) => {
|
|
3809
|
+
const isSelected = multiple && selectedArray.includes(option.value);
|
|
3810
|
+
const isDisabled = Boolean(isLimitReached && !isSelected);
|
|
3811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3812
|
+
import_material11.MenuItem,
|
|
3813
|
+
{
|
|
3814
|
+
value: option.value,
|
|
3815
|
+
disabled: isDisabled,
|
|
3816
|
+
children: [
|
|
3817
|
+
multiple && withCheckboxes && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.Checkbox, { checked: isSelected, size, disabled: isDisabled }),
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3819
|
+
import_material11.ListItemText,
|
|
3820
|
+
{
|
|
3821
|
+
primary: option.isItalic ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("em", { children: option.label }) : option.label
|
|
3822
|
+
}
|
|
3823
|
+
)
|
|
3824
|
+
]
|
|
3825
|
+
},
|
|
3826
|
+
String(option.value)
|
|
3827
|
+
);
|
|
3828
|
+
})
|
|
3829
|
+
}
|
|
3830
|
+
),
|
|
3831
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.FormHelperText, { children: helperText })
|
|
3832
|
+
] })
|
|
3833
|
+
}
|
|
3834
|
+
);
|
|
4055
3835
|
};
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
}
|
|
4075
|
-
}
|
|
4076
|
-
|
|
4077
|
-
}, []);
|
|
4078
|
-
const handleClick = (event) => {
|
|
4079
|
-
setAnchorEl(event.currentTarget);
|
|
4080
|
-
};
|
|
4081
|
-
const handleClose = () => {
|
|
4082
|
-
setAnchorEl(null);
|
|
3836
|
+
|
|
3837
|
+
// src/UI/components/inputs/CheckboxComponent.tsx
|
|
3838
|
+
var import_material12 = require("@mui/material");
|
|
3839
|
+
init_TranslateText();
|
|
3840
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3841
|
+
var CheckboxComponent = ({
|
|
3842
|
+
checked = false,
|
|
3843
|
+
onChange,
|
|
3844
|
+
label,
|
|
3845
|
+
checkedLabel,
|
|
3846
|
+
uncheckedLabel,
|
|
3847
|
+
overrideNamespace,
|
|
3848
|
+
checkboxProps,
|
|
3849
|
+
...props
|
|
3850
|
+
}) => {
|
|
3851
|
+
const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
|
|
3852
|
+
const renderLabel = (node) => {
|
|
3853
|
+
if (typeof node === "string") {
|
|
3854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace, children: node });
|
|
3855
|
+
}
|
|
3856
|
+
return node;
|
|
4083
3857
|
};
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
3858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material12.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3859
|
+
import_material12.FormControlLabel,
|
|
3860
|
+
{
|
|
3861
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3862
|
+
import_material12.Checkbox,
|
|
3863
|
+
{
|
|
3864
|
+
checked,
|
|
3865
|
+
onChange,
|
|
3866
|
+
...checkboxProps
|
|
3867
|
+
}
|
|
3868
|
+
),
|
|
3869
|
+
label: renderLabel(currentLabel),
|
|
3870
|
+
...props
|
|
3871
|
+
}
|
|
3872
|
+
) });
|
|
3873
|
+
};
|
|
3874
|
+
|
|
3875
|
+
// src/UI/components/inputs/SwitchComponent.tsx
|
|
3876
|
+
var import_material13 = require("@mui/material");
|
|
3877
|
+
init_TranslateText();
|
|
3878
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3879
|
+
var SwitchComponent = ({
|
|
3880
|
+
checked = false,
|
|
3881
|
+
onChange,
|
|
3882
|
+
label,
|
|
3883
|
+
checkedLabel,
|
|
3884
|
+
uncheckedLabel,
|
|
3885
|
+
overrideNamespace,
|
|
3886
|
+
switchProps,
|
|
3887
|
+
...props
|
|
3888
|
+
}) => {
|
|
3889
|
+
const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
|
|
3890
|
+
const renderLabel = (node) => {
|
|
3891
|
+
if (typeof node === "string") {
|
|
3892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace, children: node });
|
|
3893
|
+
}
|
|
3894
|
+
return node;
|
|
4087
3895
|
};
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
3896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3897
|
+
import_material13.FormControlLabel,
|
|
3898
|
+
{
|
|
3899
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3900
|
+
import_material13.Switch,
|
|
3901
|
+
{
|
|
3902
|
+
checked,
|
|
3903
|
+
onChange,
|
|
3904
|
+
...switchProps
|
|
3905
|
+
}
|
|
3906
|
+
),
|
|
3907
|
+
label: renderLabel(currentLabel),
|
|
3908
|
+
...props
|
|
3909
|
+
}
|
|
3910
|
+
) });
|
|
3911
|
+
};
|
|
3912
|
+
|
|
3913
|
+
// src/UI/components/inputs/UrlComponent.tsx
|
|
3914
|
+
var import_react21 = require("react");
|
|
3915
|
+
var import_material14 = require("@mui/material");
|
|
3916
|
+
var import_Link = __toESM(require("@mui/icons-material/Link"));
|
|
3917
|
+
var import_Launch2 = __toESM(require("@mui/icons-material/Launch"));
|
|
3918
|
+
var import_ContentCopy2 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
3919
|
+
var import_Check2 = __toESM(require("@mui/icons-material/Check"));
|
|
3920
|
+
var import_EditNote = __toESM(require("@mui/icons-material/EditNote"));
|
|
3921
|
+
var import_Lock2 = __toESM(require("@mui/icons-material/Lock"));
|
|
3922
|
+
init_TranslateText();
|
|
3923
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3924
|
+
function UrlComponent({
|
|
3925
|
+
overrideNamespace,
|
|
3926
|
+
label,
|
|
3927
|
+
value,
|
|
3928
|
+
onChange,
|
|
3929
|
+
disabled = false,
|
|
3930
|
+
readOnly = false,
|
|
3931
|
+
required = false,
|
|
3932
|
+
error = false,
|
|
3933
|
+
helperText = "",
|
|
3934
|
+
description = "",
|
|
3935
|
+
fullWidth = true,
|
|
3936
|
+
openInNewTab = true,
|
|
3937
|
+
showLock = true,
|
|
3938
|
+
lockTooltip = "Field is not editable",
|
|
3939
|
+
sx
|
|
3940
|
+
}) {
|
|
3941
|
+
const [copied, setCopied] = (0, import_react21.useState)(false);
|
|
3942
|
+
const [anchorEl, setAnchorEl] = (0, import_react21.useState)(null);
|
|
3943
|
+
const isViewMode = disabled || readOnly;
|
|
3944
|
+
const currentUrl = typeof value === "object" && value !== null ? value.url || "" : value || "";
|
|
3945
|
+
const currentTitle = typeof value === "object" && value !== null ? value.title || "" : "";
|
|
3946
|
+
const getFormattedUrl = (val) => {
|
|
3947
|
+
if (!val) return "";
|
|
3948
|
+
const trimmed = val.trim();
|
|
3949
|
+
if (trimmed.match(/^[a-zA-Z]+:\/\//)) {
|
|
3950
|
+
return trimmed;
|
|
3951
|
+
}
|
|
3952
|
+
return `https://${trimmed}`;
|
|
3953
|
+
};
|
|
3954
|
+
const finalUrl = getFormattedUrl(currentUrl);
|
|
3955
|
+
const targetAttribute = openInNewTab ? "_blank" : "_self";
|
|
3956
|
+
const displayLabelText = currentTitle.trim() || currentUrl;
|
|
3957
|
+
const handleUrlChange = (newUrl) => {
|
|
3958
|
+
onChange?.({ url: newUrl, title: currentTitle });
|
|
3959
|
+
};
|
|
3960
|
+
const handleTitleChange = (newTitle) => {
|
|
3961
|
+
onChange?.({ url: currentUrl, title: newTitle });
|
|
3962
|
+
};
|
|
3963
|
+
const handleCopy = (e) => {
|
|
3964
|
+
e.stopPropagation();
|
|
3965
|
+
if (!finalUrl) return;
|
|
3966
|
+
navigator.clipboard.writeText(finalUrl);
|
|
3967
|
+
setCopied(true);
|
|
3968
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
3969
|
+
};
|
|
3970
|
+
const handleOpenLink = (e) => {
|
|
3971
|
+
e.stopPropagation();
|
|
3972
|
+
if (finalUrl) {
|
|
3973
|
+
window.open(finalUrl, targetAttribute, openInNewTab ? "noopener,noreferrer" : void 0);
|
|
3974
|
+
}
|
|
3975
|
+
};
|
|
3976
|
+
const handleInputClick = (e) => {
|
|
3977
|
+
if (isViewMode && finalUrl) {
|
|
3978
|
+
handleOpenLink(e);
|
|
3979
|
+
}
|
|
3980
|
+
};
|
|
3981
|
+
const handleOpenTitleMenu = (e) => {
|
|
3982
|
+
e.stopPropagation();
|
|
3983
|
+
setAnchorEl(e.currentTarget);
|
|
3984
|
+
};
|
|
3985
|
+
const handleCloseTitleMenu = () => {
|
|
3986
|
+
setAnchorEl(null);
|
|
3987
|
+
};
|
|
3988
|
+
const isTitlePopoverOpen = Boolean(anchorEl);
|
|
3989
|
+
const displayHelperText = error ? helperText : description || helperText;
|
|
3990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3992
|
+
import_material14.TextField,
|
|
3993
|
+
{
|
|
3994
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace, children: label }),
|
|
3995
|
+
type: isViewMode ? "text" : "url",
|
|
3996
|
+
value: isViewMode ? displayLabelText : currentUrl,
|
|
3997
|
+
onChange: (e) => handleUrlChange(e.target.value),
|
|
3998
|
+
required,
|
|
3999
|
+
error,
|
|
4000
|
+
disabled,
|
|
4001
|
+
margin: "dense",
|
|
4002
|
+
helperText: displayHelperText,
|
|
4003
|
+
fullWidth,
|
|
4004
|
+
placeholder: "example.com",
|
|
4103
4005
|
sx: {
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4006
|
+
"& .MuiInputLabel-asterisk": {
|
|
4007
|
+
color: "red",
|
|
4008
|
+
fontSize: "1.5rem"
|
|
4009
|
+
},
|
|
4010
|
+
"& .MuiInputBase-input": {
|
|
4011
|
+
color: isViewMode && finalUrl ? "primary.main" : void 0,
|
|
4012
|
+
textDecoration: isViewMode && finalUrl ? "underline" : "none",
|
|
4013
|
+
cursor: isViewMode && finalUrl ? "pointer" : void 0,
|
|
4014
|
+
fontWeight: isViewMode && finalUrl ? 500 : void 0
|
|
4015
|
+
},
|
|
4016
|
+
...sx
|
|
4110
4017
|
},
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4018
|
+
slotProps: {
|
|
4019
|
+
htmlInput: {
|
|
4020
|
+
readOnly,
|
|
4021
|
+
onClick: handleInputClick
|
|
4022
|
+
},
|
|
4023
|
+
input: {
|
|
4024
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Link.default, { fontSize: "small", color: isViewMode && finalUrl ? "primary" : "action" }) }),
|
|
4025
|
+
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
|
|
4026
|
+
!isViewMode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: currentTitle ? `Title: "${currentTitle}"` : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set link title" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4027
|
+
import_material14.IconButton,
|
|
4028
|
+
{
|
|
4029
|
+
size: "small",
|
|
4030
|
+
onClick: handleOpenTitleMenu,
|
|
4031
|
+
color: currentTitle ? "primary" : "default",
|
|
4032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_EditNote.default, { fontSize: "small" })
|
|
4033
|
+
}
|
|
4034
|
+
) }),
|
|
4035
|
+
finalUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copied!" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copy link" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", onClick: handleCopy, color: copied ? "success" : "default", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Check2.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ContentCopy2.default, { fontSize: "small" }) }) }),
|
|
4036
|
+
isViewMode && showLock && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4037
|
+
import_material14.IconButton,
|
|
4038
|
+
{
|
|
4039
|
+
size: "small",
|
|
4040
|
+
disabled: true,
|
|
4041
|
+
edge: "end",
|
|
4042
|
+
"aria-label": "locked input",
|
|
4043
|
+
sx: {
|
|
4044
|
+
"&.Mui-disabled": {
|
|
4045
|
+
color: "text.secondary"
|
|
4046
|
+
}
|
|
4047
|
+
},
|
|
4048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Lock2.default, { fontSize: "small" })
|
|
4049
|
+
}
|
|
4050
|
+
) }),
|
|
4051
|
+
finalUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Open link" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", onClick: handleOpenLink, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Launch2.default, { fontSize: "small", color: isViewMode ? "primary" : "action" }) }) })
|
|
4052
|
+
] })
|
|
4127
4053
|
}
|
|
4128
|
-
|
|
4054
|
+
}
|
|
4129
4055
|
}
|
|
4130
|
-
)
|
|
4131
|
-
/* @__PURE__ */ (0,
|
|
4132
|
-
|
|
4056
|
+
),
|
|
4057
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4058
|
+
import_material14.Popover,
|
|
4133
4059
|
{
|
|
4134
|
-
|
|
4060
|
+
open: isTitlePopoverOpen,
|
|
4135
4061
|
anchorEl,
|
|
4136
|
-
|
|
4137
|
-
|
|
4062
|
+
onClose: handleCloseTitleMenu,
|
|
4063
|
+
anchorOrigin: {
|
|
4064
|
+
vertical: "bottom",
|
|
4065
|
+
horizontal: "right"
|
|
4066
|
+
},
|
|
4067
|
+
transformOrigin: {
|
|
4068
|
+
vertical: "top",
|
|
4069
|
+
horizontal: "right"
|
|
4070
|
+
},
|
|
4138
4071
|
slotProps: {
|
|
4139
|
-
paper: {
|
|
4140
|
-
elevation: 3,
|
|
4141
|
-
sx: {
|
|
4142
|
-
mt: 1,
|
|
4143
|
-
minWidth: 150,
|
|
4144
|
-
borderRadius: 2
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
4072
|
+
paper: { sx: { p: 2, width: 280 } }
|
|
4147
4073
|
},
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4074
|
+
children: [
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "subtitle2", sx: { mb: 1, fontWeight: "bold" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Link Title (Anchor)" }) }),
|
|
4076
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1.5, display: "block" }, children: [
|
|
4077
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Specify the text to display instead of the URL address" }),
|
|
4078
|
+
":"
|
|
4079
|
+
] }),
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4081
|
+
import_material14.TextField,
|
|
4154
4082
|
{
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
borderRadius: "2px",
|
|
4172
|
-
overflow: "hidden",
|
|
4173
|
-
flexShrink: 0,
|
|
4174
|
-
boxShadow: "0 0 1px rgba(0,0,0,0.4)",
|
|
4175
|
-
"& svg": { width: "100%", height: "100%", display: "block" }
|
|
4176
|
-
},
|
|
4177
|
-
dangerouslySetInnerHTML: { __html: lang.svg_flag }
|
|
4178
|
-
}
|
|
4179
|
-
),
|
|
4180
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
|
|
4181
|
-
]
|
|
4182
|
-
},
|
|
4183
|
-
lang.code
|
|
4184
|
-
);
|
|
4185
|
-
})
|
|
4083
|
+
size: "small",
|
|
4084
|
+
fullWidth: true,
|
|
4085
|
+
placeholder: "e.g. Instruction",
|
|
4086
|
+
value: currentTitle,
|
|
4087
|
+
onChange: (e) => handleTitleChange(e.target.value),
|
|
4088
|
+
autoFocus: true,
|
|
4089
|
+
onKeyDown: (e) => {
|
|
4090
|
+
if (e.key === "Enter") {
|
|
4091
|
+
e.preventDefault();
|
|
4092
|
+
handleCloseTitleMenu();
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
),
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "flex-end", mt: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Button, { size: "small", variant: "contained", onClick: handleCloseTitleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Done" }) }) })
|
|
4098
|
+
]
|
|
4186
4099
|
}
|
|
4187
4100
|
)
|
|
4188
4101
|
] });
|
|
4189
|
-
}
|
|
4102
|
+
}
|
|
4190
4103
|
|
|
4191
|
-
// src/UI/components/
|
|
4192
|
-
var
|
|
4193
|
-
var
|
|
4194
|
-
var import_material18 = require("@mui/material");
|
|
4195
|
-
var import_Translate4 = __toESM(require("@mui/icons-material/Translate"));
|
|
4196
|
-
var import_Clear2 = __toESM(require("@mui/icons-material/Clear"));
|
|
4104
|
+
// src/UI/components/buttons/ButtonComponent.tsx
|
|
4105
|
+
var import_react22 = require("react");
|
|
4106
|
+
var import_material15 = require("@mui/material");
|
|
4197
4107
|
init_context();
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4108
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4109
|
+
var ButtonComponent = (0, import_react22.forwardRef)(
|
|
4110
|
+
({ label, children, overrideNamespace, ...props }, ref) => {
|
|
4111
|
+
const renderContent = (content) => {
|
|
4112
|
+
if (typeof content === "string") {
|
|
4113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TranslateText, { overrideNamespace, children: content });
|
|
4114
|
+
}
|
|
4115
|
+
return content;
|
|
4116
|
+
};
|
|
4117
|
+
const contentToRender = label !== void 0 ? label : children;
|
|
4118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Button, { ref, ...props, children: renderContent(contentToRender) });
|
|
4119
|
+
}
|
|
4120
|
+
);
|
|
4121
|
+
ButtonComponent.displayName = "ButtonComponent";
|
|
4201
4122
|
|
|
4202
|
-
// src/
|
|
4203
|
-
|
|
4204
|
-
function useDebounce(value, delay = 500) {
|
|
4205
|
-
const [debouncedValue, setDebouncedValue] = (0, import_react25.useState)(value);
|
|
4206
|
-
(0, import_react25.useEffect)(() => {
|
|
4207
|
-
const timer = setTimeout(() => {
|
|
4208
|
-
setDebouncedValue(value);
|
|
4209
|
-
}, delay);
|
|
4210
|
-
return () => {
|
|
4211
|
-
clearTimeout(timer);
|
|
4212
|
-
};
|
|
4213
|
-
}, [value, delay]);
|
|
4214
|
-
return debouncedValue;
|
|
4215
|
-
}
|
|
4123
|
+
// src/UI/index.ts
|
|
4124
|
+
init_CopyClipboardButtonComponent();
|
|
4216
4125
|
|
|
4217
|
-
// src/UI/components/
|
|
4218
|
-
var
|
|
4219
|
-
var
|
|
4126
|
+
// src/UI/components/buttons/RefreshButtonComponent.tsx
|
|
4127
|
+
var import_react24 = require("react");
|
|
4128
|
+
var import_material17 = require("@mui/material");
|
|
4129
|
+
var import_Refresh = __toESM(require("@mui/icons-material/Refresh"));
|
|
4130
|
+
init_context();
|
|
4131
|
+
init_TranslatableTooltipComponent();
|
|
4132
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4133
|
+
var AnimatedRefreshIcon = (0, import_material17.styled)(import_Refresh.default, {
|
|
4134
|
+
shouldForwardProp: (prop) => prop !== "isSpinning"
|
|
4135
|
+
})(({ isSpinning }) => ({
|
|
4136
|
+
animation: isSpinning ? "spin 1s linear infinite" : "none",
|
|
4137
|
+
"@keyframes spin": {
|
|
4138
|
+
"0%": {
|
|
4139
|
+
transform: "rotate(0deg)"
|
|
4140
|
+
},
|
|
4141
|
+
"100%": {
|
|
4142
|
+
transform: "rotate(360deg)"
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
}));
|
|
4146
|
+
var RefreshButtonComponent = ({
|
|
4220
4147
|
overrideNamespace,
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4148
|
+
size = "small",
|
|
4149
|
+
onClick,
|
|
4150
|
+
disabled = false,
|
|
4151
|
+
fullWidth = false,
|
|
4152
|
+
loading: externalLoading,
|
|
4153
|
+
tooltip,
|
|
4154
|
+
mobileViewOnly,
|
|
4155
|
+
disableMobileView,
|
|
4156
|
+
hideTooltipOnMobile,
|
|
4157
|
+
hideTooltipOnDesktop
|
|
4231
4158
|
}) => {
|
|
4232
|
-
const
|
|
4233
|
-
const
|
|
4234
|
-
const
|
|
4235
|
-
const
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
(0, import_react26.useEffect)(() => {
|
|
4243
|
-
if (onDebounceChange) {
|
|
4244
|
-
onDebounceChange(debouncedValue);
|
|
4245
|
-
}
|
|
4246
|
-
if (onChange && debouncedValue !== String(value ?? "")) {
|
|
4247
|
-
const syntheticEvent = {
|
|
4248
|
-
target: { value: debouncedValue },
|
|
4249
|
-
currentTarget: { value: debouncedValue }
|
|
4250
|
-
};
|
|
4251
|
-
onChange(syntheticEvent);
|
|
4252
|
-
}
|
|
4253
|
-
}, [debouncedValue]);
|
|
4254
|
-
const hasValue = localValue.length > 0;
|
|
4255
|
-
const handleChange = (e) => {
|
|
4256
|
-
setLocalValue(e.target.value);
|
|
4257
|
-
};
|
|
4258
|
-
const handleClear = (e) => {
|
|
4259
|
-
e.stopPropagation();
|
|
4260
|
-
setLocalValue("");
|
|
4261
|
-
if (onClear) {
|
|
4262
|
-
onClear();
|
|
4263
|
-
}
|
|
4264
|
-
if (onChange) {
|
|
4265
|
-
const syntheticEvent = {
|
|
4266
|
-
...e,
|
|
4267
|
-
target: { ...e.target, value: "" },
|
|
4268
|
-
currentTarget: { ...e.currentTarget, value: "" }
|
|
4269
|
-
};
|
|
4270
|
-
onChange(syntheticEvent);
|
|
4271
|
-
}
|
|
4272
|
-
};
|
|
4273
|
-
const translatedPlaceholder = placeholderKey ? t(placeholderKey) : void 0;
|
|
4274
|
-
const handleSaveTranslations = async (newValues, contextHint) => {
|
|
4275
|
-
if (!placeholderKey) return;
|
|
4276
|
-
const upsertData = Object.entries(newValues).map(([langCode, text]) => ({
|
|
4277
|
-
lang_code: langCode,
|
|
4278
|
-
namespace,
|
|
4279
|
-
key: placeholderKey,
|
|
4280
|
-
value: text,
|
|
4281
|
-
context_hint: contextHint
|
|
4282
|
-
}));
|
|
4283
|
-
const { error } = await supabase.from("translations").upsert(upsertData, { onConflict: "lang_code,namespace,key" });
|
|
4284
|
-
if (error) {
|
|
4285
|
-
alert("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0456\u0434 \u0447\u0430\u0441 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043D\u0438\u0445");
|
|
4286
|
-
throw error;
|
|
4287
|
-
}
|
|
4288
|
-
await translationService.incrementVersion(supabase, namespace, Object.keys(newValues));
|
|
4289
|
-
Object.entries(newValues).forEach(([langCode, text]) => {
|
|
4290
|
-
i18n2.addResource(langCode, namespace, placeholderKey, text);
|
|
4291
|
-
});
|
|
4292
|
-
};
|
|
4293
|
-
const renderEndAdornment = () => {
|
|
4294
|
-
const rawInputProps = slotProps?.input;
|
|
4295
|
-
const isInputObject = typeof rawInputProps === "object" && rawInputProps !== null;
|
|
4296
|
-
const existingEndAdornment = isInputObject && "endAdornment" in rawInputProps ? rawInputProps.endAdornment : void 0;
|
|
4297
|
-
if (!hasValue && (!isTranslationMode || !placeholderKey)) {
|
|
4298
|
-
return existingEndAdornment;
|
|
4159
|
+
const { displayState } = useAppTheme();
|
|
4160
|
+
const [internalLoading, setInternalLoading] = (0, import_react24.useState)(false);
|
|
4161
|
+
const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
|
|
4162
|
+
const handleClick = async (event) => {
|
|
4163
|
+
if (!onClick || isLoading || disabled) return;
|
|
4164
|
+
try {
|
|
4165
|
+
setInternalLoading(true);
|
|
4166
|
+
await onClick(event);
|
|
4167
|
+
} finally {
|
|
4168
|
+
setInternalLoading(false);
|
|
4299
4169
|
}
|
|
4300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4301
|
-
existingEndAdornment,
|
|
4302
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material18.InputAdornment, { position: "end", children: [
|
|
4303
|
-
hasValue && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4304
|
-
import_material18.IconButton,
|
|
4305
|
-
{
|
|
4306
|
-
size: "small",
|
|
4307
|
-
onClick: handleClear,
|
|
4308
|
-
edge: "end",
|
|
4309
|
-
"aria-label": "clear input",
|
|
4310
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Clear2.default, { fontSize: "small" })
|
|
4311
|
-
}
|
|
4312
|
-
) }),
|
|
4313
|
-
isTranslationMode && placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material18.Tooltip, { title: `Translate placeholder: "${placeholderKey}"`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4314
|
-
import_material18.IconButton,
|
|
4315
|
-
{
|
|
4316
|
-
size: "small",
|
|
4317
|
-
onClick: (e) => {
|
|
4318
|
-
e.preventDefault();
|
|
4319
|
-
e.stopPropagation();
|
|
4320
|
-
setIsDialogOpen(true);
|
|
4321
|
-
},
|
|
4322
|
-
sx: {
|
|
4323
|
-
color: "#d97706",
|
|
4324
|
-
backgroundColor: "rgba(254, 243, 199, 0.6)",
|
|
4325
|
-
border: "1px dashed #f59e0b",
|
|
4326
|
-
p: "3px",
|
|
4327
|
-
ml: 0.5,
|
|
4328
|
-
"&:hover": {
|
|
4329
|
-
backgroundColor: "#fef08a"
|
|
4330
|
-
}
|
|
4331
|
-
},
|
|
4332
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Translate4.default, { fontSize: "small" })
|
|
4333
|
-
}
|
|
4334
|
-
) })
|
|
4335
|
-
] })
|
|
4336
|
-
] });
|
|
4337
4170
|
};
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
...restProps,
|
|
4343
|
-
label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
|
|
4344
|
-
value: localValue,
|
|
4345
|
-
onChange: handleChange,
|
|
4346
|
-
placeholder: translatedPlaceholder,
|
|
4347
|
-
slotProps: {
|
|
4348
|
-
...slotProps,
|
|
4349
|
-
input: {
|
|
4350
|
-
...slotProps?.input,
|
|
4351
|
-
endAdornment: renderEndAdornment()
|
|
4352
|
-
}
|
|
4353
|
-
}
|
|
4354
|
-
}
|
|
4355
|
-
),
|
|
4356
|
-
placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4357
|
-
TranslationDialog,
|
|
4171
|
+
const renderIcon = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
|
|
4172
|
+
if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
|
|
4173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4174
|
+
import_material17.Fab,
|
|
4358
4175
|
{
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4176
|
+
size,
|
|
4177
|
+
color: "inherit",
|
|
4178
|
+
onClick: handleClick,
|
|
4179
|
+
disabled: disabled || isLoading,
|
|
4180
|
+
"aria-label": "refresh",
|
|
4181
|
+
children: renderIcon()
|
|
4364
4182
|
}
|
|
4365
|
-
)
|
|
4366
|
-
|
|
4183
|
+
) }) });
|
|
4184
|
+
}
|
|
4185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4186
|
+
import_material17.Button,
|
|
4187
|
+
{
|
|
4188
|
+
variant: "contained",
|
|
4189
|
+
color: "inherit",
|
|
4190
|
+
size,
|
|
4191
|
+
onClick: handleClick,
|
|
4192
|
+
disabled: disabled || isLoading,
|
|
4193
|
+
fullWidth,
|
|
4194
|
+
startIcon: renderIcon(),
|
|
4195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
|
|
4196
|
+
}
|
|
4197
|
+
) });
|
|
4367
4198
|
};
|
|
4368
4199
|
|
|
4369
|
-
// src/UI/
|
|
4370
|
-
|
|
4371
|
-
|
|
4200
|
+
// src/UI/index.ts
|
|
4201
|
+
init_TranslatableTooltipComponent();
|
|
4202
|
+
|
|
4203
|
+
// src/UI/components/data.display/UserAvatarComponent.tsx
|
|
4204
|
+
var import_react26 = require("react");
|
|
4205
|
+
var import_material21 = require("@mui/material");
|
|
4372
4206
|
init_context();
|
|
4373
|
-
var
|
|
4374
|
-
var
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4207
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4208
|
+
var LazyUserPopover = (0, import_react26.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
|
|
4209
|
+
var getInitials = (name) => {
|
|
4210
|
+
if (!name) return "?";
|
|
4211
|
+
const parts = name.trim().split(" ");
|
|
4212
|
+
if (parts.length >= 2) {
|
|
4213
|
+
return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
|
|
4214
|
+
}
|
|
4215
|
+
return name[0].toUpperCase();
|
|
4216
|
+
};
|
|
4217
|
+
var UserAvatarComponent = ({
|
|
4218
|
+
userId = "",
|
|
4219
|
+
avatarUrl = "",
|
|
4220
|
+
displayName = "",
|
|
4221
|
+
employeePost = "",
|
|
4222
|
+
size = 40,
|
|
4223
|
+
disableBorder = false,
|
|
4224
|
+
disableShadow = false,
|
|
4225
|
+
disablePopover = false,
|
|
4226
|
+
disableTooltip = false,
|
|
4227
|
+
sx = {}
|
|
4393
4228
|
}) => {
|
|
4394
|
-
const
|
|
4395
|
-
const
|
|
4396
|
-
const
|
|
4397
|
-
const
|
|
4398
|
-
const
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
if (
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4229
|
+
const supabase = useSupabase();
|
|
4230
|
+
const [anchorEl, setAnchorEl] = (0, import_react26.useState)(null);
|
|
4231
|
+
const [hasInteracted, setHasInteracted] = (0, import_react26.useState)(false);
|
|
4232
|
+
const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react26.useState)(null);
|
|
4233
|
+
const canShowPopover = !disablePopover && Boolean(userId);
|
|
4234
|
+
(0, import_react26.useEffect)(() => {
|
|
4235
|
+
let isMounted = true;
|
|
4236
|
+
const resolveAvatar = async () => {
|
|
4237
|
+
if (!avatarUrl) {
|
|
4238
|
+
if (isMounted) setResolvedAvatarUrl(null);
|
|
4239
|
+
return;
|
|
4240
|
+
}
|
|
4241
|
+
if (!avatarUrl.startsWith("http") && !avatarUrl.startsWith("data:")) {
|
|
4242
|
+
try {
|
|
4243
|
+
const { data } = await supabase.storage.from("user-media").createSignedUrl(avatarUrl, 3600);
|
|
4244
|
+
if (isMounted) {
|
|
4245
|
+
setResolvedAvatarUrl(data?.signedUrl || null);
|
|
4246
|
+
}
|
|
4247
|
+
} catch (err) {
|
|
4248
|
+
console.error("Error resolving signed url for avatar:", err);
|
|
4249
|
+
if (isMounted) setResolvedAvatarUrl(null);
|
|
4250
|
+
}
|
|
4251
|
+
} else {
|
|
4252
|
+
if (isMounted) setResolvedAvatarUrl(avatarUrl);
|
|
4417
4253
|
}
|
|
4418
4254
|
};
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4255
|
+
resolveAvatar();
|
|
4256
|
+
return () => {
|
|
4257
|
+
isMounted = false;
|
|
4258
|
+
};
|
|
4259
|
+
}, [avatarUrl]);
|
|
4260
|
+
const handleClick = (event) => {
|
|
4261
|
+
event.stopPropagation();
|
|
4262
|
+
event.preventDefault();
|
|
4263
|
+
if (canShowPopover) {
|
|
4264
|
+
setAnchorEl(event.currentTarget);
|
|
4265
|
+
if (!hasInteracted) {
|
|
4266
|
+
setHasInteracted(true);
|
|
4267
|
+
}
|
|
4430
4268
|
}
|
|
4431
|
-
return visibleLabels.join(", ");
|
|
4432
4269
|
};
|
|
4433
|
-
const
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
title: multiple ? Array.isArray(value) ? options.filter((opt) => value.includes(opt.value)).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ") : "" : options.find((opt) => opt.value === value)?.label ?? String(value ?? ""),
|
|
4438
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material19.FormControl, { fullWidth, size, sx: { mt: 1 }, children: [
|
|
4439
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.InputLabel, { id: labelId, size: isSmall ? "small" : "medium", children: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace, children: label }) : label }),
|
|
4440
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4441
|
-
import_material19.Select,
|
|
4442
|
-
{
|
|
4443
|
-
labelId,
|
|
4444
|
-
id,
|
|
4445
|
-
value: safeValue,
|
|
4446
|
-
label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
|
|
4447
|
-
size,
|
|
4448
|
-
multiple,
|
|
4449
|
-
disabled,
|
|
4450
|
-
onChange: handleChange,
|
|
4451
|
-
renderValue: multiple ? renderValueHandler : void 0,
|
|
4452
|
-
...restProps,
|
|
4453
|
-
endAdornment: clearable && hasValue && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.InputAdornment, { position: "end", sx: { mr: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4454
|
-
import_material19.IconButton,
|
|
4455
|
-
{
|
|
4456
|
-
size: "small",
|
|
4457
|
-
onClick: handleClear,
|
|
4458
|
-
"aria-label": "clear selection",
|
|
4459
|
-
edge: "end",
|
|
4460
|
-
sx: { p: 0.5 },
|
|
4461
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Close.default, { fontSize: "small" })
|
|
4462
|
-
}
|
|
4463
|
-
) }) : null,
|
|
4464
|
-
sx: {
|
|
4465
|
-
// 1. Задаем фиксированную высоту для всего контейнера инпута
|
|
4466
|
-
height: isSmall ? "40px" : "56px",
|
|
4467
|
-
minHeight: isSmall ? "40px" : "56px",
|
|
4468
|
-
// 2. Выравниваем внутренний класс текстового поля
|
|
4469
|
-
"& .MuiSelect-select": {
|
|
4470
|
-
display: "flex",
|
|
4471
|
-
alignItems: "center",
|
|
4472
|
-
boxSizing: "border-box",
|
|
4473
|
-
height: "100%",
|
|
4474
|
-
minHeight: "100% !important",
|
|
4475
|
-
py: 0,
|
|
4476
|
-
lineHeight: "normal",
|
|
4477
|
-
overflow: "hidden",
|
|
4478
|
-
textOverflow: "ellipsis",
|
|
4479
|
-
whiteSpace: "nowrap",
|
|
4480
|
-
paddingRight: clearable && hasValue ? "64px !important" : "32px !important"
|
|
4481
|
-
},
|
|
4482
|
-
// 3. Корректируем иконку стрелки выпадающего списка
|
|
4483
|
-
"& .MuiSelect-icon": {
|
|
4484
|
-
top: "calc(50% - 12px)"
|
|
4485
|
-
},
|
|
4486
|
-
// 4. Корректируем расположение иконки очистки
|
|
4487
|
-
"& .MuiInputAdornment-root": {
|
|
4488
|
-
maxHeight: "100%",
|
|
4489
|
-
height: "100%",
|
|
4490
|
-
alignItems: "center"
|
|
4491
|
-
},
|
|
4492
|
-
...sx
|
|
4493
|
-
},
|
|
4494
|
-
children: options.map((option) => {
|
|
4495
|
-
const isSelected = multiple && selectedArray.includes(option.value);
|
|
4496
|
-
const isDisabled = Boolean(isLimitReached && !isSelected);
|
|
4497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4498
|
-
import_material19.MenuItem,
|
|
4499
|
-
{
|
|
4500
|
-
value: option.value,
|
|
4501
|
-
disabled: isDisabled,
|
|
4502
|
-
children: [
|
|
4503
|
-
multiple && withCheckboxes && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.Checkbox, { checked: isSelected, size, disabled: isDisabled }),
|
|
4504
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4505
|
-
import_material19.ListItemText,
|
|
4506
|
-
{
|
|
4507
|
-
primary: option.isItalic ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("em", { children: option.label }) : option.label
|
|
4508
|
-
}
|
|
4509
|
-
)
|
|
4510
|
-
]
|
|
4511
|
-
},
|
|
4512
|
-
String(option.value)
|
|
4513
|
-
);
|
|
4514
|
-
})
|
|
4515
|
-
}
|
|
4516
|
-
),
|
|
4517
|
-
helperText && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.FormHelperText, { children: helperText })
|
|
4518
|
-
] })
|
|
4270
|
+
const handleClose = (event) => {
|
|
4271
|
+
if (event) {
|
|
4272
|
+
event.stopPropagation();
|
|
4273
|
+
event.preventDefault();
|
|
4519
4274
|
}
|
|
4520
|
-
|
|
4275
|
+
setAnchorEl(null);
|
|
4276
|
+
};
|
|
4277
|
+
const isPopoverOpen = Boolean(anchorEl);
|
|
4278
|
+
const initials = getInitials(displayName || "");
|
|
4279
|
+
const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { component: "div", variant: "caption", children: displayName }),
|
|
4281
|
+
displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { component: "div", variant: "caption", children: employeePost })
|
|
4282
|
+
] });
|
|
4283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4284
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4285
|
+
import_material21.Avatar,
|
|
4286
|
+
{
|
|
4287
|
+
src: resolvedAvatarUrl || void 0,
|
|
4288
|
+
alt: displayName || "User Avatar",
|
|
4289
|
+
onClick: handleClick,
|
|
4290
|
+
sx: {
|
|
4291
|
+
width: size,
|
|
4292
|
+
height: size,
|
|
4293
|
+
fontSize: size * 0.4,
|
|
4294
|
+
fontWeight: 600,
|
|
4295
|
+
bgcolor: "primary.main",
|
|
4296
|
+
color: "primary.contrastText",
|
|
4297
|
+
cursor: canShowPopover ? "pointer" : void 0,
|
|
4298
|
+
transition: "transform 0.2s ease, box-shadow 0.2s ease",
|
|
4299
|
+
border: disableBorder ? "none" : "2px solid",
|
|
4300
|
+
borderColor: "background.paper",
|
|
4301
|
+
boxShadow: disableShadow ? "none" : 2,
|
|
4302
|
+
"&:hover": {
|
|
4303
|
+
transform: canShowPopover ? "scale(1.05)" : "none"
|
|
4304
|
+
},
|
|
4305
|
+
...sx
|
|
4306
|
+
},
|
|
4307
|
+
children: !resolvedAvatarUrl && initials
|
|
4308
|
+
}
|
|
4309
|
+
) }),
|
|
4310
|
+
canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react26.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4311
|
+
LazyUserPopover,
|
|
4312
|
+
{
|
|
4313
|
+
userId,
|
|
4314
|
+
anchorEl,
|
|
4315
|
+
open: isPopoverOpen,
|
|
4316
|
+
onClose: handleClose
|
|
4317
|
+
}
|
|
4318
|
+
) })
|
|
4319
|
+
] });
|
|
4521
4320
|
};
|
|
4522
4321
|
|
|
4523
|
-
// src/UI/
|
|
4322
|
+
// src/UI/index.ts
|
|
4323
|
+
init_UserPopoverComponent();
|
|
4324
|
+
init_UserRoleChipComponent();
|
|
4325
|
+
init_UserStatusChipComponent();
|
|
4326
|
+
|
|
4327
|
+
// src/UI/components/data.display/MyAvatarComponent.tsx
|
|
4524
4328
|
var import_react27 = require("react");
|
|
4525
|
-
var
|
|
4329
|
+
var import_material22 = require("@mui/material");
|
|
4526
4330
|
init_context();
|
|
4527
|
-
var
|
|
4528
|
-
var
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4331
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4332
|
+
var getInitials2 = (name) => {
|
|
4333
|
+
if (!name) return "?";
|
|
4334
|
+
const parts = name.trim().split(" ");
|
|
4335
|
+
if (parts.length >= 2) {
|
|
4336
|
+
return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
|
|
4337
|
+
}
|
|
4338
|
+
return name[0].toUpperCase();
|
|
4339
|
+
};
|
|
4340
|
+
var MyAvatarComponent = ({
|
|
4341
|
+
size = 40,
|
|
4342
|
+
disableBorder = false,
|
|
4343
|
+
disableShadow = false,
|
|
4344
|
+
disablePopover = false,
|
|
4345
|
+
sx = {}
|
|
4535
4346
|
}) => {
|
|
4536
|
-
const
|
|
4537
|
-
|
|
4538
|
-
const
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
e.stopPropagation();
|
|
4542
|
-
setIsExpanded((prev) => !prev);
|
|
4543
|
-
};
|
|
4544
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4545
|
-
import_material20.Typography,
|
|
4546
|
-
{
|
|
4547
|
-
variant: "caption",
|
|
4548
|
-
sx: {
|
|
4549
|
-
color: "text.secondary",
|
|
4550
|
-
fontStyle: "italic",
|
|
4551
|
-
display: "inline-block",
|
|
4552
|
-
...sx
|
|
4553
|
-
},
|
|
4554
|
-
...restProps,
|
|
4555
|
-
children: [
|
|
4556
|
-
label !== void 0 ? label : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4557
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Note" }),
|
|
4558
|
-
": "
|
|
4559
|
-
] }),
|
|
4560
|
-
" ",
|
|
4561
|
-
displayedText,
|
|
4562
|
-
" ",
|
|
4563
|
-
isLong && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4564
|
-
import_material20.Link,
|
|
4565
|
-
{
|
|
4566
|
-
component: "button",
|
|
4567
|
-
type: "button",
|
|
4568
|
-
variant: "caption",
|
|
4569
|
-
underline: "hover",
|
|
4570
|
-
onClick: toggleExpand,
|
|
4571
|
-
sx: {
|
|
4572
|
-
fontStyle: "normal",
|
|
4573
|
-
fontWeight: "bold",
|
|
4574
|
-
ml: 0.5,
|
|
4575
|
-
cursor: "pointer",
|
|
4576
|
-
verticalAlign: "baseline"
|
|
4577
|
-
},
|
|
4578
|
-
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "less" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4579
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "more" }),
|
|
4580
|
-
"..."
|
|
4581
|
-
] })
|
|
4582
|
-
}
|
|
4583
|
-
)
|
|
4584
|
-
]
|
|
4347
|
+
const { profile: userProfile, loading: isLoading } = useAuth();
|
|
4348
|
+
const [anchorEl, setAnchorEl] = (0, import_react27.useState)(null);
|
|
4349
|
+
const handlePopoverOpen = (event) => {
|
|
4350
|
+
if (!disablePopover) {
|
|
4351
|
+
setAnchorEl(event.currentTarget);
|
|
4585
4352
|
}
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4353
|
+
};
|
|
4354
|
+
const handlePopoverClose = () => {
|
|
4355
|
+
setAnchorEl(null);
|
|
4356
|
+
};
|
|
4357
|
+
const isPopoverOpen = Boolean(anchorEl);
|
|
4358
|
+
if (isLoading) {
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4360
|
+
import_material22.Skeleton,
|
|
4361
|
+
{
|
|
4362
|
+
variant: "circular",
|
|
4363
|
+
width: size,
|
|
4364
|
+
height: size,
|
|
4365
|
+
sx: { display: "inline-block", flexShrink: 0, ...sx }
|
|
4366
|
+
}
|
|
4367
|
+
);
|
|
4368
|
+
}
|
|
4369
|
+
const initials = getInitials2(userProfile?.display_name || "");
|
|
4370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4371
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4372
|
+
import_material22.Avatar,
|
|
4373
|
+
{
|
|
4374
|
+
src: userProfile?.avatar_url || void 0,
|
|
4375
|
+
alt: userProfile?.display_name || "User Avatar",
|
|
4376
|
+
onMouseEnter: handlePopoverOpen,
|
|
4377
|
+
onMouseLeave: handlePopoverClose,
|
|
4378
|
+
sx: {
|
|
4379
|
+
width: size,
|
|
4380
|
+
height: size,
|
|
4381
|
+
fontSize: size * 0.4,
|
|
4382
|
+
fontWeight: 600,
|
|
4383
|
+
bgcolor: "primary.main",
|
|
4384
|
+
color: "primary.contrastText",
|
|
4385
|
+
cursor: disablePopover ? void 0 : "pointer",
|
|
4386
|
+
transition: "transform 0.2s ease, box-shadow 0.2s ease",
|
|
4387
|
+
border: disableBorder ? "none" : "2px solid",
|
|
4388
|
+
borderColor: "background.paper",
|
|
4389
|
+
boxShadow: disableShadow ? "none" : 2,
|
|
4390
|
+
"&:hover": {
|
|
4391
|
+
transform: disablePopover ? "none" : "scale(1.05)"
|
|
4392
|
+
},
|
|
4393
|
+
...sx
|
|
4394
|
+
},
|
|
4395
|
+
children: !userProfile?.avatar_url && initials
|
|
4396
|
+
}
|
|
4397
|
+
),
|
|
4398
|
+
!disablePopover && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4399
|
+
import_material22.Popover,
|
|
4400
|
+
{
|
|
4401
|
+
id: `avatar-popover-${userProfile?.id}`,
|
|
4402
|
+
open: isPopoverOpen,
|
|
4403
|
+
anchorEl,
|
|
4404
|
+
anchorOrigin: {
|
|
4405
|
+
vertical: "bottom",
|
|
4406
|
+
horizontal: "center"
|
|
4407
|
+
},
|
|
4408
|
+
transformOrigin: {
|
|
4409
|
+
vertical: "top",
|
|
4410
|
+
horizontal: "center"
|
|
4411
|
+
},
|
|
4412
|
+
onClose: handlePopoverClose,
|
|
4413
|
+
disableRestoreFocus: true,
|
|
4414
|
+
disableAutoFocus: true,
|
|
4415
|
+
disableEnforceFocus: true,
|
|
4416
|
+
sx: {
|
|
4417
|
+
pointerEvents: "none",
|
|
4418
|
+
mt: 1
|
|
4419
|
+
},
|
|
4420
|
+
slotProps: {
|
|
4421
|
+
paper: {
|
|
4422
|
+
sx: {
|
|
4423
|
+
p: 1.5,
|
|
4424
|
+
borderRadius: 2,
|
|
4425
|
+
boxShadow: 3
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
},
|
|
4429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material22.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5 }, children: [
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Typography, { variant: "subtitle2", sx: { fontWeight: 600 }, children: userProfile?.display_name }),
|
|
4431
|
+
userProfile?.email && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Typography, { variant: "caption", color: "text.secondary", children: userProfile.email })
|
|
4432
|
+
] })
|
|
4433
|
+
}
|
|
4434
|
+
)
|
|
4435
|
+
] });
|
|
4436
|
+
};
|
|
4437
|
+
|
|
4438
|
+
// src/UI/components/data.display/ExpandableNoteComponent.tsx
|
|
4439
|
+
var import_react28 = require("react");
|
|
4440
|
+
var import_material23 = require("@mui/material");
|
|
4441
|
+
init_context();
|
|
4442
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4443
|
+
var ExpandableNoteComponent = ({
|
|
4444
|
+
overrideNamespace,
|
|
4445
|
+
text,
|
|
4446
|
+
maxLength = 100,
|
|
4447
|
+
label,
|
|
4448
|
+
sx,
|
|
4449
|
+
...restProps
|
|
4606
4450
|
}) => {
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4609
|
-
|
|
4451
|
+
const [isExpanded, setIsExpanded] = (0, import_react28.useState)(false);
|
|
4452
|
+
if (!text) return null;
|
|
4453
|
+
const isLong = text.length > maxLength;
|
|
4454
|
+
const displayedText = isExpanded || !isLong ? text : `${text.slice(0, maxLength).trim()}...`;
|
|
4455
|
+
const toggleExpand = (e) => {
|
|
4456
|
+
e.stopPropagation();
|
|
4457
|
+
setIsExpanded((prev) => !prev);
|
|
4458
|
+
};
|
|
4459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4460
|
+
import_material23.Typography,
|
|
4610
4461
|
{
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
|
|
4620
|
-
}),
|
|
4462
|
+
variant: "caption",
|
|
4463
|
+
sx: {
|
|
4464
|
+
color: "text.secondary",
|
|
4465
|
+
fontStyle: "italic",
|
|
4466
|
+
display: "inline-block",
|
|
4467
|
+
...sx
|
|
4468
|
+
},
|
|
4469
|
+
...restProps,
|
|
4621
4470
|
children: [
|
|
4622
|
-
/* @__PURE__ */ (0,
|
|
4623
|
-
|
|
4471
|
+
label !== void 0 ? label : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Note" }),
|
|
4473
|
+
": "
|
|
4474
|
+
] }),
|
|
4475
|
+
" ",
|
|
4476
|
+
displayedText,
|
|
4477
|
+
" ",
|
|
4478
|
+
isLong && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4479
|
+
import_material23.Link,
|
|
4624
4480
|
{
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
import_material21.ListItem,
|
|
4637
|
-
{
|
|
4638
|
-
disablePadding: true,
|
|
4639
|
-
sx: {
|
|
4640
|
-
mt: 1,
|
|
4641
|
-
// Запрещаем ListItem менять цвет фона при наведении
|
|
4642
|
-
"&:hover": {
|
|
4643
|
-
backgroundColor: "transparent"
|
|
4644
|
-
}
|
|
4645
|
-
},
|
|
4646
|
-
children: [
|
|
4647
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4648
|
-
import_material21.ListItemIcon,
|
|
4649
|
-
{
|
|
4650
|
-
sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
|
|
4651
|
-
onClick: () => {
|
|
4652
|
-
if (link?.href) navigate(link.href);
|
|
4653
|
-
},
|
|
4654
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_material3.ArrowRight, { fontSize: "small", color: "inherit" })
|
|
4655
|
-
}
|
|
4656
|
-
),
|
|
4657
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.ListItemText, { children: link.onClick ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4658
|
-
import_material21.Button,
|
|
4659
|
-
{
|
|
4660
|
-
size: "small",
|
|
4661
|
-
variant: "text",
|
|
4662
|
-
color: bgcolor ? "inherit" : "primary",
|
|
4663
|
-
onClick: link.onClick,
|
|
4664
|
-
sx: {
|
|
4665
|
-
fontWeight: 500,
|
|
4666
|
-
textTransform: "none",
|
|
4667
|
-
// Отключает автоматические заглавные буквы (UPPERCASE)
|
|
4668
|
-
padding: 0,
|
|
4669
|
-
minWidth: "auto",
|
|
4670
|
-
justifyContent: "flex-start",
|
|
4671
|
-
textAlign: "left",
|
|
4672
|
-
transition: "opacity 0.2s ease-in-out",
|
|
4673
|
-
"&:hover": {
|
|
4674
|
-
opacity: 0.75,
|
|
4675
|
-
backgroundColor: "transparent",
|
|
4676
|
-
// Убирает стандартную серую подложку при ховере кнопки
|
|
4677
|
-
textDecoration: "underline"
|
|
4678
|
-
// Эффект подчеркивания, как у ссылки
|
|
4679
|
-
}
|
|
4680
|
-
},
|
|
4681
|
-
children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
4682
|
-
}
|
|
4683
|
-
) : link.href ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4684
|
-
import_material21.Link,
|
|
4685
|
-
{
|
|
4686
|
-
component: import_react_router_dom.Link,
|
|
4687
|
-
to: link.href,
|
|
4688
|
-
target: link.external ? "_blank" : "_self",
|
|
4689
|
-
rel: link.external ? "noopener noreferrer" : "",
|
|
4690
|
-
underline: "hover",
|
|
4691
|
-
color: bgcolor ? "inherit" : "primary",
|
|
4692
|
-
sx: {
|
|
4693
|
-
fontWeight: 500,
|
|
4694
|
-
display: "inline-block",
|
|
4695
|
-
transition: "opacity 0.2s ease-in-out",
|
|
4696
|
-
"&:hover": {
|
|
4697
|
-
opacity: 0.75,
|
|
4698
|
-
backgroundColor: "transparent"
|
|
4699
|
-
}
|
|
4700
|
-
},
|
|
4701
|
-
children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
4702
|
-
}
|
|
4703
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
|
|
4704
|
-
]
|
|
4481
|
+
component: "button",
|
|
4482
|
+
type: "button",
|
|
4483
|
+
variant: "caption",
|
|
4484
|
+
underline: "hover",
|
|
4485
|
+
onClick: toggleExpand,
|
|
4486
|
+
sx: {
|
|
4487
|
+
fontStyle: "normal",
|
|
4488
|
+
fontWeight: "bold",
|
|
4489
|
+
ml: 0.5,
|
|
4490
|
+
cursor: "pointer",
|
|
4491
|
+
verticalAlign: "baseline"
|
|
4705
4492
|
},
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4493
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "less" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "more" }),
|
|
4495
|
+
"..."
|
|
4496
|
+
] })
|
|
4497
|
+
}
|
|
4498
|
+
)
|
|
4710
4499
|
]
|
|
4711
4500
|
}
|
|
4712
4501
|
);
|
|
4713
4502
|
};
|
|
4714
4503
|
|
|
4715
|
-
// src/UI/components/
|
|
4716
|
-
var
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
var
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
switchProps,
|
|
4727
|
-
...props
|
|
4728
|
-
}) => {
|
|
4729
|
-
const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
|
|
4730
|
-
const renderLabel = (node) => {
|
|
4731
|
-
if (typeof node === "string") {
|
|
4732
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TranslateText, { overrideNamespace, children: node });
|
|
4733
|
-
}
|
|
4734
|
-
return node;
|
|
4735
|
-
};
|
|
4736
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4737
|
-
import_material22.FormControlLabel,
|
|
4504
|
+
// src/UI/components/data.display/ErrorAlertComponent.tsx
|
|
4505
|
+
var import_material24 = require("@mui/material");
|
|
4506
|
+
var import_Replay = __toESM(require("@mui/icons-material/Replay"));
|
|
4507
|
+
init_context();
|
|
4508
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4509
|
+
var ErrorIllustration = ({ size = 64 }) => {
|
|
4510
|
+
const theme = (0, import_material24.useTheme)();
|
|
4511
|
+
const mainColor = theme.palette.error.main;
|
|
4512
|
+
const lightColor = theme.palette.error.light;
|
|
4513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4514
|
+
import_material24.Box,
|
|
4738
4515
|
{
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
label: renderLabel(currentLabel),
|
|
4748
|
-
...props
|
|
4749
|
-
}
|
|
4750
|
-
) });
|
|
4751
|
-
};
|
|
4752
|
-
|
|
4753
|
-
// src/UI/components/inputs/CheckboxComponent.tsx
|
|
4754
|
-
var import_material23 = require("@mui/material");
|
|
4755
|
-
init_TranslateText();
|
|
4756
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4757
|
-
var CheckboxComponent = ({
|
|
4758
|
-
checked = false,
|
|
4759
|
-
onChange,
|
|
4760
|
-
label,
|
|
4761
|
-
checkedLabel,
|
|
4762
|
-
uncheckedLabel,
|
|
4763
|
-
overrideNamespace,
|
|
4764
|
-
checkboxProps,
|
|
4765
|
-
...props
|
|
4766
|
-
}) => {
|
|
4767
|
-
const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
|
|
4768
|
-
const renderLabel = (node) => {
|
|
4769
|
-
if (typeof node === "string") {
|
|
4770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace, children: node });
|
|
4771
|
-
}
|
|
4772
|
-
return node;
|
|
4773
|
-
};
|
|
4774
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material23.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4775
|
-
import_material23.FormControlLabel,
|
|
4776
|
-
{
|
|
4777
|
-
control: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4778
|
-
import_material23.Checkbox,
|
|
4779
|
-
{
|
|
4780
|
-
checked,
|
|
4781
|
-
onChange,
|
|
4782
|
-
...checkboxProps
|
|
4783
|
-
}
|
|
4784
|
-
),
|
|
4785
|
-
label: renderLabel(currentLabel),
|
|
4786
|
-
...props
|
|
4787
|
-
}
|
|
4788
|
-
) });
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
|
-
// src/UI/widgets/page/CollapsedWidgetContainer.tsx
|
|
4792
|
-
var import_icons_material4 = require("@mui/icons-material");
|
|
4793
|
-
var import_material24 = require("@mui/material");
|
|
4794
|
-
var import_react29 = require("react");
|
|
4795
|
-
init_context();
|
|
4796
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4797
|
-
var ExpandMore = (0, import_material24.styled)((props) => {
|
|
4798
|
-
const { expand, ...other } = props;
|
|
4799
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.IconButton, { size: "small", ...other, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons_material4.ExpandMore, {}) });
|
|
4800
|
-
})(({ theme, expand }) => ({
|
|
4801
|
-
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
|
|
4802
|
-
transition: theme.transitions.create("transform", {
|
|
4803
|
-
duration: theme.transitions.duration.shortest
|
|
4804
|
-
}),
|
|
4805
|
-
backgroundColor: expand ? theme.palette.primary.main : "transparent",
|
|
4806
|
-
color: expand ? theme.palette.common.white : theme.palette.text.secondary,
|
|
4807
|
-
border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
|
|
4808
|
-
"&:hover": {
|
|
4809
|
-
backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
|
|
4810
|
-
}
|
|
4811
|
-
}));
|
|
4812
|
-
var CollapsedWidgetContainer = (props) => {
|
|
4813
|
-
const { displayState } = useAppTheme();
|
|
4814
|
-
const [expanded, setExpanded] = (0, import_react29.useState)(props.expanded === void 0 ? false : props.expanded);
|
|
4815
|
-
const handleExpandClick = () => {
|
|
4816
|
-
setExpanded(!expanded);
|
|
4817
|
-
props.onExpanded && props.onExpanded(!expanded);
|
|
4818
|
-
};
|
|
4819
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Card, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
|
|
4820
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4821
|
-
import_material24.Box,
|
|
4822
|
-
{
|
|
4823
|
-
onClick: () => handleExpandClick(),
|
|
4824
|
-
sx: {
|
|
4825
|
-
cursor: "pointer",
|
|
4826
|
-
"&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
|
|
4827
|
-
display: "flex",
|
|
4828
|
-
alignItems: "center",
|
|
4829
|
-
pr: 2
|
|
4830
|
-
},
|
|
4831
|
-
children: [
|
|
4832
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4833
|
-
import_material24.CardHeader,
|
|
4834
|
-
{
|
|
4835
|
-
sx: { flexGrow: 1 },
|
|
4836
|
-
avatar: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Avatar, { sx: { bgcolor: "primary.main" }, children: props.icon }),
|
|
4837
|
-
title: typeof props.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Typography, { variant: "subtitle1", sx: { fontWeight: "700" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) }) : props.title,
|
|
4838
|
-
subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
|
|
4839
|
-
}
|
|
4840
|
-
),
|
|
4841
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Tooltip, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Box, { sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4842
|
-
ExpandMore,
|
|
4843
|
-
{
|
|
4844
|
-
expand: expanded,
|
|
4845
|
-
onClick: handleExpandClick,
|
|
4846
|
-
"aria-expanded": expanded
|
|
4847
|
-
}
|
|
4848
|
-
) }) })
|
|
4849
|
-
]
|
|
4850
|
-
}
|
|
4851
|
-
),
|
|
4852
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Collapse, { in: expanded, timeout: "auto", children: [
|
|
4853
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Divider, { variant: "middle" }),
|
|
4854
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.CardContent, { children: props.children })
|
|
4855
|
-
] })
|
|
4856
|
-
] });
|
|
4857
|
-
};
|
|
4858
|
-
|
|
4859
|
-
// src/UI/components/buttons/RefreshButtonComponent.tsx
|
|
4860
|
-
var import_react30 = require("react");
|
|
4861
|
-
var import_material25 = require("@mui/material");
|
|
4862
|
-
var import_Refresh = __toESM(require("@mui/icons-material/Refresh"));
|
|
4863
|
-
init_context();
|
|
4864
|
-
init_TranslatableTooltipComponent();
|
|
4865
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4866
|
-
var AnimatedRefreshIcon = (0, import_material25.styled)(import_Refresh.default, {
|
|
4867
|
-
shouldForwardProp: (prop) => prop !== "isSpinning"
|
|
4868
|
-
})(({ isSpinning }) => ({
|
|
4869
|
-
animation: isSpinning ? "spin 1s linear infinite" : "none",
|
|
4870
|
-
"@keyframes spin": {
|
|
4871
|
-
"0%": {
|
|
4872
|
-
transform: "rotate(0deg)"
|
|
4873
|
-
},
|
|
4874
|
-
"100%": {
|
|
4875
|
-
transform: "rotate(360deg)"
|
|
4876
|
-
}
|
|
4877
|
-
}
|
|
4878
|
-
}));
|
|
4879
|
-
var RefreshButtonComponent = ({
|
|
4880
|
-
overrideNamespace,
|
|
4881
|
-
size = "small",
|
|
4882
|
-
onClick,
|
|
4883
|
-
disabled = false,
|
|
4884
|
-
fullWidth = false,
|
|
4885
|
-
loading: externalLoading,
|
|
4886
|
-
tooltip,
|
|
4887
|
-
mobileViewOnly,
|
|
4888
|
-
disableMobileView,
|
|
4889
|
-
hideTooltipOnMobile,
|
|
4890
|
-
hideTooltipOnDesktop
|
|
4891
|
-
}) => {
|
|
4892
|
-
const { displayState } = useAppTheme();
|
|
4893
|
-
const [internalLoading, setInternalLoading] = (0, import_react30.useState)(false);
|
|
4894
|
-
const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
|
|
4895
|
-
const handleClick = async (event) => {
|
|
4896
|
-
if (!onClick || isLoading || disabled) return;
|
|
4897
|
-
try {
|
|
4898
|
-
setInternalLoading(true);
|
|
4899
|
-
await onClick(event);
|
|
4900
|
-
} finally {
|
|
4901
|
-
setInternalLoading(false);
|
|
4902
|
-
}
|
|
4903
|
-
};
|
|
4904
|
-
const renderIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
|
|
4905
|
-
if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
|
|
4906
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4907
|
-
import_material25.Fab,
|
|
4908
|
-
{
|
|
4909
|
-
size,
|
|
4910
|
-
color: "inherit",
|
|
4911
|
-
onClick: handleClick,
|
|
4912
|
-
disabled: disabled || isLoading,
|
|
4913
|
-
"aria-label": "refresh",
|
|
4914
|
-
children: renderIcon()
|
|
4915
|
-
}
|
|
4916
|
-
) }) });
|
|
4917
|
-
}
|
|
4918
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4919
|
-
import_material25.Button,
|
|
4920
|
-
{
|
|
4921
|
-
variant: "contained",
|
|
4922
|
-
color: "inherit",
|
|
4923
|
-
size,
|
|
4924
|
-
onClick: handleClick,
|
|
4925
|
-
disabled: disabled || isLoading,
|
|
4926
|
-
fullWidth,
|
|
4927
|
-
startIcon: renderIcon(),
|
|
4928
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
|
|
4929
|
-
}
|
|
4930
|
-
) });
|
|
4931
|
-
};
|
|
4932
|
-
|
|
4933
|
-
// src/UI/widgets/misc/ErrorAlertWidget.tsx
|
|
4934
|
-
var import_material26 = require("@mui/material");
|
|
4935
|
-
var import_Replay = __toESM(require("@mui/icons-material/Replay"));
|
|
4936
|
-
init_context();
|
|
4937
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4938
|
-
var ErrorIllustration = ({ size = 64 }) => {
|
|
4939
|
-
const theme = (0, import_material26.useTheme)();
|
|
4940
|
-
const mainColor = theme.palette.error.main;
|
|
4941
|
-
const lightColor = theme.palette.error.light;
|
|
4942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4943
|
-
import_material26.Box,
|
|
4944
|
-
{
|
|
4945
|
-
sx: {
|
|
4946
|
-
display: "flex",
|
|
4947
|
-
alignItems: "center",
|
|
4948
|
-
justifyContent: "center",
|
|
4949
|
-
flexShrink: 0
|
|
4950
|
-
},
|
|
4951
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
4952
|
-
"svg",
|
|
4516
|
+
sx: {
|
|
4517
|
+
display: "flex",
|
|
4518
|
+
alignItems: "center",
|
|
4519
|
+
justifyContent: "center",
|
|
4520
|
+
flexShrink: 0
|
|
4521
|
+
},
|
|
4522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4523
|
+
"svg",
|
|
4953
4524
|
{
|
|
4954
4525
|
width: size,
|
|
4955
4526
|
height: size,
|
|
@@ -4957,7 +4528,7 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
4957
4528
|
fill: "none",
|
|
4958
4529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4959
4530
|
children: [
|
|
4960
|
-
/* @__PURE__ */ (0,
|
|
4531
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4961
4532
|
"circle",
|
|
4962
4533
|
{
|
|
4963
4534
|
cx: "50",
|
|
@@ -4966,7 +4537,7 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
4966
4537
|
fill: lightColor,
|
|
4967
4538
|
fillOpacity: "0.25",
|
|
4968
4539
|
children: [
|
|
4969
|
-
/* @__PURE__ */ (0,
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4970
4541
|
"animate",
|
|
4971
4542
|
{
|
|
4972
4543
|
attributeName: "r",
|
|
@@ -4975,7 +4546,7 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
4975
4546
|
repeatCount: "indefinite"
|
|
4976
4547
|
}
|
|
4977
4548
|
),
|
|
4978
|
-
/* @__PURE__ */ (0,
|
|
4549
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4979
4550
|
"animate",
|
|
4980
4551
|
{
|
|
4981
4552
|
attributeName: "fill-opacity",
|
|
@@ -4987,8 +4558,8 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
4987
4558
|
]
|
|
4988
4559
|
}
|
|
4989
4560
|
),
|
|
4990
|
-
/* @__PURE__ */ (0,
|
|
4991
|
-
/* @__PURE__ */ (0,
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "50", cy: "50", r: "34", fill: lightColor, fillOpacity: "0.35" }),
|
|
4562
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4992
4563
|
"path",
|
|
4993
4564
|
{
|
|
4994
4565
|
d: "M50 20L80 72H20L50 20Z",
|
|
@@ -4998,7 +4569,7 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
4998
4569
|
strokeLinejoin: "round"
|
|
4999
4570
|
}
|
|
5000
4571
|
),
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
4572
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5002
4573
|
"path",
|
|
5003
4574
|
{
|
|
5004
4575
|
d: "M50 36V54",
|
|
@@ -5007,17 +4578,17 @@ var ErrorIllustration = ({ size = 64 }) => {
|
|
|
5007
4578
|
strokeLinecap: "round"
|
|
5008
4579
|
}
|
|
5009
4580
|
),
|
|
5010
|
-
/* @__PURE__ */ (0,
|
|
5011
|
-
/* @__PURE__ */ (0,
|
|
5012
|
-
/* @__PURE__ */ (0,
|
|
5013
|
-
/* @__PURE__ */ (0,
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "50", cy: "62", r: "2.5", fill: "#FFFFFF" }),
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "16", cy: "30", r: "3", fill: mainColor, opacity: "0.4" }),
|
|
4583
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "84", cy: "30", r: "2", fill: mainColor, opacity: "0.6" }),
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "88", cy: "68", r: "3", fill: mainColor, opacity: "0.3" })
|
|
5014
4585
|
]
|
|
5015
4586
|
}
|
|
5016
4587
|
)
|
|
5017
4588
|
}
|
|
5018
4589
|
);
|
|
5019
4590
|
};
|
|
5020
|
-
var
|
|
4591
|
+
var ErrorAlertComponent = ({
|
|
5021
4592
|
overrideNamespace,
|
|
5022
4593
|
title = "An error occurred",
|
|
5023
4594
|
message,
|
|
@@ -5025,8 +4596,8 @@ var ErrorAlertWidget = ({
|
|
|
5025
4596
|
retryText = "Retry",
|
|
5026
4597
|
isRetrying = false
|
|
5027
4598
|
}) => {
|
|
5028
|
-
return /* @__PURE__ */ (0,
|
|
5029
|
-
|
|
4599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4600
|
+
import_material24.Alert,
|
|
5030
4601
|
{
|
|
5031
4602
|
severity: "error",
|
|
5032
4603
|
icon: false,
|
|
@@ -5043,8 +4614,8 @@ var ErrorAlertWidget = ({
|
|
|
5043
4614
|
p: 0
|
|
5044
4615
|
}
|
|
5045
4616
|
},
|
|
5046
|
-
children: /* @__PURE__ */ (0,
|
|
5047
|
-
|
|
4617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4618
|
+
import_material24.Box,
|
|
5048
4619
|
{
|
|
5049
4620
|
sx: {
|
|
5050
4621
|
display: "flex",
|
|
@@ -5053,34 +4624,34 @@ var ErrorAlertWidget = ({
|
|
|
5053
4624
|
gap: 2
|
|
5054
4625
|
},
|
|
5055
4626
|
children: [
|
|
5056
|
-
/* @__PURE__ */ (0,
|
|
5057
|
-
/* @__PURE__ */ (0,
|
|
5058
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
5059
|
-
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorIllustration, { size: 68 }),
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Box, { sx: { flexGrow: 1 }, children: [
|
|
4629
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4630
|
+
import_material24.Typography,
|
|
5060
4631
|
{
|
|
5061
4632
|
variant: "subtitle1",
|
|
5062
4633
|
sx: { fontWeight: 600, color: "error.main", mb: 0.5 },
|
|
5063
|
-
children: /* @__PURE__ */ (0,
|
|
4634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace, children: title })
|
|
5064
4635
|
}
|
|
5065
4636
|
) : title,
|
|
5066
|
-
typeof message === "string" ? /* @__PURE__ */ (0,
|
|
4637
|
+
typeof message === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Typography, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace, children: message }) }) : message
|
|
5067
4638
|
] }),
|
|
5068
|
-
onRetry && /* @__PURE__ */ (0,
|
|
5069
|
-
|
|
4639
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4640
|
+
import_material24.Box,
|
|
5070
4641
|
{
|
|
5071
4642
|
sx: {
|
|
5072
4643
|
alignSelf: { xs: "flex-end", sm: "center" },
|
|
5073
4644
|
mt: { xs: 1, sm: 0 }
|
|
5074
4645
|
},
|
|
5075
|
-
children: /* @__PURE__ */ (0,
|
|
5076
|
-
|
|
4646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4647
|
+
import_material24.Button,
|
|
5077
4648
|
{
|
|
5078
4649
|
variant: "outlined",
|
|
5079
4650
|
color: "error",
|
|
5080
4651
|
size: "small",
|
|
5081
4652
|
disabled: isRetrying,
|
|
5082
4653
|
onClick: onRetry,
|
|
5083
|
-
startIcon: /* @__PURE__ */ (0,
|
|
4654
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5084
4655
|
import_Replay.default,
|
|
5085
4656
|
{
|
|
5086
4657
|
sx: {
|
|
@@ -5112,34 +4683,15 @@ var ErrorAlertWidget = ({
|
|
|
5112
4683
|
);
|
|
5113
4684
|
};
|
|
5114
4685
|
|
|
5115
|
-
// src/UI/components/buttons/ButtonComponent.tsx
|
|
5116
|
-
var import_react31 = require("react");
|
|
5117
|
-
var import_material27 = require("@mui/material");
|
|
5118
|
-
init_context();
|
|
5119
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5120
|
-
var ButtonComponent = (0, import_react31.forwardRef)(
|
|
5121
|
-
({ label, children, overrideNamespace, ...props }, ref) => {
|
|
5122
|
-
const renderContent = (content) => {
|
|
5123
|
-
if (typeof content === "string") {
|
|
5124
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: content });
|
|
5125
|
-
}
|
|
5126
|
-
return content;
|
|
5127
|
-
};
|
|
5128
|
-
const contentToRender = label !== void 0 ? label : children;
|
|
5129
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Button, { ref, ...props, children: renderContent(contentToRender) });
|
|
5130
|
-
}
|
|
5131
|
-
);
|
|
5132
|
-
ButtonComponent.displayName = "ButtonComponent";
|
|
5133
|
-
|
|
5134
4686
|
// src/UI/components/layout/PageComponent.tsx
|
|
5135
|
-
var
|
|
5136
|
-
var
|
|
4687
|
+
var import_react29 = __toESM(require("react"));
|
|
4688
|
+
var import_material25 = require("@mui/material");
|
|
5137
4689
|
var import_MoreVert = __toESM(require("@mui/icons-material/MoreVert"));
|
|
5138
4690
|
var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"));
|
|
5139
|
-
var
|
|
4691
|
+
var import_icons_material3 = require("@mui/icons-material");
|
|
5140
4692
|
init_context();
|
|
5141
4693
|
init_TranslatableTooltipComponent();
|
|
5142
|
-
var
|
|
4694
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5143
4695
|
var getTruncateStyles = (mode = "truncate") => {
|
|
5144
4696
|
switch (mode) {
|
|
5145
4697
|
case "truncate":
|
|
@@ -5167,10 +4719,10 @@ var PageHeader = ({
|
|
|
5167
4719
|
forceMobileView,
|
|
5168
4720
|
sx = []
|
|
5169
4721
|
}) => {
|
|
5170
|
-
const theme = (0,
|
|
5171
|
-
const mediaIsMobile = (0,
|
|
4722
|
+
const theme = (0, import_material25.useTheme)();
|
|
4723
|
+
const mediaIsMobile = (0, import_material25.useMediaQuery)(theme.breakpoints.down(mobileBreakpoint));
|
|
5172
4724
|
const isMobile = forceMobileView ?? mediaIsMobile;
|
|
5173
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
4725
|
+
const [anchorEl, setAnchorEl] = (0, import_react29.useState)(null);
|
|
5174
4726
|
const isMenuOpen = Boolean(anchorEl);
|
|
5175
4727
|
const handleOpenMenu = (e) => setAnchorEl(e.currentTarget);
|
|
5176
4728
|
const handleCloseMenu = () => setAnchorEl(null);
|
|
@@ -5180,8 +4732,8 @@ var PageHeader = ({
|
|
|
5180
4732
|
};
|
|
5181
4733
|
const hasSecondaryActions = secondaryActions.length > 0;
|
|
5182
4734
|
const hasActions = Boolean(primaryAction || hasSecondaryActions || refreshAction);
|
|
5183
|
-
return /* @__PURE__ */ (0,
|
|
5184
|
-
|
|
4735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4736
|
+
import_material25.Box,
|
|
5185
4737
|
{
|
|
5186
4738
|
sx: [
|
|
5187
4739
|
{
|
|
@@ -5199,9 +4751,9 @@ var PageHeader = ({
|
|
|
5199
4751
|
...Array.isArray(sx) ? sx : [sx]
|
|
5200
4752
|
],
|
|
5201
4753
|
children: [
|
|
5202
|
-
/* @__PURE__ */ (0,
|
|
5203
|
-
icon && /* @__PURE__ */ (0,
|
|
5204
|
-
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { display: "flex", alignItems: "center", gap: { xs: 1.5, sm: 2 }, minWidth: 0, flex: 1 }, children: [
|
|
4755
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4756
|
+
import_material25.Box,
|
|
5205
4757
|
{
|
|
5206
4758
|
sx: {
|
|
5207
4759
|
display: "flex",
|
|
@@ -5220,10 +4772,10 @@ var PageHeader = ({
|
|
|
5220
4772
|
children: icon
|
|
5221
4773
|
}
|
|
5222
4774
|
),
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5224
|
-
tag && /* @__PURE__ */ (0,
|
|
5225
|
-
/* @__PURE__ */ (0,
|
|
5226
|
-
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { minWidth: 0, flex: 1 }, children: [
|
|
4776
|
+
tag && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Box, { sx: { mb: 0.5, display: "flex", alignItems: "center" }, children: tag }),
|
|
4777
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Tooltip, { title: titleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: title }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4778
|
+
import_material25.Typography,
|
|
5227
4779
|
{
|
|
5228
4780
|
variant: "h5",
|
|
5229
4781
|
component: "h1",
|
|
@@ -5234,11 +4786,11 @@ var PageHeader = ({
|
|
|
5234
4786
|
lineHeight: 1.3,
|
|
5235
4787
|
...getTruncateStyles(titleTruncateMode)
|
|
5236
4788
|
},
|
|
5237
|
-
children: /* @__PURE__ */ (0,
|
|
4789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: title })
|
|
5238
4790
|
}
|
|
5239
4791
|
) }),
|
|
5240
|
-
subtitle && /* @__PURE__ */ (0,
|
|
5241
|
-
|
|
4792
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Tooltip, { title: subtitleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: subtitle }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4793
|
+
import_material25.Typography,
|
|
5242
4794
|
{
|
|
5243
4795
|
variant: "body2",
|
|
5244
4796
|
sx: {
|
|
@@ -5248,24 +4800,24 @@ var PageHeader = ({
|
|
|
5248
4800
|
lineHeight: 1.4,
|
|
5249
4801
|
...getTruncateStyles(subtitleTruncateMode)
|
|
5250
4802
|
},
|
|
5251
|
-
children: /* @__PURE__ */ (0,
|
|
4803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: subtitle })
|
|
5252
4804
|
}
|
|
5253
4805
|
) })
|
|
5254
4806
|
] })
|
|
5255
4807
|
] }),
|
|
5256
|
-
hasActions && /* @__PURE__ */ (0,
|
|
4808
|
+
hasActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Box, { sx: { flexShrink: 0, display: "flex", alignItems: "center", gap: 1 }, children: isMobile ? (
|
|
5257
4809
|
/* MOBILE: IconButton with MoreVertIcon showing ALL actions inside Menu */
|
|
5258
|
-
/* @__PURE__ */ (0,
|
|
5259
|
-
/* @__PURE__ */ (0,
|
|
5260
|
-
|
|
4810
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Actions" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4812
|
+
import_material25.IconButton,
|
|
5261
4813
|
{
|
|
5262
4814
|
onClick: handleOpenMenu,
|
|
5263
4815
|
sx: { border: "1px solid", borderColor: "divider", borderRadius: 2, p: 1 },
|
|
5264
|
-
children: /* @__PURE__ */ (0,
|
|
4816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_MoreVert.default, {})
|
|
5265
4817
|
}
|
|
5266
4818
|
) }),
|
|
5267
|
-
/* @__PURE__ */ (0,
|
|
5268
|
-
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4820
|
+
import_material25.Menu,
|
|
5269
4821
|
{
|
|
5270
4822
|
anchorEl,
|
|
5271
4823
|
open: isMenuOpen,
|
|
@@ -5274,9 +4826,9 @@ var PageHeader = ({
|
|
|
5274
4826
|
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
5275
4827
|
slotProps: { paper: { elevation: 4, sx: { minWidth: 200, borderRadius: 2, mt: 1, p: 0.5 } } },
|
|
5276
4828
|
children: [
|
|
5277
|
-
primaryAction && /* @__PURE__ */ (0,
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5279
|
-
|
|
4829
|
+
primaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4830
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4831
|
+
import_material25.MenuItem,
|
|
5280
4832
|
{
|
|
5281
4833
|
onClick: () => handleMenuAction(primaryAction.onClick),
|
|
5282
4834
|
disabled: primaryAction.disabled,
|
|
@@ -5289,32 +4841,32 @@ var PageHeader = ({
|
|
|
5289
4841
|
px: 1.5
|
|
5290
4842
|
},
|
|
5291
4843
|
children: [
|
|
5292
|
-
primaryAction.icon && /* @__PURE__ */ (0,
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
4844
|
+
primaryAction.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: primaryAction.icon }),
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: primaryAction.label }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
|
|
5294
4846
|
]
|
|
5295
4847
|
}
|
|
5296
4848
|
),
|
|
5297
|
-
hasSecondaryActions && /* @__PURE__ */ (0,
|
|
4849
|
+
hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.75 } })
|
|
5298
4850
|
] }),
|
|
5299
|
-
secondaryActions.map((action) => /* @__PURE__ */ (0,
|
|
5300
|
-
action.divider && /* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5302
|
-
|
|
4851
|
+
secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react29.default.Fragment, { children: [
|
|
4852
|
+
action.divider && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4854
|
+
import_material25.MenuItem,
|
|
5303
4855
|
{
|
|
5304
4856
|
onClick: () => handleMenuAction(action.onClick),
|
|
5305
4857
|
disabled: action.disabled,
|
|
5306
4858
|
sx: { borderRadius: 1, py: 1, px: 1.5, color: action.color ? `${action.color}.main` : "text.primary" },
|
|
5307
4859
|
children: [
|
|
5308
|
-
action.icon && /* @__PURE__ */ (0,
|
|
5309
|
-
/* @__PURE__ */ (0,
|
|
4860
|
+
action.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
|
|
5310
4862
|
]
|
|
5311
4863
|
}
|
|
5312
4864
|
)
|
|
5313
4865
|
] }, action.id)),
|
|
5314
|
-
refreshAction && /* @__PURE__ */ (0,
|
|
5315
|
-
/* @__PURE__ */ (0,
|
|
5316
|
-
/* @__PURE__ */ (0,
|
|
5317
|
-
|
|
4866
|
+
refreshAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4867
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
|
|
4868
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4869
|
+
import_material25.MenuItem,
|
|
5318
4870
|
{
|
|
5319
4871
|
onClick: () => handleMenuAction(refreshAction.onClick),
|
|
5320
4872
|
disabled: refreshAction.disabled,
|
|
@@ -5326,8 +4878,8 @@ var PageHeader = ({
|
|
|
5326
4878
|
px: 1.5
|
|
5327
4879
|
},
|
|
5328
4880
|
children: [
|
|
5329
|
-
/* @__PURE__ */ (0,
|
|
5330
|
-
/* @__PURE__ */ (0,
|
|
4881
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons_material3.Refresh, {}) }),
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
|
|
5331
4883
|
]
|
|
5332
4884
|
}
|
|
5333
4885
|
)
|
|
@@ -5338,10 +4890,10 @@ var PageHeader = ({
|
|
|
5338
4890
|
] })
|
|
5339
4891
|
) : (
|
|
5340
4892
|
/* DESKTOP: Primary Action Button + Secondary Actions Dropdown Button */
|
|
5341
|
-
/* @__PURE__ */ (0,
|
|
5342
|
-
(primaryAction || refreshAction) && /* @__PURE__ */ (0,
|
|
5343
|
-
primaryAction && /* @__PURE__ */ (0,
|
|
5344
|
-
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
4894
|
+
(primaryAction || refreshAction) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Stack, { direction: "row", spacing: 2, children: [
|
|
4895
|
+
primaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4896
|
+
import_material25.Button,
|
|
5345
4897
|
{
|
|
5346
4898
|
variant: primaryAction.variant || "contained",
|
|
5347
4899
|
color: primaryAction.color || "primary",
|
|
@@ -5349,32 +4901,32 @@ var PageHeader = ({
|
|
|
5349
4901
|
disabled: primaryAction.disabled,
|
|
5350
4902
|
startIcon: primaryAction.icon,
|
|
5351
4903
|
sx: { borderRadius: 2, textTransform: "none", fontWeight: 600, px: 2, py: 0.85 },
|
|
5352
|
-
children: /* @__PURE__ */ (0,
|
|
4904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: primaryAction.label })
|
|
5353
4905
|
}
|
|
5354
4906
|
),
|
|
5355
|
-
refreshAction && /* @__PURE__ */ (0,
|
|
5356
|
-
|
|
4907
|
+
refreshAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4908
|
+
import_material25.Fab,
|
|
5357
4909
|
{
|
|
5358
4910
|
color: "default",
|
|
5359
4911
|
onClick: refreshAction.onClick,
|
|
5360
4912
|
disabled: refreshAction.disabled,
|
|
5361
4913
|
"aria-label": "refresh",
|
|
5362
4914
|
size: "small",
|
|
5363
|
-
children: /* @__PURE__ */ (0,
|
|
4915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons_material3.Refresh, {})
|
|
5364
4916
|
}
|
|
5365
4917
|
) })
|
|
5366
4918
|
] }),
|
|
5367
|
-
hasSecondaryActions && /* @__PURE__ */ (0,
|
|
5368
|
-
/* @__PURE__ */ (0,
|
|
5369
|
-
|
|
4919
|
+
hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4920
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4921
|
+
import_material25.IconButton,
|
|
5370
4922
|
{
|
|
5371
4923
|
onClick: handleOpenMenu,
|
|
5372
4924
|
sx: { border: "1px solid", borderColor: "divider", borderRadius: 2, p: 1 },
|
|
5373
|
-
children: /* @__PURE__ */ (0,
|
|
4925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_KeyboardArrowDown.default, {})
|
|
5374
4926
|
}
|
|
5375
4927
|
),
|
|
5376
|
-
/* @__PURE__ */ (0,
|
|
5377
|
-
|
|
4928
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4929
|
+
import_material25.Menu,
|
|
5378
4930
|
{
|
|
5379
4931
|
anchorEl,
|
|
5380
4932
|
open: isMenuOpen,
|
|
@@ -5382,17 +4934,17 @@ var PageHeader = ({
|
|
|
5382
4934
|
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
5383
4935
|
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
5384
4936
|
slotProps: { paper: { elevation: 4, sx: { minWidth: 180, borderRadius: 2, mt: 1, p: 0.5 } } },
|
|
5385
|
-
children: secondaryActions.map((action) => /* @__PURE__ */ (0,
|
|
5386
|
-
action.divider && /* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5388
|
-
|
|
4937
|
+
children: secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react29.default.Fragment, { children: [
|
|
4938
|
+
action.divider && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4940
|
+
import_material25.MenuItem,
|
|
5389
4941
|
{
|
|
5390
4942
|
onClick: () => handleMenuAction(action.onClick),
|
|
5391
4943
|
disabled: action.disabled,
|
|
5392
4944
|
sx: { borderRadius: 1, py: 0.85, color: action.color ? `${action.color}.main` : "text.primary" },
|
|
5393
4945
|
children: [
|
|
5394
|
-
action.icon && /* @__PURE__ */ (0,
|
|
5395
|
-
/* @__PURE__ */ (0,
|
|
4946
|
+
action.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
|
|
4947
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
|
|
5396
4948
|
]
|
|
5397
4949
|
}
|
|
5398
4950
|
)
|
|
@@ -5402,14 +4954,14 @@ var PageHeader = ({
|
|
|
5402
4954
|
] })
|
|
5403
4955
|
] })
|
|
5404
4956
|
) }),
|
|
5405
|
-
customFragment && /* @__PURE__ */ (0,
|
|
4957
|
+
customFragment && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: customFragment })
|
|
5406
4958
|
]
|
|
5407
4959
|
}
|
|
5408
4960
|
);
|
|
5409
4961
|
};
|
|
5410
4962
|
var PageContainer = ({ children }) => {
|
|
5411
|
-
return /* @__PURE__ */ (0,
|
|
5412
|
-
|
|
4963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4964
|
+
import_material25.Box,
|
|
5413
4965
|
{
|
|
5414
4966
|
sx: {
|
|
5415
4967
|
width: "100%",
|
|
@@ -5425,8 +4977,8 @@ var PageComponent = ({
|
|
|
5425
4977
|
header,
|
|
5426
4978
|
children
|
|
5427
4979
|
}) => {
|
|
5428
|
-
return /* @__PURE__ */ (0,
|
|
5429
|
-
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4981
|
+
import_material25.Box,
|
|
5430
4982
|
{
|
|
5431
4983
|
sx: {
|
|
5432
4984
|
//pt: 2,
|
|
@@ -5435,120 +4987,511 @@ var PageComponent = ({
|
|
|
5435
4987
|
overflowY: "auto",
|
|
5436
4988
|
boxSizing: "border-box"
|
|
5437
4989
|
},
|
|
5438
|
-
children: /* @__PURE__ */ (0,
|
|
5439
|
-
header && /* @__PURE__ */ (0,
|
|
4990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(PageContainer, { children: [
|
|
4991
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PageHeader, { ...header }),
|
|
5440
4992
|
children
|
|
5441
4993
|
] })
|
|
5442
4994
|
}
|
|
5443
4995
|
);
|
|
5444
4996
|
};
|
|
5445
4997
|
|
|
5446
|
-
// src/UI/
|
|
5447
|
-
var
|
|
5448
|
-
var
|
|
5449
|
-
var
|
|
4998
|
+
// src/UI/components/layout/FilterContainerComponent.tsx
|
|
4999
|
+
var import_react30 = __toESM(require("react"));
|
|
5000
|
+
var import_material26 = require("@mui/material");
|
|
5001
|
+
var import_jsx_runtime36 = (
|
|
5450
5002
|
/* Автоматическая обертка каждого дочернего элемента в Grid size */
|
|
5451
5003
|
require("react/jsx-runtime")
|
|
5452
5004
|
);
|
|
5453
|
-
var
|
|
5454
|
-
switch (width) {
|
|
5455
|
-
case "25%":
|
|
5456
|
-
return 3;
|
|
5457
|
-
case "33%":
|
|
5458
|
-
return 4;
|
|
5459
|
-
case "50%":
|
|
5460
|
-
return 6;
|
|
5461
|
-
case "66%":
|
|
5462
|
-
return 8;
|
|
5463
|
-
case "75%":
|
|
5464
|
-
return 9;
|
|
5465
|
-
case "100%":
|
|
5466
|
-
default:
|
|
5467
|
-
return 12;
|
|
5468
|
-
}
|
|
5469
|
-
};
|
|
5470
|
-
var createGridSize = (desktopWidth, mobileWidth = "100%") => {
|
|
5471
|
-
return {
|
|
5472
|
-
xs: widthToGridColumns(mobileWidth),
|
|
5473
|
-
md: widthToGridColumns(desktopWidth)
|
|
5474
|
-
};
|
|
5475
|
-
};
|
|
5476
|
-
var FilterSection = ({
|
|
5477
|
-
width = "100%",
|
|
5478
|
-
mobileWidth = "100%",
|
|
5479
|
-
itemWidth = "50%",
|
|
5480
|
-
itemMobileWidth = "100%",
|
|
5481
|
-
children
|
|
5482
|
-
}) => {
|
|
5483
|
-
const sectionGridSize = createGridSize(width, mobileWidth);
|
|
5484
|
-
const itemGridSize = createGridSize(itemWidth, itemMobileWidth);
|
|
5485
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { size: sectionGridSize, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { container: true, spacing: 2, sx: { alignItems: "center" }, children: import_react33.default.Children.map(children, (child) => {
|
|
5486
|
-
if (!child) return null;
|
|
5487
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { size: itemGridSize, children: child });
|
|
5488
|
-
}) }) });
|
|
5489
|
-
};
|
|
5490
|
-
var FilterContainerWidget = ({
|
|
5005
|
+
var FilterContainerComponent = ({
|
|
5491
5006
|
sections,
|
|
5492
5007
|
children,
|
|
5493
5008
|
sx
|
|
5494
5009
|
}) => {
|
|
5495
|
-
return /* @__PURE__ */ (0,
|
|
5496
|
-
|
|
5010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5011
|
+
import_material26.Paper,
|
|
5497
5012
|
{
|
|
5498
5013
|
variant: "outlined",
|
|
5499
5014
|
sx: [
|
|
5500
5015
|
{ p: 2, mb: 3 },
|
|
5501
5016
|
...Array.isArray(sx) ? sx : [sx]
|
|
5502
5017
|
],
|
|
5503
|
-
children: /* @__PURE__ */ (0,
|
|
5018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material26.Grid, { container: true, spacing: 2, sx: { alignItems: "center" }, children: sections ? sections.map((sec, idx) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react30.default.Fragment, { children: sec }, idx)) : children })
|
|
5504
5019
|
}
|
|
5505
5020
|
);
|
|
5506
5021
|
};
|
|
5507
5022
|
|
|
5508
|
-
// src/UI/
|
|
5509
|
-
var
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5023
|
+
// src/UI/components/layout/PageLinkComponent.tsx
|
|
5024
|
+
var import_icons_material4 = require("@mui/icons-material");
|
|
5025
|
+
var import_material27 = require("@mui/material");
|
|
5026
|
+
var import_react31 = __toESM(require("react"));
|
|
5027
|
+
var import_react_router_dom = require("react-router-dom");
|
|
5028
|
+
init_context();
|
|
5029
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5030
|
+
var PageLinkComponent = ({
|
|
5031
|
+
overrideNamespace,
|
|
5032
|
+
title,
|
|
5033
|
+
subheader,
|
|
5034
|
+
description,
|
|
5035
|
+
icon,
|
|
5036
|
+
links,
|
|
5037
|
+
actionButtonText,
|
|
5038
|
+
onActionButtonClick,
|
|
5039
|
+
bgcolor
|
|
5040
|
+
}) => {
|
|
5041
|
+
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
5042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5043
|
+
import_material27.Card,
|
|
5044
|
+
{
|
|
5045
|
+
sx: (theme) => ({
|
|
5046
|
+
height: "100%",
|
|
5047
|
+
display: "flex",
|
|
5048
|
+
flexDirection: "column",
|
|
5049
|
+
boxShadow: 3,
|
|
5050
|
+
bgcolor,
|
|
5051
|
+
color: bgcolor ? typeof bgcolor === "string" && bgcolor.includes(".") ? theme.palette.getContrastText(
|
|
5052
|
+
bgcolor.split(".").reduce((acc, key) => acc[key], theme.palette)
|
|
5053
|
+
) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
|
|
5054
|
+
}),
|
|
5055
|
+
children: [
|
|
5056
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5057
|
+
import_material27.CardHeader,
|
|
5058
|
+
{
|
|
5059
|
+
avatar: icon ? import_react31.default.cloneElement(icon, {
|
|
5060
|
+
sx: { color: bgcolor ? "inherit" : "primary", ...icon.props.sx }
|
|
5061
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_material4.Settings, { color: bgcolor ? "inherit" : "primary" }),
|
|
5062
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "h6", component: "div", color: "inherit", children: typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: title }) : title }),
|
|
5063
|
+
subheader: subheader && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { opacity: 0.8, color: "inherit" }, children: typeof subheader === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: subheader }) : subheader })
|
|
5064
|
+
}
|
|
5065
|
+
),
|
|
5066
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Divider, { sx: { borderColor: "inherit", opacity: 0.2 } }),
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material27.CardContent, { sx: { flexGrow: 1 }, children: [
|
|
5068
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { opacity: 0.85, color: "inherit" }, children: typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: description }) : description }),
|
|
5069
|
+
links && links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.List, { dense: true, disablePadding: true, children: links.filter((f) => !f.hidden).map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5070
|
+
import_material27.ListItem,
|
|
5071
|
+
{
|
|
5072
|
+
disablePadding: true,
|
|
5073
|
+
sx: {
|
|
5074
|
+
mt: 1,
|
|
5075
|
+
// Запрещаем ListItem менять цвет фона при наведении
|
|
5076
|
+
"&:hover": {
|
|
5077
|
+
backgroundColor: "transparent"
|
|
5078
|
+
}
|
|
5079
|
+
},
|
|
5080
|
+
children: [
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5082
|
+
import_material27.ListItemIcon,
|
|
5083
|
+
{
|
|
5084
|
+
sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
|
|
5085
|
+
onClick: () => {
|
|
5086
|
+
if (link?.href) navigate(link.href);
|
|
5087
|
+
},
|
|
5088
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_material4.ArrowRight, { fontSize: "small", color: "inherit" })
|
|
5089
|
+
}
|
|
5090
|
+
),
|
|
5091
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.ListItemText, { children: link.onClick ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5092
|
+
import_material27.Button,
|
|
5093
|
+
{
|
|
5094
|
+
size: "small",
|
|
5095
|
+
variant: "text",
|
|
5096
|
+
color: bgcolor ? "inherit" : "primary",
|
|
5097
|
+
onClick: link.onClick,
|
|
5098
|
+
sx: {
|
|
5099
|
+
fontWeight: 500,
|
|
5100
|
+
textTransform: "none",
|
|
5101
|
+
// Отключает автоматические заглавные буквы (UPPERCASE)
|
|
5102
|
+
padding: 0,
|
|
5103
|
+
minWidth: "auto",
|
|
5104
|
+
justifyContent: "flex-start",
|
|
5105
|
+
textAlign: "left",
|
|
5106
|
+
transition: "opacity 0.2s ease-in-out",
|
|
5107
|
+
"&:hover": {
|
|
5108
|
+
opacity: 0.75,
|
|
5109
|
+
backgroundColor: "transparent",
|
|
5110
|
+
// Убирает стандартную серую подложку при ховере кнопки
|
|
5111
|
+
textDecoration: "underline"
|
|
5112
|
+
// Эффект подчеркивания, как у ссылки
|
|
5113
|
+
}
|
|
5114
|
+
},
|
|
5115
|
+
children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
5116
|
+
}
|
|
5117
|
+
) : link.href ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5118
|
+
import_material27.Link,
|
|
5119
|
+
{
|
|
5120
|
+
component: import_react_router_dom.Link,
|
|
5121
|
+
to: link.href,
|
|
5122
|
+
target: link.external ? "_blank" : "_self",
|
|
5123
|
+
rel: link.external ? "noopener noreferrer" : "",
|
|
5124
|
+
underline: "hover",
|
|
5125
|
+
color: bgcolor ? "inherit" : "primary",
|
|
5126
|
+
sx: {
|
|
5127
|
+
fontWeight: 500,
|
|
5128
|
+
display: "inline-block",
|
|
5129
|
+
transition: "opacity 0.2s ease-in-out",
|
|
5130
|
+
"&:hover": {
|
|
5131
|
+
opacity: 0.75,
|
|
5132
|
+
backgroundColor: "transparent"
|
|
5133
|
+
}
|
|
5134
|
+
},
|
|
5135
|
+
children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
5136
|
+
}
|
|
5137
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
|
|
5138
|
+
]
|
|
5139
|
+
},
|
|
5140
|
+
index
|
|
5141
|
+
)) })
|
|
5142
|
+
] }),
|
|
5143
|
+
actionButtonText && onActionButtonClick && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.CardActions, { sx: { justifyContent: "flex-end", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Button, { size: "small", variant: "contained", onClick: onActionButtonClick, children: typeof actionButtonText === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: actionButtonText }) : actionButtonText }) })
|
|
5144
|
+
]
|
|
5145
|
+
}
|
|
5146
|
+
);
|
|
5147
|
+
};
|
|
5148
|
+
|
|
5149
|
+
// src/UI/components/layout/CollapsedContainerComponent.tsx
|
|
5150
|
+
var import_icons_material5 = require("@mui/icons-material");
|
|
5151
|
+
var import_material28 = require("@mui/material");
|
|
5152
|
+
var import_react32 = require("react");
|
|
5153
|
+
init_context();
|
|
5154
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5155
|
+
var ExpandMore = (0, import_material28.styled)((props) => {
|
|
5156
|
+
const { expand, ...other } = props;
|
|
5157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.IconButton, { size: "small", ...other, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons_material5.ExpandMore, {}) });
|
|
5158
|
+
})(({ theme, expand }) => ({
|
|
5159
|
+
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
|
|
5160
|
+
transition: theme.transitions.create("transform", {
|
|
5161
|
+
duration: theme.transitions.duration.shortest
|
|
5162
|
+
}),
|
|
5163
|
+
backgroundColor: expand ? theme.palette.primary.main : "transparent",
|
|
5164
|
+
color: expand ? theme.palette.common.white : theme.palette.text.secondary,
|
|
5165
|
+
border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
|
|
5166
|
+
"&:hover": {
|
|
5167
|
+
backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
|
|
5168
|
+
}
|
|
5169
|
+
}));
|
|
5170
|
+
var CollapsedContainerComponent = (props) => {
|
|
5171
|
+
const { displayState } = useAppTheme();
|
|
5172
|
+
const [expanded, setExpanded] = (0, import_react32.useState)(props.expanded === void 0 ? false : props.expanded);
|
|
5173
|
+
const handleExpandClick = () => {
|
|
5174
|
+
setExpanded(!expanded);
|
|
5175
|
+
props.onExpanded && props.onExpanded(!expanded);
|
|
5176
|
+
};
|
|
5177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Card, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
5179
|
+
import_material28.Box,
|
|
5180
|
+
{
|
|
5181
|
+
onClick: () => handleExpandClick(),
|
|
5182
|
+
sx: {
|
|
5183
|
+
cursor: "pointer",
|
|
5184
|
+
"&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
|
|
5185
|
+
display: "flex",
|
|
5186
|
+
alignItems: "center",
|
|
5187
|
+
pr: 2
|
|
5188
|
+
},
|
|
5189
|
+
children: [
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5191
|
+
import_material28.CardHeader,
|
|
5192
|
+
{
|
|
5193
|
+
sx: { flexGrow: 1 },
|
|
5194
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Avatar, { sx: { bgcolor: "primary.main" }, children: props.icon }),
|
|
5195
|
+
title: typeof props.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Typography, { variant: "subtitle1", sx: { fontWeight: "700" }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) }) : props.title,
|
|
5196
|
+
subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
|
|
5197
|
+
}
|
|
5198
|
+
),
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Tooltip, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Box, { sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5200
|
+
ExpandMore,
|
|
5201
|
+
{
|
|
5202
|
+
expand: expanded,
|
|
5203
|
+
onClick: handleExpandClick,
|
|
5204
|
+
"aria-expanded": expanded
|
|
5205
|
+
}
|
|
5206
|
+
) }) })
|
|
5207
|
+
]
|
|
5208
|
+
}
|
|
5209
|
+
),
|
|
5210
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Collapse, { in: expanded, timeout: "auto", children: [
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { variant: "middle" }),
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.CardContent, { children: props.children })
|
|
5213
|
+
] })
|
|
5214
|
+
] });
|
|
5215
|
+
};
|
|
5216
|
+
|
|
5217
|
+
// src/i18n/LanguageSelector.tsx
|
|
5218
|
+
var import_react33 = require("react");
|
|
5219
|
+
var import_react_i18next6 = require("react-i18next");
|
|
5220
|
+
var import_material29 = require("@mui/material");
|
|
5221
|
+
init_LocalizationProvider();
|
|
5222
|
+
init_UserSettingsProvider();
|
|
5223
|
+
init_SupabaseProvider();
|
|
5224
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5225
|
+
var LanguageSelector = () => {
|
|
5226
|
+
const supabase = useSupabase();
|
|
5227
|
+
const { i18n: i18n2 } = (0, import_react_i18next6.useTranslation)();
|
|
5228
|
+
const [languages, setLanguages] = (0, import_react33.useState)([]);
|
|
5229
|
+
const [loading, setLoading] = (0, import_react33.useState)(true);
|
|
5230
|
+
const { changeLanguage } = useLocalization();
|
|
5231
|
+
const { settings: userSettings, setLanguage } = useUserSettings();
|
|
5232
|
+
const [anchorEl, setAnchorEl] = (0, import_react33.useState)(null);
|
|
5233
|
+
const open = Boolean(anchorEl);
|
|
5234
|
+
(0, import_react33.useEffect)(() => {
|
|
5235
|
+
const fetchLanguages = async () => {
|
|
5236
|
+
try {
|
|
5237
|
+
const { data, error } = await supabase.from("languages").select("code, name, svg_flag").eq("enabled", true);
|
|
5238
|
+
if (error) throw error;
|
|
5239
|
+
setLanguages(data || []);
|
|
5240
|
+
if (userSettings.language) changeLanguage(userSettings.language);
|
|
5241
|
+
} catch (err) {
|
|
5242
|
+
console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043C\u043E\u0432:", err);
|
|
5243
|
+
} finally {
|
|
5244
|
+
setLoading(false);
|
|
5245
|
+
}
|
|
5246
|
+
};
|
|
5247
|
+
fetchLanguages();
|
|
5248
|
+
}, []);
|
|
5249
|
+
const handleClick = (event) => {
|
|
5250
|
+
setAnchorEl(event.currentTarget);
|
|
5251
|
+
};
|
|
5252
|
+
const handleClose = () => {
|
|
5253
|
+
setAnchorEl(null);
|
|
5254
|
+
};
|
|
5255
|
+
const handleSelectLanguage = (langCode) => {
|
|
5256
|
+
changeLanguage(langCode);
|
|
5257
|
+
setLanguage(langCode);
|
|
5258
|
+
handleClose();
|
|
5259
|
+
};
|
|
5260
|
+
if (loading) {
|
|
5261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.CircularProgress, { size: 20, color: "inherit", sx: { mx: 1 } });
|
|
5262
|
+
}
|
|
5263
|
+
const rawCurrentLang = i18n2.language || "uk";
|
|
5264
|
+
const currentLangCode = rawCurrentLang.split("-")[0];
|
|
5265
|
+
const currentLang = languages.find((l) => l.code === currentLangCode) || languages[0];
|
|
5266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Tooltip, { title: currentLang ? currentLang.name : "\u041C\u043E\u0432\u0430", arrow: true, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5268
|
+
import_material29.IconButton,
|
|
5269
|
+
{
|
|
5270
|
+
onClick: handleClick,
|
|
5271
|
+
size: "small",
|
|
5272
|
+
"aria-controls": open ? "language-menu" : void 0,
|
|
5273
|
+
"aria-haspopup": "true",
|
|
5274
|
+
"aria-expanded": open ? "true" : void 0,
|
|
5275
|
+
sx: {
|
|
5276
|
+
p: 1,
|
|
5277
|
+
borderRadius: 2,
|
|
5278
|
+
transition: "background-color 0.2s",
|
|
5279
|
+
"&:hover": {
|
|
5280
|
+
backgroundColor: "action.hover"
|
|
5281
|
+
}
|
|
5282
|
+
},
|
|
5283
|
+
children: currentLang?.svg_flag && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5284
|
+
import_material29.Box,
|
|
5285
|
+
{
|
|
5286
|
+
sx: {
|
|
5287
|
+
width: 24,
|
|
5288
|
+
height: 16,
|
|
5289
|
+
borderRadius: "3px",
|
|
5290
|
+
overflow: "hidden",
|
|
5291
|
+
flexShrink: 0,
|
|
5292
|
+
boxShadow: "0 0 2px rgba(0,0,0,0.3)",
|
|
5293
|
+
display: "flex",
|
|
5294
|
+
alignItems: "center",
|
|
5295
|
+
justifyContent: "center",
|
|
5296
|
+
"& svg": { width: "100%", height: "100%", display: "block", objectFit: "cover" }
|
|
5297
|
+
},
|
|
5298
|
+
dangerouslySetInnerHTML: { __html: currentLang.svg_flag }
|
|
5299
|
+
}
|
|
5300
|
+
)
|
|
5301
|
+
}
|
|
5302
|
+
) }),
|
|
5303
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5304
|
+
import_material29.Menu,
|
|
5305
|
+
{
|
|
5306
|
+
id: "language-menu",
|
|
5307
|
+
anchorEl,
|
|
5308
|
+
open,
|
|
5309
|
+
onClose: handleClose,
|
|
5310
|
+
slotProps: {
|
|
5311
|
+
paper: {
|
|
5312
|
+
elevation: 3,
|
|
5313
|
+
sx: {
|
|
5314
|
+
mt: 1,
|
|
5315
|
+
minWidth: 150,
|
|
5316
|
+
borderRadius: 2
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
},
|
|
5320
|
+
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
5321
|
+
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
5322
|
+
children: languages.map((lang) => {
|
|
5323
|
+
const isSelected = lang.code === currentLangCode;
|
|
5324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
5325
|
+
import_material29.MenuItem,
|
|
5326
|
+
{
|
|
5327
|
+
selected: isSelected,
|
|
5328
|
+
onClick: () => handleSelectLanguage(lang.code),
|
|
5329
|
+
sx: {
|
|
5330
|
+
display: "flex",
|
|
5331
|
+
alignItems: "center",
|
|
5332
|
+
gap: 1.5,
|
|
5333
|
+
py: 1,
|
|
5334
|
+
px: 2
|
|
5335
|
+
},
|
|
5336
|
+
children: [
|
|
5337
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5338
|
+
import_material29.Box,
|
|
5339
|
+
{
|
|
5340
|
+
sx: {
|
|
5341
|
+
width: 22,
|
|
5342
|
+
height: 15,
|
|
5343
|
+
borderRadius: "2px",
|
|
5344
|
+
overflow: "hidden",
|
|
5345
|
+
flexShrink: 0,
|
|
5346
|
+
boxShadow: "0 0 1px rgba(0,0,0,0.4)",
|
|
5347
|
+
"& svg": { width: "100%", height: "100%", display: "block" }
|
|
5348
|
+
},
|
|
5349
|
+
dangerouslySetInnerHTML: { __html: lang.svg_flag }
|
|
5350
|
+
}
|
|
5351
|
+
),
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
|
|
5353
|
+
]
|
|
5354
|
+
},
|
|
5355
|
+
lang.code
|
|
5356
|
+
);
|
|
5357
|
+
})
|
|
5358
|
+
}
|
|
5359
|
+
)
|
|
5360
|
+
] });
|
|
5361
|
+
};
|
|
5362
|
+
var PublicLanguageSelector = () => {
|
|
5363
|
+
const supabase = useSupabase();
|
|
5364
|
+
const { i18n: i18n2 } = (0, import_react_i18next6.useTranslation)();
|
|
5365
|
+
const { changeLanguage } = useLocalization();
|
|
5366
|
+
const [languages, setLanguages] = (0, import_react33.useState)([]);
|
|
5367
|
+
const [loading, setLoading] = (0, import_react33.useState)(true);
|
|
5368
|
+
const [anchorEl, setAnchorEl] = (0, import_react33.useState)(null);
|
|
5369
|
+
const open = Boolean(anchorEl);
|
|
5370
|
+
(0, import_react33.useEffect)(() => {
|
|
5371
|
+
const fetchLanguages = async () => {
|
|
5372
|
+
try {
|
|
5373
|
+
const { data, error } = await supabase.from("languages").select("code, name, svg_flag").eq("enabled", true);
|
|
5374
|
+
if (error) throw error;
|
|
5375
|
+
setLanguages(data || []);
|
|
5376
|
+
} catch (err) {
|
|
5377
|
+
console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043C\u043E\u0432:", err);
|
|
5378
|
+
} finally {
|
|
5379
|
+
setLoading(false);
|
|
5380
|
+
}
|
|
5381
|
+
};
|
|
5382
|
+
fetchLanguages();
|
|
5383
|
+
}, []);
|
|
5384
|
+
const handleClick = (event) => {
|
|
5385
|
+
setAnchorEl(event.currentTarget);
|
|
5386
|
+
};
|
|
5387
|
+
const handleClose = () => {
|
|
5388
|
+
setAnchorEl(null);
|
|
5389
|
+
};
|
|
5390
|
+
const handleSelectLanguage = (langCode) => {
|
|
5391
|
+
changeLanguage(langCode);
|
|
5392
|
+
handleClose();
|
|
5393
|
+
};
|
|
5394
|
+
if (loading) {
|
|
5395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.CircularProgress, { size: 20, color: "inherit", sx: { mx: 1 } });
|
|
5396
|
+
}
|
|
5397
|
+
const rawCurrentLang = i18n2.language || "uk";
|
|
5398
|
+
const currentLangCode = rawCurrentLang.split("-")[0];
|
|
5399
|
+
const currentLang = languages.find((l) => l.code === currentLangCode) || languages[0];
|
|
5400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Tooltip, { title: currentLang ? currentLang.name : "\u041C\u043E\u0432\u0430", arrow: true, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5402
|
+
import_material29.IconButton,
|
|
5403
|
+
{
|
|
5404
|
+
onClick: handleClick,
|
|
5405
|
+
size: "small",
|
|
5406
|
+
"aria-controls": open ? "language-menu" : void 0,
|
|
5407
|
+
"aria-haspopup": "true",
|
|
5408
|
+
"aria-expanded": open ? "true" : void 0,
|
|
5409
|
+
sx: {
|
|
5410
|
+
p: 1,
|
|
5411
|
+
borderRadius: 2,
|
|
5412
|
+
transition: "background-color 0.2s",
|
|
5413
|
+
"&:hover": {
|
|
5414
|
+
backgroundColor: "action.hover"
|
|
5415
|
+
}
|
|
5416
|
+
},
|
|
5417
|
+
children: currentLang?.svg_flag && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5418
|
+
import_material29.Box,
|
|
5419
|
+
{
|
|
5420
|
+
sx: {
|
|
5421
|
+
width: 24,
|
|
5422
|
+
height: 16,
|
|
5423
|
+
borderRadius: "3px",
|
|
5424
|
+
overflow: "hidden",
|
|
5425
|
+
flexShrink: 0,
|
|
5426
|
+
boxShadow: "0 0 2px rgba(0,0,0,0.3)",
|
|
5427
|
+
display: "flex",
|
|
5428
|
+
alignItems: "center",
|
|
5429
|
+
justifyContent: "center",
|
|
5430
|
+
"& svg": { width: "100%", height: "100%", display: "block", objectFit: "cover" }
|
|
5431
|
+
},
|
|
5432
|
+
dangerouslySetInnerHTML: { __html: currentLang.svg_flag }
|
|
5433
|
+
}
|
|
5434
|
+
)
|
|
5435
|
+
}
|
|
5436
|
+
) }),
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5438
|
+
import_material29.Menu,
|
|
5439
|
+
{
|
|
5440
|
+
id: "language-menu",
|
|
5441
|
+
anchorEl,
|
|
5442
|
+
open,
|
|
5443
|
+
onClose: handleClose,
|
|
5444
|
+
slotProps: {
|
|
5445
|
+
paper: {
|
|
5446
|
+
elevation: 3,
|
|
5447
|
+
sx: {
|
|
5448
|
+
mt: 1,
|
|
5449
|
+
minWidth: 150,
|
|
5450
|
+
borderRadius: 2
|
|
5451
|
+
}
|
|
5452
|
+
}
|
|
5453
|
+
},
|
|
5454
|
+
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
5455
|
+
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
5456
|
+
children: languages.map((lang) => {
|
|
5457
|
+
const isSelected = lang.code === currentLangCode;
|
|
5458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
5459
|
+
import_material29.MenuItem,
|
|
5460
|
+
{
|
|
5461
|
+
selected: isSelected,
|
|
5462
|
+
onClick: () => handleSelectLanguage(lang.code),
|
|
5463
|
+
sx: {
|
|
5464
|
+
display: "flex",
|
|
5465
|
+
alignItems: "center",
|
|
5466
|
+
gap: 1.5,
|
|
5467
|
+
py: 1,
|
|
5468
|
+
px: 2
|
|
5469
|
+
},
|
|
5470
|
+
children: [
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5472
|
+
import_material29.Box,
|
|
5473
|
+
{
|
|
5474
|
+
sx: {
|
|
5475
|
+
width: 22,
|
|
5476
|
+
height: 15,
|
|
5477
|
+
borderRadius: "2px",
|
|
5478
|
+
overflow: "hidden",
|
|
5479
|
+
flexShrink: 0,
|
|
5480
|
+
boxShadow: "0 0 1px rgba(0,0,0,0.4)",
|
|
5481
|
+
"& svg": { width: "100%", height: "100%", display: "block" }
|
|
5482
|
+
},
|
|
5483
|
+
dangerouslySetInnerHTML: { __html: lang.svg_flag }
|
|
5484
|
+
}
|
|
5485
|
+
),
|
|
5486
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
|
|
5487
|
+
]
|
|
5488
|
+
},
|
|
5489
|
+
lang.code
|
|
5490
|
+
);
|
|
5491
|
+
})
|
|
5492
|
+
}
|
|
5493
|
+
)
|
|
5494
|
+
] });
|
|
5552
5495
|
};
|
|
5553
5496
|
|
|
5554
5497
|
// src/types/index.ts
|
|
@@ -5704,19 +5647,43 @@ var Utils = {
|
|
|
5704
5647
|
AppSettingsProvider,
|
|
5705
5648
|
AuthProvider,
|
|
5706
5649
|
BreadcrumbProvider,
|
|
5650
|
+
ButtonComponent,
|
|
5651
|
+
CheckboxComponent,
|
|
5652
|
+
CollapsedContainerComponent,
|
|
5707
5653
|
ConfirmationProvider,
|
|
5654
|
+
CopyClipboardButtonComponent,
|
|
5655
|
+
EmailInputComponent,
|
|
5656
|
+
ErrorAlertComponent,
|
|
5657
|
+
ExpandableNoteComponent,
|
|
5658
|
+
FilterContainerComponent,
|
|
5708
5659
|
Hooks,
|
|
5709
5660
|
LocalizationProvider,
|
|
5661
|
+
MyAvatarComponent,
|
|
5662
|
+
NumberInputComponent,
|
|
5663
|
+
PageComponent,
|
|
5664
|
+
PageLinkComponent,
|
|
5665
|
+
ProtectedLanguageSelector,
|
|
5710
5666
|
Providers,
|
|
5667
|
+
PublicLanguageSelector,
|
|
5668
|
+
RefreshButtonComponent,
|
|
5669
|
+
SearchComponent,
|
|
5670
|
+
SelectComponent,
|
|
5711
5671
|
Services,
|
|
5712
5672
|
SupabaseProvider,
|
|
5673
|
+
SwitchComponent,
|
|
5674
|
+
TextFieldComponent,
|
|
5713
5675
|
ThemeProvider,
|
|
5714
5676
|
ToastProvider,
|
|
5677
|
+
TranslatableTooltipComponent,
|
|
5715
5678
|
TranslateProvider,
|
|
5716
5679
|
TranslateText,
|
|
5717
5680
|
TranslationEditProvider,
|
|
5718
|
-
|
|
5681
|
+
UrlComponent,
|
|
5682
|
+
UserAvatarComponent,
|
|
5683
|
+
UserPopoverComponent,
|
|
5684
|
+
UserRoleChipComponent,
|
|
5719
5685
|
UserSettingsProvider,
|
|
5686
|
+
UserStatusChipComponent,
|
|
5720
5687
|
Utils,
|
|
5721
5688
|
defaultUserSettings,
|
|
5722
5689
|
initI18n,
|