@serhii.olishevskyi/docs 1.0.8 → 1.0.9
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-YKVTSRTJ.mjs → UserPopoverComponent-VE2Q77FP.mjs} +1 -1
- package/dist/{chunk-ABYNAO4A.mjs → chunk-I4NSFSES.mjs} +262 -81
- package/dist/index.d.mts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +351 -161
- package/dist/index.mjs +8 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1804,6 +1804,216 @@ var init_AppSettingsProvider = __esm({
|
|
|
1804
1804
|
}
|
|
1805
1805
|
});
|
|
1806
1806
|
|
|
1807
|
+
// src/types/user.types.ts
|
|
1808
|
+
var defaultUserSettings;
|
|
1809
|
+
var init_user_types = __esm({
|
|
1810
|
+
"src/types/user.types.ts"() {
|
|
1811
|
+
"use strict";
|
|
1812
|
+
defaultUserSettings = {
|
|
1813
|
+
sidebar_open: true,
|
|
1814
|
+
chat_open: false,
|
|
1815
|
+
language: "ua",
|
|
1816
|
+
theme_mode: "light"
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
// src/context/UserSettingsProvider.tsx
|
|
1822
|
+
var import_react18, import_jsx_runtime19, UserSettingsContext, UserSettingsProvider, useUserSettings;
|
|
1823
|
+
var init_UserSettingsProvider = __esm({
|
|
1824
|
+
"src/context/UserSettingsProvider.tsx"() {
|
|
1825
|
+
"use strict";
|
|
1826
|
+
import_react18 = require("react");
|
|
1827
|
+
init_user_types();
|
|
1828
|
+
init_ThemeProvider();
|
|
1829
|
+
init_AuthProvider();
|
|
1830
|
+
init_SupabaseProvider();
|
|
1831
|
+
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1832
|
+
UserSettingsContext = (0, import_react18.createContext)(void 0);
|
|
1833
|
+
UserSettingsProvider = ({ children }) => {
|
|
1834
|
+
const supabase = useSupabase();
|
|
1835
|
+
const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
|
|
1836
|
+
const userId = user?.id;
|
|
1837
|
+
const [settings, setSettings] = (0, import_react18.useState)({
|
|
1838
|
+
id: "",
|
|
1839
|
+
...defaultUserSettings
|
|
1840
|
+
});
|
|
1841
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
1842
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
1843
|
+
const [activeChatUserId, setActiveChatUserId] = (0, import_react18.useState)(null);
|
|
1844
|
+
const fetchSettings = (0, import_react18.useCallback)(async () => {
|
|
1845
|
+
if (isAuthLoading) return;
|
|
1846
|
+
if (!isAuthenticated || !userId) {
|
|
1847
|
+
setSettings({ id: "", ...defaultUserSettings });
|
|
1848
|
+
setLoading(false);
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1851
|
+
try {
|
|
1852
|
+
setSettings((prev) => {
|
|
1853
|
+
if (prev.id !== userId) {
|
|
1854
|
+
setLoading(true);
|
|
1855
|
+
}
|
|
1856
|
+
return prev;
|
|
1857
|
+
});
|
|
1858
|
+
setError(null);
|
|
1859
|
+
let { data, error: fetchError } = await supabase.from("user_settings").select("*").eq("id", userId).maybeSingle();
|
|
1860
|
+
if (fetchError) throw fetchError;
|
|
1861
|
+
if (!data) {
|
|
1862
|
+
const newSettings = {
|
|
1863
|
+
id: userId,
|
|
1864
|
+
sidebar_open: defaultUserSettings.sidebar_open ?? true,
|
|
1865
|
+
chat_open: defaultUserSettings.chat_open ?? false,
|
|
1866
|
+
language: defaultUserSettings.language ?? "ua",
|
|
1867
|
+
theme_mode: defaultUserSettings.theme_mode ?? "light"
|
|
1868
|
+
};
|
|
1869
|
+
const { data: insertedData, error: insertError } = await supabase.from("user_settings").insert(newSettings).select().single();
|
|
1870
|
+
if (insertError) {
|
|
1871
|
+
if (insertError.code === "23505") {
|
|
1872
|
+
const { data: retryData } = await supabase.from("user_settings").select("*").eq("id", userId).single();
|
|
1873
|
+
data = retryData;
|
|
1874
|
+
} else {
|
|
1875
|
+
throw insertError;
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
data = insertedData;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
if (data) {
|
|
1882
|
+
setSettings({
|
|
1883
|
+
...defaultUserSettings,
|
|
1884
|
+
...data
|
|
1885
|
+
});
|
|
1886
|
+
if (data.theme_mode) {
|
|
1887
|
+
localStorage.setItem(THEME_MODE_STORAGE_KEY, data.theme_mode);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
} catch (err) {
|
|
1891
|
+
console.error("Failed to load user settings from Supabase:", err);
|
|
1892
|
+
setError(err.message || "Failed to load user settings");
|
|
1893
|
+
} finally {
|
|
1894
|
+
setLoading(false);
|
|
1895
|
+
}
|
|
1896
|
+
}, [isAuthenticated, isAuthLoading, userId]);
|
|
1897
|
+
(0, import_react18.useEffect)(() => {
|
|
1898
|
+
fetchSettings();
|
|
1899
|
+
}, [fetchSettings]);
|
|
1900
|
+
const toggleSidebar = (0, import_react18.useCallback)(
|
|
1901
|
+
async (open) => {
|
|
1902
|
+
const isExplicitBoolean = typeof open === "boolean";
|
|
1903
|
+
const nextState = isExplicitBoolean ? open : !settings.sidebar_open;
|
|
1904
|
+
setSettings((prev) => ({ ...prev, sidebar_open: nextState }));
|
|
1905
|
+
if (!userId) return;
|
|
1906
|
+
try {
|
|
1907
|
+
const { error: error2 } = await supabase.from("user_settings").update({ sidebar_open: nextState, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
|
|
1908
|
+
if (error2) throw error2;
|
|
1909
|
+
} catch (err) {
|
|
1910
|
+
console.error("Failed to update sidebar state:", err);
|
|
1911
|
+
setSettings((prev) => ({ ...prev, sidebar_open: !nextState }));
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
[settings.sidebar_open, userId]
|
|
1915
|
+
);
|
|
1916
|
+
const toggleChat = (0, import_react18.useCallback)(
|
|
1917
|
+
async (open) => {
|
|
1918
|
+
const isExplicitBoolean = typeof open === "boolean";
|
|
1919
|
+
const nextState = isExplicitBoolean ? open : !settings.chat_open;
|
|
1920
|
+
setSettings((prev) => ({ ...prev, chat_open: nextState }));
|
|
1921
|
+
if (!userId) return;
|
|
1922
|
+
try {
|
|
1923
|
+
const { error: error2 } = await supabase.from("user_settings").update({ chat_open: nextState, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
|
|
1924
|
+
if (error2) throw error2;
|
|
1925
|
+
} catch (err) {
|
|
1926
|
+
console.error("Failed to update chat state:", err);
|
|
1927
|
+
setSettings((prev) => ({ ...prev, chat_open: !nextState }));
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
[settings.chat_open, userId]
|
|
1931
|
+
);
|
|
1932
|
+
const openChatWithUser = (0, import_react18.useCallback)(
|
|
1933
|
+
async (targetUserId) => {
|
|
1934
|
+
setActiveChatUserId(targetUserId);
|
|
1935
|
+
if (!settings.chat_open) {
|
|
1936
|
+
await toggleChat(true);
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
[settings.chat_open, toggleChat]
|
|
1940
|
+
);
|
|
1941
|
+
const setLanguage = (0, import_react18.useCallback)(
|
|
1942
|
+
async (newLanguage) => {
|
|
1943
|
+
const previousLanguage = settings.language;
|
|
1944
|
+
setSettings((prev) => ({ ...prev, language: newLanguage }));
|
|
1945
|
+
if (!userId) return;
|
|
1946
|
+
try {
|
|
1947
|
+
const { error: error2 } = await supabase.from("user_settings").update({ language: newLanguage, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
|
|
1948
|
+
if (error2) throw error2;
|
|
1949
|
+
} catch (err) {
|
|
1950
|
+
console.error("Failed to update language on server:", err);
|
|
1951
|
+
setSettings((prev) => ({ ...prev, language: previousLanguage }));
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
[settings.language, userId]
|
|
1955
|
+
);
|
|
1956
|
+
const setThemeMode = (0, import_react18.useCallback)(
|
|
1957
|
+
async (newMode) => {
|
|
1958
|
+
const previousMode = settings.theme_mode;
|
|
1959
|
+
setSettings((prev) => ({ ...prev, theme_mode: newMode }));
|
|
1960
|
+
localStorage.setItem(THEME_MODE_STORAGE_KEY, newMode);
|
|
1961
|
+
if (!userId) return;
|
|
1962
|
+
try {
|
|
1963
|
+
const { error: error2 } = await supabase.from("user_settings").update({ theme_mode: newMode, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", userId);
|
|
1964
|
+
if (error2) throw error2;
|
|
1965
|
+
} catch (err) {
|
|
1966
|
+
console.error("Failed to update theme mode on server:", err);
|
|
1967
|
+
setSettings((prev) => ({ ...prev, theme_mode: previousMode }));
|
|
1968
|
+
}
|
|
1969
|
+
},
|
|
1970
|
+
[settings.theme_mode, userId]
|
|
1971
|
+
);
|
|
1972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1973
|
+
UserSettingsContext.Provider,
|
|
1974
|
+
{
|
|
1975
|
+
value: {
|
|
1976
|
+
settings,
|
|
1977
|
+
loading,
|
|
1978
|
+
error,
|
|
1979
|
+
activeChatUserId,
|
|
1980
|
+
toggleSidebar,
|
|
1981
|
+
toggleChat,
|
|
1982
|
+
openChatWithUser,
|
|
1983
|
+
setLanguage,
|
|
1984
|
+
setThemeMode,
|
|
1985
|
+
refreshSettings: fetchSettings
|
|
1986
|
+
},
|
|
1987
|
+
children
|
|
1988
|
+
}
|
|
1989
|
+
);
|
|
1990
|
+
};
|
|
1991
|
+
useUserSettings = () => {
|
|
1992
|
+
const context = (0, import_react18.useContext)(UserSettingsContext);
|
|
1993
|
+
if (!context) {
|
|
1994
|
+
throw new Error("useUserSettings should be used within the UserSettingsProvider");
|
|
1995
|
+
}
|
|
1996
|
+
return context;
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
|
|
2001
|
+
// src/context/PublicThemeProvider.tsx
|
|
2002
|
+
var import_react19, import_material10, import_jsx_runtime20, PublicThemeProvider;
|
|
2003
|
+
var init_PublicThemeProvider = __esm({
|
|
2004
|
+
"src/context/PublicThemeProvider.tsx"() {
|
|
2005
|
+
"use strict";
|
|
2006
|
+
import_react19 = require("react");
|
|
2007
|
+
import_material10 = require("@mui/material");
|
|
2008
|
+
init_ThemeProvider();
|
|
2009
|
+
import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2010
|
+
PublicThemeProvider = ({ children }) => {
|
|
2011
|
+
const publicTheme = (0, import_react19.useMemo)(() => buildMuiTheme(INITIAL_THEME_CONFIG), []);
|
|
2012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material10.ThemeProvider, { theme: publicTheme, children });
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
|
|
1807
2017
|
// src/context/index.ts
|
|
1808
2018
|
var Providers;
|
|
1809
2019
|
var init_context = __esm({
|
|
@@ -1820,9 +2030,12 @@ var init_context = __esm({
|
|
|
1820
2030
|
init_AIProvider();
|
|
1821
2031
|
init_AppSettingsProvider();
|
|
1822
2032
|
init_AuthProvider();
|
|
2033
|
+
init_UserSettingsProvider();
|
|
2034
|
+
init_PublicThemeProvider();
|
|
1823
2035
|
init_SupabaseProvider();
|
|
1824
2036
|
init_AppSettingsProvider();
|
|
1825
2037
|
init_AuthProvider();
|
|
2038
|
+
init_UserSettingsProvider();
|
|
1826
2039
|
init_TranslateProvider();
|
|
1827
2040
|
init_TranslateText();
|
|
1828
2041
|
init_TranslationEditProvider();
|
|
@@ -1836,10 +2049,12 @@ var init_context = __esm({
|
|
|
1836
2049
|
Supabase: SupabaseProvider,
|
|
1837
2050
|
AppSettings: AppSettingsProvider,
|
|
1838
2051
|
Auth: AuthProvider,
|
|
2052
|
+
UserSettings: UserSettingsProvider,
|
|
1839
2053
|
Translate: TranslateProvider,
|
|
1840
2054
|
TranslationEdit: TranslationEditProvider,
|
|
1841
2055
|
Localization: LocalizationProvider,
|
|
1842
|
-
|
|
2056
|
+
PublicTheme: PublicThemeProvider,
|
|
2057
|
+
ProtectedTheme: ThemeProvider,
|
|
1843
2058
|
Breadcrumb: BreadcrumbProvider,
|
|
1844
2059
|
Toast: ToastProvider,
|
|
1845
2060
|
Confirmation: ConfirmationProvider,
|
|
@@ -1849,33 +2064,33 @@ var init_context = __esm({
|
|
|
1849
2064
|
});
|
|
1850
2065
|
|
|
1851
2066
|
// src/UI/components/data.display/UserStatusChipComponent.tsx
|
|
1852
|
-
var
|
|
2067
|
+
var import_material11, import_InfoOutlined, import_jsx_runtime21, UserStatusChipComponent;
|
|
1853
2068
|
var init_UserStatusChipComponent = __esm({
|
|
1854
2069
|
"src/UI/components/data.display/UserStatusChipComponent.tsx"() {
|
|
1855
2070
|
"use strict";
|
|
1856
|
-
|
|
2071
|
+
import_material11 = require("@mui/material");
|
|
1857
2072
|
import_InfoOutlined = __toESM(require("@mui/icons-material/InfoOutlined"));
|
|
1858
2073
|
init_context();
|
|
1859
|
-
|
|
2074
|
+
import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1860
2075
|
UserStatusChipComponent = ({ overrideNamespace, state }) => {
|
|
1861
2076
|
const confirm = useConfirmation();
|
|
1862
2077
|
const handleShowReason = async (e) => {
|
|
1863
2078
|
e.stopPropagation();
|
|
1864
2079
|
if (!state.locked_reason) return;
|
|
1865
2080
|
await confirm({
|
|
1866
|
-
title: /* @__PURE__ */ (0,
|
|
2081
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
|
|
1867
2082
|
message: state.locked_reason,
|
|
1868
2083
|
type: "info",
|
|
1869
|
-
confirmText: /* @__PURE__ */ (0,
|
|
2084
|
+
confirmText: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
|
|
1870
2085
|
showNoButton: false,
|
|
1871
2086
|
showCancelButton: false
|
|
1872
2087
|
});
|
|
1873
2088
|
};
|
|
1874
2089
|
if (state.profile_archived) {
|
|
1875
|
-
return /* @__PURE__ */ (0,
|
|
1876
|
-
|
|
2090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2091
|
+
import_material11.Chip,
|
|
1877
2092
|
{
|
|
1878
|
-
label: /* @__PURE__ */ (0,
|
|
2093
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
|
|
1879
2094
|
color: "default",
|
|
1880
2095
|
size: "small",
|
|
1881
2096
|
variant: "filled"
|
|
@@ -1883,10 +2098,10 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1883
2098
|
);
|
|
1884
2099
|
}
|
|
1885
2100
|
if (state.profile_locked) {
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
1887
|
-
|
|
2101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2102
|
+
import_material11.Chip,
|
|
1888
2103
|
{
|
|
1889
|
-
label: /* @__PURE__ */ (0,
|
|
2104
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
|
|
1890
2105
|
color: "error",
|
|
1891
2106
|
size: "small",
|
|
1892
2107
|
variant: "filled"
|
|
@@ -1894,30 +2109,30 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1894
2109
|
);
|
|
1895
2110
|
}
|
|
1896
2111
|
if (state.excluded) {
|
|
1897
|
-
return /* @__PURE__ */ (0,
|
|
1898
|
-
|
|
2112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2113
|
+
import_material11.Chip,
|
|
1899
2114
|
{
|
|
1900
|
-
label: /* @__PURE__ */ (0,
|
|
2115
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
|
|
1901
2116
|
size: "small"
|
|
1902
2117
|
}
|
|
1903
2118
|
);
|
|
1904
2119
|
}
|
|
1905
2120
|
if (state.locked) {
|
|
1906
|
-
return /* @__PURE__ */ (0,
|
|
1907
|
-
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2122
|
+
import_material11.Chip,
|
|
1908
2123
|
{
|
|
1909
|
-
label: /* @__PURE__ */ (0,
|
|
2124
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
|
|
1910
2125
|
color: "error",
|
|
1911
2126
|
size: "small",
|
|
1912
2127
|
onDelete: state.locked_reason ? handleShowReason : void 0,
|
|
1913
|
-
deleteIcon: state.locked_reason ? /* @__PURE__ */ (0,
|
|
2128
|
+
deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
|
|
1914
2129
|
}
|
|
1915
2130
|
);
|
|
1916
2131
|
}
|
|
1917
|
-
return /* @__PURE__ */ (0,
|
|
1918
|
-
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2133
|
+
import_material11.Chip,
|
|
1919
2134
|
{
|
|
1920
|
-
label: /* @__PURE__ */ (0,
|
|
2135
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
|
|
1921
2136
|
color: "success",
|
|
1922
2137
|
size: "small",
|
|
1923
2138
|
variant: "outlined"
|
|
@@ -1928,38 +2143,38 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1928
2143
|
});
|
|
1929
2144
|
|
|
1930
2145
|
// src/UI/components/data.display/UserRoleChipComponent.tsx
|
|
1931
|
-
var
|
|
2146
|
+
var import_material12, import_jsx_runtime22, UserRoleChipComponent;
|
|
1932
2147
|
var init_UserRoleChipComponent = __esm({
|
|
1933
2148
|
"src/UI/components/data.display/UserRoleChipComponent.tsx"() {
|
|
1934
2149
|
"use strict";
|
|
1935
|
-
|
|
2150
|
+
import_material12 = require("@mui/material");
|
|
1936
2151
|
init_context();
|
|
1937
|
-
|
|
2152
|
+
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1938
2153
|
UserRoleChipComponent = ({ overrideNamespace, role }) => {
|
|
1939
2154
|
switch (role) {
|
|
1940
2155
|
case "superadmin":
|
|
1941
|
-
return /* @__PURE__ */ (0,
|
|
1942
|
-
|
|
2156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2157
|
+
import_material12.Chip,
|
|
1943
2158
|
{
|
|
1944
|
-
label: /* @__PURE__ */ (0,
|
|
2159
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
|
|
1945
2160
|
color: "error",
|
|
1946
2161
|
size: "small"
|
|
1947
2162
|
}
|
|
1948
2163
|
);
|
|
1949
2164
|
case "admin":
|
|
1950
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
-
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2166
|
+
import_material12.Chip,
|
|
1952
2167
|
{
|
|
1953
|
-
label: /* @__PURE__ */ (0,
|
|
2168
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
|
|
1954
2169
|
color: "primary",
|
|
1955
2170
|
size: "small"
|
|
1956
2171
|
}
|
|
1957
2172
|
);
|
|
1958
2173
|
default:
|
|
1959
|
-
return /* @__PURE__ */ (0,
|
|
1960
|
-
|
|
2174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2175
|
+
import_material12.Chip,
|
|
1961
2176
|
{
|
|
1962
|
-
label: /* @__PURE__ */ (0,
|
|
2177
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
|
|
1963
2178
|
variant: "outlined",
|
|
1964
2179
|
size: "small"
|
|
1965
2180
|
}
|
|
@@ -1970,16 +2185,16 @@ var init_UserRoleChipComponent = __esm({
|
|
|
1970
2185
|
});
|
|
1971
2186
|
|
|
1972
2187
|
// src/UI/components/buttons/CopyClipboardButtonComponent.tsx
|
|
1973
|
-
var
|
|
2188
|
+
var import_react20, import_material13, import_Check3, import_ContentCopy3, import_jsx_runtime23, CopyClipboardButtonComponent;
|
|
1974
2189
|
var init_CopyClipboardButtonComponent = __esm({
|
|
1975
2190
|
"src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
|
|
1976
2191
|
"use strict";
|
|
1977
|
-
|
|
1978
|
-
|
|
2192
|
+
import_react20 = require("react");
|
|
2193
|
+
import_material13 = require("@mui/material");
|
|
1979
2194
|
import_Check3 = __toESM(require("@mui/icons-material/Check"));
|
|
1980
2195
|
import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
1981
2196
|
init_TranslatableTooltipComponent();
|
|
1982
|
-
|
|
2197
|
+
import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1983
2198
|
CopyClipboardButtonComponent = ({
|
|
1984
2199
|
overrideNamespace,
|
|
1985
2200
|
textToCopy,
|
|
@@ -1992,7 +2207,7 @@ var init_CopyClipboardButtonComponent = __esm({
|
|
|
1992
2207
|
sx,
|
|
1993
2208
|
...iconButtonProps
|
|
1994
2209
|
}) => {
|
|
1995
|
-
const [copied, setCopied] = (0,
|
|
2210
|
+
const [copied, setCopied] = (0, import_react20.useState)(false);
|
|
1996
2211
|
const handleCopy = async (e) => {
|
|
1997
2212
|
e.stopPropagation();
|
|
1998
2213
|
if (!textToCopy) return;
|
|
@@ -2009,62 +2224,33 @@ var init_CopyClipboardButtonComponent = __esm({
|
|
|
2009
2224
|
console.error("Failed to copy text to clipboard:", error);
|
|
2010
2225
|
}
|
|
2011
2226
|
};
|
|
2012
|
-
return /* @__PURE__ */ (0,
|
|
2013
|
-
|
|
2227
|
+
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)(
|
|
2228
|
+
import_material13.IconButton,
|
|
2014
2229
|
{
|
|
2015
2230
|
size,
|
|
2016
2231
|
onClick: handleCopy,
|
|
2017
2232
|
disabled: !textToCopy || iconButtonProps.disabled,
|
|
2018
2233
|
sx: { p: 0.25, ...sx },
|
|
2019
2234
|
...iconButtonProps,
|
|
2020
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2235
|
+
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" })
|
|
2021
2236
|
}
|
|
2022
2237
|
) }) });
|
|
2023
2238
|
};
|
|
2024
2239
|
}
|
|
2025
2240
|
});
|
|
2026
2241
|
|
|
2027
|
-
// src/types/user.types.ts
|
|
2028
|
-
var init_user_types = __esm({
|
|
2029
|
-
"src/types/user.types.ts"() {
|
|
2030
|
-
"use strict";
|
|
2031
|
-
}
|
|
2032
|
-
});
|
|
2033
|
-
|
|
2034
|
-
// src/context/UserSettingsProvider.tsx
|
|
2035
|
-
var import_react19, import_jsx_runtime22, UserSettingsContext, useUserSettings;
|
|
2036
|
-
var init_UserSettingsProvider = __esm({
|
|
2037
|
-
"src/context/UserSettingsProvider.tsx"() {
|
|
2038
|
-
"use strict";
|
|
2039
|
-
import_react19 = require("react");
|
|
2040
|
-
init_user_types();
|
|
2041
|
-
init_ThemeProvider();
|
|
2042
|
-
init_AuthProvider();
|
|
2043
|
-
init_SupabaseProvider();
|
|
2044
|
-
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2045
|
-
UserSettingsContext = (0, import_react19.createContext)(void 0);
|
|
2046
|
-
useUserSettings = () => {
|
|
2047
|
-
const context = (0, import_react19.useContext)(UserSettingsContext);
|
|
2048
|
-
if (!context) {
|
|
2049
|
-
throw new Error("useUserSettings should be used within the UserSettingsProvider");
|
|
2050
|
-
}
|
|
2051
|
-
return context;
|
|
2052
|
-
};
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
|
|
2056
2242
|
// src/UI/components/data.display/UserPopoverComponent.tsx
|
|
2057
2243
|
var UserPopoverComponent_exports = {};
|
|
2058
2244
|
__export(UserPopoverComponent_exports, {
|
|
2059
2245
|
UserPopoverComponent: () => UserPopoverComponent,
|
|
2060
2246
|
default: () => UserPopoverComponent_default
|
|
2061
2247
|
});
|
|
2062
|
-
var
|
|
2248
|
+
var import_react21, import_material14, import_icons_material2, import_jsx_runtime24, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
|
|
2063
2249
|
var init_UserPopoverComponent = __esm({
|
|
2064
2250
|
"src/UI/components/data.display/UserPopoverComponent.tsx"() {
|
|
2065
2251
|
"use strict";
|
|
2066
|
-
|
|
2067
|
-
|
|
2252
|
+
import_react21 = require("react");
|
|
2253
|
+
import_material14 = require("@mui/material");
|
|
2068
2254
|
import_icons_material2 = require("@mui/icons-material");
|
|
2069
2255
|
init_UserStatusChipComponent();
|
|
2070
2256
|
init_UserRoleChipComponent();
|
|
@@ -2074,11 +2260,11 @@ var init_UserPopoverComponent = __esm({
|
|
|
2074
2260
|
init_UserSettingsProvider();
|
|
2075
2261
|
init_TranslatableTooltipComponent();
|
|
2076
2262
|
init_session_service();
|
|
2077
|
-
|
|
2263
|
+
import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2078
2264
|
useUserStatus = (supabase, userId, open) => {
|
|
2079
|
-
const [lastSeenAt, setLastSeenAt] = (0,
|
|
2080
|
-
const [loading, setLoading] = (0,
|
|
2081
|
-
(0,
|
|
2265
|
+
const [lastSeenAt, setLastSeenAt] = (0, import_react21.useState)(null);
|
|
2266
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
2267
|
+
(0, import_react21.useEffect)(() => {
|
|
2082
2268
|
if (!userId || !open) {
|
|
2083
2269
|
setLastSeenAt(null);
|
|
2084
2270
|
setLoading(false);
|
|
@@ -2127,13 +2313,13 @@ var init_UserPopoverComponent = __esm({
|
|
|
2127
2313
|
const { activeCompanyId, membership: currentMembership } = useAuth();
|
|
2128
2314
|
const { openChatWithUser } = useUserSettings();
|
|
2129
2315
|
const { formatDate, formatRelativeTime } = useLocalization();
|
|
2130
|
-
const [profileData, setProfileData] = (0,
|
|
2131
|
-
const [membershipData, setMembershipData] = (0,
|
|
2132
|
-
const [avatarUrl, setAvatarUrl] = (0,
|
|
2133
|
-
const [coverUrl, setCoverUrl] = (0,
|
|
2134
|
-
const [loading, setLoading] = (0,
|
|
2316
|
+
const [profileData, setProfileData] = (0, import_react21.useState)(null);
|
|
2317
|
+
const [membershipData, setMembershipData] = (0, import_react21.useState)(null);
|
|
2318
|
+
const [avatarUrl, setAvatarUrl] = (0, import_react21.useState)(null);
|
|
2319
|
+
const [coverUrl, setCoverUrl] = (0, import_react21.useState)(null);
|
|
2320
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
2135
2321
|
const { lastSeenAt, isOnline } = useUserStatus(supabase, userId, open);
|
|
2136
|
-
(0,
|
|
2322
|
+
(0, import_react21.useEffect)(() => {
|
|
2137
2323
|
if (!open || !userId || !activeCompanyId) return;
|
|
2138
2324
|
let isMounted = true;
|
|
2139
2325
|
setLoading(true);
|
|
@@ -2179,7 +2365,7 @@ var init_UserPopoverComponent = __esm({
|
|
|
2179
2365
|
}, [open, userId, currentMembership?.id, activeCompanyId]);
|
|
2180
2366
|
const getStatusChip = () => {
|
|
2181
2367
|
if (!profileData) return null;
|
|
2182
|
-
return /* @__PURE__ */ (0,
|
|
2368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
|
|
2183
2369
|
};
|
|
2184
2370
|
const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
|
|
2185
2371
|
if (isOnline2) return "success";
|
|
@@ -2200,8 +2386,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2200
2386
|
return "inherit";
|
|
2201
2387
|
};
|
|
2202
2388
|
const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
|
|
2203
|
-
return /* @__PURE__ */ (0,
|
|
2204
|
-
|
|
2389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2390
|
+
import_material14.Popover,
|
|
2205
2391
|
{
|
|
2206
2392
|
open,
|
|
2207
2393
|
anchorEl,
|
|
@@ -2219,9 +2405,9 @@ var init_UserPopoverComponent = __esm({
|
|
|
2219
2405
|
}
|
|
2220
2406
|
}
|
|
2221
2407
|
},
|
|
2222
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
2223
|
-
/* @__PURE__ */ (0,
|
|
2224
|
-
|
|
2408
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2410
|
+
import_material14.Box,
|
|
2225
2411
|
{
|
|
2226
2412
|
sx: {
|
|
2227
2413
|
position: "relative",
|
|
@@ -2230,8 +2416,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2230
2416
|
bgcolor: "action.selected"
|
|
2231
2417
|
},
|
|
2232
2418
|
children: [
|
|
2233
|
-
coverUrl && /* @__PURE__ */ (0,
|
|
2234
|
-
|
|
2419
|
+
coverUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2420
|
+
import_material14.Box,
|
|
2235
2421
|
{
|
|
2236
2422
|
component: "img",
|
|
2237
2423
|
src: coverUrl,
|
|
@@ -2246,8 +2432,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2246
2432
|
}
|
|
2247
2433
|
}
|
|
2248
2434
|
),
|
|
2249
|
-
/* @__PURE__ */ (0,
|
|
2250
|
-
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2436
|
+
import_material14.IconButton,
|
|
2251
2437
|
{
|
|
2252
2438
|
size: "small",
|
|
2253
2439
|
onClick: onClose,
|
|
@@ -2264,16 +2450,16 @@ var init_UserPopoverComponent = __esm({
|
|
|
2264
2450
|
transform: "scale(1.1)"
|
|
2265
2451
|
}
|
|
2266
2452
|
},
|
|
2267
|
-
children: /* @__PURE__ */ (0,
|
|
2453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Close, { fontSize: "small" })
|
|
2268
2454
|
}
|
|
2269
2455
|
)
|
|
2270
2456
|
]
|
|
2271
2457
|
}
|
|
2272
2458
|
),
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2276
|
-
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { p: 2, pt: 0 }, children: [
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2462
|
+
import_material14.Badge,
|
|
2277
2463
|
{
|
|
2278
2464
|
overlap: "circular",
|
|
2279
2465
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -2309,8 +2495,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2309
2495
|
}
|
|
2310
2496
|
}
|
|
2311
2497
|
},
|
|
2312
|
-
children: /* @__PURE__ */ (0,
|
|
2313
|
-
|
|
2498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2499
|
+
import_material14.Avatar,
|
|
2314
2500
|
{
|
|
2315
2501
|
src: avatarUrl || coverUrl || void 0,
|
|
2316
2502
|
sx: {
|
|
@@ -2328,54 +2514,54 @@ var init_UserPopoverComponent = __esm({
|
|
|
2328
2514
|
)
|
|
2329
2515
|
}
|
|
2330
2516
|
),
|
|
2331
|
-
/* @__PURE__ */ (0,
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2333
|
-
membershipData?.employee_post && /* @__PURE__ */ (0,
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
|
|
2519
|
+
membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
|
|
2334
2520
|
] })
|
|
2335
2521
|
] }),
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
|
|
2337
2523
|
getStatusChip(),
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
|
|
2339
2525
|
] }),
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2344
|
-
/* @__PURE__ */ (0,
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Divider, { sx: { my: 1.5 } }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
|
|
2346
2532
|
":",
|
|
2347
2533
|
" ",
|
|
2348
|
-
/* @__PURE__ */ (0,
|
|
2349
|
-
] }) : /* @__PURE__ */ (0,
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
|
|
2535
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
|
|
2350
2536
|
] }),
|
|
2351
|
-
profileData.email && /* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2353
|
-
/* @__PURE__ */ (0,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2537
|
+
profileData.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Email, { fontSize: "small" }),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
|
|
2355
2541
|
] }),
|
|
2356
|
-
membershipData?.employee_post && /* @__PURE__ */ (0,
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
/* @__PURE__ */ (0,
|
|
2542
|
+
membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Work, { fontSize: "small" }),
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
|
|
2360
2546
|
] }),
|
|
2361
|
-
profileData.phone && /* @__PURE__ */ (0,
|
|
2362
|
-
/* @__PURE__ */ (0,
|
|
2363
|
-
/* @__PURE__ */ (0,
|
|
2547
|
+
profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
|
|
2364
2550
|
] }),
|
|
2365
|
-
profileData.birthday && /* @__PURE__ */ (0,
|
|
2366
|
-
/* @__PURE__ */ (0,
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2551
|
+
profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
|
|
2368
2554
|
] }),
|
|
2369
|
-
membershipData?.created_at && /* @__PURE__ */ (0,
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2371
|
-
/* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2555
|
+
membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Typography, { variant: "body2", color: "text.primary", children: [
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
|
|
2373
2559
|
": ",
|
|
2374
2560
|
formatDate(membershipData.created_at)
|
|
2375
2561
|
] })
|
|
2376
2562
|
] }),
|
|
2377
|
-
profileData.description && /* @__PURE__ */ (0,
|
|
2378
|
-
|
|
2563
|
+
profileData.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2564
|
+
import_material14.Typography,
|
|
2379
2565
|
{
|
|
2380
2566
|
variant: "caption",
|
|
2381
2567
|
color: "text.secondary",
|
|
@@ -2390,28 +2576,28 @@ var init_UserPopoverComponent = __esm({
|
|
|
2390
2576
|
}
|
|
2391
2577
|
)
|
|
2392
2578
|
] }),
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2398
|
-
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Divider, { sx: { my: 1 } }),
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2584
|
+
import_material14.IconButton,
|
|
2399
2585
|
{
|
|
2400
2586
|
size: "small",
|
|
2401
2587
|
color: "primary",
|
|
2402
2588
|
disabled: !canChat,
|
|
2403
2589
|
onClick: () => membershipData && openChatWithUser(membershipData.id),
|
|
2404
|
-
children: /* @__PURE__ */ (0,
|
|
2590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
|
|
2405
2591
|
}
|
|
2406
2592
|
) })
|
|
2407
2593
|
] })
|
|
2408
2594
|
] })
|
|
2409
|
-
] }) : /* @__PURE__ */ (0,
|
|
2410
|
-
|
|
2595
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2596
|
+
import_material14.Typography,
|
|
2411
2597
|
{
|
|
2412
2598
|
color: "error",
|
|
2413
2599
|
variant: "body2",
|
|
2414
|
-
children: /* @__PURE__ */ (0,
|
|
2600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
|
|
2415
2601
|
}
|
|
2416
2602
|
) })
|
|
2417
2603
|
}
|
|
@@ -2438,6 +2624,7 @@ __export(index_exports, {
|
|
|
2438
2624
|
TranslateText: () => TranslateText,
|
|
2439
2625
|
TranslationEditProvider: () => TranslationEditProvider,
|
|
2440
2626
|
UI: () => UI,
|
|
2627
|
+
UserSettingsProvider: () => UserSettingsProvider,
|
|
2441
2628
|
useAI: () => useAI,
|
|
2442
2629
|
useAppSettings: () => useAppSettings,
|
|
2443
2630
|
useAppTheme: () => useAppTheme,
|
|
@@ -2448,7 +2635,8 @@ __export(index_exports, {
|
|
|
2448
2635
|
useSupabase: () => useSupabase,
|
|
2449
2636
|
useToast: () => useToast,
|
|
2450
2637
|
useTranslationEdit: () => useTranslationEdit,
|
|
2451
|
-
useTranslationNamespace: () => useTranslationNamespace
|
|
2638
|
+
useTranslationNamespace: () => useTranslationNamespace,
|
|
2639
|
+
useUserSettings: () => useUserSettings
|
|
2452
2640
|
});
|
|
2453
2641
|
module.exports = __toCommonJS(index_exports);
|
|
2454
2642
|
|
|
@@ -3141,11 +3329,11 @@ var EmailInputComponent = ({
|
|
|
3141
3329
|
};
|
|
3142
3330
|
|
|
3143
3331
|
// src/UI/components/data.display/UserAvatarComponent.tsx
|
|
3144
|
-
var
|
|
3145
|
-
var
|
|
3332
|
+
var import_react22 = require("react");
|
|
3333
|
+
var import_material15 = require("@mui/material");
|
|
3146
3334
|
init_context();
|
|
3147
|
-
var
|
|
3148
|
-
var LazyUserPopover = (0,
|
|
3335
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3336
|
+
var LazyUserPopover = (0, import_react22.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
|
|
3149
3337
|
var getInitials = (name) => {
|
|
3150
3338
|
if (!name) return "?";
|
|
3151
3339
|
const parts = name.trim().split(" ");
|
|
@@ -3167,11 +3355,11 @@ var UserAvatarComponent = ({
|
|
|
3167
3355
|
sx = {}
|
|
3168
3356
|
}) => {
|
|
3169
3357
|
const supabase = useSupabase();
|
|
3170
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
3171
|
-
const [hasInteracted, setHasInteracted] = (0,
|
|
3172
|
-
const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0,
|
|
3358
|
+
const [anchorEl, setAnchorEl] = (0, import_react22.useState)(null);
|
|
3359
|
+
const [hasInteracted, setHasInteracted] = (0, import_react22.useState)(false);
|
|
3360
|
+
const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react22.useState)(null);
|
|
3173
3361
|
const canShowPopover = !disablePopover && Boolean(userId);
|
|
3174
|
-
(0,
|
|
3362
|
+
(0, import_react22.useEffect)(() => {
|
|
3175
3363
|
let isMounted = true;
|
|
3176
3364
|
const resolveAvatar = async () => {
|
|
3177
3365
|
if (!avatarUrl) {
|
|
@@ -3216,13 +3404,13 @@ var UserAvatarComponent = ({
|
|
|
3216
3404
|
};
|
|
3217
3405
|
const isPopoverOpen = Boolean(anchorEl);
|
|
3218
3406
|
const initials = getInitials(displayName || "");
|
|
3219
|
-
const getTooltip = /* @__PURE__ */ (0,
|
|
3220
|
-
/* @__PURE__ */ (0,
|
|
3221
|
-
displayName && employeePost && /* @__PURE__ */ (0,
|
|
3407
|
+
const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Typography, { component: "div", variant: "caption", children: displayName }),
|
|
3409
|
+
displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Typography, { component: "div", variant: "caption", children: employeePost })
|
|
3222
3410
|
] });
|
|
3223
|
-
return /* @__PURE__ */ (0,
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3225
|
-
|
|
3411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3413
|
+
import_material15.Avatar,
|
|
3226
3414
|
{
|
|
3227
3415
|
src: resolvedAvatarUrl || void 0,
|
|
3228
3416
|
alt: displayName || "User Avatar",
|
|
@@ -3247,7 +3435,7 @@ var UserAvatarComponent = ({
|
|
|
3247
3435
|
children: !resolvedAvatarUrl && initials
|
|
3248
3436
|
}
|
|
3249
3437
|
) }),
|
|
3250
|
-
canShowPopover && hasInteracted && /* @__PURE__ */ (0,
|
|
3438
|
+
canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react22.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3251
3439
|
LazyUserPopover,
|
|
3252
3440
|
{
|
|
3253
3441
|
userId,
|
|
@@ -3305,6 +3493,7 @@ init_context();
|
|
|
3305
3493
|
TranslateText,
|
|
3306
3494
|
TranslationEditProvider,
|
|
3307
3495
|
UI,
|
|
3496
|
+
UserSettingsProvider,
|
|
3308
3497
|
useAI,
|
|
3309
3498
|
useAppSettings,
|
|
3310
3499
|
useAppTheme,
|
|
@@ -3315,5 +3504,6 @@ init_context();
|
|
|
3315
3504
|
useSupabase,
|
|
3316
3505
|
useToast,
|
|
3317
3506
|
useTranslationEdit,
|
|
3318
|
-
useTranslationNamespace
|
|
3507
|
+
useTranslationNamespace,
|
|
3508
|
+
useUserSettings
|
|
3319
3509
|
});
|