@taruvi/navkit 0.0.21 → 0.0.23

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taruvi/navkit",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "main": "src/App.tsx",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -109,7 +109,7 @@ export const NavkitProvider = ({ children, client, onThemeChange }: NavkitProvid
109
109
  const transformedApps: AppData[] = (appsResponse?.data || []).map?.((app: any) => ({
110
110
  id: app.slug,
111
111
  appname: app.display_name || app.name,
112
- icon: app.icon || "fa-question",
112
+ icon: app.icon || "",
113
113
  url: app.url
114
114
  }))
115
115
  startTransition(() => {
@@ -3,7 +3,7 @@ import type { AppData } from "../../types"
3
3
  import Search from "../Search/Search"
4
4
  import { Card, Box, Grid, Typography } from "@mui/material"
5
5
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
6
- import type { IconName } from "@fortawesome/fontawesome-svg-core"
6
+ import { findIconDefinition, library, type IconName } from "@fortawesome/fontawesome-svg-core"
7
7
  import { useNavigation } from "../../NavkitContext"
8
8
  import { getAppLauncherStyles } from "./AppLauncher.styles"
9
9
 
@@ -12,6 +12,11 @@ const isIconUrl = (icon: string): boolean => {
12
12
  return icon.startsWith('http://') || icon.startsWith('https://') || icon.startsWith('/')
13
13
  }
14
14
 
15
+ const isValidFaIcon = (icon: string): boolean => {
16
+ const iconName = icon.replace('fa-', '') as IconName
17
+ return !!findIconDefinition({ prefix: 'fas', iconName }) || !!findIconDefinition({ prefix: 'far', iconName })
18
+ }
19
+
15
20
  const AppLauncher = () => {
16
21
  const { navigateToUrl, appsList, themeMode } = useNavigation()
17
22
  const styles = getAppLauncherStyles(themeMode)
@@ -34,10 +39,10 @@ const AppLauncher = () => {
34
39
  <Search appsList={appsList} onSearchChange={handleSearchChange} />
35
40
  {filteredApps && filteredApps.length > 0 && (
36
41
  <Box sx={styles.scrollContainer}>
37
- <Grid container spacing={1}>
42
+ <Grid container spacing={0}>
38
43
  {filteredApps.map((app) => {
39
44
  return (
40
- <Grid size={3} key={app.id}>
45
+ <Grid size={2} key={app.id}>
41
46
  <Box
42
47
  sx={styles.appItem}
43
48
  onClick={() => handleAppClick(app)}
@@ -55,18 +60,22 @@ const AppLauncher = () => {
55
60
  objectFit: 'contain'
56
61
  }}
57
62
  />
58
- ) : (
63
+ ) : app.icon && isValidFaIcon(app.icon) ? (
59
64
  <FontAwesomeIcon
60
65
  icon={["fas", app.icon.replace('fa-', '') as IconName]}
61
66
  style={styles.iconStyle}
62
67
  />
68
+ ) : (
69
+ <Typography sx={{ fontSize: '1.25rem', fontWeight: 600 }}>
70
+ {app.appname?.charAt(0).toUpperCase()}
71
+ </Typography>
63
72
  )}
64
73
  </Box>
65
74
  <Typography
66
75
  variant="body2"
67
76
  sx={styles.appName}
68
77
  >
69
- {app?.appname?.length > 15 ? `${app.appname.substring(0, 15)}...` : app.appname}
78
+ {app?.appname?.length > 40 ? `${app.appname.substring(0, 40)}...` : app.appname}
70
79
  </Typography>
71
80
  </Box>
72
81
  </Grid>
@@ -1,4 +1,4 @@
1
- import { colours, spacing, shadows, borderRadius, typography, zIndex, dimensions, getColors, getShadows } from '../../styles/variables'
1
+ import { colours, darkColors, spacing, shadows, borderRadius, typography, zIndex, dimensions, getColors, getShadows } from '../../styles/variables'
2
2
  import type { ThemeMode } from '../../styles/variables'
3
3
 
4
4
  export const profileStyles = {
@@ -76,8 +76,8 @@ export const getProfileStyles = (mode: ThemeMode) => {
76
76
  avatar: {
77
77
  width: dimensions.avatarSize,
78
78
  height: dimensions.avatarSize,
79
- bgcolor: colors.bg.avatar,
80
- color: colors.text.primary,
79
+ bgcolor: darkColors.bg.avatar,
80
+ color: darkColors.text.primary,
81
81
  fontWeight: typography.weights.semibold,
82
82
  fontSize: typography.sizes.sm,
83
83
  },