@serhii.olishevskyi/docs 1.0.7 → 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-ZPPVLFBL.mjs → UserPopoverComponent-VE2Q77FP.mjs} +1 -1
- package/dist/{chunk-VCRXKPJ4.mjs → chunk-I4NSFSES.mjs} +263 -81
- package/dist/index.d.mts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +353 -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({
|
|
@@ -1819,9 +2029,13 @@ var init_context = __esm({
|
|
|
1819
2029
|
init_ConfirmationProvider();
|
|
1820
2030
|
init_AIProvider();
|
|
1821
2031
|
init_AppSettingsProvider();
|
|
2032
|
+
init_AuthProvider();
|
|
2033
|
+
init_UserSettingsProvider();
|
|
2034
|
+
init_PublicThemeProvider();
|
|
1822
2035
|
init_SupabaseProvider();
|
|
1823
2036
|
init_AppSettingsProvider();
|
|
1824
2037
|
init_AuthProvider();
|
|
2038
|
+
init_UserSettingsProvider();
|
|
1825
2039
|
init_TranslateProvider();
|
|
1826
2040
|
init_TranslateText();
|
|
1827
2041
|
init_TranslationEditProvider();
|
|
@@ -1834,10 +2048,13 @@ var init_context = __esm({
|
|
|
1834
2048
|
Providers = {
|
|
1835
2049
|
Supabase: SupabaseProvider,
|
|
1836
2050
|
AppSettings: AppSettingsProvider,
|
|
2051
|
+
Auth: AuthProvider,
|
|
2052
|
+
UserSettings: UserSettingsProvider,
|
|
1837
2053
|
Translate: TranslateProvider,
|
|
1838
2054
|
TranslationEdit: TranslationEditProvider,
|
|
1839
2055
|
Localization: LocalizationProvider,
|
|
1840
|
-
|
|
2056
|
+
PublicTheme: PublicThemeProvider,
|
|
2057
|
+
ProtectedTheme: ThemeProvider,
|
|
1841
2058
|
Breadcrumb: BreadcrumbProvider,
|
|
1842
2059
|
Toast: ToastProvider,
|
|
1843
2060
|
Confirmation: ConfirmationProvider,
|
|
@@ -1847,33 +2064,33 @@ var init_context = __esm({
|
|
|
1847
2064
|
});
|
|
1848
2065
|
|
|
1849
2066
|
// src/UI/components/data.display/UserStatusChipComponent.tsx
|
|
1850
|
-
var
|
|
2067
|
+
var import_material11, import_InfoOutlined, import_jsx_runtime21, UserStatusChipComponent;
|
|
1851
2068
|
var init_UserStatusChipComponent = __esm({
|
|
1852
2069
|
"src/UI/components/data.display/UserStatusChipComponent.tsx"() {
|
|
1853
2070
|
"use strict";
|
|
1854
|
-
|
|
2071
|
+
import_material11 = require("@mui/material");
|
|
1855
2072
|
import_InfoOutlined = __toESM(require("@mui/icons-material/InfoOutlined"));
|
|
1856
2073
|
init_context();
|
|
1857
|
-
|
|
2074
|
+
import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1858
2075
|
UserStatusChipComponent = ({ overrideNamespace, state }) => {
|
|
1859
2076
|
const confirm = useConfirmation();
|
|
1860
2077
|
const handleShowReason = async (e) => {
|
|
1861
2078
|
e.stopPropagation();
|
|
1862
2079
|
if (!state.locked_reason) return;
|
|
1863
2080
|
await confirm({
|
|
1864
|
-
title: /* @__PURE__ */ (0,
|
|
2081
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
|
|
1865
2082
|
message: state.locked_reason,
|
|
1866
2083
|
type: "info",
|
|
1867
|
-
confirmText: /* @__PURE__ */ (0,
|
|
2084
|
+
confirmText: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
|
|
1868
2085
|
showNoButton: false,
|
|
1869
2086
|
showCancelButton: false
|
|
1870
2087
|
});
|
|
1871
2088
|
};
|
|
1872
2089
|
if (state.profile_archived) {
|
|
1873
|
-
return /* @__PURE__ */ (0,
|
|
1874
|
-
|
|
2090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2091
|
+
import_material11.Chip,
|
|
1875
2092
|
{
|
|
1876
|
-
label: /* @__PURE__ */ (0,
|
|
2093
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
|
|
1877
2094
|
color: "default",
|
|
1878
2095
|
size: "small",
|
|
1879
2096
|
variant: "filled"
|
|
@@ -1881,10 +2098,10 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1881
2098
|
);
|
|
1882
2099
|
}
|
|
1883
2100
|
if (state.profile_locked) {
|
|
1884
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
-
|
|
2101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2102
|
+
import_material11.Chip,
|
|
1886
2103
|
{
|
|
1887
|
-
label: /* @__PURE__ */ (0,
|
|
2104
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
|
|
1888
2105
|
color: "error",
|
|
1889
2106
|
size: "small",
|
|
1890
2107
|
variant: "filled"
|
|
@@ -1892,30 +2109,30 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1892
2109
|
);
|
|
1893
2110
|
}
|
|
1894
2111
|
if (state.excluded) {
|
|
1895
|
-
return /* @__PURE__ */ (0,
|
|
1896
|
-
|
|
2112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2113
|
+
import_material11.Chip,
|
|
1897
2114
|
{
|
|
1898
|
-
label: /* @__PURE__ */ (0,
|
|
2115
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
|
|
1899
2116
|
size: "small"
|
|
1900
2117
|
}
|
|
1901
2118
|
);
|
|
1902
2119
|
}
|
|
1903
2120
|
if (state.locked) {
|
|
1904
|
-
return /* @__PURE__ */ (0,
|
|
1905
|
-
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2122
|
+
import_material11.Chip,
|
|
1906
2123
|
{
|
|
1907
|
-
label: /* @__PURE__ */ (0,
|
|
2124
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
|
|
1908
2125
|
color: "error",
|
|
1909
2126
|
size: "small",
|
|
1910
2127
|
onDelete: state.locked_reason ? handleShowReason : void 0,
|
|
1911
|
-
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
|
|
1912
2129
|
}
|
|
1913
2130
|
);
|
|
1914
2131
|
}
|
|
1915
|
-
return /* @__PURE__ */ (0,
|
|
1916
|
-
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2133
|
+
import_material11.Chip,
|
|
1917
2134
|
{
|
|
1918
|
-
label: /* @__PURE__ */ (0,
|
|
2135
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
|
|
1919
2136
|
color: "success",
|
|
1920
2137
|
size: "small",
|
|
1921
2138
|
variant: "outlined"
|
|
@@ -1926,38 +2143,38 @@ var init_UserStatusChipComponent = __esm({
|
|
|
1926
2143
|
});
|
|
1927
2144
|
|
|
1928
2145
|
// src/UI/components/data.display/UserRoleChipComponent.tsx
|
|
1929
|
-
var
|
|
2146
|
+
var import_material12, import_jsx_runtime22, UserRoleChipComponent;
|
|
1930
2147
|
var init_UserRoleChipComponent = __esm({
|
|
1931
2148
|
"src/UI/components/data.display/UserRoleChipComponent.tsx"() {
|
|
1932
2149
|
"use strict";
|
|
1933
|
-
|
|
2150
|
+
import_material12 = require("@mui/material");
|
|
1934
2151
|
init_context();
|
|
1935
|
-
|
|
2152
|
+
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1936
2153
|
UserRoleChipComponent = ({ overrideNamespace, role }) => {
|
|
1937
2154
|
switch (role) {
|
|
1938
2155
|
case "superadmin":
|
|
1939
|
-
return /* @__PURE__ */ (0,
|
|
1940
|
-
|
|
2156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2157
|
+
import_material12.Chip,
|
|
1941
2158
|
{
|
|
1942
|
-
label: /* @__PURE__ */ (0,
|
|
2159
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
|
|
1943
2160
|
color: "error",
|
|
1944
2161
|
size: "small"
|
|
1945
2162
|
}
|
|
1946
2163
|
);
|
|
1947
2164
|
case "admin":
|
|
1948
|
-
return /* @__PURE__ */ (0,
|
|
1949
|
-
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2166
|
+
import_material12.Chip,
|
|
1950
2167
|
{
|
|
1951
|
-
label: /* @__PURE__ */ (0,
|
|
2168
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
|
|
1952
2169
|
color: "primary",
|
|
1953
2170
|
size: "small"
|
|
1954
2171
|
}
|
|
1955
2172
|
);
|
|
1956
2173
|
default:
|
|
1957
|
-
return /* @__PURE__ */ (0,
|
|
1958
|
-
|
|
2174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2175
|
+
import_material12.Chip,
|
|
1959
2176
|
{
|
|
1960
|
-
label: /* @__PURE__ */ (0,
|
|
2177
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
|
|
1961
2178
|
variant: "outlined",
|
|
1962
2179
|
size: "small"
|
|
1963
2180
|
}
|
|
@@ -1968,16 +2185,16 @@ var init_UserRoleChipComponent = __esm({
|
|
|
1968
2185
|
});
|
|
1969
2186
|
|
|
1970
2187
|
// src/UI/components/buttons/CopyClipboardButtonComponent.tsx
|
|
1971
|
-
var
|
|
2188
|
+
var import_react20, import_material13, import_Check3, import_ContentCopy3, import_jsx_runtime23, CopyClipboardButtonComponent;
|
|
1972
2189
|
var init_CopyClipboardButtonComponent = __esm({
|
|
1973
2190
|
"src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
|
|
1974
2191
|
"use strict";
|
|
1975
|
-
|
|
1976
|
-
|
|
2192
|
+
import_react20 = require("react");
|
|
2193
|
+
import_material13 = require("@mui/material");
|
|
1977
2194
|
import_Check3 = __toESM(require("@mui/icons-material/Check"));
|
|
1978
2195
|
import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
1979
2196
|
init_TranslatableTooltipComponent();
|
|
1980
|
-
|
|
2197
|
+
import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1981
2198
|
CopyClipboardButtonComponent = ({
|
|
1982
2199
|
overrideNamespace,
|
|
1983
2200
|
textToCopy,
|
|
@@ -1990,7 +2207,7 @@ var init_CopyClipboardButtonComponent = __esm({
|
|
|
1990
2207
|
sx,
|
|
1991
2208
|
...iconButtonProps
|
|
1992
2209
|
}) => {
|
|
1993
|
-
const [copied, setCopied] = (0,
|
|
2210
|
+
const [copied, setCopied] = (0, import_react20.useState)(false);
|
|
1994
2211
|
const handleCopy = async (e) => {
|
|
1995
2212
|
e.stopPropagation();
|
|
1996
2213
|
if (!textToCopy) return;
|
|
@@ -2007,62 +2224,33 @@ var init_CopyClipboardButtonComponent = __esm({
|
|
|
2007
2224
|
console.error("Failed to copy text to clipboard:", error);
|
|
2008
2225
|
}
|
|
2009
2226
|
};
|
|
2010
|
-
return /* @__PURE__ */ (0,
|
|
2011
|
-
|
|
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,
|
|
2012
2229
|
{
|
|
2013
2230
|
size,
|
|
2014
2231
|
onClick: handleCopy,
|
|
2015
2232
|
disabled: !textToCopy || iconButtonProps.disabled,
|
|
2016
2233
|
sx: { p: 0.25, ...sx },
|
|
2017
2234
|
...iconButtonProps,
|
|
2018
|
-
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" })
|
|
2019
2236
|
}
|
|
2020
2237
|
) }) });
|
|
2021
2238
|
};
|
|
2022
2239
|
}
|
|
2023
2240
|
});
|
|
2024
2241
|
|
|
2025
|
-
// src/types/user.types.ts
|
|
2026
|
-
var init_user_types = __esm({
|
|
2027
|
-
"src/types/user.types.ts"() {
|
|
2028
|
-
"use strict";
|
|
2029
|
-
}
|
|
2030
|
-
});
|
|
2031
|
-
|
|
2032
|
-
// src/context/UserSettingsProvider.tsx
|
|
2033
|
-
var import_react19, import_jsx_runtime22, UserSettingsContext, useUserSettings;
|
|
2034
|
-
var init_UserSettingsProvider = __esm({
|
|
2035
|
-
"src/context/UserSettingsProvider.tsx"() {
|
|
2036
|
-
"use strict";
|
|
2037
|
-
import_react19 = require("react");
|
|
2038
|
-
init_user_types();
|
|
2039
|
-
init_ThemeProvider();
|
|
2040
|
-
init_AuthProvider();
|
|
2041
|
-
init_SupabaseProvider();
|
|
2042
|
-
import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2043
|
-
UserSettingsContext = (0, import_react19.createContext)(void 0);
|
|
2044
|
-
useUserSettings = () => {
|
|
2045
|
-
const context = (0, import_react19.useContext)(UserSettingsContext);
|
|
2046
|
-
if (!context) {
|
|
2047
|
-
throw new Error("useUserSettings should be used within the UserSettingsProvider");
|
|
2048
|
-
}
|
|
2049
|
-
return context;
|
|
2050
|
-
};
|
|
2051
|
-
}
|
|
2052
|
-
});
|
|
2053
|
-
|
|
2054
2242
|
// src/UI/components/data.display/UserPopoverComponent.tsx
|
|
2055
2243
|
var UserPopoverComponent_exports = {};
|
|
2056
2244
|
__export(UserPopoverComponent_exports, {
|
|
2057
2245
|
UserPopoverComponent: () => UserPopoverComponent,
|
|
2058
2246
|
default: () => UserPopoverComponent_default
|
|
2059
2247
|
});
|
|
2060
|
-
var
|
|
2248
|
+
var import_react21, import_material14, import_icons_material2, import_jsx_runtime24, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
|
|
2061
2249
|
var init_UserPopoverComponent = __esm({
|
|
2062
2250
|
"src/UI/components/data.display/UserPopoverComponent.tsx"() {
|
|
2063
2251
|
"use strict";
|
|
2064
|
-
|
|
2065
|
-
|
|
2252
|
+
import_react21 = require("react");
|
|
2253
|
+
import_material14 = require("@mui/material");
|
|
2066
2254
|
import_icons_material2 = require("@mui/icons-material");
|
|
2067
2255
|
init_UserStatusChipComponent();
|
|
2068
2256
|
init_UserRoleChipComponent();
|
|
@@ -2072,11 +2260,11 @@ var init_UserPopoverComponent = __esm({
|
|
|
2072
2260
|
init_UserSettingsProvider();
|
|
2073
2261
|
init_TranslatableTooltipComponent();
|
|
2074
2262
|
init_session_service();
|
|
2075
|
-
|
|
2263
|
+
import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2076
2264
|
useUserStatus = (supabase, userId, open) => {
|
|
2077
|
-
const [lastSeenAt, setLastSeenAt] = (0,
|
|
2078
|
-
const [loading, setLoading] = (0,
|
|
2079
|
-
(0,
|
|
2265
|
+
const [lastSeenAt, setLastSeenAt] = (0, import_react21.useState)(null);
|
|
2266
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
2267
|
+
(0, import_react21.useEffect)(() => {
|
|
2080
2268
|
if (!userId || !open) {
|
|
2081
2269
|
setLastSeenAt(null);
|
|
2082
2270
|
setLoading(false);
|
|
@@ -2125,13 +2313,13 @@ var init_UserPopoverComponent = __esm({
|
|
|
2125
2313
|
const { activeCompanyId, membership: currentMembership } = useAuth();
|
|
2126
2314
|
const { openChatWithUser } = useUserSettings();
|
|
2127
2315
|
const { formatDate, formatRelativeTime } = useLocalization();
|
|
2128
|
-
const [profileData, setProfileData] = (0,
|
|
2129
|
-
const [membershipData, setMembershipData] = (0,
|
|
2130
|
-
const [avatarUrl, setAvatarUrl] = (0,
|
|
2131
|
-
const [coverUrl, setCoverUrl] = (0,
|
|
2132
|
-
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);
|
|
2133
2321
|
const { lastSeenAt, isOnline } = useUserStatus(supabase, userId, open);
|
|
2134
|
-
(0,
|
|
2322
|
+
(0, import_react21.useEffect)(() => {
|
|
2135
2323
|
if (!open || !userId || !activeCompanyId) return;
|
|
2136
2324
|
let isMounted = true;
|
|
2137
2325
|
setLoading(true);
|
|
@@ -2177,7 +2365,7 @@ var init_UserPopoverComponent = __esm({
|
|
|
2177
2365
|
}, [open, userId, currentMembership?.id, activeCompanyId]);
|
|
2178
2366
|
const getStatusChip = () => {
|
|
2179
2367
|
if (!profileData) return null;
|
|
2180
|
-
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 || "" } });
|
|
2181
2369
|
};
|
|
2182
2370
|
const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
|
|
2183
2371
|
if (isOnline2) return "success";
|
|
@@ -2198,8 +2386,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2198
2386
|
return "inherit";
|
|
2199
2387
|
};
|
|
2200
2388
|
const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
|
|
2201
|
-
return /* @__PURE__ */ (0,
|
|
2202
|
-
|
|
2389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2390
|
+
import_material14.Popover,
|
|
2203
2391
|
{
|
|
2204
2392
|
open,
|
|
2205
2393
|
anchorEl,
|
|
@@ -2217,9 +2405,9 @@ var init_UserPopoverComponent = __esm({
|
|
|
2217
2405
|
}
|
|
2218
2406
|
}
|
|
2219
2407
|
},
|
|
2220
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
2221
|
-
/* @__PURE__ */ (0,
|
|
2222
|
-
|
|
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,
|
|
2223
2411
|
{
|
|
2224
2412
|
sx: {
|
|
2225
2413
|
position: "relative",
|
|
@@ -2228,8 +2416,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2228
2416
|
bgcolor: "action.selected"
|
|
2229
2417
|
},
|
|
2230
2418
|
children: [
|
|
2231
|
-
coverUrl && /* @__PURE__ */ (0,
|
|
2232
|
-
|
|
2419
|
+
coverUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2420
|
+
import_material14.Box,
|
|
2233
2421
|
{
|
|
2234
2422
|
component: "img",
|
|
2235
2423
|
src: coverUrl,
|
|
@@ -2244,8 +2432,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2244
2432
|
}
|
|
2245
2433
|
}
|
|
2246
2434
|
),
|
|
2247
|
-
/* @__PURE__ */ (0,
|
|
2248
|
-
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2436
|
+
import_material14.IconButton,
|
|
2249
2437
|
{
|
|
2250
2438
|
size: "small",
|
|
2251
2439
|
onClick: onClose,
|
|
@@ -2262,16 +2450,16 @@ var init_UserPopoverComponent = __esm({
|
|
|
2262
2450
|
transform: "scale(1.1)"
|
|
2263
2451
|
}
|
|
2264
2452
|
},
|
|
2265
|
-
children: /* @__PURE__ */ (0,
|
|
2453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Close, { fontSize: "small" })
|
|
2266
2454
|
}
|
|
2267
2455
|
)
|
|
2268
2456
|
]
|
|
2269
2457
|
}
|
|
2270
2458
|
),
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2274
|
-
|
|
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,
|
|
2275
2463
|
{
|
|
2276
2464
|
overlap: "circular",
|
|
2277
2465
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -2307,8 +2495,8 @@ var init_UserPopoverComponent = __esm({
|
|
|
2307
2495
|
}
|
|
2308
2496
|
}
|
|
2309
2497
|
},
|
|
2310
|
-
children: /* @__PURE__ */ (0,
|
|
2311
|
-
|
|
2498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2499
|
+
import_material14.Avatar,
|
|
2312
2500
|
{
|
|
2313
2501
|
src: avatarUrl || coverUrl || void 0,
|
|
2314
2502
|
sx: {
|
|
@@ -2326,54 +2514,54 @@ var init_UserPopoverComponent = __esm({
|
|
|
2326
2514
|
)
|
|
2327
2515
|
}
|
|
2328
2516
|
),
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2330
|
-
/* @__PURE__ */ (0,
|
|
2331
|
-
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 })
|
|
2332
2520
|
] })
|
|
2333
2521
|
] }),
|
|
2334
|
-
/* @__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: [
|
|
2335
2523
|
getStatusChip(),
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
|
|
2337
2525
|
] }),
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2339
|
-
/* @__PURE__ */ (0,
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2343
|
-
/* @__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" }),
|
|
2344
2532
|
":",
|
|
2345
2533
|
" ",
|
|
2346
|
-
/* @__PURE__ */ (0,
|
|
2347
|
-
] }) : /* @__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" }) })
|
|
2348
2536
|
] }),
|
|
2349
|
-
profileData.email && /* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2351
|
-
/* @__PURE__ */ (0,
|
|
2352
|
-
/* @__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 })
|
|
2353
2541
|
] }),
|
|
2354
|
-
membershipData?.employee_post && /* @__PURE__ */ (0,
|
|
2355
|
-
/* @__PURE__ */ (0,
|
|
2356
|
-
/* @__PURE__ */ (0,
|
|
2357
|
-
/* @__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 })
|
|
2358
2546
|
] }),
|
|
2359
|
-
profileData.phone && /* @__PURE__ */ (0,
|
|
2360
|
-
/* @__PURE__ */ (0,
|
|
2361
|
-
/* @__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 })
|
|
2362
2550
|
] }),
|
|
2363
|
-
profileData.birthday && /* @__PURE__ */ (0,
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2365
|
-
/* @__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) })
|
|
2366
2554
|
] }),
|
|
2367
|
-
membershipData?.created_at && /* @__PURE__ */ (0,
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2369
|
-
/* @__PURE__ */ (0,
|
|
2370
|
-
/* @__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" }),
|
|
2371
2559
|
": ",
|
|
2372
2560
|
formatDate(membershipData.created_at)
|
|
2373
2561
|
] })
|
|
2374
2562
|
] }),
|
|
2375
|
-
profileData.description && /* @__PURE__ */ (0,
|
|
2376
|
-
|
|
2563
|
+
profileData.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2564
|
+
import_material14.Typography,
|
|
2377
2565
|
{
|
|
2378
2566
|
variant: "caption",
|
|
2379
2567
|
color: "text.secondary",
|
|
@@ -2388,28 +2576,28 @@ var init_UserPopoverComponent = __esm({
|
|
|
2388
2576
|
}
|
|
2389
2577
|
)
|
|
2390
2578
|
] }),
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
|
|
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,
|
|
2397
2585
|
{
|
|
2398
2586
|
size: "small",
|
|
2399
2587
|
color: "primary",
|
|
2400
2588
|
disabled: !canChat,
|
|
2401
2589
|
onClick: () => membershipData && openChatWithUser(membershipData.id),
|
|
2402
|
-
children: /* @__PURE__ */ (0,
|
|
2590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
|
|
2403
2591
|
}
|
|
2404
2592
|
) })
|
|
2405
2593
|
] })
|
|
2406
2594
|
] })
|
|
2407
|
-
] }) : /* @__PURE__ */ (0,
|
|
2408
|
-
|
|
2595
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2596
|
+
import_material14.Typography,
|
|
2409
2597
|
{
|
|
2410
2598
|
color: "error",
|
|
2411
2599
|
variant: "body2",
|
|
2412
|
-
children: /* @__PURE__ */ (0,
|
|
2600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
|
|
2413
2601
|
}
|
|
2414
2602
|
) })
|
|
2415
2603
|
}
|
|
@@ -2436,6 +2624,7 @@ __export(index_exports, {
|
|
|
2436
2624
|
TranslateText: () => TranslateText,
|
|
2437
2625
|
TranslationEditProvider: () => TranslationEditProvider,
|
|
2438
2626
|
UI: () => UI,
|
|
2627
|
+
UserSettingsProvider: () => UserSettingsProvider,
|
|
2439
2628
|
useAI: () => useAI,
|
|
2440
2629
|
useAppSettings: () => useAppSettings,
|
|
2441
2630
|
useAppTheme: () => useAppTheme,
|
|
@@ -2446,7 +2635,8 @@ __export(index_exports, {
|
|
|
2446
2635
|
useSupabase: () => useSupabase,
|
|
2447
2636
|
useToast: () => useToast,
|
|
2448
2637
|
useTranslationEdit: () => useTranslationEdit,
|
|
2449
|
-
useTranslationNamespace: () => useTranslationNamespace
|
|
2638
|
+
useTranslationNamespace: () => useTranslationNamespace,
|
|
2639
|
+
useUserSettings: () => useUserSettings
|
|
2450
2640
|
});
|
|
2451
2641
|
module.exports = __toCommonJS(index_exports);
|
|
2452
2642
|
|
|
@@ -3139,11 +3329,11 @@ var EmailInputComponent = ({
|
|
|
3139
3329
|
};
|
|
3140
3330
|
|
|
3141
3331
|
// src/UI/components/data.display/UserAvatarComponent.tsx
|
|
3142
|
-
var
|
|
3143
|
-
var
|
|
3332
|
+
var import_react22 = require("react");
|
|
3333
|
+
var import_material15 = require("@mui/material");
|
|
3144
3334
|
init_context();
|
|
3145
|
-
var
|
|
3146
|
-
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)));
|
|
3147
3337
|
var getInitials = (name) => {
|
|
3148
3338
|
if (!name) return "?";
|
|
3149
3339
|
const parts = name.trim().split(" ");
|
|
@@ -3165,11 +3355,11 @@ var UserAvatarComponent = ({
|
|
|
3165
3355
|
sx = {}
|
|
3166
3356
|
}) => {
|
|
3167
3357
|
const supabase = useSupabase();
|
|
3168
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
3169
|
-
const [hasInteracted, setHasInteracted] = (0,
|
|
3170
|
-
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);
|
|
3171
3361
|
const canShowPopover = !disablePopover && Boolean(userId);
|
|
3172
|
-
(0,
|
|
3362
|
+
(0, import_react22.useEffect)(() => {
|
|
3173
3363
|
let isMounted = true;
|
|
3174
3364
|
const resolveAvatar = async () => {
|
|
3175
3365
|
if (!avatarUrl) {
|
|
@@ -3214,13 +3404,13 @@ var UserAvatarComponent = ({
|
|
|
3214
3404
|
};
|
|
3215
3405
|
const isPopoverOpen = Boolean(anchorEl);
|
|
3216
3406
|
const initials = getInitials(displayName || "");
|
|
3217
|
-
const getTooltip = /* @__PURE__ */ (0,
|
|
3218
|
-
/* @__PURE__ */ (0,
|
|
3219
|
-
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 })
|
|
3220
3410
|
] });
|
|
3221
|
-
return /* @__PURE__ */ (0,
|
|
3222
|
-
/* @__PURE__ */ (0,
|
|
3223
|
-
|
|
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,
|
|
3224
3414
|
{
|
|
3225
3415
|
src: resolvedAvatarUrl || void 0,
|
|
3226
3416
|
alt: displayName || "User Avatar",
|
|
@@ -3245,7 +3435,7 @@ var UserAvatarComponent = ({
|
|
|
3245
3435
|
children: !resolvedAvatarUrl && initials
|
|
3246
3436
|
}
|
|
3247
3437
|
) }),
|
|
3248
|
-
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)(
|
|
3249
3439
|
LazyUserPopover,
|
|
3250
3440
|
{
|
|
3251
3441
|
userId,
|
|
@@ -3303,6 +3493,7 @@ init_context();
|
|
|
3303
3493
|
TranslateText,
|
|
3304
3494
|
TranslationEditProvider,
|
|
3305
3495
|
UI,
|
|
3496
|
+
UserSettingsProvider,
|
|
3306
3497
|
useAI,
|
|
3307
3498
|
useAppSettings,
|
|
3308
3499
|
useAppTheme,
|
|
@@ -3313,5 +3504,6 @@ init_context();
|
|
|
3313
3504
|
useSupabase,
|
|
3314
3505
|
useToast,
|
|
3315
3506
|
useTranslationEdit,
|
|
3316
|
-
useTranslationNamespace
|
|
3507
|
+
useTranslationNamespace,
|
|
3508
|
+
useUserSettings
|
|
3317
3509
|
});
|