@taruvi/navkit 0.0.38 → 0.0.39
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/.claude/settings.local.json +12 -0
- package/package.json +2 -2
- package/src/App.styles.ts +4 -1
- package/src/App.tsx +15 -7
- package/src/components/DraggableResizable.tsx +1 -1
- package/src/components/Profile/Profile.tsx +7 -6
- package/src/components/Shortucts/Shortcuts.styles.ts +2 -2
- package/src/components/Shortucts/Shortcuts.tsx +8 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taruvi/navkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"main": "src/App.tsx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"vitest": "^4.0.18"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@taruvi/sdk": "
|
|
51
|
+
"@taruvi/sdk": "latest"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/src/App.styles.ts
CHANGED
|
@@ -77,7 +77,7 @@ export const getAppStyles = (mode: ThemeMode) => {
|
|
|
77
77
|
overflow: 'hidden',
|
|
78
78
|
},
|
|
79
79
|
toolbar: {
|
|
80
|
-
backgroundColor: '#
|
|
80
|
+
backgroundColor: '#2B97FF',
|
|
81
81
|
boxShadow: ' 0px 0px 10px 2px rgba(0, 0, 0, 0.3)',
|
|
82
82
|
justifyContent: 'space-between',
|
|
83
83
|
minHeight: dimensions.navHeight,
|
|
@@ -106,6 +106,9 @@ export const getAppStyles = (mode: ThemeMode) => {
|
|
|
106
106
|
fontWeight: 600,
|
|
107
107
|
cursor: 'pointer',
|
|
108
108
|
},
|
|
109
|
+
taruviSpaceLogo: {
|
|
110
|
+
height: '22px',
|
|
111
|
+
},
|
|
109
112
|
rightSection: {
|
|
110
113
|
display: 'flex',
|
|
111
114
|
alignItems: 'center',
|
package/src/App.tsx
CHANGED
|
@@ -9,10 +9,12 @@ import DraggableResizable from "./components/DraggableResizable";
|
|
|
9
9
|
import { getAppStyles } from "./App.styles"
|
|
10
10
|
import { NavkitProvider, useNavigation } from "./NavkitContext"
|
|
11
11
|
import taruviLogo from "./assets/logo.svg";
|
|
12
|
+
import taruviLogoWhite from "./assets/taruvi-logo-white.png";
|
|
12
13
|
import type { Client } from "@taruvi/sdk"
|
|
13
14
|
|
|
14
15
|
const NavkitContent = () => {
|
|
15
16
|
const { isUserAuthenticated, siteSettings, appSettings, appName, userData, jwtToken, themeMode } = useNavigation();
|
|
17
|
+
const showTaruviLogo = !appName
|
|
16
18
|
const styles = getAppStyles(themeMode)
|
|
17
19
|
const [showAppLauncher, setShowAppLauncher] = useState<boolean>(false)
|
|
18
20
|
const [showProfileMenu, setShowProfileMenu] = useState<boolean>(false)
|
|
@@ -35,12 +37,18 @@ const NavkitContent = () => {
|
|
|
35
37
|
<AppBar position="static" sx={styles.appBar}>
|
|
36
38
|
<Toolbar sx={styles.toolbar}>
|
|
37
39
|
<Box component={"a"} href="/" sx={styles.leftSection}>
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
{showTaruviLogo ? (
|
|
41
|
+
<Box component="img" src={taruviLogoWhite} sx={styles.taruviSpaceLogo} />
|
|
42
|
+
) : (
|
|
43
|
+
<>
|
|
44
|
+
{appSettings?.icon ? <Box component="img" src={appSettings?.icon} sx={styles.logo} /> : <></>}
|
|
45
|
+
{(appName || appSettings?.displayName) &&
|
|
46
|
+
<Typography sx={styles.appName} onClick={() => (window.location.href = "/")}>
|
|
47
|
+
{(() => { const name = appName || appSettings!.displayName!; return name.length > 40 ? `${name.substring(0, 40)}...` : name })()}
|
|
48
|
+
</Typography>
|
|
49
|
+
}
|
|
50
|
+
</>
|
|
51
|
+
)}
|
|
44
52
|
</Box>
|
|
45
53
|
<Box component={"div"} sx={styles.rightSection}>
|
|
46
54
|
<Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} />
|
|
@@ -70,7 +78,7 @@ const NavkitContent = () => {
|
|
|
70
78
|
<Box component="img" src={taruviLogo} sx={styles.appLauncherLogo} />
|
|
71
79
|
)}
|
|
72
80
|
</Box>
|
|
73
|
-
{isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)}/>}
|
|
81
|
+
{isUserAuthenticated && userData && <Profile userData={userData} onClick={() => setShowProfileMenu(!showProfileMenu)} />}
|
|
74
82
|
</Box>
|
|
75
83
|
</Toolbar>
|
|
76
84
|
</AppBar>
|
|
@@ -41,7 +41,7 @@ const DraggableResizable = ({
|
|
|
41
41
|
y: Math.max(0, Math.min(e.clientY - dragOffset.current.y, window.innerHeight - 50)),
|
|
42
42
|
})
|
|
43
43
|
} else if (action.current === 'resize') {
|
|
44
|
-
setSize(
|
|
44
|
+
setSize(() => ({
|
|
45
45
|
w: Math.max(minWidth, e.clientX - dragOffset.current.x),
|
|
46
46
|
h: Math.max(minHeight, e.clientY - dragOffset.current.y),
|
|
47
47
|
}))
|
|
@@ -2,11 +2,11 @@ import { Box, SvgIcon } from '@mui/material'
|
|
|
2
2
|
import { getProfileStyles } from './Profile.styles'
|
|
3
3
|
import { useNavigation } from '../../NavkitContext'
|
|
4
4
|
|
|
5
|
-
const ProfileIcon = () => (
|
|
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="#
|
|
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="#
|
|
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="#
|
|
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 || "#ffffff"} 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 || "#ffffff"} 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 || "#ffffff"} fill="none" strokeWidth="1.99856" strokeLinecap="round" strokeLinejoin="round"/>
|
|
10
10
|
</SvgIcon>
|
|
11
11
|
)
|
|
12
12
|
|
|
@@ -15,10 +15,11 @@ import type { UserData } from '../../types'
|
|
|
15
15
|
interface ProfileProps {
|
|
16
16
|
userData: UserData
|
|
17
17
|
onClick: () => void
|
|
18
|
+
iconColor?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const Profile = (props: ProfileProps) => {
|
|
21
|
-
const { userData, onClick } = props
|
|
22
|
+
const { userData, onClick, iconColor } = props
|
|
22
23
|
const { themeMode } = useNavigation()
|
|
23
24
|
const styles = getProfileStyles(themeMode)
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ const Profile = (props: ProfileProps) => {
|
|
|
27
28
|
{userData.icon_url ? (
|
|
28
29
|
<Box component="img" src={userData.icon_url} sx={{ width: 23, height: 23, borderRadius: '50%' }} />
|
|
29
30
|
) : (
|
|
30
|
-
<ProfileIcon />
|
|
31
|
+
<ProfileIcon color={iconColor} />
|
|
31
32
|
)}
|
|
32
33
|
</Box>
|
|
33
34
|
)
|
|
@@ -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: '#ffffff',
|
|
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: '#ffffff',
|
|
29
29
|
},
|
|
30
30
|
}
|
|
@@ -4,9 +4,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
|
4
4
|
import { shortcutsStyles } from './Shortcuts.styles'
|
|
5
5
|
import { useNavigation } from '../../NavkitContext'
|
|
6
6
|
|
|
7
|
-
const ChatIcon = () => (
|
|
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="#
|
|
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 || "#ffffff"}/>
|
|
10
10
|
</SvgIcon>
|
|
11
11
|
)
|
|
12
12
|
|
|
@@ -14,11 +14,12 @@ interface ShortcutsProps {
|
|
|
14
14
|
showChat?: (showChat: boolean) => void
|
|
15
15
|
onMenuToggle?: () => void
|
|
16
16
|
triggerRef?: React.RefObject<HTMLButtonElement | null>
|
|
17
|
+
iconColor?: string
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const Shortcuts = (props: ShortcutsProps) => {
|
|
20
21
|
|
|
21
|
-
const { showChat, onMenuToggle, triggerRef } = props
|
|
22
|
+
const { showChat, onMenuToggle, triggerRef, iconColor } = props
|
|
22
23
|
const { navigateToUrl, siteSettings, isUserAuthenticated } = useNavigation()
|
|
23
24
|
const shortcuts = siteSettings.shortcuts
|
|
24
25
|
|
|
@@ -40,7 +41,7 @@ const Shortcuts = (props: ShortcutsProps) => {
|
|
|
40
41
|
>
|
|
41
42
|
<FontAwesomeIcon
|
|
42
43
|
icon={["far", shortcut.icon] as any}
|
|
43
|
-
style={shortcutsStyles.iconStyle}
|
|
44
|
+
style={{ ...shortcutsStyles.iconStyle, ...(iconColor && { color: iconColor }) }}
|
|
44
45
|
/>
|
|
45
46
|
</Link>
|
|
46
47
|
))}
|
|
@@ -50,7 +51,7 @@ const Shortcuts = (props: ShortcutsProps) => {
|
|
|
50
51
|
onClick={() => showChat?.(true)}
|
|
51
52
|
sx={shortcutsStyles.shortcut}
|
|
52
53
|
>
|
|
53
|
-
<ChatIcon />
|
|
54
|
+
<ChatIcon color={iconColor} />
|
|
54
55
|
</Link>
|
|
55
56
|
}
|
|
56
57
|
</Box>
|
|
@@ -60,11 +61,11 @@ const Shortcuts = (props: ShortcutsProps) => {
|
|
|
60
61
|
<IconButton
|
|
61
62
|
ref={triggerRef}
|
|
62
63
|
onClick={onMenuToggle}
|
|
63
|
-
sx={shortcutsStyles.mobileTrigger}
|
|
64
|
+
sx={{ ...shortcutsStyles.mobileTrigger, ...(iconColor && { color: iconColor }) }}
|
|
64
65
|
>
|
|
65
66
|
<FontAwesomeIcon
|
|
66
67
|
icon={["fas", "ellipsis-v"]}
|
|
67
|
-
style={{ ...shortcutsStyles.iconStyle, color: '#
|
|
68
|
+
style={{ ...shortcutsStyles.iconStyle, color: iconColor || '#ffffff' }}
|
|
68
69
|
/>
|
|
69
70
|
</IconButton>
|
|
70
71
|
)}
|