Skip to content

refactor(ui): remove unused codes with knip #4751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions packages/ui/craco.config.js

This file was deleted.

16 changes: 5 additions & 11 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-markdown": "^6.2.5",
"@codemirror/view": "^6.26.3",
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@lezer/highlight": "^1.2.1",
Expand All @@ -35,13 +34,10 @@
"@uiw/codemirror-theme-vscode": "^4.21.21",
"@uiw/react-codemirror": "^4.21.21",
"axios": "1.7.9",
"clsx": "^1.1.1",
"dotenv": "^16.0.0",
"flowise-embed": "latest",
"flowise-embed-react": "latest",
"flowise-react-json-view": "*",
"formik": "^2.2.6",
"framer-motion": "^4.1.13",
"history": "^5.0.0",
"html-react-parser": "^3.0.4",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -70,15 +66,15 @@
"remark-math": "^5.1.1",
"showdown": "^2.1.0",
"tippy.js": "^6.3.7",
"uuid": "^9.0.1",
"yup": "^0.32.9"
"uuid": "^9.0.1"
},
"scripts": {
"dev": "vite",
"start": "vite",
"build": "vite build",
"clean": "rimraf build",
"nuke": "rimraf build node_modules .turbo"
"nuke": "rimraf build node_modules .turbo",
"knip": "knip"
},
"babel": {
"presets": [
Expand All @@ -100,12 +96,10 @@
"devDependencies": {
"@babel/eslint-parser": "^7.15.8",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^12.8.3",
"@types/node": "^24.0.7",
"@vitejs/plugin-react": "^4.2.0",
"knip": "^5.61.3",
"pretty-quick": "^3.1.3",
"react-scripts": "^5.0.1",
"rimraf": "^5.0.5",
"sass": "^1.42.1",
"typescript": "^5.4.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CssBaseline, StyledEngineProvider } from '@mui/material'
import Routes from '@/routes'

// defaultTheme
import themes from '@/themes'
import { theme } from '@/themes'

// project imports
import NavigationScroll from '@/layout/NavigationScroll'
Expand All @@ -19,7 +19,7 @@ const App = () => {

return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={themes(customization)}>
<ThemeProvider theme={theme(customization)}>
<CssBaseline />
<NavigationScroll>
<Routes />
Expand Down
18 changes: 0 additions & 18 deletions packages/ui/src/hooks/useScriptRef.jsx

This file was deleted.

58 changes: 0 additions & 58 deletions packages/ui/src/layout/MainLayout/Sidebar/TrialInfo.jsx

This file was deleted.

39 changes: 0 additions & 39 deletions packages/ui/src/layout/NavMotion.jsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/ui/src/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// action - customization reducer
export const SET_MENU = '@customization/SET_MENU'
export const MENU_TOGGLE = '@customization/MENU_TOGGLE'
export const MENU_OPEN = '@customization/MENU_OPEN'
export const SET_FONT_FAMILY = '@customization/SET_FONT_FAMILY'
export const SET_BORDER_RADIUS = '@customization/SET_BORDER_RADIUS'
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/store/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {

export const gridSpacing = 3
export const drawerWidth = 260
export const appDrawerWidth = 320
export const headerHeight = 80
export const maxScroll = 100000
export const baseURL = import.meta.env.VITE_API_BASE_URL || window.location.origin
Expand Down
5 changes: 1 addition & 4 deletions packages/ui/src/store/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import reducer from './reducer'

// ==============================|| REDUX - MAIN STORE ||============================== //

const store = createStore(reducer)
const persister = 'Free'

export { store, persister }
export const store = createStore(reducer)
2 changes: 1 addition & 1 deletion packages/ui/src/store/reducers/canvasReducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// action - state management
import * as actionTypes from '../actions'

export const initialState = {
const initialState = {
isDirty: false,
chatflow: null,
canvasDialogShow: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/store/reducers/customizationReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from '@/config'
// action - state management
import * as actionTypes from '../actions'

export const initialState = {
const initialState = {
isOpen: [], // for active default menu
fontFamily: config.fontFamily,
borderRadius: config.borderRadius,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/store/reducers/notifierReducer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ENQUEUE_SNACKBAR, CLOSE_SNACKBAR, REMOVE_SNACKBAR } from '../actions'

export const initialState = {
const initialState = {
notifications: []
}

Expand Down
2 changes: 0 additions & 2 deletions packages/ui/src/themes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,3 @@ export const theme = (customization) => {

return themes
}

export default theme
97 changes: 0 additions & 97 deletions packages/ui/src/ui-component/button/AnimateButton.jsx

This file was deleted.

13 changes: 1 addition & 12 deletions packages/ui/src/ui-component/button/RBACButtons.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as PropTypes from 'prop-types'
import { useAuth } from '@/hooks/useAuth'
import { StyledButton, StyledToggleButton } from '@/ui-component/button/StyledButton'
import { StyledButton } from '@/ui-component/button/StyledButton'
import { Button, IconButton, ListItemButton, MenuItem, Tab } from '@mui/material'

export const StyledPermissionButton = ({ permissionId, display, ...props }) => {
Expand All @@ -13,16 +13,6 @@ export const StyledPermissionButton = ({ permissionId, display, ...props }) => {
return <StyledButton {...props} />
}

export const StyledPermissionToggleButton = ({ permissionId, display, ...props }) => {
const { hasPermission, hasDisplay } = useAuth()

if (!hasPermission(permissionId) || !hasDisplay(display)) {
return null
}

return <StyledToggleButton {...props} />
}

export const PermissionIconButton = ({ permissionId, display, ...props }) => {
const { hasPermission, hasDisplay } = useAuth()

Expand Down Expand Up @@ -74,7 +64,6 @@ export const PermissionListItemButton = ({ permissionId, display, ...props }) =>
}

StyledPermissionButton.propTypes = { permissionId: PropTypes.string, display: PropTypes.array }
StyledPermissionToggleButton.propTypes = { permissionId: PropTypes.string, display: PropTypes.array }
PermissionIconButton.propTypes = { permissionId: PropTypes.string, display: PropTypes.array }
PermissionButton.propTypes = { permissionId: PropTypes.string, display: PropTypes.array }
PermissionTab.propTypes = { permissionId: PropTypes.string, display: PropTypes.array }
Expand Down
Loading