File size: 1,883 Bytes
2e9c97f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
 * @license
 * SPDX-License-Identifier: Apache-2.0
*/
import React from 'react';
import type { ActiveEditor } from '../lib/types';

interface AiCoPilotPanelProps {
  activeEditor: ActiveEditor | null;
  onRefine: (instruction: string) => void;
  isLoading: boolean;
}

export default function AiCoPilotPanel({ activeEditor, onRefine, isLoading }: AiCoPilotPanelProps) {
  if (!activeEditor) {
    return (
      <div className="ai-copilot-panel">
        <div className="copilot-placeholder">
            <i className="ph-cursor-text" style={{fontSize: '2rem', marginBottom: '0.5rem'}}></i>
            Click on a section in your resume to activate the AI Co-pilot.
        </div>
      </div>
    );
  }

  const refinementActions = [
    { instruction: "Rewrite this section to be more impactful.", label: "Rewrite for Impact", icon: "ph-shooting-star" },
    { instruction: "Make this section more concise.", label: "Make More Concise", icon: "ph-arrows-in-simple" },
    { instruction: "Rephrase this using stronger, professional action verbs.", label: "Use Stronger Verbs", icon: "ph-rocket-launch" },
    { instruction: "Generate 3 alternative bullet points based on this content.", label: "Suggest Bullet Points", icon: "ph-list-bullets" },
  ];

  return (
    <div className="ai-copilot-panel">
      <h3>AI Co-pilot: <span style={{color: 'var(--color-accent)'}}>{activeEditor.sectionId}</span></h3>
      <div className="copilot-actions">
        {refinementActions.map(({ instruction, label, icon }) => (
          <button
            key={instruction}
            className="copilot-button"
            onClick={() => onRefine(instruction)}
            disabled={isLoading}
          >
            <i className={icon}></i>
            <span>{label}</span>
            {isLoading && <small>(...)</small>}
          </button>
        ))}
      </div>
    </div>
  );
}