Skip to content

mbari-org/kb

Repository files navigation

MBARI VARS KnowledgeBase Editor

A React-based web application for managing the MBARI VARS (Video Annotation and Reference System) knowledge base. This application provides a comprehensive interface for taxonomic concept management, including concept editing, media management, user administration, and reference management.

πŸ—οΈ Project Overview

Technology Stack

  • Frontend Framework: React 19.0.0 with JSX
  • Build Tool: Vite 6.0.9
  • UI Framework: Material-UI (MUI) v6.4.0
  • Routing: React Router DOM v7.1.1
  • HTTP Client: Axios v1.7.9
  • Package Manager: Yarn v4.5.1
  • Development: ES2022+ with ESLint

Key Features

  • 🌲 Taxonomic Tree Management: Interactive concept hierarchy navigation
  • πŸ“ Concept Editing: Create, edit, and manage taxonomic concepts
  • πŸ–ΌοΈ Media Management: Associate and manage media files with concepts
  • πŸ‘₯ User Administration: Manage system users and permissions
  • πŸ“š Reference Management: Handle scientific references and citations
  • πŸ“Š History Tracking: View concept change history and versioning
  • πŸ”’ Authentication: Secure login with JWT tokens
  • πŸ“± Responsive Design: Mobile-friendly interface

πŸ“ Project Structure

src/
β”œβ”€β”€ components/           # React components
β”‚   β”œβ”€β”€ auth/            # Authentication components
β”‚   β”œβ”€β”€ common/          # Reusable UI components
β”‚   β”œβ”€β”€ config/          # Configuration forms
β”‚   β”œβ”€β”€ kb/              # Knowledge base specific components
β”‚   β”‚   β”œβ”€β”€ panels/      # Main panel components
β”‚   β”‚   β”‚   β”œβ”€β”€ concepts/ # Concept management
β”‚   β”‚   β”‚   β”œβ”€β”€ history/  # History tracking
β”‚   β”‚   β”‚   β”œβ”€β”€ references/ # Reference management
β”‚   β”‚   β”‚   β”œβ”€β”€ templates/ # Template management
β”‚   β”‚   β”‚   └── users/   # User management
β”‚   β”‚   └── nav/         # Navigation components
β”‚   β”œβ”€β”€ modal/           # Modal dialogs
β”‚   └── util/            # Utility components
β”œβ”€β”€ contexts/            # React contexts for state management
β”‚   β”œβ”€β”€ auth/            # Authentication context
β”‚   β”œβ”€β”€ concept/         # Concept state management
β”‚   β”œβ”€β”€ config/          # Configuration context
β”‚   β”œβ”€β”€ modal/           # Modal state management
β”‚   β”œβ”€β”€ references/      # References context
β”‚   β”œβ”€β”€ selected/        # Selection state
β”‚   β”œβ”€β”€ taxonomy/        # Taxonomy data context
β”‚   β”œβ”€β”€ templates/       # Templates context
β”‚   └── users/           # Users context
β”œβ”€β”€ hooks/               # Custom React hooks
β”œβ”€β”€ lib/                 # Utility libraries
β”‚   β”œβ”€β”€ api/             # API service functions
β”‚   β”œβ”€β”€ auth/            # Authentication utilities
β”‚   β”œβ”€β”€ kb/              # Knowledge base models
β”‚   β”œβ”€β”€ services/        # External service integrations
β”‚   └── store/           # State management stores
└── App.jsx              # Main application component

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Yarn 4.5.1+
  • Modern web browser

Installation

  1. Clone the repository

    git clone <repository-url>
    cd kb
  2. Install dependencies

    yarn install
  3. Start development server

    yarn dev
  4. Open in browser Navigate to http://localhost:5173/kbeditor/

Available Scripts

Command Description
yarn dev Start development server with hot reload
yarn build Build production bundle
yarn preview Preview production build locally
yarn kb Build and preview (combined command)
yarn lint Run ESLint code analysis
yarn version:generate Generate version information

πŸ—οΈ Development

Project Configuration

  • Base URL: /kbeditor/
  • Development Port: 5173
  • Path Aliases: @ maps to ./src
  • Source Maps: Enabled in production builds

Code Standards

  • ESLint: Configured with React best practices
  • React: Uses modern hooks and functional components
  • JSX: Standard JSX syntax
  • ES2022+: Modern JavaScript features

State Management

The application uses React Contexts for state management:

  • AuthContext: User authentication and authorization
  • ConceptContext: Concept editing and staging
  • TaxonomyContext: Taxonomic tree data
  • SelectedContext: Current selections (concepts, history)
  • ModalContext: Modal dialog state
  • ConfigContext: Application configuration

Key Components

Main Application Structure

  • App.jsx: Root component with routing
  • KBContainer.jsx: Main knowledge base container
  • KnowledgeBase.jsx: Core KB interface

Panel Components

  • Concepts.jsx: Concept management panel
  • References.jsx: Reference management
  • Users.jsx: User administration
  • Templates.jsx: Template management
  • History.jsx: Change history tracking

Tree Navigation

  • TaxonomyTree.jsx: Interactive concept tree
  • ConceptTreeItem.jsx: Individual tree nodes
  • ConceptTreeLabel.jsx: Tree item labels

API Integration

API services are organized in src/lib/api/:

  • concept.js: Concept CRUD operations
  • taxonomy.js: Taxonomic tree operations
  • references.js: Reference management
  • users.js: User management
  • media.js: Media file operations

Authentication

  • JWT-based authentication
  • Role-based access control (Read-only, Editor, Admin)
  • Automatic token refresh
  • Secure route protection

🎨 UI/UX

Design System

  • Material-UI: Consistent component library
  • Theme: Custom MBARI-branded theme
  • Typography: Roboto font family
  • Responsive: Mobile-first design approach
  • Accessibility: ARIA compliant components

Key UI Patterns

  • Panel Layout: Tabbed interface for different sections
  • Tree Navigation: Expandable taxonomic hierarchy
  • Modal Dialogs: Overlay forms for editing
  • Data Grids: Sortable and filterable tables
  • Form Validation: Real-time input validation

πŸ§ͺ Testing & Quality

Code Quality

  • ESLint configuration with React rules
  • Strict mode enabled
  • Error boundaries for graceful error handling
  • TypeScript definitions available

Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • ES2022+ features required
  • JavaScript modules support needed

πŸ“¦ Deployment

Build Process

# Production build
yarn build

# Preview build locally
yarn preview

Build Output

  • Static files in dist/ directory
  • Source maps included
  • Optimized and minified assets
  • Base path: /kbeditor/

Environment Configuration

  • Development: Vite dev server with HMR
  • Production: Static file serving
  • API endpoints configurable via context

πŸ”§ Customization

Theme Customization

Modify src/lib/theme.js to customize:

  • Color palette
  • Typography settings
  • Component variants
  • Spacing and breakpoints

Adding New Features

  1. Create components in appropriate directory
  2. Add contexts for state management if needed
  3. Implement API services in src/lib/api/
  4. Update routing in App.jsx
  5. Add navigation links in appropriate panels

πŸ“„ License

[Add license information here]

🀝 Contributing

[Add contribution guidelines here]

πŸ“ž Support

For technical support or questions about MBARI VARS:

  • [Add contact information here]
  • [Add documentation links here]

About

Development repo for the VARS KB web app

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages