diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs index 3e2cfac..323a0d3 100644 --- a/frontend/.eslintrc.cjs +++ b/frontend/.eslintrc.cjs @@ -16,8 +16,9 @@ module.exports = { ecmaVersion: 'latest', sourceType: 'module', }, - plugins: ['react'], + plugins: ['react', 'unused-imports'], rules: { + 'unused-imports/no-unused-imports': 'error', 'react/react-in-jsx-scope': 'off', 'prettier/prettier': [ 'error', diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e41a1ae..d8330e5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1805,6 +1805,21 @@ } } }, + "eslint-plugin-unused-imports": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz", + "integrity": "sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==", + "dev": true, + "requires": { + "eslint-rule-composer": "^0.3.0" + } + }, + "eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index c63a305..f1e973d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -40,6 +40,7 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.32.2", + "eslint-plugin-unused-imports": "^2.0.0", "husky": "^8.0.0", "lint-staged": "^13.1.1", "postcss": "^8.4.21", diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 2847296..7145286 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { NavLink } from 'react-router-dom'; import Arrow1 from './assets/arrow.svg'; import Message from './assets/message.svg'; @@ -8,15 +9,14 @@ import Link from './assets/link.svg'; import { ActiveState } from './models/misc'; import APIKeyModal from './preferences/APIKeyModal'; import SelectDocsModal from './preferences/SelectDocsModal'; -import { useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { selectApiKeyStatus, + selectSelectedDocs, selectSelectedDocsStatus, + selectSourceDocs, + setSelectedDocs, } from './preferences/preferenceSlice'; -import { useState } from 'react'; - -//TODO - Need to replace Chat button to open secondary nav with scrollable past chats option and new chat at top -//TODO - Need to add Discord and Github links export default function Navigation({ navState, @@ -25,6 +25,12 @@ export default function Navigation({ navState: ActiveState; setNavState: (val: ActiveState) => void; }) { + const dispatch = useDispatch(); + const docs = useSelector(selectSourceDocs); + const selectedDocs = useSelector(selectSelectedDocs); + + const [isDocsListOpen, setIsDocsListOpen] = useState(false); + const isApiKeySet = useSelector(selectApiKeyStatus); const [apiKeyModalState, setApiKeyModalState] = useState( isApiKeySet ? 'INACTIVE' : 'ACTIVE', @@ -39,9 +45,9 @@ export default function Navigation({
-
+