Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Web Client Components

This document describes the reusable components available in the AREA web client.

Component Categories

Components are organized into three categories:

CategoryLocationPurpose
UIcomponents/ui/Generic, reusable UI elements
Layoutcomponents/layout/Page structure components
Featurescomponents/features/Domain-specific components

UI Components

Input

A form input component with built-in error handling and consistent styling.

Location: src/components/Input.jsx

Props:

PropTypeDefaultDescription
labelstring-Input label text
namestringrequiredInput name attribute
typestring'text'Input type (text, email, password, etc.)
valuestring-Controlled input value
onChangefunctionrequiredChange handler
errorstring-Error message to display
placeholderstring-Placeholder text
disabledbooleanfalseDisable input

Usage:

import Input from '../components/Input';

<Input
  label="Email"
  name="email"
  type="email"
  value={formData.email}
  onChange={handleChange}
  error={errors.email}
  placeholder="Enter your email"
/>

Button

A button component with loading state support.

Location: src/components/Button.jsx

Props:

PropTypeDefaultDescription
childrennoderequiredButton content
typestring'button'Button type attribute
onClickfunction-Click handler
loadingbooleanfalseShow loading spinner
disabledbooleanfalseDisable button
variantstring'primary'Button style variant
classNamestring-Additional CSS classes

Variants:

  • primary - Blue background
  • secondary - Outline style
  • danger - Red background

Usage:

import Button from '../components/Button';

<Button
  type="submit"
  loading={isSubmitting}
  disabled={!isValid}
>
  Submit
</Button>

Alert

A notification component for displaying success/error messages.

Location: src/components/Alert.jsx

Props:

PropTypeDefaultDescription
messagestringrequiredAlert message
typestring'error'Alert type (success, error, warning, info)
onClosefunction-Close handler (shows X button if provided)

Usage:

import Alert from '../components/Alert';

{alertMessage && (
  <Alert
    message={alertMessage}
    type={alertType}
    onClose={() => setAlertMessage(null)}
  />
)}

A consistent header component for pages.

Location: src/components/ui/PageHeader.jsx

Props:

PropTypeDefaultDescription
titlestringrequiredPage title
subtitlestring-Optional subtitle
actionnode-Optional action button/element

Usage:

import PageHeader from '../components/ui/PageHeader';
import Button from '../components/Button';

<PageHeader
  title="My Workflows"
  subtitle="Manage your automation workflows"
  action={
    <Button onClick={() => navigate('/workflows/create')}>
      Create New
    </Button>
  }
/>

Layout Components

Layout

The main layout wrapper that includes the sidebar navigation.

Location: src/components/layout/Layout.jsx

Props:

PropTypeDefaultDescription
childrennoderequiredPage content

Usage:

import Layout from '../components/layout/Layout';

const MyPage = () => (
  <Layout>
    <div className="max-w-4xl mx-auto px-4 py-12">
    </div>
  </Layout>
);

The navigation sidebar component.

Location: src/components/layout/Sidebar.jsx

Navigation Items:

  • Dashboard (/dashboard)
  • Services (/services)
  • Workflows (/workflows)
  • Logout (action)

Feature Components

ConnectedServiceItem

Displays a connected service with disconnect option.

Location: src/components/features/ConnectedServiceItem.jsx

Props:

PropTypeDefaultDescription
serviceobjectrequiredService object
isDisconnectingbooleanfalseLoading state
onDisconnectfunctionrequiredDisconnect handler

ServiceCategory

Groups services by category with connect buttons.

Location: src/components/features/ServiceCategory.jsx

Props:

PropTypeDefaultDescription
titlestringrequiredCategory title
servicesarrayrequiredArray of services
isConnectingstring-Service currently connecting
onConnectfunctionrequiredConnect handler

StepIndicator

Visual progress indicator for multi-step forms.

Location: src/components/features/StepIndicator.jsx

Props:

PropTypeDefaultDescription
currentStepnumberrequiredCurrent step (1-3)
totalStepsnumber3Total number of steps

Usage:

<StepIndicator currentStep={2} />

Step1ActionSelection

Action selection step for workflow creation.

Location: src/components/features/Step1ActionSelection.jsx

Props:

PropTypeDescription
availableServicesarrayServices with actions
selectedServicestringCurrently selected service
onServiceChangefunctionService change handler
actionsarrayAvailable actions for service
selectedActionobjectCurrently selected action
onActionChangefunctionAction change handler
actionConfigobjectAction configuration
onConfigChangefunctionConfig change handler
onNextfunctionNext step handler
canProceedbooleanEnable next button

Step2ReactionSelection

Reaction selection step for workflow creation.

Location: src/components/features/Step2ReactionSelection.jsx

Props: Similar to Step1ActionSelection, but for reactions.


Step3NameAndSubmit

Final step for naming and submitting the workflow.

Location: src/components/features/Step3NameAndSubmit.jsx

Props:

PropTypeDescription
namestringWorkflow name
onNameChangefunctionName change handler
descriptionstringWorkflow description
onDescriptionChangefunctionDescription change handler
selectedActionobjectSelected action (summary display)
selectedReactionobjectSelected reaction (summary display)
onPrevfunctionPrevious step handler
onSubmitfunctionSubmit handler
submittingbooleanLoading state

Dynamic Form Generation

The workflow creation steps use dynamic form generation based on config_schema from the API.

Schema Structure

{
  "type": "object",
  "properties": {
    "time": {
      "type": "string",
      "pattern": "^([0-1][0-9]|2[0-3]):[0-5][0-9]$",
      "description": "Time in HH:MM format"
    },
    "recipient": {
      "type": "string",
      "description": "Email address"
    }
  },
  "required": ["time"]
}

Field Type Mapping

Schema TypeInput Type
stringtext
string with email formatemail
string with password formatpassword
numbernumber
booleancheckbox

Example Implementation

const renderConfigFields = (schema, config, onChange) => {
  if (!schema?.properties) return null;

  return Object.entries(schema.properties).map(([key, prop]) => (
    <Input
      key={key}
      label={prop.description || key}
      name={key}
      type={getInputType(prop)}
      value={config[key] || ''}
      onChange={(e) => onChange(key, e.target.value)}
      required={schema.required?.includes(key)}
      placeholder={prop.description}
    />
  ));
};

Creating New Components

When creating new components, follow these guidelines:

  1. Functional Components: Always use functional components with hooks
  2. Props Documentation: Define clear prop types
  3. Consistent Styling: Use Tailwind CSS utilities
  4. Error Handling: Handle loading and error states
  5. Accessibility: Include proper ARIA attributes

Component Template

import React from 'react';

const ComponentName = ({ propName, onClick }) => {
  return (
    <div className="component-styles">
    </div>
  );
};

export default ComponentName;