|
|
|
@@ -1,82 +1,134 @@
|
|
|
|
|
"use client"
|
|
|
|
|
|
|
|
|
|
import { useState, useCallback } from "react"
|
|
|
|
|
import { useState, useCallback, useRef, useEffect } from "react"
|
|
|
|
|
import { AIChat } from "@/components/ai/ai-chat"
|
|
|
|
|
import { JobSelector } from "@/components/ai/job-selector"
|
|
|
|
|
import { Bot, Lightbulb, Target, MessageSquare } from "lucide-react"
|
|
|
|
|
import { Bot, ChevronRight } from "lucide-react"
|
|
|
|
|
|
|
|
|
|
const tips = [
|
|
|
|
|
"Ask for cold email templates for a specific job",
|
|
|
|
|
"Request objection handling tips",
|
|
|
|
|
"Ask for outreach strategies per industry",
|
|
|
|
|
"Generate a follow up sequence",
|
|
|
|
|
"Get LinkedIn connection message templates",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
export default function AIAssistantPage() {
|
|
|
|
|
const [selectedJob, setSelectedJob] = useState<{ job_title: string; keywords: string[]; industry: string; description: string } | null>(null)
|
|
|
|
|
const [recentPrompts, setRecentPrompts] = useState<string[]>([])
|
|
|
|
|
const aiChatRef = useRef<{ fillInput: (text: string) => void } | null>(null)
|
|
|
|
|
|
|
|
|
|
const handleJobSelect = useCallback((job: typeof selectedJob) => {
|
|
|
|
|
setSelectedJob(job)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const handleTipClick = useCallback((tip: string) => {
|
|
|
|
|
aiChatRef.current?.fillInput(tip)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const handleRecentPromptClick = useCallback((prompt: string) => {
|
|
|
|
|
aiChatRef.current?.fillInput(prompt)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const handleMessageSent = useCallback((msg: string) => {
|
|
|
|
|
setRecentPrompts((prev) => {
|
|
|
|
|
const next = [msg, ...prev.filter((p) => p !== msg)].slice(0, 3)
|
|
|
|
|
return next
|
|
|
|
|
})
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex h-[calc(100vh-3.5rem)]">
|
|
|
|
|
<div className="flex h-[calc(100vh-3.5rem)] bg-[#0f1117]">
|
|
|
|
|
<div className="flex-1 flex flex-col min-w-0">
|
|
|
|
|
<div className="border-b border-[#2a2a35] px-6 py-4">
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<div className="h-9 w-9 rounded-lg bg-[#1BB0CE]/15 flex items-center justify-center">
|
|
|
|
|
<Bot className="h-5 w-5 text-[#1BB0CE]" />
|
|
|
|
|
<div className="bg-[#1a1d2e]/80 backdrop-blur-md border-b border-[#ffffff08] px-6 py-4">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div className="flex items-center gap-4">
|
|
|
|
|
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-[#f97316] to-[#ea580c] flex items-center justify-center shadow-[0_0_40px_rgba(249,115,22,0.3)]">
|
|
|
|
|
<Bot className="h-5 w-5 text-white" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-white font-bold text-lg">AI Sales Assistant</h1>
|
|
|
|
|
<p className="text-[#6b7280] text-xs mt-0.5">Powered by local AI</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-lg font-semibold text-[#e8e8ef]">AI Sales Assistant</h1>
|
|
|
|
|
<p className="text-xs text-[#6a6a75]">Uncensored sales tips and strategies powered by local AI</p>
|
|
|
|
|
<div className="flex items-center gap-4">
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<span className="w-2 h-2 rounded-full bg-[#22c55e] animate-pulse" />
|
|
|
|
|
<span className="text-[#22c55e] text-xs font-medium">Online</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="w-px h-5 bg-[#ffffff08]" />
|
|
|
|
|
<div className="bg-[#ffffff08] rounded-lg px-3 py-1.5">
|
|
|
|
|
<span className="text-[#9ca3af] text-xs">Local AI Model</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex-1 flex">
|
|
|
|
|
<div className="flex-1 flex flex-col min-w-0 border-r border-[#2a2a35]">
|
|
|
|
|
<AIChat />
|
|
|
|
|
<AIChat ref={aiChatRef} onMessageSent={handleMessageSent} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="w-[300px] flex-none bg-[#13151f] border-l border-[#ffffff08] p-5 overflow-y-auto h-full flex flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div className="flex items-center gap-2 mb-3">
|
|
|
|
|
<span className="w-1.5 h-1.5 rounded-full bg-[#f97316]" />
|
|
|
|
|
<span className="text-[#f97316] text-[10px] font-bold uppercase tracking-[0.15em]">Target Job</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="w-72 flex-none p-4 space-y-4 overflow-y-auto">
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="text-xs font-semibold text-[#6a6a75] uppercase tracking-wider mb-2 flex items-center gap-1.5">
|
|
|
|
|
<Target className="h-3.5 w-3.5" />
|
|
|
|
|
Target Job
|
|
|
|
|
</h3>
|
|
|
|
|
<JobSelector onSelect={handleJobSelect} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{selectedJob && (
|
|
|
|
|
<div className="bg-[#1a1a24] border border-[#2a2a35] rounded-lg p-3 space-y-2">
|
|
|
|
|
<h4 className="text-sm font-medium text-[#e8e8ef]">{selectedJob.job_title}</h4>
|
|
|
|
|
<div className="flex items-center gap-1.5">
|
|
|
|
|
<span className="text-xs px-1.5 py-0.5 rounded bg-[#1BB0CE]/10 text-[#1BB0CE]">{selectedJob.industry}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-xs text-[#8a8a95]">{selectedJob.description}</p>
|
|
|
|
|
<div className="flex flex-wrap gap-1">
|
|
|
|
|
{selectedJob.keywords.map((kw, i) => (
|
|
|
|
|
<span key={i} className="text-xs px-1.5 py-0.5 rounded bg-[#2a2a35] text-[#6a6a75]">
|
|
|
|
|
{kw}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<JobSelector onSelect={handleJobSelect} />
|
|
|
|
|
{selectedJob && (
|
|
|
|
|
<div className="bg-[#1a1d2e]/50 border border-[#ffffff08] rounded-xl p-3.5 mt-3 space-y-2">
|
|
|
|
|
<h4 className="text-sm font-semibold text-[#e5e7eb]">{selectedJob.job_title}</h4>
|
|
|
|
|
<span className="text-xs px-2 py-0.5 rounded-md bg-[#f97316]/10 text-[#f97316] font-medium inline-block">{selectedJob.industry}</span>
|
|
|
|
|
<p className="text-xs text-[#6b7280] leading-relaxed">{selectedJob.description}</p>
|
|
|
|
|
<div className="flex flex-wrap gap-1.5">
|
|
|
|
|
{selectedJob.keywords.map((kw, i) => (
|
|
|
|
|
<span key={i} className="text-xs px-2 py-0.5 rounded-md bg-[#ffffff08] text-[#4b5563]">{kw}</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div className="bg-[#1a1a24] border border-[#2a2a35] rounded-lg p-3 space-y-2">
|
|
|
|
|
<h4 className="text-xs font-semibold text-[#6a6a75] uppercase tracking-wider flex items-center gap-1.5">
|
|
|
|
|
<Lightbulb className="h-3.5 w-3.5" />
|
|
|
|
|
Tips
|
|
|
|
|
</h4>
|
|
|
|
|
<ul className="space-y-1.5 text-xs text-[#8a8a95]">
|
|
|
|
|
<li className="flex gap-2">
|
|
|
|
|
<MessageSquare className="h-3 w-3 mt-0.5 flex-none text-[#1BB0CE]" />
|
|
|
|
|
Ask for cold email templates for a specific job
|
|
|
|
|
</li>
|
|
|
|
|
<li className="flex gap-2">
|
|
|
|
|
<MessageSquare className="h-3 w-3 mt-0.5 flex-none text-[#1BB0CE]" />
|
|
|
|
|
Request objection handling tips
|
|
|
|
|
</li>
|
|
|
|
|
<li className="flex gap-2">
|
|
|
|
|
<MessageSquare className="h-3 w-3 mt-0.5 flex-none text-[#1BB0CE]" />
|
|
|
|
|
Ask for outreach strategies per industry
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-6">
|
|
|
|
|
<div className="flex items-center gap-2 mb-3">
|
|
|
|
|
<span className="w-1.5 h-1.5 rounded-full bg-[#f97316]" />
|
|
|
|
|
<span className="text-[#f97316] text-[10px] font-bold uppercase tracking-[0.15em]">Quick Tips</span>
|
|
|
|
|
</div>
|
|
|
|
|
{tips.map((tip, i) => (
|
|
|
|
|
<div
|
|
|
|
|
key={i}
|
|
|
|
|
onClick={() => handleTipClick(tip)}
|
|
|
|
|
className="flex items-start gap-2.5 bg-[#1a1d2e]/50 hover:bg-[#1a1d2e] border border-[#ffffff08] hover:border-[#f97316]/20 rounded-xl p-3.5 mb-2 cursor-pointer transition-all duration-200 group"
|
|
|
|
|
>
|
|
|
|
|
<ChevronRight className="h-3.5 w-3.5 mt-0.5 text-[#374151] group-hover:text-[#f97316] transition-colors duration-200 flex-shrink-0" />
|
|
|
|
|
<span className="text-[#9ca3af] text-xs leading-5 group-hover:text-[#e5e7eb] transition-colors duration-200">{tip}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-6">
|
|
|
|
|
<div className="flex items-center gap-2 mb-3">
|
|
|
|
|
<span className="w-1.5 h-1.5 rounded-full bg-[#f97316]" />
|
|
|
|
|
<span className="text-[#f97316] text-[10px] font-bold uppercase tracking-[0.15em]">Recent Prompts</span>
|
|
|
|
|
</div>
|
|
|
|
|
{recentPrompts.length > 0 ? (
|
|
|
|
|
recentPrompts.map((prompt, i) => (
|
|
|
|
|
<div
|
|
|
|
|
key={i}
|
|
|
|
|
onClick={() => handleRecentPromptClick(prompt)}
|
|
|
|
|
className="bg-[#1a1d2e]/50 rounded-xl p-3 mb-2 border border-[#ffffff08] text-[#6b7280] text-xs truncate hover:text-[#9ca3af] cursor-pointer transition-colors duration-200"
|
|
|
|
|
>
|
|
|
|
|
{prompt}
|
|
|
|
|
</div>
|
|
|
|
|
))
|
|
|
|
|
) : (
|
|
|
|
|
<div className="text-[#374151] text-xs text-center py-4">Your recent prompts will appear here</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-auto border-t border-[#ffffff08] pt-4">
|
|
|
|
|
<div className="flex gap-4">
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<div className="text-[#4b5563] text-[10px] uppercase tracking-wide">Messages today</div>
|
|
|
|
|
<div className="text-[#e5e7eb] text-sm font-semibold mt-0.5">24</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<div className="text-[#4b5563] text-[10px] uppercase tracking-wide">Tokens used</div>
|
|
|
|
|
<div className="text-[#e5e7eb] text-sm font-semibold mt-0.5">12.4k</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|