diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 16aec3f..92d7daf 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -1,7 +1,6 @@ { "env": { "browser": true, - "es2021": true, "jest": true }, "extends": [ diff --git a/frontend/prettier b/frontend/.prettierrc similarity index 100% rename from frontend/prettier rename to frontend/.prettierrc diff --git a/frontend/package.json b/frontend/package.json index e1beaca..82b4af4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -51,8 +51,8 @@ "start": "WDS_SOCKET_HOST=backstory-beta.ketrenos.com WDS_SOCKET_PORT=443 craco start", "build": "craco build", "test": "craco test", - "lint": "eslint src/**/*.{ts,tsx}", - "lint:fix": "eslint src/**/*.{ts,tsx} --fix", + "lint": "eslint src/**/*.{ts,tsx} --no-color", + "lint:fix": "eslint src/**/*.{ts,tsx} --fix --no-color", "format": "prettier --write src/**/*.{ts,tsx}" }, "eslintConfig": { diff --git a/frontend/src/BackstoryApp.tsx b/frontend/src/BackstoryApp.tsx index fc42cfd..2206826 100644 --- a/frontend/src/BackstoryApp.tsx +++ b/frontend/src/BackstoryApp.tsx @@ -1,67 +1,53 @@ -import React, { useEffect, useState, useRef, JSX } from "react"; -import { Route, Routes, useLocation, useNavigate } from "react-router-dom"; -import { ThemeProvider } from "@mui/material/styles"; -import { backstoryTheme } from "./BackstoryTheme"; +import React, { useEffect, useState, useRef, JSX } from 'react'; +import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'; +import { ThemeProvider } from '@mui/material/styles'; +import { backstoryTheme } from './BackstoryTheme'; -import { ConversationHandle } from "components/Conversation"; -import { CandidateRoute } from "routes/CandidateRoute"; -import { BackstoryLayout } from "components/layout/BackstoryLayout"; -import { ChatQuery } from "types/types"; -import { AuthProvider } from "hooks/AuthContext"; -import { AppStateProvider } from "hooks/GlobalContext"; +import { ConversationHandle } from 'components/Conversation'; +import { CandidateRoute } from 'routes/CandidateRoute'; +import { BackstoryLayout } from 'components/layout/BackstoryLayout'; +import { ChatQuery } from 'types/types'; +import { AuthProvider } from 'hooks/AuthContext'; +import { AppStateProvider } from 'hooks/GlobalContext'; -import "./BackstoryApp.css"; -import "@fontsource/roboto/300.css"; -import "@fontsource/roboto/400.css"; -import "@fontsource/roboto/500.css"; -import "@fontsource/roboto/700.css"; +import './BackstoryApp.css'; +import '@fontsource/roboto/300.css'; +import '@fontsource/roboto/400.css'; +import '@fontsource/roboto/500.css'; +import '@fontsource/roboto/700.css'; const BackstoryApp = (): JSX.Element => { - const navigate = useNavigate(); - const location = useLocation(); - const chatRef = useRef(null); - const submitQuery = (query: ChatQuery): void => { - console.log( - `handleSubmitChatQuery:`, - query, - chatRef.current ? " sending" : "no handler" - ); - chatRef.current?.submitQuery(query); - navigate("/chat"); - }; - const [page, setPage] = useState(""); + const navigate = useNavigate(); + const location = useLocation(); + const chatRef = useRef(null); + const submitQuery = (query: ChatQuery): void => { + console.log(`handleSubmitChatQuery:`, query, chatRef.current ? ' sending' : 'no handler'); + chatRef.current?.submitQuery(query); + navigate('/chat'); + }; + const [page, setPage] = useState(''); - useEffect(() => { - const currentRoute = location.pathname.split("/")[1] - ? `/${location.pathname.split("/")[1]}` - : "/"; - setPage(currentRoute); - }, [location.pathname]); + useEffect(() => { + const currentRoute = location.pathname.split('/')[1] + ? `/${location.pathname.split('/')[1]}` + : '/'; + setPage(currentRoute); + }, [location.pathname]); - // Render appropriate routes based on user type - return ( - - - - - } - /> - {/* Static/shared routes */} - - } - /> - - - - - ); + // Render appropriate routes based on user type + return ( + + + + + } /> + {/* Static/shared routes */} + } /> + + + + + ); }; export { BackstoryApp }; diff --git a/frontend/src/BackstoryTheme.tsx b/frontend/src/BackstoryTheme.tsx index cc80def..08a09b8 100644 --- a/frontend/src/BackstoryTheme.tsx +++ b/frontend/src/BackstoryTheme.tsx @@ -1,76 +1,76 @@ -import { createTheme } from "@mui/material/styles"; +import { createTheme } from '@mui/material/styles'; const backstoryTheme = createTheme({ palette: { primary: { - main: "#1A2536", // Midnight Blue - contrastText: "#D3CDBF", // Warm Gray + main: '#1A2536', // Midnight Blue + contrastText: '#D3CDBF', // Warm Gray }, secondary: { - main: "#4A7A7D", // Dusty Teal - contrastText: "#FFFFFF", // White + main: '#4A7A7D', // Dusty Teal + contrastText: '#FFFFFF', // White }, text: { - primary: "#2E2E2E", // Charcoal Black - secondary: "#1A2536", // Midnight Blue + primary: '#2E2E2E', // Charcoal Black + secondary: '#1A2536', // Midnight Blue }, background: { - default: "#D3CDBF", // Warm Gray - paper: "#FFFFFF", // White + default: '#D3CDBF', // Warm Gray + paper: '#FFFFFF', // White }, action: { - active: "#D4A017", // Golden Ochre - hover: "rgba(212, 160, 23, 0.1)", // Golden Ochre with opacity + active: '#D4A017', // Golden Ochre + hover: 'rgba(212, 160, 23, 0.1)', // Golden Ochre with opacity }, custom: { - highlight: "#D4A017", // Golden Ochre - contrast: "#2E2E2E", // Charcoal Black + highlight: '#D4A017', // Golden Ochre + contrast: '#2E2E2E', // Charcoal Black }, }, typography: { fontFamily: "'Roboto', sans-serif", h1: { - fontSize: "2rem", + fontSize: '2rem', fontWeight: 500, - color: "#2E2E2E", // Charcoal Black + color: '#2E2E2E', // Charcoal Black }, h2: { - fontSize: "1.75rem", + fontSize: '1.75rem', fontWeight: 500, - color: "#2E2E2E", // Charcoal Black - marginBottom: "1rem", + color: '#2E2E2E', // Charcoal Black + marginBottom: '1rem', }, h3: { - fontSize: "1.5rem", + fontSize: '1.5rem', fontWeight: 500, - color: "#2E2E2E", // Charcoal Black - marginBottom: "0.75rem", + color: '#2E2E2E', // Charcoal Black + marginBottom: '0.75rem', }, h4: { - fontSize: "1.25rem", + fontSize: '1.25rem', fontWeight: 500, - color: "#2E2E2E", // Charcoal Black - marginBottom: "0.5rem", + color: '#2E2E2E', // Charcoal Black + marginBottom: '0.5rem', }, body1: { - fontSize: "1rem", - color: "#2E2E2E", // Charcoal Black - marginBottom: "0.5rem", + fontSize: '1rem', + color: '#2E2E2E', // Charcoal Black + marginBottom: '0.5rem', }, body2: { - fontSize: "0.875rem", - color: "#2E2E2E", // Charcoal Black + fontSize: '0.875rem', + color: '#2E2E2E', // Charcoal Black }, }, components: { MuiLink: { styleOverrides: { root: { - color: "#4A7A7D", // Dusty Teal (your secondary color) - textDecoration: "none", - "&:hover": { - color: "#D4A017", // Golden Ochre on hover - textDecoration: "underline", + color: '#4A7A7D', // Dusty Teal (your secondary color) + textDecoration: 'none', + '&:hover': { + color: '#D4A017', // Golden Ochre on hover + textDecoration: 'underline', }, }, }, @@ -78,9 +78,9 @@ const backstoryTheme = createTheme({ MuiButton: { styleOverrides: { root: { - textTransform: "none", - "&:hover": { - backgroundColor: "rgba(212, 160, 23, 0.2)", // Golden Ochre hover + textTransform: 'none', + '&:hover': { + backgroundColor: 'rgba(212, 160, 23, 0.2)', // Golden Ochre hover }, }, }, @@ -88,7 +88,7 @@ const backstoryTheme = createTheme({ MuiAppBar: { styleOverrides: { root: { - backgroundColor: "#1A2536", // Midnight Blue + backgroundColor: '#1A2536', // Midnight Blue }, }, }, @@ -96,23 +96,23 @@ const backstoryTheme = createTheme({ styleOverrides: { root: { // padding: '0.5rem', - borderRadius: "4px", + borderRadius: '4px', }, }, }, MuiList: { styleOverrides: { root: { - padding: "0.5rem", + padding: '0.5rem', }, }, }, MuiListItem: { styleOverrides: { root: { - borderRadius: "4px", - "&:hover": { - backgroundColor: "rgba(212, 160, 23, 0.1)", // Golden Ochre with opacity + borderRadius: '4px', + '&:hover': { + backgroundColor: 'rgba(212, 160, 23, 0.1)', // Golden Ochre with opacity }, }, }, diff --git a/frontend/src/components/BackstoryQuery.tsx b/frontend/src/components/BackstoryQuery.tsx index d70453c..b58b65a 100644 --- a/frontend/src/components/BackstoryQuery.tsx +++ b/frontend/src/components/BackstoryQuery.tsx @@ -1,7 +1,7 @@ -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; -import { CandidateQuestion } from "types/types"; +import { CandidateQuestion } from 'types/types'; type ChatSubmitQueryInterface = (query: CandidateQuestion) => void; @@ -20,8 +20,8 @@ const BackstoryQuery = (props: BackstoryQueryInterface) => {