diff --git a/app/ui/src/App.tsx b/app/ui/src/App.tsx index c4a5db8..c12dbdd 100644 --- a/app/ui/src/App.tsx +++ b/app/ui/src/App.tsx @@ -1,19 +1,20 @@ import { IPublicClientApplication } from "@azure/msal-browser"; import { MsalAuthenticationTemplate, MsalProvider } from "@azure/msal-react"; -import { Button, makeStyles } from "@fluentui/react-components"; +import { Avatar, Button, makeStyles } from "@fluentui/react-components"; import { ChevronLeft20Regular } from "@fluentui/react-icons"; import { useLocation, useNavigate } from "react-router-dom"; import logo from './assets/Azure.svg'; import { interactionType, loginRequest } from "./authConfig"; import { NavMenu, Pages } from "./Navigation"; + type AppProps = { pca: IPublicClientApplication; }; const useStyles = makeStyles({ - app: { backgroundColor: '#f5f5f5', color: '#fff', minHeight: '100vh' }, - header: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', padding: '8px' }, + app: { backgroundColor: '#f5f5f5', color: '#fff', minHeight: '100vh', overflowX: 'hidden'}, + header: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', padding: '8px', width: '100%', boxSizing: 'border-box' }, logo: { display: 'flex', alignItems: 'center', @@ -29,6 +30,11 @@ const useStyles = makeStyles({ }, logoText: { textDecoration: 'none', color: '#000' }, main: { display: 'flex', flexDirection: 'column', alignItems: 'center' }, + rightSection: { + display: 'flex', + alignItems: 'center', + gap: '16px', + }, }); function App({ pca }: AppProps) { @@ -49,7 +55,11 @@ function App({ pca }: AppProps) { logo

AI Document Review

- +
+ + +
+
diff --git a/app/ui/src/Navigation.tsx b/app/ui/src/Navigation.tsx index 9eb7c5f..349bab3 100644 --- a/app/ui/src/Navigation.tsx +++ b/app/ui/src/Navigation.tsx @@ -8,7 +8,6 @@ import { MenuGroup, MenuGroupHeader, MenuDivider, - Avatar, MenuItemLink, } from "@fluentui/react-components"; import { @@ -19,11 +18,12 @@ import { DocumentBulletListFilled, } from "@fluentui/react-icons"; import { useNavigate, useLocation, Routes, Route } from "react-router-dom"; -import Agents from "./pages/admin/Agents"; +import AgentManager from "./pages/admin/AgentManager"; import Files from "./pages/files/Files"; import Review from "./pages/review/Review"; -import Settings from "./pages/admin/Settings"; -import useStyles from "./styles/useStyles"; +import SettingManager from "./pages/admin/SettingManager"; +import { DOCUMENTATION_URL } from "./constants"; +import { sharedStyles } from "./styles/sharedStyles"; // paths @@ -34,12 +34,11 @@ const paths = { settings: "/admin/settings", }; -const documentation_url = "https://github.com/Azure-Samples/ai-document-review"; const NavMenu = () => { const navigate = useNavigate(); const location = useLocation(); - const classes = useStyles() + const sharedClasses = sharedStyles(); const isSelected = (path: string) => location.pathname === path; @@ -54,7 +53,7 @@ const NavMenu = () => { } onClick={() => navigate(paths.home)} - className={isSelected(paths.home) ? classes.selected : ""} + className={isSelected(paths.home) ? sharedClasses.selected : ""} > Home @@ -67,27 +66,22 @@ const NavMenu = () => { } onClick={() => navigate(paths.adminAgents)} - className={isSelected(paths.adminAgents) ? classes.selected : ""} + className={isSelected(paths.adminAgents) ? sharedClasses.selected : ""} > Agents Manager } onClick={() => navigate(paths.settings)} - className={isSelected(paths.settings) ? classes.selected : ""} + className={isSelected(paths.settings) ? sharedClasses.selected : ""} > Settings - } href={documentation_url} target="_blank" rel="noopener noreferrer"> + } href={DOCUMENTATION_URL} target="_blank" rel="noopener noreferrer"> Documentation - - {/* Account */} - - - @@ -98,8 +92,8 @@ const Pages = () => ( } /> } /> - } /> - } /> + } /> + } /> ); diff --git a/app/ui/src/components/AddCard.tsx b/app/ui/src/components/AddCard.tsx new file mode 100644 index 0000000..0029617 --- /dev/null +++ b/app/ui/src/components/AddCard.tsx @@ -0,0 +1,46 @@ +import { Card, makeStyles, Text, tokens } from '@fluentui/react-components' +import { AddRegular } from '@fluentui/react-icons' + + +interface AddCardProps { + onClick: () => void + labelText: string +} + +const componentSyles = makeStyles({ + addIconText: { + textAlign: 'center', + fontWeight: tokens.fontWeightSemibold + }, + disabledCard: { + width: '200px', + maxWidth: '100%', + height: '260px' + }, + addIcon: { + fontSize: '72px', + color: tokens.colorNeutralForeground3, + margin: 'auto', + opacity: 0.5, + pointerEvents: 'none' + } +}) + +const AddCard: React.FC = ({ onClick, labelText }) => { + const componentClasses = componentSyles() + + return ( + onClick()} + > + + {labelText} + + ) +} + +export default AddCard diff --git a/app/ui/src/components/AgentCard.tsx b/app/ui/src/components/AgentCard.tsx new file mode 100644 index 0000000..8d1690b --- /dev/null +++ b/app/ui/src/components/AgentCard.tsx @@ -0,0 +1,113 @@ +import { + Button, + Caption1, + Card, + CardFooter, + CardHeader, + CardPreview, + Text, + Tooltip, + makeStyles +} from '@fluentui/react-components' +import { DeleteRegular, SquareMultipleRegular } from '@fluentui/react-icons' +import React from 'react' +import { sharedStyles } from '../styles/sharedStyles' +import { PromptAgent } from '../types/prompt-agent' + + +const componentSyles = makeStyles({ + cardHeaderTitle: { + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + maxWidth: '165px', + }, + cardFooter: { + marginTop: "auto", + display: "flex", + justifyContent: "flex-end", + gap: "8px" + }, + cardbody: { + padding: '12px', + width: '175px', + textAlign: 'left', + display: '-webkit-box', + WebkitBoxOrient: 'vertical', + WebkitLineClamp: 3, + overflow: 'hidden', + textOverflow: 'ellipsis', + wordBreak: 'break-word', + maxWidth: '175px', + maxHeight: '125px' + } +}) + +interface AgentCardProps { + agent: PromptAgent + onViewAgent: (agent: PromptAgent) => void + onDeleteAgent: (id: string) => void + onEditAgent: (id: string) => void + onDuplicateAgent: (id: string) => void +} + +const AgentCard: React.FC = ({ + agent, + onViewAgent, + onDeleteAgent, + onDuplicateAgent +}) => { + const extractDate = (dateString: string | number | Date | undefined) => { + const date = new Date(dateString || '') + return !isNaN(date.getTime()) ? date.toLocaleDateString() : 'Date not available' + } + + const componentClasses = componentSyles() + const sharedClasses = sharedStyles() + + return ( + onViewAgent(agent)} key={agent.id} className={sharedClasses.card}> + + {agent.name} + + } + description={ + + {agent.updated_at_UTC + ? `Updated: ${extractDate(agent.updated_at_UTC)}` + : `Created: ${extractDate(agent.created_at_UTC)}`} + + } + /> + + {agent.guideline_prompt} + + + +