Skip to content

Refactor Repositories page to use Studio App Shell layout and Add Repository Modal #928

Closed

Description

@propr-dev

The current Repositories page uses a basic padded container with an inline form. According to the ProPR Studio UI guidelines, we should use an App Shell architecture (anchored header and footer with a flexible canvas) and use centered modals specifically for disconnected setup tasks like adding a new repository.

Requirements:

  1. Refactor RepositoriesPage.tsx to have an anchored header (h-16) containing the page title and an '+ Add Repository' button.
  2. Add an anchored footer for the auto-save status indicator (matching the SettingsPage pattern).
  3. Extract the contents of AddRepositoryForm.tsx into a new AddRepositoryModal.tsx component that renders a centered modal overlay.
  4. Update the state management in RepositoriesPage to handle the modal's visibility.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Mar 6, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    This implementation restructures the Repositories page to adhere to the ProPR Studio Aesthetic's "Workbench Metaphor" and "App Shell" guidelines. The page is converted to a full-screen split pane architecture with an anchored header and footer, allowing the repository list to scroll independently. The inline form for adding repositories is extracted into a centered modal, following the guideline to "Use centered Modals only for disconnected setup (Adding a new Repo/Agent)".

    File: propr-ui/src/components/AddRepositoryModal.tsx

    Why this file: This new component encapsulates the repository addition form into a modal dialog. It replaces AddRepositoryForm.tsx to conform to the Studio Aesthetic rule regarding modal usage for disconnected setup tasks.

    import React, { useState } from 'react';
    import { BaseBranchSelector } from './BaseBranchSelector';
    import { X } from 'lucide-react';
    
    interface AddRepositoryModalProps {
      isOpen: boolean;
      onClose: () => void;
      availableRepos: string[];
      onAdd: (repo: { name: string; alias?: string; baseBranch?: string }) => void;
    }
    
    export const AddRepositoryModal: React.FC<AddRepositoryModalProps> = ({
      isOpen,
      onClose,
      availableRepos,
      onAdd,
    }) => {
      const [newRepo, setNewRepo] = useState('');
      const [newAlias, setNewAlias] = useState('');
      const [newBaseBranch, setNewBaseBranch] = useState('');
    
      if (!isOpen) return null;
    
      const handleSubmit = (e: React.FormEvent) => {
        e.preventDefault();
        if (!newRepo) return;
        onAdd({
          name: newRepo,
          alias: newAlias.trim() || undefined,
          baseBranch: newBaseBranch.trim() || undefined
        });
        // Reset form after submission
        setNewRepo('');
        setNewAlias('');
        setNewBaseBranch('');
      };
    
      return (
        <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
          <div className="bg-white rounded-lg max-w-lg w-full shadow-xl overflow-hidden">
            {/* Modal Header */}
            <div className="flex justify-between items-center px-4 py-3 border-b border-gray-200 bg-gray-50">
              <h3 className="text-sm font-semibold text-gray-900">Add New Repository</h3>
              <button onClick={onClose} className="text-gray-400 hover:text-gray-600 transition-colors">
                <X size={16} />
              </button>
            </div>
            
            {/* Modal Form Content */}
            <form onSubmit={handleSubmit} className="p-4 space-y-4">
              <div>
                <label className="block text-xs font-medium text-gray-700 mb-1">Repository *</label>
                <input
                  list="available-repos"
                  value={newRepo}
                  onChange={(e) => setNewRepo(e.target.value)}
                  placeholder="owner/repo"
                  className="w-full px-3 py-2 bg-white text-gray-900 border border-gray-300 rounded-md font-mono text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500 outline-none"
                  autoFocus
                />
                <datalist id="available-repos">
                  {availableRepos.map(repo => <option key={repo} value={repo} />)}
                </datalist>
              </div>
              <div>
                <label className="block text-xs font-medium text-gray-700 mb-1">Alias (optional)</label>
                <input
                  value={newAlias}
                  onChange={(e) => setNewAlias(e.target.value)}
                  placeholder="e.g., Production"
                  className="w-full px-3 py-2 bg-white text-gray-900 border border-gray-300 rounded-md text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500 outline-none"
                />
              </div>
              <div>
                <label className="block text-xs font-medium text-gray-700 mb-1">Base Branch (optional)</label>
                <BaseBranchSelector
                  repoName={newRepo}
                  value={newBaseBranch}
                  onChange={setNewBaseBranch}
                  placeholder="Select branch..."
                  disabled={!newRepo}
                />
                <p className="text-xs text-gray-500 mt-1">
                  If left blank, the default branch will be used. You can add the same repository multiple times with different base branches.
                </p>
              </div>
              
              {/* Modal Actions */}
              <div className="pt-2 flex justify-end gap-2">
                <button
                  type="button"
                  onClick={onClose}
                  className="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors"
                >
                  Cancel
                </button>
                <button
                  type="submit"
                  disabled={!newRepo}
                  className={`px-4 py-2 text-sm font-medium rounded-md transition-colors ${
                    !newRepo
                      ? 'bg-gray-100 text-gray-400 cursor-not-allowed'
                      : 'bg-teal-600 text-white hover:bg-teal-700'
                  }`}
                >
                  Add Repository
                </button>
              </div>
            </form>
          </div>
        </div>
      );
    };

    File: propr-ui/src/pages/RepositoriesPage.tsx

    Why this file: The main page must be refactored to use the App Shell layout (header, canvas, footer) and integrate the new modal instead of the inline form.

    --- a/propr-ui/src/pages/RepositoriesPage.tsx
    +++ b/propr-ui/src/pages/RepositoriesPage.tsx
    @@ -2,9 +2,9 @@
     import { useDocumentTitle } from '../hooks/useDocumentTitle';
     import { getRepoConfig, updateRepoConfig, getAvailableGithubRepos, getRepositoriesIndexingStatus, stopRepositoryIndexing, RepositoryIndexingStatus, MonitoredRepo } from '../api/proprApi';
     import { triggerRepositoryIndexing, getRepoStatusKey } from '../api/repoIndexingApi';
    -import { AddRepositoryForm } from '../components/AddRepositoryForm';
    +import { AddRepositoryModal } from '../components/AddRepositoryModal';
     import { RepositoryListItem } from '../components/RepositoryListItem';
    +import { Plus, Loader2, AlertTriangle, FolderGit2 } from 'lucide-react';
     
     // Helper function to generate UUID
     const generateId = (): string => crypto.randomUUID();
    @@ -16,9 +16,7 @@
       const [repos, setRepos] = useState<Repo[]>([]);
       const [loading, setLoading] = useState<boolean>(true);
       const [error, setError] = useState<string | null>(null);
    -  const [newRepo, setNewRepo] = useState<string>('');
    -  const [newAlias, setNewAlias] = useState<string>('');
    -  const [newBaseBranch, setNewBaseBranch] = useState<string>('');
    +  const [isModalOpen, setIsModalOpen] = useState(false);
       const [availableRepos, setAvailableRepos] = useState<string[]>([]);
       const [indexingStatuses, setIndexingStatuses] = useState<Record<string, RepositoryIndexingStatus>>({});
       const [saveStatus, setSaveStatus] = useState<'idle' | 'saving' | 'saved' | 'error'>('idle');
    @@ -149,27 +147,26 @@
         }
       };
     
    -  const handleAddRepo = () => {
    -    if (!newRepo) return;
    -
    +  const handleAddRepo = (data: { name: string; alias?: string; baseBranch?: string }) => {
    +    const { name, alias, baseBranch } = data;
         // For duplicate detection, consider both name and baseBranch
         // Same repo can be added with different base branches
         const isDuplicate = repos.some(r =>
    -      r.name === newRepo &&
    -      (r.baseBranch || '') === (newBaseBranch || '')
    +      r.name === name &&
    +      (r.baseBranch || '') === (baseBranch || '')
         );
     
         if (isDuplicate) {
    -      const branchInfo = newBaseBranch ? ` with branch "${newBaseBranch}"` : ' with default branch';
    -      alert(`Repository "${newRepo}"${branchInfo} has already been added to the list.`);
    +      const branchInfo = baseBranch ? ` with branch "${baseBranch}"` : ' with default branch';
    +      alert(`Repository "${name}"${branchInfo} has already been added to the list.`);
           return;
         }
     
         const newEntry: Repo = {
           id: generateId(),
    -      name: newRepo,
           enabled: true,
    -      alias: newAlias.trim() || undefined,
    -      baseBranch: newBaseBranch.trim() || undefined
    +      name,
    +      alias,
    +      baseBranch
         };
     
         const newRepos = [...repos, newEntry];
         setRepos(newRepos);
    -    setNewRepo('');
    -    setNewAlias('');
    -    setNewBaseBranch('');
         performAutoSave(newRepos);
    +    setIsModalOpen(false);
       };
     
       const handleRemoveRepo = (repoId: string) => {
    @@ -190,140 +187,118 @@
     
       if (loading && repos.length === 0) {
         return (
    -      <div className="p-4 sm:p-8">
    -        <h2 className="text-gray-900 text-2xl font-semibold mb-4">Manage Monitored Repositories</h2>
    -        <div className="flex items-center justify-center py-12">
    +      <div className="flex flex-col h-full bg-white">
    +        <div className="flex-shrink-0 border-b border-gray-200 px-6 py-4 flex justify-between items-center bg-white">
    +          <h2 className="text-gray-900 text-xl font-semibold">Repositories</h2>
    +        </div>
    +        <div className="flex-1 overflow-auto p-6 flex items-center justify-center">
               <div className="flex items-center gap-3 text-gray-500">
    -            <svg className="animate-spin h-5 w-5 text-primary-600" fill="none" viewBox="0 0 24 24">
    -              <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
    -              <path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
    -            </svg>
    +            <Loader2 className="animate-spin h-5 w-5 text-teal-600" />
                 <span>Loading repositories...</span>
               </div>
             </div>
           </div>
         );
       }
     
       // Show error state if loading failed
       if (error && repos.length === 0 && !loading) {
         return (
    -      <div className="p-4 sm:p-8">
    -        <h2 className="text-gray-900 text-2xl font-semibold mb-4">Manage Monitored Repositories</h2>
    -        <div className="p-6 bg-red-50 border border-red-200 rounded-md">
    -          <div className="flex items-start gap-3">
    -            <svg className="h-5 w-5 text-red-500 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -              <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
    -            </svg>
    -            <div>
    -              <h3 className="text-red-800 font-medium">Failed to load repositories</h3>
    -              <p className="text-red-700 mt-1">{error}</p>
    -              <button
    -                onClick={() => {
    -                  setError(null);
    -                  loadRepos();
    -                }}
    -                className="mt-3 px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md text-sm font-medium transition-colors"
    -              >
    -                Try Again
    -              </button>
    -            </div>
    +      <div className="flex flex-col h-full bg-white">
    +        <div className="flex-shrink-0 border-b border-gray-200 px-6 py-4 flex justify-between items-center bg-white">
    +          <h2 className="text-gray-900 text-xl font-semibold">Repositories</h2>
    +        </div>
    +        <div className="flex-1 overflow-auto p-6 flex flex-col items-center justify-center">
    +          <div className="p-6 bg-red-50 border border-red-200 rounded-md text-center max-w-md w-full">
    +            <AlertTriangle className="h-8 w-8 text-red-500 mx-auto mb-3" />
    +            <h3 className="text-red-800 font-medium">Failed to load repositories</h3>
    +            <p className="text-red-700 mt-2 text-sm">{error}</p>
    +            <button
    +              onClick={() => {
    +                setError(null);
    +                loadRepos();
    +              }}
    +              className="mt-4 px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md text-sm font-medium transition-colors w-full"
    +            >
    +              Try Again
    +            </button>
               </div>
             </div>
           </div>
         );
       }
     
       return (
    -    <div className="p-4 sm:p-8">
    -      <div className="flex justify-between items-center mb-4">
    -        <h2 className="text-gray-900 text-2xl font-semibold">Manage Monitored Repositories</h2>
    -        {/* Auto-save status indicator */}
    -        <div className="flex items-center gap-2">
    -          {saveStatus === 'saving' && (
    -            <span className="flex items-center gap-1.5 text-sm text-gray-500">
    -              <svg className="animate-spin h-4 w-4 text-gray-400" fill="none" viewBox="0 0 24 24">
    -                <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
    -                <path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
    -              </svg>
    -              Saving...
    -            </span>
    -          )}
    -          {saveStatus === 'saved' && (
    -            <span className="flex items-center gap-1.5 text-sm text-green-600">
    -              <svg className="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
    -              </svg>
    -              Saved
    -            </span>
    -          )}
    -          {saveStatus === 'error' && error && (
    -            <span className="flex items-center gap-1.5 text-sm text-red-600">
    -              <svg className="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
    -              </svg>
    -              {error}
    -            </span>
    -          )}
    -        </div>
    -      </div>
    -      <p className="text-gray-600 mb-4">
    -        Add repositories to monitor, enable/disable them, or remove them from the list. Changes are saved automatically.
    -      </p>
    -      
    -      <AddRepositoryForm
    -        newRepo={newRepo}
    -        newAlias={newAlias}
    -        newBaseBranch={newBaseBranch}
    -        availableRepos={availableRepos}
    -        onRepoChange={setNewRepo}
    -        onAliasChange={setNewAlias}
    -        onBaseBranchChange={setNewBaseBranch}
    -        onAdd={handleAddRepo}
    -      />
    -
    -      <div className="flex flex-col gap-2 mb-6">
    -        {repos.map(repo => (
    -          <RepositoryListItem
    -            key={repo.id}
    -            repo={repo}
    -            indexingStatuses={indexingStatuses}
    -            onToggle={handleToggleRepo}
    -            onRemove={handleRemoveRepo}
    -            onStopIndexing={handleStopIndexing}
    -            onReindex={handleReindexRepo}
    -          />
    -        ))}
    -        {repos.length === 0 && (
    -          <div className="text-center py-16 px-6 bg-gradient-to-b from-gray-50 to-white border border-gray-200 rounded-lg shadow-sm">
    -            <div className="flex justify-center mb-6">
    -              <div className="w-20 h-20 rounded-full bg-primary-50 flex items-center justify-center">
    -                <svg className="h-10 w-10 text-primary-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
    -                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M12 11v4m0 0l-2-2m2 2l2-2" />
    -                </svg>
    -              </div>
    -            </div>
    -            <h3 className="text-lg font-semibold text-gray-900 mb-3">Welcome! Add Your First Repository</h3>
    -            <p className="text-gray-600 mb-4 max-w-md mx-auto">
    -              Repositories are the foundation of ProPR. Add a repository to enable AI-powered code reviews,
    -              automated planning, and intelligent monitoring for your projects.
    -            </p>
    -            <div className="flex flex-col items-center gap-3">
    -              <div className="flex items-center gap-4 text-sm text-gray-500">
    -                <span className="flex items-center gap-1.5">
    -                  <svg className="h-4 w-4 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
    -                  </svg>
    -                  AI Code Reviews
    -                </span>
    -                <span className="flex items-center gap-1.5">
    -                  <svg className="h-4 w-4 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
    -                  </svg>
    -                  Smart Planning
    -                </span>
    -                <span className="flex items-center gap-1.5">
    -                  <svg className="h-4 w-4 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    -                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
    -                  </svg>
    -                  Codebase Indexing
    -                </span>
    -              </div>
    -              <p className="text-sm text-gray-400 mt-2">
    -                Use the form above to select a repository from your GitHub account.
    -              </p>
    -            </div>
    +    <div className="flex flex-col h-full bg-white">
    +      {/* Anchored Header */}
    +      <div className="flex-shrink-0 border-b border-gray-200 px-6 py-4 flex justify-between items-center bg-white">
    +        <h2 className="text-gray-900 text-xl font-semibold">Repositories</h2>
    +        <button
    +          onClick={() => setIsModalOpen(true)}
    +          className="flex items-center gap-2 px-3 py-1.5 bg-teal-600 text-white text-sm font-medium hover:bg-teal-700 transition-colors rounded-md"
    +        >
    +          <Plus size={16} />
    +          Add Repository
    +        </button>
    +      </div>
    +
    +      {/* Main Content Area */}
    +      <div className="flex-1 overflow-auto p-6">
    +        <div className="flex flex-col gap-0 border-t border-slate-100">
    +          {repos.map(repo => (
    +            <RepositoryListItem
    +              key={repo.id}
    +              repo={repo}
    +              indexingStatuses={indexingStatuses}
    +              onToggle={handleToggleRepo}
    +              onRemove={handleRemoveRepo}
    +              onStopIndexing={handleStopIndexing}
    +              onReindex={handleReindexRepo}
    +            />
    +          ))}
    +          {repos.length === 0 && (
    +            <div className="text-center py-20 mx-auto max-w-2xl bg-gray-50 rounded-lg border border-dashed border-gray-300 mt-8 flex flex-col items-center">
    +              <div className="mb-4">
    +                <FolderGit2 className="w-16 h-16 text-slate-300" />
    +              </div>
    +              <h3 className="text-lg font-semibold text-slate-800 mb-2">Welcome! Add Your First Repository</h3>
    +              <p className="text-slate-500 mb-6 max-w-md">
    +                Repositories are the foundation of ProPR. Add a repository to enable AI-powered code reviews,
    +                automated planning, and intelligent monitoring for your projects.
    +              </p>
    +              <button
    +                onClick={() => setIsModalOpen(true)}
    +                className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-teal-600 hover:bg-teal-700 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-teal-500 focus:ring-offset-2"
    +              >
    +                <Plus size={16} />
    +                Add Repository
    +              </button>
    +            </div>
    +          )}
    +        </div>
    +      </div>
    +
    +      {/* Anchored Footer - Status Bar */}
    +      <div className="flex-shrink-0 border-t border-gray-200 px-6 py-3 bg-gray-50 flex items-center justify-between">
    +        <div className="flex items-center gap-2">
    +          {saveStatus === 'saving' && (
    +            <span className="flex items-center gap-1.5 text-xs text-gray-500 font-mono">
    +              <Loader2 className="h-3 w-3 text-gray-400 animate-spin" />
    +              Saving changes...
    +            </span>
    +          )}
    +          {saveStatus === 'saved' && (
    +            <span className="flex items-center gap-1.5 text-xs text-gray-500 font-mono">
    +              <span className="w-1.5 h-1.5 rounded-full bg-green-500"></span>
    +              Configuration saved
    +            </span>
    +          )}
    +          {saveStatus === 'error' && error && (
    +            <span className="flex items-center gap-1.5 text-xs text-red-600 font-mono">
    +              <span className="w-1.5 h-1.5 rounded-full bg-red-500"></span>
    +              {error}
    +            </span>
    +          )}
    +          {saveStatus === 'idle' && (
    +            <span className="flex items-center gap-1.5 text-xs text-gray-400 font-mono">
    +              <span className="w-1.5 h-1.5 rounded-full bg-gray-300"></span>
    +              All changes saved
    +            </span>
    +          )}
    +        </div>
    +      </div>
    +
    +      <AddRepositoryModal
    +        isOpen={isModalOpen}
    +        onClose={() => setIsModalOpen(false)}
    +        availableRepos={availableRepos}
    +        onAdd={handleAddRepo}
    +      />
    +    </div>
       );
     };
  2. propr-dev commented on Mar 6, 2026

    @propr-dev
    ContributorAuthor

    🤖 AI processing has started for this issue using claude agent with claude-opus-4-5-20251101 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-4-5-20251101
    • Branch: 928/claude-opus-4-5-20251101-refactor-repositories-pag-20260306-1141-ypn
    • Base Branch: main
    • Worktree: issue-928-20260306-1141-claude-opus-4-5-20251101-ypn

    🔍 Track Task Execution

  3. added a commit that references this issue on Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions