@taruvi/navkit 0.0.31 → 0.0.32
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/package.json +1 -1
- package/src/App.tsx +6 -6
- package/src/NavkitContext.tsx +2 -2
- package/src/types.ts +2 -0
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -11,14 +11,13 @@ import taruviLogo from "./assets/taruvi-logo.png";
|
|
|
11
11
|
import type { Client } from "@taruvi/sdk"
|
|
12
12
|
|
|
13
13
|
const NavkitContent = () => {
|
|
14
|
-
const { isUserAuthenticated, siteSettings, appSettings,
|
|
14
|
+
const { isUserAuthenticated, siteSettings, appSettings, appName, userData, jwtToken, themeMode } = useNavigation();
|
|
15
15
|
const styles = getAppStyles(themeMode)
|
|
16
16
|
const [showAppLauncher, setShowAppLauncher] = useState<boolean>(false)
|
|
17
17
|
const [showProfileMenu, setShowProfileMenu] = useState<boolean>(false)
|
|
18
18
|
const [showShortcutsMenu, setShowShortcutsMenu] = useState<boolean>(false)
|
|
19
19
|
const [showChat, setShowChat] = useState<boolean>(false)
|
|
20
20
|
const [isAppLauncherHovered, setIsAppLauncherHovered] = useState<boolean>(false);
|
|
21
|
-
console.log("testing cicd")
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
23
|
<>
|
|
@@ -36,9 +35,9 @@ const NavkitContent = () => {
|
|
|
36
35
|
<Toolbar sx={styles.toolbar}>
|
|
37
36
|
<Box component={"a"} href="/" sx={styles.leftSection}>
|
|
38
37
|
{appSettings?.icon ? <Box component="img" src={appSettings?.icon} sx={styles.logo} /> : <></>}
|
|
39
|
-
{appSettings?.displayName &&
|
|
38
|
+
{(appName || appSettings?.displayName) &&
|
|
40
39
|
<Typography sx={styles.appName} onClick={() => (window.location.href = "/")}>
|
|
41
|
-
{appSettings
|
|
40
|
+
{(() => { const name = appName || appSettings!.displayName!; return name.length > 40 ? `${name.substring(0, 40)}...` : name })()}
|
|
42
41
|
</Typography>
|
|
43
42
|
}
|
|
44
43
|
</Box>
|
|
@@ -112,12 +111,13 @@ const NavkitContent = () => {
|
|
|
112
111
|
|
|
113
112
|
interface NavkitProps {
|
|
114
113
|
client: Client
|
|
114
|
+
appName?: string
|
|
115
115
|
getTheme?: (theme: 'light' | 'dark') => void
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const Navkit = ({ client, getTheme }: NavkitProps) => {
|
|
118
|
+
const Navkit = ({ client, getTheme, appName }: NavkitProps) => {
|
|
119
119
|
return (
|
|
120
|
-
<NavkitProvider client={client} onThemeChange={getTheme}>
|
|
120
|
+
<NavkitProvider client={client} onThemeChange={getTheme} appName={appName}>
|
|
121
121
|
<NavkitContent />
|
|
122
122
|
</NavkitProvider>
|
|
123
123
|
)
|
package/src/NavkitContext.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const getInitialTheme = (): ThemeMode => {
|
|
|
19
19
|
|
|
20
20
|
export const NavigationContext = createContext<NavigationContextType | undefined>(undefined)
|
|
21
21
|
|
|
22
|
-
export const NavkitProvider = ({ children, client, onThemeChange }: NavkitProviderProps) => {
|
|
22
|
+
export const NavkitProvider = ({ children, client, onThemeChange, appName }: NavkitProviderProps) => {
|
|
23
23
|
const auth = new Auth(client)
|
|
24
24
|
|
|
25
25
|
const user = useRef<any>(null)
|
|
@@ -161,7 +161,7 @@ export const NavkitProvider = ({ children, client, onThemeChange }: NavkitProvid
|
|
|
161
161
|
}, [themeMode, onThemeChange])
|
|
162
162
|
|
|
163
163
|
return (
|
|
164
|
-
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings: appSettings.current, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
|
|
164
|
+
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings: appSettings.current, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
|
|
165
165
|
{children}
|
|
166
166
|
</NavigationContext.Provider>
|
|
167
167
|
)
|
package/src/types.ts
CHANGED
|
@@ -60,6 +60,7 @@ export interface NavigationContextType {
|
|
|
60
60
|
userData: UserData | null
|
|
61
61
|
siteSettings: SiteSettings
|
|
62
62
|
appSettings: AppSettings
|
|
63
|
+
appName?: string
|
|
63
64
|
jwtToken: string
|
|
64
65
|
isUserAuthenticated: boolean
|
|
65
66
|
client: Client
|
|
@@ -72,4 +73,5 @@ export interface NavkitProviderProps {
|
|
|
72
73
|
children: ReactNode
|
|
73
74
|
client: Client
|
|
74
75
|
onThemeChange?: (theme: ThemeMode) => void
|
|
76
|
+
appName?: string
|
|
75
77
|
}
|