@taruvi/navkit 0.0.45 → 0.0.47
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
CHANGED
package/src/App.styles.ts
CHANGED
|
@@ -82,6 +82,7 @@ export const getAppStyles = (mode: ThemeMode) => {
|
|
|
82
82
|
justifyContent: 'space-between',
|
|
83
83
|
minHeight: `${dimensions.navHeight} !important`,
|
|
84
84
|
height: dimensions.navHeight,
|
|
85
|
+
px: '18px !important',
|
|
85
86
|
},
|
|
86
87
|
leftSection: {
|
|
87
88
|
display: 'flex',
|
|
@@ -177,7 +178,7 @@ export const getAppStyles = (mode: ThemeMode) => {
|
|
|
177
178
|
marginTop: '2px',
|
|
178
179
|
},
|
|
179
180
|
backdrop: {
|
|
180
|
-
position: "
|
|
181
|
+
position: "fixed" as const,
|
|
181
182
|
inset: 0,
|
|
182
183
|
zIndex: 10,
|
|
183
184
|
},
|
package/src/NavkitContext.tsx
CHANGED
|
@@ -51,8 +51,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName, navba
|
|
|
51
51
|
}, [])
|
|
52
52
|
|
|
53
53
|
const checkIfDesk = async () => {
|
|
54
|
-
const
|
|
55
|
-
const frontendUrl = (fetchedSettings?.data ?? fetchedSettings)?.settings?.['navkit.frontend-url']
|
|
54
|
+
const frontendUrl = appSettings?.frontendUrl
|
|
56
55
|
if (!frontendUrl) return false
|
|
57
56
|
return window.location.href.includes(frontendUrl || '')
|
|
58
57
|
}
|
|
@@ -89,12 +88,13 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName, navba
|
|
|
89
88
|
// Fetch app settings to get the app name
|
|
90
89
|
try {
|
|
91
90
|
setAppSettingsLoaded(false)
|
|
92
|
-
const { data } =
|
|
91
|
+
const { data } = await new App(client).settings().execute() as { data: { display_name?: string, icon?: string, primary_color?: string, secondary_color?: string, frontend_url?: string } }
|
|
93
92
|
setAppSettings({
|
|
94
|
-
displayName: data?.display_name,
|
|
93
|
+
displayName: appName || data?.display_name,
|
|
95
94
|
icon: data?.icon,
|
|
96
95
|
primaryColor: data?.primary_color,
|
|
97
|
-
secondaryColor: data?.secondary_color
|
|
96
|
+
secondaryColor: data?.secondary_color,
|
|
97
|
+
frontendUrl: data?.frontend_url
|
|
98
98
|
})
|
|
99
99
|
} catch {
|
|
100
100
|
// App settings not available, continue without app settings
|
|
@@ -143,15 +143,6 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName, navba
|
|
|
143
143
|
init()
|
|
144
144
|
}, [])
|
|
145
145
|
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
const initIsDesk = async () => {
|
|
148
|
-
const isDeskValue = await checkIfDesk()
|
|
149
|
-
setIsDesk(isDeskValue)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
initIsDesk()
|
|
153
|
-
}, [])
|
|
154
|
-
|
|
155
146
|
// Listen for user profile updates via BroadcastChannel
|
|
156
147
|
useEffect(() => {
|
|
157
148
|
const channel = new BroadcastChannel('taruvi-updates')
|
|
@@ -168,7 +159,16 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName, navba
|
|
|
168
159
|
channel.removeEventListener('message', handleMessage)
|
|
169
160
|
channel.close()
|
|
170
161
|
}
|
|
171
|
-
}, [getData])
|
|
162
|
+
}, [getData, isUserAuthenticated])
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
const initIsDesk = async () => {
|
|
166
|
+
const isDeskValue = await checkIfDesk()
|
|
167
|
+
setIsDesk(isDeskValue)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
initIsDesk()
|
|
171
|
+
}, [checkIfDesk])
|
|
172
172
|
|
|
173
173
|
// Notify parent app of theme changes
|
|
174
174
|
useEffect(() => {
|
|
@@ -95,17 +95,15 @@ export const getAppLauncherStyles = (mode: ThemeMode) => {
|
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
iconContainer: {
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
98
|
+
width: 40,
|
|
99
|
+
height: 40,
|
|
100
100
|
display: 'flex',
|
|
101
101
|
alignItems: 'center',
|
|
102
102
|
justifyContent: 'center',
|
|
103
|
-
borderRadius: borderRadius.default,
|
|
104
|
-
border: `1px solid ${colors.border.light}`,
|
|
105
103
|
mb: spacing.sm,
|
|
106
104
|
},
|
|
107
105
|
iconStyle: {
|
|
108
|
-
fontSize:
|
|
106
|
+
fontSize: '40px',
|
|
109
107
|
color: colors.text.secondary,
|
|
110
108
|
},
|
|
111
109
|
appName: {
|
|
@@ -38,14 +38,14 @@ const AppLauncher = () => {
|
|
|
38
38
|
return (
|
|
39
39
|
<Card sx={styles.container}>
|
|
40
40
|
<Search appsList={appsList} onSearchChange={handleSearchChange} />
|
|
41
|
-
{filteredApps.length === 0 ? (
|
|
41
|
+
{filteredApps.filter(app => app.url).length === 0 ? (
|
|
42
42
|
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', py: 6 }}>
|
|
43
43
|
<Typography sx={{ color: styles.appName.color, fontSize: typography.sizes.sm }}>No apps available</Typography>
|
|
44
44
|
</Box>
|
|
45
45
|
) : (
|
|
46
46
|
<Box sx={styles.scrollContainer}>
|
|
47
47
|
<Grid container spacing={0}>
|
|
48
|
-
{filteredApps.map((app) => {
|
|
48
|
+
{filteredApps.filter(app => app.url).map((app) => {
|
|
49
49
|
return (
|
|
50
50
|
<Grid size={2} key={app.id}>
|
|
51
51
|
<Box
|
|
@@ -60,8 +60,8 @@ const AppLauncher = () => {
|
|
|
60
60
|
src={app.icon}
|
|
61
61
|
alt={app.appname}
|
|
62
62
|
style={{
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
63
|
+
width: 40,
|
|
64
|
+
height: 40,
|
|
65
65
|
objectFit: 'contain'
|
|
66
66
|
}}
|
|
67
67
|
/>
|
package/src/types.ts
CHANGED