@taruvi/navkit 0.0.42 → 0.0.44
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 +3 -2
- package/src/App.styles.ts +3 -2
- package/src/App.tsx +8 -6
- package/src/NavkitContext.tsx +4 -2
- package/src/components/Profile/Profile.tsx +3 -3
- package/src/components/Shortucts/Shortcuts.styles.ts +2 -2
- package/src/components/Shortucts/Shortcuts.tsx +2 -2
- package/src/types.ts +4 -0
- package/tsconfig.app.json +2 -1
- package/vite.config.ts +23 -0
package/package.json
CHANGED
package/src/App.styles.ts
CHANGED
|
@@ -77,10 +77,11 @@ export const getAppStyles = (mode: ThemeMode) => {
|
|
|
77
77
|
overflow: 'hidden',
|
|
78
78
|
},
|
|
79
79
|
toolbar: {
|
|
80
|
-
backgroundColor: '#
|
|
80
|
+
backgroundColor: '#004369',
|
|
81
81
|
boxShadow: ' 0px 0px 10px 2px rgba(0, 0, 0, 0.3)',
|
|
82
82
|
justifyContent: 'space-between',
|
|
83
|
-
minHeight: dimensions.navHeight
|
|
83
|
+
minHeight: `${dimensions.navHeight} !important`,
|
|
84
|
+
height: dimensions.navHeight,
|
|
84
85
|
},
|
|
85
86
|
leftSection: {
|
|
86
87
|
display: 'flex',
|
package/src/App.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import taruviLogoWhite from "./assets/taruvi-logo-white.png";
|
|
|
13
13
|
import type { Client } from "@taruvi/sdk"
|
|
14
14
|
|
|
15
15
|
const NavkitContent = () => {
|
|
16
|
-
const { isUserAuthenticated, siteSettings, appSettings, appSettingsLoaded, appName, userData, jwtToken, themeMode } = useNavigation();
|
|
16
|
+
const { isUserAuthenticated, siteSettings, appSettings, appSettingsLoaded, appName, userData, jwtToken, themeMode, navbarColor, iconColor } = useNavigation();
|
|
17
17
|
const resolvedAppName = appName || appSettings?.displayName
|
|
18
18
|
const showTaruviLogo = appSettingsLoaded && !resolvedAppName && !appSettings?.icon
|
|
19
19
|
const styles = getAppStyles(themeMode)
|
|
@@ -36,7 +36,7 @@ const NavkitContent = () => {
|
|
|
36
36
|
/>
|
|
37
37
|
)}
|
|
38
38
|
<AppBar position="static" sx={styles.appBar}>
|
|
39
|
-
<Toolbar sx={styles.toolbar}>
|
|
39
|
+
<Toolbar sx={{ ...styles.toolbar, ...(navbarColor && { backgroundColor: navbarColor }) }}>
|
|
40
40
|
<Box component={"a"} href="/" sx={styles.leftSection}>
|
|
41
41
|
{showTaruviLogo ? (
|
|
42
42
|
<Box component="img" src={taruviLogoWhite} sx={styles.taruviSpaceLogo} />
|
|
@@ -52,7 +52,7 @@ const NavkitContent = () => {
|
|
|
52
52
|
) : null}
|
|
53
53
|
</Box>
|
|
54
54
|
<Box component={"div"} sx={styles.rightSection}>
|
|
55
|
-
<Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} />
|
|
55
|
+
<Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} iconColor={iconColor} />
|
|
56
56
|
<Box
|
|
57
57
|
onClick={() => {
|
|
58
58
|
if (isUserAuthenticated) {
|
|
@@ -79,7 +79,7 @@ const NavkitContent = () => {
|
|
|
79
79
|
<Box component="img" src={taruviLogo} sx={styles.appLauncherLogo} />
|
|
80
80
|
)}
|
|
81
81
|
</Box>
|
|
82
|
-
{isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)} />}
|
|
82
|
+
{isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)} iconColor={iconColor} />}
|
|
83
83
|
</Box>
|
|
84
84
|
</Toolbar>
|
|
85
85
|
</AppBar>
|
|
@@ -121,11 +121,13 @@ interface NavkitProps {
|
|
|
121
121
|
client: Client
|
|
122
122
|
appName?: string
|
|
123
123
|
getTheme?: (theme: 'light' | 'dark') => void
|
|
124
|
+
navbarColor?: string
|
|
125
|
+
iconColor?: string
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
const Navkit = ({ client, getTheme, appName }: NavkitProps) => {
|
|
128
|
+
const Navkit = ({ client, getTheme, appName, navbarColor, iconColor }: NavkitProps) => {
|
|
127
129
|
return (
|
|
128
|
-
<NavkitProvider client={client} onThemeChange={getTheme} appName={appName}>
|
|
130
|
+
<NavkitProvider client={client} onThemeChange={getTheme} appName={appName} navbarColor={navbarColor} iconColor={iconColor}>
|
|
129
131
|
<NavkitContent />
|
|
130
132
|
</NavkitProvider>
|
|
131
133
|
)
|
package/src/NavkitContext.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { version } from '../package.json' with { type: 'json' }
|
|
1
2
|
import { createContext, startTransition, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
2
3
|
import type { AppData, AppSettings, NavigationContextType, NavkitProviderProps, SiteSettings, UserData } from './types'
|
|
3
4
|
import type { ThemeMode } from './styles/variables'
|
|
@@ -18,7 +19,7 @@ const getInitialTheme = (): ThemeMode => {
|
|
|
18
19
|
|
|
19
20
|
export const NavigationContext = createContext<NavigationContextType | undefined>(undefined)
|
|
20
21
|
|
|
21
|
-
export const NavkitProvider = ({ children, client, onThemeChange, appName }: NavkitProviderProps) => {
|
|
22
|
+
export const NavkitProvider = ({ children, client, onThemeChange, appName, navbarColor, iconColor }: NavkitProviderProps) => {
|
|
22
23
|
const auth = new Auth(client)
|
|
23
24
|
|
|
24
25
|
const user = useRef<any>(null)
|
|
@@ -134,6 +135,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
|
|
|
134
135
|
}, [appName, client])
|
|
135
136
|
|
|
136
137
|
useLayoutEffect(() => {
|
|
138
|
+
console.log(`Taruvi Navkit v${version} initialized`)
|
|
137
139
|
const init = async () => {
|
|
138
140
|
library.add(fas, far)
|
|
139
141
|
await authenticateUser()
|
|
@@ -174,7 +176,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
|
|
|
174
176
|
}, [themeMode, onThemeChange])
|
|
175
177
|
|
|
176
178
|
return (
|
|
177
|
-
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appSettingsLoaded, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
|
|
179
|
+
<NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appSettingsLoaded, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme, navbarColor, iconColor }}>
|
|
178
180
|
{children}
|
|
179
181
|
</NavigationContext.Provider>
|
|
180
182
|
)
|
|
@@ -4,9 +4,9 @@ import { useNavigation } from '../../NavkitContext'
|
|
|
4
4
|
|
|
5
5
|
const ProfileIcon = ({ color }: { color?: string }) => (
|
|
6
6
|
<SvgIcon viewBox="0 0 22 22" sx={{ fontSize: 23, display: 'block' }}>
|
|
7
|
-
<path d="M10.9921 20.9849C16.511 20.9849 20.9849 16.511 20.9849 10.9921C20.9849 5.4732 16.511 0.999268 10.9921 0.999268C5.47322 0.999268 0.999283 5.4732 0.999283 10.9921C0.999283 16.511 5.47322 20.9849 10.9921 20.9849Z" stroke={color || "#
|
|
8
|
-
<path d="M10.9921 11.9914C12.6478 11.9914 13.9899 10.6492 13.9899 8.99357C13.9899 7.33791 12.6478 5.99573 10.9921 5.99573C9.33644 5.99573 7.99426 7.33791 7.99426 8.99357C7.99426 10.6492 9.33644 11.9914 10.9921 11.9914Z" stroke={color || "#
|
|
9
|
-
<path d="M5.99569 19.6479V17.9871C5.99569 17.457 6.20625 16.9487 6.58106 16.5739C6.95586 16.1991 7.4642 15.9885 7.99425 15.9885H13.9899C14.52 15.9885 15.0283 16.1991 15.4031 16.5739C15.7779 16.9487 15.9885 17.457 15.9885 17.9871V19.6479" stroke={color || "#
|
|
7
|
+
<path d="M10.9921 20.9849C16.511 20.9849 20.9849 16.511 20.9849 10.9921C20.9849 5.4732 16.511 0.999268 10.9921 0.999268C5.47322 0.999268 0.999283 5.4732 0.999283 10.9921C0.999283 16.511 5.47322 20.9849 10.9921 20.9849Z" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
|
|
8
|
+
<path d="M10.9921 11.9914C12.6478 11.9914 13.9899 10.6492 13.9899 8.99357C13.9899 7.33791 12.6478 5.99573 10.9921 5.99573C9.33644 5.99573 7.99426 7.33791 7.99426 8.99357C7.99426 10.6492 9.33644 11.9914 10.9921 11.9914Z" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
|
|
9
|
+
<path d="M5.99569 19.6479V17.9871C5.99569 17.457 6.20625 16.9487 6.58106 16.5739C6.95586 16.1991 7.4642 15.9885 7.99425 15.9885H13.9899C14.52 15.9885 15.0283 16.1991 15.4031 16.5739C15.7779 16.9487 15.9885 17.457 15.9885 17.9871V19.6479" stroke={color || "#9DE5FD"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
|
|
10
10
|
</SvgIcon>
|
|
11
11
|
)
|
|
12
12
|
|
|
@@ -10,7 +10,7 @@ export const shortcutsStyles = {
|
|
|
10
10
|
mobileTrigger: {
|
|
11
11
|
display: { xs: 'flex', md: 'none' },
|
|
12
12
|
ml: spacing.sm,
|
|
13
|
-
color: '#
|
|
13
|
+
color: '#9DE5FD',
|
|
14
14
|
},
|
|
15
15
|
shortcut: {
|
|
16
16
|
display: 'flex',
|
|
@@ -25,6 +25,6 @@ export const shortcutsStyles = {
|
|
|
25
25
|
},
|
|
26
26
|
iconStyle: {
|
|
27
27
|
fontSize: '23px',
|
|
28
|
-
color:
|
|
28
|
+
color: colours.text.secondary,
|
|
29
29
|
},
|
|
30
30
|
}
|
|
@@ -6,7 +6,7 @@ import { useNavigation } from '../../NavkitContext'
|
|
|
6
6
|
|
|
7
7
|
const ChatIcon = ({ color }: { color?: string }) => (
|
|
8
8
|
<SvgIcon viewBox="-2 -2 24 24" sx={{ fontSize: 23, display: 'block', position: 'relative', top: 2 }}>
|
|
9
|
-
<path d="M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0Z" fill={color || "#
|
|
9
|
+
<path d="M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0Z" fill={color || "#9DE5FD"}/>
|
|
10
10
|
</SvgIcon>
|
|
11
11
|
)
|
|
12
12
|
|
|
@@ -65,7 +65,7 @@ const Shortcuts = (props: ShortcutsProps) => {
|
|
|
65
65
|
>
|
|
66
66
|
<FontAwesomeIcon
|
|
67
67
|
icon={["fas", "ellipsis-v"]}
|
|
68
|
-
style={{ ...shortcutsStyles.iconStyle, color: iconColor || '#
|
|
68
|
+
style={{ ...shortcutsStyles.iconStyle, color: iconColor || '#9DE5FD' }}
|
|
69
69
|
/>
|
|
70
70
|
</IconButton>
|
|
71
71
|
)}
|
package/src/types.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface NavigationContextType {
|
|
|
42
42
|
auth: Auth
|
|
43
43
|
themeMode: ThemeMode
|
|
44
44
|
toggleTheme: () => void
|
|
45
|
+
navbarColor?: string
|
|
46
|
+
iconColor?: string
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export interface NavkitProviderProps {
|
|
@@ -49,4 +51,6 @@ export interface NavkitProviderProps {
|
|
|
49
51
|
client: Client
|
|
50
52
|
onThemeChange?: (theme: ThemeMode) => void
|
|
51
53
|
appName?: string
|
|
54
|
+
navbarColor?: string
|
|
55
|
+
iconColor?: string
|
|
52
56
|
}
|
package/tsconfig.app.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"skipLibCheck": true,
|
|
10
10
|
|
|
11
11
|
/* Bundler mode */
|
|
12
|
+
"resolveJsonModule": true,
|
|
12
13
|
"moduleResolution": "bundler",
|
|
13
14
|
"allowImportingTsExtensions": true,
|
|
14
15
|
"verbatimModuleSyntax": true,
|
|
@@ -24,6 +25,6 @@
|
|
|
24
25
|
"noFallthroughCasesInSwitch": true,
|
|
25
26
|
"noUncheckedSideEffectImports": true
|
|
26
27
|
},
|
|
27
|
-
"include": ["src"],
|
|
28
|
+
"include": ["src", "package.json"],
|
|
28
29
|
"exclude": ["node_modules"]
|
|
29
30
|
}
|
package/vite.config.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
2
|
import react from '@vitejs/plugin-react'
|
|
3
|
+
import { resolve } from 'path'
|
|
3
4
|
|
|
4
5
|
// https://vite.dev/config/
|
|
5
6
|
export default defineConfig({
|
|
@@ -10,4 +11,26 @@ export default defineConfig({
|
|
|
10
11
|
},
|
|
11
12
|
}),
|
|
12
13
|
],
|
|
14
|
+
build: {
|
|
15
|
+
lib: {
|
|
16
|
+
entry: resolve(__dirname, 'src/App.tsx'),
|
|
17
|
+
formats: ['es'],
|
|
18
|
+
fileName: 'index',
|
|
19
|
+
},
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
external: [
|
|
22
|
+
'react',
|
|
23
|
+
'react-dom',
|
|
24
|
+
'react/jsx-runtime',
|
|
25
|
+
'@mui/material',
|
|
26
|
+
'@mui/icons-material',
|
|
27
|
+
'@emotion/react',
|
|
28
|
+
'@emotion/styled',
|
|
29
|
+
'@fortawesome/fontawesome-svg-core',
|
|
30
|
+
'@fortawesome/free-solid-svg-icons',
|
|
31
|
+
'@fortawesome/free-regular-svg-icons',
|
|
32
|
+
'@fortawesome/react-fontawesome',
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
13
36
|
})
|