feat: 扩展优化重构
Some checks failed
Extension Build & Release / build (push) Failing after 56s

This commit is contained in:
zs
2026-03-03 02:19:14 +08:00
parent c686d81d30
commit 1d17ac03e0
15 changed files with 904 additions and 692 deletions

View File

@@ -14,11 +14,14 @@ InsightReply 采用现代化解耦的三端架构:
- 数据库PostgreSQL 14+
- 功能模块Nitter 高可用爬虫引擎、多模态 AI 接入层、策略派发与遥测统计引擎。
2. **`/web` (SaaS 管理控制台)**
- 核心选型Vue 3 + Vite + Tailwind 玻璃态美学
- 功能模块:数据指标大盘、策略雷达与组合词配置、生成表现记录仪表板
- 核心选型Vue 3 + Vite + Tailwind **Apple Pro Max 玻璃态美学**
- 功能模块:数据指标大盘、策略雷达、生成表现记录。
3. **`/extension` (Chrome 浏览器助手)**
- 核心选型CRXJS + Vue 3
- 功能模块:侵入 X 原生界面,一键触发 AI 分析、克隆高赞评论语言风格。
- 核心选型CRXJS + Vue 3 + **macOS Settings 交互规范**
- 功能模块:
- **Spatial Sidebar**: 侵入 X 原生界面,全玻璃态侧边栏一键触发 AI 分析。
- **Pro Dashboard**: 类似 macOS 系统设置的后台管理,极简高效。
- **Magic Toggle**: `Cmd + Shift + I` 全局快捷键秒开侧边栏。
---

View File

@@ -1,7 +1,8 @@
# InsightReply 用户使用指南
# InsightReply 用户使用指南 💎
> InsightReply 是一个帮助创始人和独立开发者在 X (Twitter) 行业热点中输出更有洞察力评论的 AI 助手
> 是**社交表达增强系统**,不是自动化机器人 —— 所有评论由你决定是否发布
> InsightReply 是一款专为独立开发者与数字游民设计的 **AI 驱动 X (Twitter) 自动化营销套件**
> 采用 **Apple Pro Max 玻璃态美学** 与 **macOS Settings 交互规范**,为你提供丝滑、专业的社交增长体验
> 所有评论由你决定是否发布 —— 我们是**社交表达增强系统**,不是自动化机器人。
---
@@ -20,63 +21,67 @@
### 1.2 首次设置 (Onboarding)
安装后首次点击扩展图标,会进入 **3 步引导**
安装后首次点击扩展图标,会进入 **Pro Max 引导流程**
| 步骤 | 设置内容 | 说明 |
|------|---------|------|
| Step 1 | 🧑‍💻 **你的身份** | AI 创始人 / SaaS Builder / 投资人 / 独立开发者 / 技术分析者 |
| Step 2 | 🌐 **偏好语言** | English / 中文 / 跟随原推文 (Auto) |
| Step 1 | 🧑‍💻 **身份定义** | AI 创始人 / SaaS Builder / 投资人 / 独立开发者 / 技术分析者 |
| Step 2 | 🌐 **语言智能** | English / 中文 / 跟随原推文 (Auto) |
| Step 3 | 🎨 **风格倾向** | 专业严谨 / 轻松幽默 / 犀利锐评 |
这些设置会影响 AI 生成评论的语气和风格,后续可随时在设置中修改。
---
## 二、核心功能使用
## 二、核心功能Spatial Sidebar
### 2.1 生成评论(主流程)
### 2.1 沉浸式生成(主流程)
```
打开 X (Twitter) → 浏览 Timeline → 找到想评论的推文
点击推文操作栏旁的紫色 ✦ Insight 按钮
点击推文操作栏旁的紫色 ✦ Insight 按钮(或 Cmd+Shift+I 唤起面板)
右侧InsightReply 面板
右侧Spatial Sidebar高斯模糊玻璃态设计
选择评论策略 → 点击「Generate High-Quality Reply」
选择评论策略 → 点击「Generate Pro Reply」
AI 返回多条备选评论 → 选择最满意的一条
点击「Copy」→ 粘贴到推文评论框 → 发布
点击「COPY」→ 粘贴到推文评论框 → 发布
```
### 2.2 评论策略一览
### 2.2 顶级策略库
系统内置 5 种策略,适用于不同场景:
| 策略 | 标 | 适用场景 | 典型开头 |
|------|------|---------|---------|
| **认知升级型** | 🧠 | 对话题提出更深层的洞察 | "Most people miss this part..." |
| **反向观点型** | 🔥 | 提出不同角度,引发讨论 | "Unpopular opinion:" |
| **数据补充型** | 📊 | 用数据/案例补充论点 | "Data shows that..." |
| **共鸣支持型** | ❤️ | 表达认同并延伸讨论 | "This resonates deeply..." |
| **创始人经验型** | 🚀 | 以自身实战经验为论据 | "We faced this building our product..." |
| 策略 | 深度目标 | 适用场景 | 典型 AI 开头 |
|------|---------|---------|-------------|
| **Cognitive Lift** | 🧠 认知升级 | 对话题提出更深层的洞察 | "Most people miss this part..." |
| **Witty & Fun** | 😄 幽默破冰 | 提出不同角度,引发讨论 | "I can't be the only one who thinks..." |
| **Pro Rigor** | 💼 专业严谨 | 用数据/案例补充论点 | "Based on our engineering data..." |
| **Empathetic** | ❤️ 情感共鸣 | 表达认同并延伸讨论 | "This resonates deeply..." |
| **Sharp Critique** | 🔥 犀利锐评 | 以自身实战经验为论据 | "Unpopular opinion, but..." |
> [!TIP]
> **选择策略的技巧**
> - 大 V 发的行业观点 → 用「认知升级型」或「反向观点型」更容易获得关注
> - 有人吐槽痛点 → 用「创始人经验型」分享你的解决方案
> - 行业数据/报告 → 用「数据补充型」让你的评论更有说服力
> - 大 V 发的行业观点 → 用「Cognitive Lift」或「Sharp Critique」更容易获得关注
> - 有人吐槽痛点 → 用「Empathetic」分享你的解决方案
> - 行业数据/报告 → 用「Pro Rigor」让你的评论更有说服力
### 2.3 识别高价值推文
### 2.3 识别高价值推文(智能标签)
InsightReply 会在推文旁显示提示标签,帮你快速判断:
InsightReply 会在推文旁自动显示提示标签,帮你快速判断互动价值
| 标签 | 含义 | 建议 |
|------|------|------|
| 🔥 **Trending** | 高热度推文Likes > 1000发帖 < 2h | 快速评论争取高曝光 |
| ⚡ **Rising** | 增长中的推文Likes > 100发帖 < 1h | 黄金窗口期,强烈建议评论 |
| 🎯 **High Relevance** | 与你的产品领域高度相关 | 最适合你评论的推文! |
| 标签 | 触发条件 | 建议 |
|------|---------|------|
| 🔥 **Trending** | 综合热度 > 50,000Likes×1 + Retweets×2 + Replies×3 | 流量巅峰,快速评论争取高曝光 |
| ⚡ **Rising** | 综合热度 > 5,000 | 黄金窗口期,强烈建议评论 |
| 🎯 **Relevant** | 推文内容匹配你在产品档案中设置的关键词 | **最适合你评论的推文!** |
> [!NOTE]
> 热度公式:`heatScore = likes × 1 + retweets × 2 + replies × 3`
> 关键词匹配基于你在 Dashboard → Product DNA 中配置的竞品名与相关关键词。
---
@@ -84,9 +89,9 @@ InsightReply 会在推文旁显示提示标签,帮你快速判断:
> 如果你是创始人/独立开发者,正在用 InsightReply 提升产品曝光,以下功能专为你设计。
### 3.1 配置你的产品档案
### 3.1 配置你的产品档案 (Product DNA)
扩展设置中填写你的产品信息AI 会自动从你的产品领域出发生成评论:
Dashboard 中填写你的产品信息AI 会自动从你的产品领域出发生成评论:
| 配置项 | 填什么 | 作用 |
|-------|-------|------|
@@ -103,24 +108,24 @@ InsightReply 会在推文旁显示提示标签,帮你快速判断:
### 3.2 切换与自定义 AI 引擎 (多模型支持)
为了满足成本、速度、质量等不同维度的需求,InsightReply 支持四大主流平台,并允许**完全自定义模型**。
InsightReply 支持四大主流平台,并允许**完全自定义模型**。
在产品档案的「重写 AI 引擎」设置中:
1. **下拉选择**你可以从系统管理员预设的模型列表中快速选择(如 `gpt-4o-mini`, `claude-3-5-haiku-latest`)。
2. **手动输入 (支持本地/代理)**:如果你使用的平台兼容 OpenAI如 Groq、vLLM、Ollama或者你想使用列表中没有的最新模型(如刚刚发布的 `gpt-4.5-turbo`可以直接在框内**手动打字输入任意模型名称**。
1. **下拉选择**从系统预设的模型列表中快速切换(如 `gpt-4o-mini`, `claude-3-5-haiku-latest`)。
2. **手动输入 (支持本地/代理)**:如果你使用兼容 OpenAI 的平台(如 Groq、vLLM、Ollama可以直接**手动输入任意模型名称**。
| 引擎 | 推荐模型 | 适用场景特点 |
|------|---------|-------------|
| **Anthropic** | `claude-3-5-haiku-latest` | **默认推荐**响应速度极快,文本语气最自然、最像真人社交媒体发言,不易产生"AI味" |
| **OpenAI (或兼容接口)** | `gpt-4o-mini` | 表现稳定,成本极低,适合大批量生成 |
| **DeepSeek** | `deepseek-chat` | 逻辑分析能力强,中文语感极佳,价格优势明显,适合技术长文讨论。 |
| **Google** | `gemini-2.5-flash` | 速度快,多语言处理能力强 |
| **Anthropic** | `claude-3-5-haiku-latest` | **默认推荐**语气最自然,不易产生"AI味" |
| **OpenAI (或兼容接口)** | `gpt-4o-mini` | 表现稳定,成本极低,适合大批量生成 |
| **DeepSeek** | `deepseek-chat` | 逻辑分析强,中文语感极佳,价格优势明显 |
| **Google** | `gemini-2.5-flash` | 速度快,多语言处理能力强 |
*注:切换平台需要系统后台配置了相应的 API Key 或 Base URL。管理员可将 OpenAI Base URL 指向任意兼容代理,实现模型的无限扩展。*
### 3.3 创建自定义策略
除了内置的 5 种策略,你可以创建专属策略:
除了内置的 5 种策略,你可以在 Dashboard → Custom Logic 中创建专属策略:
**示例创建「Builder Story」策略**
@@ -148,7 +153,7 @@ Few-shot 示例:
| `{language}` | 输出语言 |
| `{max_length}` | 最大字符数 |
### 3.3 推广效果最大化小贴士
### 3.4 推广效果最大化小贴士
1. **优化你的 X Profile**
- Bio 中明确写 "Building @YourProduct"
@@ -161,7 +166,7 @@ Few-shot 示例:
3. **评论质量 > 数量**
- 一条有深度的评论 > 十条"Great post!"
- 用「反向观点型」或「数据补充型」更容易引发讨论 → 更多曝光
- 用「Sharp Critique」或「Pro Rigor」更容易引发讨论 → 更多曝光
4. **不要硬推产品**
- ❌ "Check out my product SwiftBiu!"
@@ -169,9 +174,13 @@ Few-shot 示例:
---
## 四、评论历史与效果追踪
## 四、Dashboard (macOS 风格)
### 4.1 查看评论历史
InsightReply 的管理后台采用 **macOS Settings 侧边栏布局**,操作直观高效。
打开方式:点击扩展图标 → 点击「Launch Dashboard」按钮或直接使用快捷键。
### 4.1 评论历史
点击扩展图标 → `History` Tab
- 查看所有生成过的评论
@@ -179,18 +188,28 @@ Few-shot 示例:
- 搜索关键词
- 查看复制/跳过状态
### 4.2 效果追踪
### 4.2 效果追踪 (24h Performance Feedback)
InsightReply 会自动追踪你发布的评论效果:
1. 你复制并发布了一条评论
2. 24 小时后,当你再次浏览 X 时,系统自动回查该评论的互动数据
3. 互动数据Likes、Replies会记录到你的个人面板
2. 24 小时后,系统自动回查该评论的互动数据Likes、Replies
3. 互动数据会记录到你的个人面板
> 效果数据积累越多 → AI 越懂你的风格 → 生成质量越高 → 形成正向飞轮 🔄
---
## 五、版本与定价
## 五、快捷键 (Shortcuts)
| 功能 | Mac 快捷键 | Win 快捷键 | 状态 |
|------|------|------|------|
| **唤起/隐藏 Sidebar** | `Cmd + Shift + I` | `Ctrl + Shift + I` | ✅ 已实现 |
| **快速生成** | `Alt + G` | `Alt + G` | 📋 规划中 |
| **一键复制** | `Alt + C` | `Alt + C` | 📋 规划中 |
---
## 六、版本与定价
| 版本 | 价格 | 包含功能 |
|------|------|---------|
@@ -200,7 +219,7 @@ InsightReply 会自动追踪你发布的评论效果:
---
## 、常见问题 (FAQ)
## 、常见问题 (FAQ)
### Q: InsightReply 会自动发布评论吗?
**不会**。InsightReply 只生成评论建议,你决定是否复制和发布。我们是 AI 写作增强工具,不是自动化机器人。
@@ -217,21 +236,14 @@ Chrome 和 Edge基于 Manifest V3。Firefox 支持规划中。
- 我们不会代替你操作你的 X 账号
### Q: 如何修改已保存的设置?
点击扩展图标 → 齿轮图标 ⚙️ → 可修改身份标签、语言偏好、产品档案、自定义策略
点击扩展图标 → 「Launch Dashboard」→ 在 macOS 风格的侧边栏中选择对应模块修改
### Q: 竞品关键词如何工作?
产品档案中添加竞品名称后,当 Timeline 中出现包含竞品关键词的推文InsightReply 会在推文旁显示 🎯 标签,提示你这是一条高价值评论机会。
Dashboard → Product DNA 中添加竞品名称后,当 Timeline 中出现包含竞品关键词的推文InsightReply 会在推文旁显示 🎯 标签,提示你这是一条高价值评论机会。
### Q: 界面被推文遮挡怎么办?
我们已升级为 **Shadow DOM 最高优先级渲染**z-index: 2147483647面板将永远浮于页面最顶层。
---
## 七、快捷键
| 快捷键 | 功能 |
|-------|------|
| `Alt + I` | 打开/关闭 InsightReply 面板 |
| `Alt + G` | 快速生成评论 |
| `Alt + C` | 复制选中的评论 |
---
> **反馈与建议**:如果你有功能建议或遇到问题,欢迎在我们的 Gitea 仓库提交 Issue。
> **反馈与建议**:如果你有功能建议或遇到问题,欢迎在我们的 [Gitea 仓库](https://git.buildapp.eu.org/) 提交 Issue。

View File

@@ -33,5 +33,14 @@
"https://x.com/*"
]
}
]
],
"commands": {
"toggle-sidebar": {
"suggested_key": {
"default": "Ctrl+Shift+I",
"mac": "Command+Shift+I"
},
"description": "Toggle InsightReply Sidebar"
}
}
}

View File

@@ -47,31 +47,50 @@ const clearHistory = () => {
historyList.value = []
})
}
const launchDashboard = () => {
chrome.tabs.create({ url: chrome.runtime.getURL('options.html') })
}
</script>
<template>
<div class="w-[400px] h-[600px] bg-[#0A0A0A] text-[#E5E5E5] flex flex-col font-sans overflow-hidden">
<div class="w-[400px] h-[600px] glass-card flex flex-col overflow-hidden text-[#f8fafc] selection:bg-rose-500/30">
<!-- Header -->
<div class="p-5 border-b border-white/10 bg-white/5 flex justify-between items-center">
<!-- Premium Header -->
<div class="px-6 py-5 flex justify-between items-center border-b border-white/5 bg-white/[0.02]">
<div>
<h1 class="text-xl font-semibold tracking-tight bg-gradient-to-r from-violet-500 to-blue-500 bg-clip-text text-transparent">
<h1 class="text-xl font-bold tracking-tight bg-gradient-to-br from-rose-400 via-violet-400 to-blue-400 bg-clip-text text-transparent opacity-90">
InsightReply
</h1>
<p class="text-[11px] text-zinc-500 mt-1 uppercase tracking-widest font-semibold">Social Copilot</p>
<div class="flex items-center gap-2 mt-0.5">
<span class="text-[10px] text-zinc-500 uppercase tracking-[0.2em] font-bold">Social Copilot</span>
<span class="h-1 w-1 rounded-full bg-zinc-700"></span>
<span class="text-[10px] text-zinc-500 font-medium">Pro Max</span>
</div>
</div>
<!-- Tab Switcher -->
<div class="flex gap-1 bg-black/50 p-1 rounded-lg border border-white/5">
<!-- Launch Dashboard Button -->
<button
@click="launchDashboard"
class="p-2 rounded-xl bg-white/5 border border-white/10 hover:bg-white/10 transition-apple group"
title="Open Dashboard"
>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-zinc-400 group-hover:text-rose-400 transition-apple"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
</button>
</div>
<!-- Segmented Control (Tabs) -->
<div class="px-6 pt-5">
<div class="flex p-1 bg-black/40 rounded-xl border border-white/5 backdrop-blur-md">
<button
@click="activeTab = 'settings'"
:class="['px-3 py-1 text-xs font-medium rounded-md transition-all', activeTab === 'settings' ? 'bg-zinc-800 text-white shadow-md' : 'text-zinc-500 hover:text-zinc-300']"
:class="['flex-1 py-1.5 text-xs font-semibold rounded-lg transition-apple', activeTab === 'settings' ? 'bg-zinc-800 text-white shadow-[0_2px_8px_rgba(0,0,0,0.4)]' : 'text-zinc-500 hover:text-zinc-300']"
>
Settings
</button>
<button
@click="activeTab = 'history'"
:class="['px-3 py-1 text-xs font-medium rounded-md transition-all', activeTab === 'history' ? 'bg-zinc-800 text-white shadow-md' : 'text-zinc-500 hover:text-zinc-300']"
:class="['flex-1 py-1.5 text-xs font-semibold rounded-lg transition-apple', activeTab === 'history' ? 'bg-zinc-800 text-white shadow-[0_2px_8px_rgba(0,0,0,0.4)]' : 'text-zinc-500 hover:text-zinc-300']"
>
History
</button>
@@ -79,35 +98,44 @@ const clearHistory = () => {
</div>
<!-- Main Content Area -->
<div class="flex-1 overflow-y-auto p-5">
<div class="flex-1 overflow-y-auto px-6 py-5 custom-scrollbar">
<!-- Settings Tab -->
<div v-if="activeTab === 'settings'" class="animate-in fade-in slide-in-from-right-4 duration-300 space-y-6">
<div>
<h2 class="text-base font-medium text-white mb-1">Your Identity Profile</h2>
<p class="text-xs text-zinc-400 mb-4">Set your background so AI can generate relevant, authentic replies matching your persona.</p>
<div class="space-y-4">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Identity Label</label>
<input
v-model="identity"
type="text"
class="w-full bg-[#171717] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. AI Founder, Indie Hacker, Marketer"
/>
</div>
<div v-if="activeTab === 'settings'" class="animate-in fade-in slide-in-from-bottom-2 duration-500 space-y-6">
<div class="space-y-4">
<div class="bg-white/[0.03] border border-white/5 rounded-2xl p-4 space-y-4">
<h2 class="text-xs font-bold text-zinc-500 uppercase tracking-widest flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="text-rose-500"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
Identity Profile
</h2>
<div class="space-y-4">
<div class="space-y-2">
<label class="text-[11px] font-semibold text-zinc-400 ml-1">Identity Label</label>
<input
v-model="identity"
type="text"
class="w-full bg-black/40 border border-white/5 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500/40 transition-apple placeholder:text-zinc-600"
placeholder="e.g. AI Founder, Indie Hacker"
/>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Reply Language</label>
<select
v-model="language"
class="w-full bg-[#171717] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors appearance-none"
>
<option value="auto">Auto (Match Tweet)</option>
<option value="en">English (en)</option>
<option value="zh">Chinese (zh)</option>
</select>
<div class="space-y-2">
<label class="text-[11px] font-semibold text-zinc-400 ml-1">Reply Language</label>
<div class="relative">
<select
v-model="language"
class="w-full bg-black/40 border border-white/5 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:ring-2 focus:ring-rose-500/20 focus:border-rose-500/40 transition-apple appearance-none cursor-pointer"
>
<option value="auto">Auto (Match Tweet)</option>
<option value="en">English (en)</option>
<option value="zh">Chinese (zh)</option>
</select>
<div class="absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-zinc-500">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -115,7 +143,7 @@ const clearHistory = () => {
<button
@click="saveSettings"
:disabled="isSaving"
class="w-full py-2.5 bg-brand-primary hover:bg-brand-primary/90 text-white rounded-lg text-sm font-medium transition-all shadow-lg flex items-center justify-center gap-2 mt-4 disabled:opacity-70 disabled:cursor-not-allowed"
class="w-full py-3.5 bg-gradient-to-r from-rose-600 to-rose-500 hover:from-rose-500 hover:to-rose-400 text-white rounded-2xl text-sm font-bold transition-apple shadow-[0_8px_20px_rgba(136,19,55,0.3)] flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed"
>
<span v-if="isSaving" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></span>
{{ isSaving ? 'Saving...' : 'Save Preferences' }}
@@ -123,29 +151,40 @@ const clearHistory = () => {
</div>
<!-- History Tab -->
<div v-if="activeTab === 'history'" class="animate-in fade-in slide-in-from-left-4 duration-300 flex flex-col h-full">
<div class="flex justify-between items-center mb-4 pb-2 border-b border-white/10">
<h2 class="text-xs font-semibold text-zinc-400 uppercase tracking-widest">Generation History</h2>
<button @click="clearHistory" class="text-xs text-red-400/80 hover:text-red-400 transition-colors">Clear All</button>
<div v-if="activeTab === 'history'" class="animate-in fade-in slide-in-from-bottom-2 duration-500 flex flex-col h-full">
<div class="flex justify-between items-center mb-6 px-1">
<h2 class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em]">Activity Log</h2>
<button @click="clearHistory" class="text-[10px] font-bold text-rose-500/80 hover:text-rose-400 transition-apple uppercase tracking-widest">Clear All</button>
</div>
<div v-if="historyList.length === 0" class="flex-1 flex flex-col items-center justify-center text-zinc-500 space-y-3 pb-10">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" class="opacity-20"><path d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<p class="text-sm">No history yet</p>
<div v-if="historyList.length === 0" class="flex-1 flex flex-col items-center justify-center text-zinc-500 space-y-4 pb-12">
<div class="p-5 rounded-full bg-white/[0.02] border border-white/5">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="opacity-20"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
</div>
<p class="text-xs font-medium tracking-wide">No generations found</p>
</div>
<div v-else class="space-y-6">
<div v-for="(item, idx) in historyList" :key="idx" class="space-y-3 bg-white/5 rounded-xl p-4 border border-white/5">
<div class="text-[10px] text-zinc-500 font-mono">{{ new Date(item.timestamp).toLocaleString() }}</div>
<div class="text-xs italic text-zinc-400 border-l-2 border-zinc-700 pl-2">"{{ item.tweetContent?.substring(0, 100) }}{{ item.tweetContent?.length > 100 ? '...' : '' }}"</div>
<div v-for="(item, idx) in historyList" :key="idx" class="bg-white/[0.02] border border-white/5 rounded-2xl p-5 space-y-4 hover:border-white/10 transition-apple">
<div class="flex justify-between items-center">
<div class="text-[10px] font-mono text-zinc-600 tracking-tighter">{{ new Date(item.timestamp).toLocaleString() }}</div>
<div class="h-1.5 w-1.5 rounded-full bg-rose-500/40"></div>
</div>
<div class="space-y-2 mt-3 pt-3 border-t border-white/5">
<div v-for="(reply, rIdx) in item.replies" :key="rIdx" class="bg-[#171717] rounded-lg p-3 group relative">
<div class="flex justify-between items-center mb-1">
<span class="text-[10px] font-medium text-brand-primary bg-brand-primary/10 px-1.5 py-0.5 rounded">{{ reply.strategy }}</span>
<button @click="copyToClipboard(reply.content)" class="opacity-0 group-hover:opacity-100 transition-opacity text-[10px] text-zinc-400 hover:text-white">Copy</button>
<div class="text-[11px] leading-relaxed text-zinc-400 italic bg-black/20 rounded-xl p-3 border border-white/[0.02]">
"{{ item.tweetContent?.substring(0, 80) }}{{ item.tweetContent?.length > 80 ? '...' : '' }}"
</div>
<div class="space-y-3">
<div v-for="(reply, rIdx) in item.replies" :key="rIdx" class="bg-white/[0.03] rounded-xl p-4 group relative border border-white/5 hover:border-rose-500/20 transition-apple">
<div class="flex justify-between items-center mb-2">
<span class="text-[9px] font-bold text-rose-400 bg-rose-400/10 px-2 py-0.5 rounded-full uppercase tracking-widest">{{ reply.strategy }}</span>
<button @click="copyToClipboard(reply.content)" class="opacity-0 group-hover:opacity-100 transition-apple text-[10px] text-zinc-400 hover:text-white flex items-center gap-1.5">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
Copy
</button>
</div>
<div class="text-xs text-zinc-300 leading-relaxed">{{ reply.content }}</div>
<div class="text-xs text-zinc-300 leading-relaxed font-medium">{{ reply.content }}</div>
</div>
</div>
</div>
@@ -157,11 +196,19 @@ const clearHistory = () => {
</template>
<style>
/* Scoped overrides */
body {
margin: 0;
padding: 0;
width: 400px;
height: 600px;
}
.custom-scrollbar::-webkit-scrollbar {
width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
}
.custom-scrollbar:hover::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
}
</style>

View File

@@ -103,3 +103,15 @@ chrome.runtime.onMessage.addListener((message: { type: string; payload?: any },
}
return true;
});
// Handle Command (Keyboard Shortcut)
chrome.commands.onCommand.addListener((command) => {
if (command === 'toggle-sidebar') {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const activeTab = tabs[0];
if (activeTab?.id) {
chrome.tabs.sendMessage(activeTab.id, { type: 'TOGGLE_SIDEBAR' });
}
});
}
});

View File

@@ -14,29 +14,24 @@ const props = defineProps<{
}
}>()
const isVisible = ref(true)
const selectedStrategy = ref('Insightful')
const generatedReplies = ref<Array<{strategy: string, content: string}>>([])
const isGenerating = ref(false)
const defaultStrategies = [
{ id: 'Insightful', label: '认知升级型', icon: '🧠' },
{ id: 'Humorous', label: '幽默风趣型', icon: '😄' },
{ id: 'Professional', label: '专业严谨型', icon: '⚖️' },
{ id: 'Supportive', label: '共鸣支持型', icon: '❤️' },
{ id: 'Critical', label: '锐评批判型', icon: '🔥' },
{ id: 'Quote', label: '引用转发型', icon: '💬' }
]
const strategies = ref([...defaultStrategies])
const isVisible = ref(false) // Start hidden, wait for trigger
onMounted(() => {
// Listen for toggle messages directly in the component
chrome.runtime.onMessage.addListener((message) => {
if (message.type === 'TOGGLE_SIDEBAR') {
isVisible.value = !isVisible.value
} else if (message.type === 'SHOW_INSIGHT') {
isVisible.value = true
}
})
chrome.runtime.sendMessage({ type: 'FETCH_CUSTOM_STRATEGIES' }, (response) => {
if (response && response.success && response.data) {
const customStrategies = response.data.map((s: any) => ({
id: s.strategy_key,
label: s.label,
icon: ''
icon: '<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>'
}))
strategies.value = [...defaultStrategies, ...customStrategies]
}
@@ -72,7 +67,7 @@ const generate = () => {
generatedReplies.value = [{ strategy: 'Auth Required', content: 'Connection required. Please log in first.' }]
chrome.runtime.openOptionsPage()
} else {
generatedReplies.value = [{ strategy: 'Error', content: response?.error || 'Failed to generate reply. Please check your connection or API key.' }]
generatedReplies.value = [{ strategy: 'Error', content: response?.error || 'Failed to generate reply. Please check your connection.' }]
}
})
})
@@ -85,7 +80,6 @@ const copyToClipboard = async (reply: any) => {
showProfileTip.value = true
setTimeout(() => { showProfileTip.value = false }, 7000)
// Epic 13: Record generated reply for performance tracking telemetry
if (!props.tweetData || !props.tweetData.id) return;
chrome.storage.local.get(['jwt_token'], async (result) => {
@@ -107,7 +101,7 @@ const copyToClipboard = async (reply: any) => {
})
});
} catch (err) {
console.error('Failed to log telemetry:', err) // Non blocking telemetry
console.error('Failed to log telemetry:', err)
}
}
});
@@ -115,92 +109,115 @@ const copyToClipboard = async (reply: any) => {
</script>
<template>
<div v-if="isVisible" class="fixed right-4 top-20 w-[360px] max-h-[85vh] flex flex-col bg-[#0A0A0A]/90 backdrop-blur-2xl border border-white/10 rounded-2xl shadow-2xl text-[#E5E5E5] font-sans z-[9999] overflow-hidden">
<!-- Header -->
<div class="p-4 border-b border-white/5 flex justify-between items-center bg-white/5">
<div class="flex items-center gap-2">
<div class="w-2 h-2 rounded-full bg-brand-primary animate-pulse"></div>
<span class="text-sm font-medium tracking-wide">InsightReply AI</span>
<transition
enter-active-class="transition duration-500 ease-out transform"
enter-from-class="translate-x-full opacity-0 scale-95"
enter-to-class="translate-x-0 opacity-100 scale-100"
leave-active-class="transition duration-400 ease-in transform"
leave-from-class="translate-x-0 opacity-100 scale-100"
leave-to-class="translate-x-full opacity-0 scale-95"
>
<div v-if="isVisible" class="fixed right-6 top-1/2 -translate-y-1/2 w-[380px] max-h-[90vh] flex flex-col glass-card rounded-[24px] shadow-[0_32px_64px_rgba(0,0,0,0.5)] text-[#f8fafc] font-sans z-[2147483647] overflow-hidden border border-white/5 selection:bg-rose-500/30">
<!-- Premium Header -->
<div class="px-6 py-5 flex justify-between items-center bg-white/[0.02] border-b border-white/5">
<div class="flex items-center gap-3">
<div class="p-2 rounded-lg bg-rose-500/10 border border-rose-500/20">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="text-rose-500"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg>
</div>
<div>
<span class="text-sm font-bold tracking-tight block">InsightReply</span>
<span class="text-[9px] text-zinc-500 uppercase tracking-[0.2em] font-bold">Spatial Copilot</span>
</div>
</div>
<button @click="isVisible = false" class="p-2 rounded-full hover:bg-white/10 transition-apple group">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-zinc-500 group-hover:text-white transition-apple"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
<button @click="isVisible = false" class="text-zinc-500 hover:text-white transition-colors">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
<!-- Content -->
<div class="p-5 flex-1 overflow-y-auto space-y-6">
<div class="p-6 flex-1 overflow-y-auto space-y-8 custom-scrollbar">
<!-- Tweet Context (Small Preview) -->
<div v-if="tweetData" class="bg-white/5 rounded-xl p-3 border border-white/5">
<div class="text-[10px] text-zinc-500 mb-1 font-mono uppercase">Context</div>
<div class="text-xs text-zinc-400 line-clamp-2 italic">" {{ tweetData.content }} "</div>
<!-- Context Module -->
<div v-if="tweetData" class="space-y-3">
<h3 class="text-[10px] font-bold text-zinc-500 uppercase tracking-widest flex items-center gap-2 px-1">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="text-rose-500"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
Current Tweet
</h3>
<div class="bg-black/20 rounded-2xl p-4 border border-white/[0.03] relative group">
<div class="text-[13px] text-zinc-400 leading-relaxed font-medium italic">
"{{ tweetData.content }}"
</div>
</div>
</div>
<!-- Strategy Selector -->
<div class="space-y-3">
<span class="text-xs font-semibold text-zinc-500 uppercase tracking-widest">Generation Strategy</span>
<div class="grid grid-cols-1 gap-2">
<!-- Strategy Grid -->
<div class="space-y-4">
<h3 class="text-[10px] font-bold text-zinc-500 uppercase tracking-widest flex items-center gap-2 px-1">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="text-rose-500"><path d="m16 4 4 4-4 4"/><path d="M20 8H4v12"/></svg>
Generation Strategy
</h3>
<div class="grid grid-cols-1 gap-2.5">
<button
v-for="s in strategies"
:key="s.id"
@click="selectedStrategy = s.id"
:class="[
'flex items-center gap-3 p-3 rounded-xl border transition-all duration-200 text-sm group',
'flex items-center gap-4 p-4 rounded-2xl border transition-apple group text-sm font-semibold active:scale-[0.98]',
selectedStrategy === s.id
? 'bg-brand-primary/20 border-brand-primary text-white shadow-lg shadow-brand-primary/10'
: 'bg-white/5 border-transparent hover:bg-white/10 text-zinc-400'
? 'bg-rose-500/10 border-rose-500/30 text-rose-50 text-white shadow-[0_8px_16px_rgba(136,19,55,0.15)]'
: 'bg-white/[0.02] border-white/5 hover:bg-white/[0.05] text-zinc-400'
]"
>
<span class="text-lg">{{ s.icon }}</span>
<span class="flex-1 text-left">{{ s.label }}</span>
<div v-if="selectedStrategy === s.id" class="w-1.5 h-1.5 rounded-full bg-brand-primary"></div>
<div :class="['p-2 rounded-lg transition-apple', selectedStrategy === s.id ? 'bg-rose-500/20 text-rose-400' : 'bg-black/20 text-zinc-500 group-hover:text-zinc-300']">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" v-html="s.icon"></svg>
</div>
<span class="flex-1 text-left tracking-tight">{{ s.label }}</span>
<div v-if="selectedStrategy === s.id" class="w-2 h-2 rounded-full bg-rose-500 shadow-[0_0_8px_#f43f5e]"></div>
</button>
</div>
</div>
<!-- Result Area -->
<div v-if="generatedReplies.length > 0" class="space-y-4 animate-in fade-in slide-in-from-bottom-2 duration-500">
<div class="flex justify-between items-center">
<span class="text-xs font-semibold text-zinc-500 uppercase tracking-widest">Assistant Suggestions</span>
</div>
<!-- Result Module -->
<div v-if="generatedReplies.length > 0" class="space-y-4 animate-in fade-in slide-in-from-bottom-4 duration-700">
<h3 class="text-[10px] font-bold text-zinc-500 uppercase tracking-widest px-1">AI Suggestions</h3>
<div v-for="(reply, idx) in generatedReplies" :key="idx" class="bg-[#171717] rounded-xl p-4 border border-white/10 space-y-3 relative group transition-all hover:bg-[#202020] hover:border-white/20">
<div v-for="(reply, idx) in generatedReplies" :key="idx" class="bg-white/[0.03] rounded-2xl p-5 border border-white/5 space-y-4 relative group hover:border-rose-500/20 transition-apple">
<div class="flex justify-between items-center">
<span class="text-xs font-medium text-brand-primary bg-brand-primary/10 px-2 py-0.5 rounded-full">
{{ reply.strategy || 'Suggestion' }}
<span class="text-[9px] font-bold text-rose-400 bg-rose-400/10 px-2.5 py-1 rounded-full uppercase tracking-widest">
{{ reply.strategy || 'Insight' }}
</span>
<button @click="copyToClipboard(reply)" class="opacity-0 group-hover:opacity-100 transition-opacity text-[10px] text-zinc-400 hover:text-white flex items-center gap-1 cursor-pointer">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
Copy
<button @click="copyToClipboard(reply)" class="opacity-0 group-hover:opacity-100 transition-apple text-[10px] font-bold text-zinc-500 hover:text-white flex items-center gap-2 px-2 py-1 rounded-lg hover:bg-white/5">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
COPY
</button>
</div>
<div class="text-sm leading-relaxed whitespace-pre-wrap text-[#E5E5E5]">
<div class="text-[13px] leading-relaxed whitespace-pre-wrap text-zinc-200 font-medium tracking-tight">
{{ reply.content }}
</div>
</div>
</div>
</div>
<!-- Footer Action -->
<div class="p-4 bg-white/5 border-t border-white/5 flex flex-col gap-3">
<transition enter-active-class="transition ease-out duration-300 transform" enter-from-class="opacity-0 translate-y-2" enter-to-class="opacity-100 translate-y-0" leave-active-class="transition ease-in duration-200 transform" leave-from-class="opacity-100 translate-y-0" leave-to-class="opacity-0 translate-y-2">
<div v-if="showProfileTip" class="bg-blue-500/10 border border-blue-500/20 text-blue-400 text-[11px] p-2.5 rounded-lg flex gap-2 items-start relative pr-6">
<span class="text-sm leading-none">💡</span>
<p class="leading-relaxed"><strong>Optimze your conversion:</strong> Ensure your X Bio and Pinned Tweet clearly mention your product/link!</p>
<button @click="showProfileTip = false" class="absolute top-2 right-2 text-blue-400/50 hover:text-blue-400"></button>
<!-- Sticky Action Footer -->
<div class="p-6 bg-white/[0.02] border-t border-white/5 space-y-4 shadow-[0_-12px_24px_rgba(0,0,0,0.2)]">
<transition enter-active-class="transition duration-500 transform ease-out" enter-from-class="opacity-0 translate-y-4" enter-to-class="opacity-100 translate-y-0" leave-active-class="transition duration-300 transform ease-in" leave-from-class="opacity-100 translate-y-0" leave-to-class="opacity-0 translate-y-4">
<div v-if="showProfileTip" class="bg-rose-500/10 border border-rose-500/20 text-rose-400 text-[11px] p-4 rounded-2xl flex gap-3 items-start relative font-medium leading-relaxed">
<span class="text-base leading-none"></span>
<p><strong>Optimize Conversion:</strong> Make sure your X Bio prominently features your product link!</p>
<button @click="showProfileTip = false" class="absolute top-3 right-3 opacity-50 hover:opacity-100"></button>
</div>
</transition>
<button
@click="generate"
:disabled="isGenerating"
class="w-full py-3 bg-gradient-to-r from-violet-600 to-blue-600 hover:from-violet-500 hover:to-blue-500 disabled:from-zinc-800 disabled:to-zinc-800 disabled:text-zinc-500 disabled:cursor-not-allowed text-white rounded-xl text-sm font-semibold transition-all shadow-xl shadow-brand-primary/20 flex items-center justify-center gap-2"
class="w-full py-4 bg-gradient-to-br from-rose-600 to-rose-500 hover:from-rose-500 hover:to-rose-400 disabled:from-zinc-900 disabled:to-zinc-900 disabled:text-zinc-600 disabled:cursor-not-allowed text-white rounded-[20px] text-[15px] font-bold transition-all shadow-[0_12px_24px_rgba(136,19,55,0.25)] flex items-center justify-center gap-3 active:scale-[0.97]"
>
<div v-if="isGenerating" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
{{ isGenerating ? 'AI Thinking...' : 'Generate High-Quality Reply' }}
<div v-if="isGenerating" class="w-5 h-5 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
<svg v-else xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="text-rose-100"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>
{{ isGenerating ? 'AI Thinking...' : 'Generate Pro Reply' }}
</button>
</div>
@@ -208,18 +225,14 @@ const copyToClipboard = async (reply: any) => {
</template>
<style scoped>
/* 局部样式保证不溢出 */
::-webkit-scrollbar {
.custom-scrollbar::-webkit-scrollbar {
width: 4px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
.custom-scrollbar::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.2);
.custom-scrollbar:hover::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
}
</style>

View File

@@ -5,49 +5,59 @@ import '../assets/tailwind.css' // We might need to handle this specially for Sh
const MOUNT_ID = 'insight-reply-sidebar-root'
function initSidebar(tweetData?: any) {
if (document.getElementById(MOUNT_ID)) return
let host = document.getElementById(MOUNT_ID)
if (host) return;
// 1. Create Host Element
const host = document.createElement('div')
host = document.createElement('div')
host.id = MOUNT_ID
host.style.cssText = `
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 2147483647;
pointer-events: none;
`
document.body.appendChild(host)
// 2. Create Shadow Root
const shadowRoot = host.attachShadow({ mode: 'open' })
// 3. Create Container for Vue
// 3. Create Container
const container = document.createElement('div')
container.id = 'app'
container.style.cssText = `
pointer-events: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
`
shadowRoot.appendChild(container)
// 4. Inject Styles into Shadow DOM
// Note: In development/build, we need to find the generated CSS and inject it.
// CRXJS usually puts CSS in <link> tags in the head for content scripts.
// For Shadow DOM, we need to move or clone them into the shadow root.
// 4. Inject Styles
const injectStyles = () => {
const styles = document.querySelectorAll('style, link[rel="stylesheet"]')
styles.forEach(style => {
// Only clone styles that look like they belong to our extension
// This is a heuristic, in a real build we'd use the asset URL
shadowRoot.appendChild(style.cloneNode(true))
})
}
// Initial injection
injectStyles()
// 5. Create Vue App
const app = createApp(Sidebar, { tweetData })
app.mount(container)
console.log('InsightReply Sidebar Mounted in Shadow DOM');
}
// Listen for messages to show/hide or update data
// Ensure it mounts on load if needed, but primarily triggered by messages
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
if (message.type === 'SHOW_INSIGHT') {
console.log('[InsightReply Sidebar Mount] Received SHOW_INSIGHT message:', message.payload);
if (message.type === 'SHOW_INSIGHT' || message.type === 'TOGGLE_SIDEBAR') {
initSidebar(message.payload);
// The component itself listens for TOGGLE_SIDEBAR to show/hide
sendResponse({ received: true });
}
return true;

View File

@@ -16,7 +16,7 @@ const API_BASE = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080/api
const submitAuth = async () => {
if (!form.value.email || !form.value.password) {
errorMsg.value = 'Email and password are required'
errorMsg.value = 'Security credentials required.'
return
}
@@ -38,7 +38,7 @@ const submitAuth = async () => {
const data = await res.json()
if (!res.ok || data.code !== 200) {
throw new Error(data.message || 'Authentication failed')
throw new Error(data.message || 'Authentication sequence failed.')
}
// Auth Success
@@ -58,52 +58,68 @@ const submitAuth = async () => {
</script>
<template>
<div class="space-y-4">
<div v-if="errorMsg" class="p-3 bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg">
{{ errorMsg }}
</div>
<div class="space-y-8">
<transition enter-active-class="transition duration-300 transform" enter-from-class="opacity-0 -translate-y-2" enter-to-class="opacity-100 translate-y-0">
<div v-if="errorMsg" class="p-4 bg-rose-500/10 border border-rose-500/20 text-rose-400 text-xs font-bold rounded-2xl flex items-center gap-3">
<span class="text-base font-normal"></span>
{{ errorMsg }}
</div>
</transition>
<form @submit.prevent="submitAuth" class="space-y-4 text-left">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Email Address</label>
<form @submit.prevent="submitAuth" class="space-y-6 text-left animate-in fade-in slide-in-from-bottom-2 duration-500">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Universal Identity (Email)</label>
<input
v-model="form.email"
type="email"
required
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="your@email.com"
class="dashboard-input"
placeholder="e.g. user@insight-reply.pro"
/>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Password</label>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Security Key (Password)</label>
<input
v-model="form.password"
type="password"
required
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="••••••••"
class="dashboard-input"
placeholder="••••••••••••"
/>
</div>
<button
type="submit"
:disabled="isLoading"
class="w-full py-2.5 bg-brand-primary hover:bg-brand-primary/90 text-white rounded-lg text-sm font-medium transition-all shadow-lg flex items-center justify-center gap-2 mt-2 disabled:opacity-70 disabled:cursor-not-allowed"
:class="[
'w-full py-4 rounded-2xl text-[15px] font-bold transition-all shadow-xl flex items-center justify-center gap-3 active:scale-[0.98] disabled:opacity-50 mt-4',
isLogin
? 'bg-rose-500 hover:bg-rose-400 text-white shadow-rose-900/40'
: 'bg-white hover:bg-zinc-200 text-black shadow-white/5'
]"
>
<span v-if="isLoading" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></span>
{{ isLoading ? 'Processing...' : (isLogin ? 'Sign In' : 'Create Account') }}
<span v-if="isLoading" class="w-5 h-5 border-2 border-current/20 border-t-current rounded-full animate-spin"></span>
<svg v-else xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" x2="3" y1="12" y2="12"/></svg>
{{ isLoading ? 'Synchronizing...' : (isLogin ? 'Initiate Session' : 'Create Intelligence Profile') }}
</button>
</form>
<div class="text-center mt-4 border-t border-white/10 pt-4">
<div class="text-center pt-2">
<button
type="button"
@click="isLogin = !isLogin"
class="text-xs text-zinc-400 hover:text-white transition-colors"
class="text-xs font-bold text-zinc-500 hover:text-rose-400 transition-apple px-4 py-2 rounded-full hover:bg-rose-500/5 active:scale-95"
>
{{ isLogin ? "Don't have an account? Sign up" : "Already have an account? Log in" }}
{{ isLogin ? "New to InsightReply? Secure an account" : "Existive user? Authenticate here" }}
</button>
</div>
</div>
</template>
<style scoped>
.dashboard-input {
@apply w-full bg-black/40 border border-white/5 rounded-2xl px-5 py-3.5 text-sm font-semibold;
@apply transition-apple focus:outline-none focus:ring-4 focus:ring-rose-500/10 focus:border-rose-500/40 placeholder:text-zinc-700;
}
</style>

View File

@@ -51,7 +51,6 @@ const createCompetitor = async () => {
throw new Error(data.message || 'Failed to add competitor')
}
// Reset form & reload
form.value = { competitor_name: '', platform: 'twitter', target_handle: '', keywords: '' }
showForm.value = false
await fetchCompetitors()
@@ -85,108 +84,140 @@ onMounted(() => {
</script>
<template>
<div class="space-y-6">
<div class="space-y-12">
<div v-if="isLoading" class="p-10 flex justify-center">
<div class="w-6 h-6 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
<header class="flex justify-between items-end">
<div class="space-y-1">
<h2 class="text-2xl font-bold tracking-tight">Competitor Radar</h2>
<p class="text-sm text-zinc-500 font-medium">Identify and engage in conversations happening around your alternatives.</p>
</div>
<button
v-if="!showForm"
@click="showForm = true"
class="px-5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white rounded-[14px] text-sm font-bold transition-apple shadow-lg shadow-blue-900/20 active:scale-95 flex items-center gap-2"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
Add Target
</button>
</header>
<div v-if="isLoading" class="py-20 flex justify-center">
<div class="w-8 h-8 border-2 border-white/10 border-t-blue-500 rounded-full animate-spin"></div>
</div>
<div v-else>
<div class="flex justify-between items-center mb-6">
<p class="text-sm text-zinc-400">Track competitors tweets & mentions to find opportunistic conversations.</p>
<button
v-if="!showForm"
@click="showForm = true"
class="px-4 py-2 bg-brand-primary/20 text-brand-primary border border-brand-primary/30 rounded-lg text-xs font-semibold hover:bg-brand-primary hover:text-white transition-colors flex items-center gap-1"
>
+ Add Competitor
</button>
</div>
<!-- Create Form -->
<form v-if="showForm" @submit.prevent="createCompetitor" class="bg-[#171717] border border-white/10 rounded-xl p-6 space-y-4 mb-8">
<div class="flex justify-between items-center mb-2 border-b border-white/10 pb-2">
<h3 class="text-sm font-semibold text-white">Add Target Radar</h3>
<button type="button" @click="showForm = false" class="text-zinc-500 hover:text-white"></button>
</div>
<div v-if="errorMsg" class="p-3 bg-red-500/10 border border-red-500/20 text-red-400 text-xs rounded-lg">
{{ errorMsg }}
</div>
<div class="grid grid-cols-2 gap-4">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Competitor Product / Name</label>
<input v-model="form.competitor_name" required class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50" placeholder="e.g. Acme Corp" />
<div v-else class="space-y-8">
<!-- Create Form Modal View -->
<transition enter-active-class="transition duration-500 ease-out transform" enter-from-class="opacity-0 scale-95 -translate-y-4" enter-to-class="opacity-100 scale-100 translate-y-0">
<form v-if="showForm" @submit.prevent="createCompetitor" class="bg-white/[0.03] border border-white/5 rounded-[32px] p-8 space-y-8 shadow-2xl relative">
<div class="flex justify-between items-center">
<h3 class="text-lg font-bold">New Radar Target</h3>
<button type="button" @click="showForm = false" class="p-2 rounded-full hover:bg-white/5 transition-apple">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Platform</label>
<select v-model="form.platform" class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 appearance-none">
<option value="twitter">Twitter / X</option>
<option value="reddit">Reddit (Coming Soon)</option>
</select>
<div v-if="errorMsg" class="p-4 bg-rose-500/10 border border-rose-500/20 text-rose-400 text-xs font-bold rounded-xl">
{{ errorMsg }}
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Target Handle</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 pl-3 flex items-center text-zinc-500 pointer-events-none text-sm">@</span>
<input v-model="form.target_handle" class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg pl-8 pr-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50" placeholder="acmecorp" />
<div class="grid grid-cols-2 gap-8">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Competitor Name</label>
<input v-model="form.competitor_name" required class="dashboard-input" placeholder="e.g. Acme Corp" />
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Platform</label>
<div class="relative">
<select v-model="form.platform" class="dashboard-input appearance-none cursor-pointer">
<option value="twitter">Twitter / X</option>
<option value="reddit">Reddit (Coming Soon)</option>
</select>
<div class="absolute right-5 top-1/2 -translate-y-1/2 pointer-events-none text-zinc-600">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
</div>
</div>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Track Keywords (Comma separated)</label>
<input v-model="form.keywords" required class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50" placeholder="e.g. acme sucks, alternative to acme" />
</div>
<div class="grid grid-cols-2 gap-8">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">X Handle <span class="text-zinc-700">(optional)</span></label>
<div class="relative">
<span class="absolute inset-y-0 left-5 flex items-center text-zinc-600 pointer-events-none text-sm font-bold">@</span>
<input v-model="form.target_handle" class="dashboard-input pl-10" placeholder="handle" />
</div>
</div>
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Monitor Keywords</label>
<input v-model="form.keywords" required class="dashboard-input" placeholder="e.g. acme sucks, alternative to acme" />
</div>
</div>
<div class="flex justify-end pt-4">
<button type="submit" :disabled="isSubmitting" class="px-5 py-2.5 bg-brand-primary hover:bg-brand-primary/90 text-white rounded-lg text-sm font-medium transition-all shadow flex items-center justify-center gap-2 disabled:opacity-70 disabled:cursor-not-allowed">
<span v-if="isSubmitting" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></span>
{{ isSubmitting ? 'Saving...' : 'Start Tracking' }}
</button>
</div>
</form>
<div class="flex justify-end">
<button type="submit" :disabled="isSubmitting" class="px-8 py-3.5 bg-blue-600 hover:bg-blue-500 text-white rounded-2xl text-[15px] font-bold transition-apple shadow-xl shadow-blue-900/30 flex items-center gap-3 active:scale-95 disabled:opacity-50">
<div v-if="isSubmitting" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
{{ isSubmitting ? 'Calibrating...' : 'Initialize Radar' }}
</button>
</div>
</form>
</transition>
<!-- List -->
<div v-if="competitors.length === 0 && !showForm" class="text-center p-12 border border-dashed border-white/10 rounded-xl text-zinc-500">
You are not tracking any competitors.
<!-- Radar List -->
<div v-if="competitors.length === 0 && !showForm" class="text-center py-20 bg-white/[0.01] border-2 border-dashed border-white/5 rounded-[40px] space-y-4">
<div class="w-16 h-16 bg-white/[0.03] rounded-3xl mx-auto flex items-center justify-center border border-white/5">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-zinc-700"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="M2 12h2"/><path d="M20 12h2"/></svg>
</div>
<p class="text-zinc-500 font-bold tracking-tight">Radar is currently silent. No competitors added.</p>
</div>
<div class="grid grid-cols-2 gap-4">
<div v-for="c in competitors" :key="c.id" class="bg-[#0A0A0A] border border-white/10 rounded-xl p-5 relative group hover:border-white/20 transition-colors">
<div class="grid grid-cols-2 gap-6">
<div v-for="c in competitors" :key="c.id" class="group bg-white/[0.02] border border-white/5 rounded-[32px] p-6 flex flex-col justify-between transition-apple hover:bg-white/[0.04] hover:border-white/10 hover:shadow-2xl relative overflow-hidden">
<div class="flex justify-between items-start mb-4">
<div class="flex items-center gap-3">
<div class="w-8 h-8 rounded-full bg-white/5 flex items-center justify-center text-brand-primary">
<svg v-if="c.platform === 'twitter'" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>
<div class="flex justify-between items-start mb-6 z-10">
<div class="flex items-center gap-4">
<div class="w-12 h-12 rounded-2xl bg-blue-500/10 border border-blue-500/20 flex items-center justify-center text-blue-500 group-hover:scale-110 transition-apple">
<svg v-if="c.platform === 'twitter'" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>
<svg v-else width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="M2 12h2"/><path d="M20 12h2"/></svg>
</div>
<div>
<h4 class="text-sm font-semibold text-white">{{ c.competitor_name }}</h4>
<p v-if="c.target_handle" class="text-xs text-zinc-500">@{{ c.target_handle }}</p>
<h4 class="text-[17px] font-black tracking-tight group-hover:text-blue-400 transition-apple">{{ c.competitor_name }}</h4>
<p v-if="c.target_handle" class="text-[11px] font-bold text-zinc-600 mt-0.5 tracking-tight font-mono">@{{ c.target_handle }}</p>
</div>
</div>
<span class="px-2.5 py-1 bg-green-500/10 text-green-400 text-[10px] font-bold rounded-full border border-green-500/20 uppercase tracking-wide">Active</span>
<div class="group/pulse flex items-center gap-2 px-3 py-1 bg-emerald-500/10 rounded-full border border-emerald-500/20">
<div class="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"></div>
<span class="text-[9px] font-black text-emerald-400 uppercase tracking-widest">Tracking</span>
</div>
</div>
<div class="space-y-1">
<p class="text-[10px] text-zinc-500 uppercase tracking-wider font-semibold">Keywords Targeted</p>
<div class="flex flex-wrap gap-1.5">
<span v-for="kw in c.keywords.split(',')" :key="kw" class="px-2 py-0.5 bg-zinc-800 text-zinc-300 text-[11px] rounded flex border border-zinc-700">
<div class="space-y-3 z-10">
<span class="text-[9px] font-black text-zinc-700 uppercase tracking-[0.2em] flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
Search Logic
</span>
<div class="flex flex-wrap gap-2">
<span v-for="kw in c.keywords.split(',')" :key="kw" class="px-3 py-1 bg-black/40 text-zinc-400 text-[11px] font-bold rounded-lg border border-white/5 transition-apple group-hover:border-blue-500/30 group-hover:text-zinc-200">
{{ kw.trim() }}
</span>
</div>
</div>
<button @click="deleteCompetitor(c.id)" class="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity text-red-500 hover:text-red-400 p-2 rounded-lg hover:bg-red-500/10">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
<button @click="deleteCompetitor(c.id)" class="absolute top-2 right-2 p-3 text-zinc-800 hover:text-rose-500 transition-apple opacity-0 group-hover:opacity-100 z-20 active:scale-90">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
</button>
<!-- Abstract Decor -->
<div class="absolute -right-10 -bottom-10 w-32 h-32 bg-blue-500/5 blur-3xl rounded-full group-hover:bg-blue-500/10 transition-apple"></div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.dashboard-input {
@apply w-full bg-black/40 border border-white/5 rounded-2xl px-5 py-3.5 text-sm font-semibold;
@apply transition-apple focus:outline-none focus:ring-4 focus:ring-blue-500/10 focus:border-blue-500/40 placeholder:text-zinc-700;
}
</style>

View File

@@ -1,80 +1,3 @@
<template>
<div class="h-full flex flex-col p-6 space-y-6">
<div class="flex items-center justify-between">
<div>
<h2 class="text-2xl font-bold text-white tracking-tight flex items-center gap-2">
🔥 Hot Opportunities
</h2>
<p class="text-zinc-400 mt-1">High-potential threads bubbling up from your monitoring radar</p>
</div>
<button
@click="loadHotTweets"
class="p-2 bg-white/5 border border-white/10 rounded-lg hover:bg-white/10 transition-colors"
title="Refresh data"
>
<svg v-if="loading" class="w-5 h-5 text-white animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="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"></path></svg>
<span v-else></span>
</button>
</div>
<!-- Error State -->
<div v-if="error" class="bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl flex items-start gap-3">
<span></span>
<p class="text-sm font-medium">{{ error }}</p>
</div>
<!-- Empty State -->
<div v-else-if="!loading && tweets.length === 0" class="flex-1 flex flex-col items-center justify-center text-center p-8 bg-white/5 border border-white/10 rounded-2xl border-dashed">
<div class="w-16 h-16 bg-white/5 rounded-full flex items-center justify-center mb-4">
<span class="text-2xl opacity-50">🔭</span>
</div>
<h3 class="text-white font-medium mb-2">No hot tweets found</h3>
<p class="text-sm text-zinc-400 max-w-sm">
The scraper is running in the background. It takes some time and activity to build momentum heat scores. Check back later!
</p>
</div>
<!-- List -->
<div v-else class="grid gap-4 md:grid-cols-2">
<div v-for="tweet in tweets" :key="tweet.id" class="p-5 bg-white/5 border border-white/10 hover:border-white/20 hover:bg-white/[0.07] transition-all rounded-xl relative group flex flex-col justify-between">
<!-- Header -->
<div class="flex justify-between items-start mb-3">
<div class="flex flex-col">
<span class="font-bold text-white tracking-wide">@{{ tweet.author_handle }}</span>
<span class="text-[11px] text-zinc-500 font-mono">{{ new Date(tweet.posted_at).toLocaleString() }}</span>
</div>
<div class="flex items-center gap-1.5 bg-rose-500/10 text-rose-400 border border-rose-500/20 px-2 py-1 rounded text-xs font-bold font-mono">
<span>🔥</span> {{ tweet.heat_score }}
</div>
</div>
<!-- Body -->
<p class="text-zinc-300 text-sm leading-relaxed mb-4 line-clamp-4">
{{ tweet.content }}
</p>
<!-- Footer -->
<div class="mt-auto flex items-center justify-between border-t border-white/5 pt-3">
<div class="flex gap-4 text-xs text-zinc-400 font-mono">
<span title="Replies">💬 {{ tweet.reply_count }}</span>
<span title="Retweets">🔁 {{ tweet.retweet_count }}</span>
<span title="Likes"> {{ tweet.like_count }}</span>
</div>
<button
@click="openTweet(tweet.author_handle, tweet.x_tweet_id)"
class="px-3 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium rounded-md transition-colors"
>
Reply on X
</button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
@@ -102,7 +25,7 @@ const error = ref('')
const loadHotTweets = async () => {
if (!props.token) {
error.value = 'Unauthenticated. Please login.'
error.value = 'Unauthenticated intelligence profile. Please synchronize.'
return
}
@@ -117,20 +40,19 @@ const loadHotTweets = async () => {
})
if (!response.ok) {
throw new Error(`Failed to load hot opportunities (${response.status})`)
throw new Error(`Opportunity discovery failed (${response.status})`)
}
const data = await response.json()
tweets.value = data || []
} catch (err: any) {
error.value = err.message || 'Network error while fetching tweets.'
error.value = err.message || 'Quantum network sync error.'
} finally {
loading.value = false
}
}
const openTweet = (handle: string, tweetId: string) => {
// Construct the active twitter URL to trigger the context script sidebar there
const url = `https://twitter.com/${handle}/status/${tweetId}`
chrome.tabs.create({ url })
}
@@ -139,3 +61,99 @@ onMounted(() => {
loadHotTweets()
})
</script>
<template>
<div class="h-full flex flex-col space-y-10 animate-in fade-in duration-700">
<header class="flex items-center justify-between">
<div class="space-y-1">
<h2 class="text-2xl font-bold tracking-tight flex items-center gap-3">
Growth Opportunities
<div class="px-2.5 py-1 bg-orange-500/10 text-orange-500 border border-orange-500/20 rounded-full text-[9px] font-black uppercase tracking-widest animate-pulse">Live Radar</div>
</h2>
<p class="text-sm text-zinc-500 font-medium">Threads where your product DNA has the highest relevance and conversion potential.</p>
</div>
<button
@click="loadHotTweets"
class="p-3 bg-white/[0.03] border border-white/10 rounded-2xl hover:bg-white/[0.08] transition-apple active:scale-95 group shadow-xl"
title="Refresh Radar"
>
<svg :class="['w-5 h-5 text-zinc-400 group-hover:text-white transition-apple', loading ? 'animate-spin' : '']" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/>
</svg>
</button>
</header>
<!-- Notifications -->
<transition enter-active-class="transition duration-300 transform" enter-from-class="opacity-0 -translate-y-2" enter-to-class="opacity-100 translate-y-0">
<div v-if="error" class="bg-rose-500/10 border border-rose-500/20 text-rose-400 p-4 rounded-[20px] flex items-center gap-3 font-bold text-xs">
<span class="text-base font-normal"></span>
{{ error }}
</div>
</transition>
<!-- Empty State -->
<div v-if="!loading && tweets.length === 0" class="flex-1 flex flex-col items-center justify-center text-center py-20 bg-white/[0.01] border-2 border-dashed border-white/5 rounded-[40px] space-y-6">
<div class="w-20 h-20 bg-white/[0.03] rounded-[32px] flex items-center justify-center border border-white/5 shadow-2xl">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" class="text-zinc-700"><path d="M3 12c.5-2 2.5-4.5 4.5-4.5S11 10 11 12s2 4.5 4.5 4.5S20.5 14 21 12"/><path d="M3 12h18"/><path d="M9 12a3 3 0 1 0 6 0 3 3 0 1 0-6 0Z"/></svg>
</div>
<div class="space-y-2">
<h3 class="text-white font-black tracking-tight text-lg">Radar Scanning...</h3>
<p class="text-sm text-zinc-600 max-w-sm font-medium leading-relaxed">
Autonomous agents are currently mapping X threads. High-momentum opportunities will appear here momentarily.
</p>
</div>
</div>
<!-- Feed Grid -->
<div v-else class="grid gap-6 md:grid-cols-2">
<div v-for="tweet in tweets" :key="tweet.id" class="group bg-white/[0.02] border border-white/5 hover:border-orange-500/20 hover:bg-white/[0.04] transition-apple rounded-[32px] overflow-hidden p-8 flex flex-col justify-between shadow-xl relative hover:shadow-orange-950/20">
<!-- Heat score visualizer -->
<div class="absolute top-0 right-0 w-32 h-32 bg-orange-500/5 blur-[40px] rounded-full -mr-10 -mt-10 group-hover:bg-orange-500/15 transition-apple"></div>
<div>
<header class="flex justify-between items-start mb-6">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full bg-black/40 border border-white/5 flex items-center justify-center text-[11px] font-black font-mono text-zinc-400 uppercase">
{{ tweet.author_handle.slice(0, 2) }}
</div>
<div class="flex flex-col">
<span class="font-black text-[15px] text-white tracking-tight group-hover:text-orange-400 transition-apple">@{{ tweet.author_handle }}</span>
<span class="text-[9px] text-zinc-600 font-black uppercase tracking-widest">{{ new Date(tweet.posted_at).toLocaleDateString() }}</span>
</div>
</div>
<div class="flex items-center gap-2.5 px-3 py-1 bg-rose-500/10 border border-rose-500/20 rounded-full">
<div class="w-1.5 h-1.5 rounded-full bg-rose-500 shadow-[0_0_8px_#f43f5e]"></div>
<span class="text-[9px] font-black text-rose-400 uppercase tracking-[0.2em]">{{ tweet.heat_score }}</span>
</div>
</header>
<p class="text-zinc-400 text-[13px] leading-relaxed mb-6 font-medium line-clamp-4 relative group-hover:text-zinc-300 transition-apple">
"{{ tweet.content }}"
</p>
</div>
<footer class="flex items-center justify-between border-t border-white/5 pt-6 mt-4">
<div class="flex gap-4">
<div class="flex items-center gap-1.5 text-zinc-600 group-hover:text-zinc-400 transition-apple font-bold text-[11px]">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
{{ tweet.reply_count }}
</div>
<div class="flex items-center gap-1.5 text-zinc-600 group-hover:text-zinc-400 transition-apple font-bold text-[11px]">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"/></svg>
{{ tweet.like_count }}
</div>
</div>
<button
@click="openTweet(tweet.author_handle, tweet.x_tweet_id)"
class="px-6 py-2.5 bg-zinc-800 hover:bg-orange-500 text-white text-[11px] font-black uppercase tracking-[0.1em] rounded-xl transition-apple shadow-lg active:scale-95"
>
Engage
</button>
</footer>
</div>
</div>
</div>
</template>

View File

@@ -8,7 +8,7 @@ import HotTweets from './HotTweets.vue'
const token = ref('')
const isLoading = ref(true)
const activeTab = ref('profile') // 'profile', 'strategies', 'competitors'
const activeTab = ref('profile')
onMounted(() => {
chrome.storage.local.get(['jwt_token'], (res) => {
@@ -31,93 +31,140 @@ const logout = () => {
</script>
<template>
<div class="min-h-screen flex flex-col items-center pt-20 pb-10 font-sans">
<div class="min-h-screen bg-[#09090b] text-[#f8fafc] font-sans selection:bg-rose-500/30 overflow-x-hidden">
<div class="w-full max-w-4xl px-6">
<div class="mb-10 flex justify-between items-end border-b border-white/10 pb-4">
<div>
<h1 class="text-3xl font-bold tracking-tight bg-gradient-to-r from-violet-500 to-blue-500 bg-clip-text text-transparent">
InsightReply Dashboard
</h1>
<p class="text-zinc-400 mt-2">Configure your custom AI strategies, product context, and monitor radar.</p>
<!-- Background Decor -->
<div class="fixed top-0 left-0 w-full h-full pointer-events-none overflow-hidden -z-10">
<div class="absolute -top-[10%] -left-[10%] w-[40%] h-[40%] bg-rose-900/10 blur-[120px] rounded-full"></div>
<div class="absolute top-[40%] -right-[5%] w-[30%] h-[50%] bg-blue-900/10 blur-[120px] rounded-full"></div>
</div>
<div class="max-w-[1200px] mx-auto px-8 py-12">
<!-- Premium Header -->
<header class="mb-16 flex justify-between items-center animate-in fade-in slide-in-from-top-4 duration-700">
<div class="space-y-2">
<div class="flex items-center gap-3">
<div class="p-2.5 rounded-xl bg-gradient-to-br from-rose-500 to-rose-600 shadow-lg shadow-rose-900/20">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="text-white"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg>
</div>
<h1 class="text-4xl font-black tracking-tight bg-gradient-to-br from-white via-white to-zinc-500 bg-clip-text text-transparent">
InsightReply <span class="text-rose-500">Dashboard</span>
</h1>
</div>
<p class="text-zinc-500 font-medium ml-1 flex items-center gap-2">
Professional Social Copilot
<span class="h-1 w-1 rounded-full bg-zinc-700"></span>
<span class="text-zinc-600 text-xs tracking-widest uppercase font-bold">Pro Max Edition</span>
</p>
</div>
<div v-if="token" class="flex items-center gap-4">
<span class="text-sm text-green-400 flex items-center gap-2">
<div class="w-2 h-2 rounded-full bg-green-400"></div> Connected
</span>
<button @click="logout" class="text-sm text-zinc-500 hover:text-white transition-colors">Sign out</button>
<div v-if="token" class="flex items-center gap-6 bg-white/[0.03] border border-white/5 px-6 py-3 rounded-2xl backdrop-blur-xl">
<div class="flex items-center gap-2.5 px-3 py-1.5 rounded-full bg-emerald-500/10 border border-emerald-500/20">
<div class="w-2 h-2 rounded-full bg-emerald-500 shadow-[0_0_8px_#10b981]"></div>
<span class="text-xs font-bold text-emerald-400 uppercase tracking-widest">Active System</span>
</div>
<button @click="logout" class="text-sm font-bold text-zinc-500 hover:text-rose-400 transition-apple decoration-rose-500/30 underline-offset-4 hover:underline">Disconnect</button>
</div>
</header>
<div v-if="isLoading" class="flex justify-center py-32">
<div class="w-10 h-10 border-2 border-white/10 border-t-rose-500 rounded-full animate-spin"></div>
</div>
<!-- Auth State -->
<div v-else-if="!token" class="flex justify-center py-10 animate-in fade-in zoom-in-95 duration-500">
<div class="w-full max-w-md bg-white/[0.02] border border-white/5 backdrop-blur-3xl rounded-[32px] p-10 shadow-2xl space-y-8">
<div class="text-center space-y-2">
<h2 class="text-2xl font-bold">Welcome Back</h2>
<p class="text-zinc-500 font-medium">Connect your account to synchronize your AI personality and custom strategies.</p>
</div>
<Auth @authenticated="onAuthenticated" />
</div>
</div>
<div v-if="isLoading" class="flex justify-center p-20">
<div class="w-8 h-8 border-4 border-white/20 border-t-brand-primary rounded-full animate-spin"></div>
</div>
<div v-else-if="!token" class="bg-[#171717] border border-white/10 rounded-2xl p-8 max-w-md mx-auto shadow-2xl mt-10">
<h2 class="text-xl font-semibold mb-2 text-center">Authentication Required</h2>
<p class="text-zinc-400 text-sm mb-6 text-center">Log in to link your InsightReply account.</p>
<!-- Main Dashboard Grid -->
<div v-else class="grid grid-cols-[280px_1fr] gap-12 items-start">
<Auth @authenticated="onAuthenticated" />
</div>
<div v-else class="flex gap-8 items-start">
<!-- Sidebar Menu -->
<div class="w-64 flex flex-col gap-2 shrink-0">
<button
@click="activeTab = 'profile'"
:class="['text-left px-4 py-3 rounded-lg text-sm font-medium transition-colors', activeTab === 'profile' ? 'bg-white/10 text-white' : 'text-zinc-400 hover:bg-white/5 hover:text-zinc-300']"
>
<!-- macOS Style Sidebar -->
<nav class="flex flex-col gap-1 animate-in fade-in slide-in-from-left-4 duration-700">
<div class="px-3 mb-4">
<h3 class="text-[10px] font-bold text-zinc-600 uppercase tracking-[0.2em]">Personalization</h3>
</div>
<button @click="activeTab = 'profile'" :class="['sidebar-link', activeTab === 'profile' ? 'active' : '']">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="icon"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
Product Profile
</button>
<button
@click="activeTab = 'strategies'"
:class="['text-left px-4 py-3 rounded-lg text-sm font-medium transition-colors', activeTab === 'strategies' ? 'bg-white/10 text-white' : 'text-zinc-400 hover:bg-white/5 hover:text-zinc-300']"
>
Custom Strategies
<button @click="activeTab = 'strategies'" :class="['sidebar-link', activeTab === 'strategies' ? 'active' : '']">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="icon"><path d="m16 4 4 4-4 4"/><path d="M20 8H4v12"/></svg>
AI Strategies
</button>
<button
@click="activeTab = 'competitors'"
:class="['text-left px-4 py-3 rounded-lg text-sm font-medium transition-colors', activeTab === 'competitors' ? 'bg-white/10 text-white' : 'text-zinc-400 hover:bg-white/5 hover:text-zinc-300']"
>
<div class="px-3 mt-8 mb-4">
<h3 class="text-[10px] font-bold text-zinc-600 uppercase tracking-[0.2em]">Market Intelligence</h3>
</div>
<button @click="activeTab = 'competitors'" :class="['sidebar-link', activeTab === 'competitors' ? 'active' : '']">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="icon"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="M2 12h2"/><path d="M20 12h2"/></svg>
Competitor Radar
</button>
<div class="h-px bg-white/10 my-2"></div>
<button
@click="activeTab = 'hottweets'"
:class="['text-left px-4 py-3 rounded-lg text-sm font-medium transition-colors flex items-center justify-between', activeTab === 'hottweets' ? 'bg-orange-500/20 text-orange-400 border border-orange-500/30' : 'text-zinc-400 hover:bg-white/5 hover:text-zinc-300']"
>
<span>🔥 Opportunities</span>
<span v-if="activeTab !== 'hottweets'" class="w-2 h-2 rounded-full bg-orange-500 animate-pulse"></span>
</button>
</div>
<!-- Main Content Area -->
<div class="flex-1 bg-[#171717] border border-white/10 rounded-2xl p-8 shadow-xl min-h-[500px]">
<div v-show="activeTab === 'profile'" class="animate-in fade-in duration-300">
<h2 class="text-lg font-semibold mb-6 border-b border-white/10 pb-4">Product Profile Configuration</h2>
<button @click="activeTab = 'hottweets'" :class="['sidebar-link', activeTab === 'hottweets' ? 'active-orange' : '']">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="icon"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5Z"/></svg>
Growth Opportunities
</button>
</nav>
<!-- Dynamic Content Window -->
<main class="bg-white/[0.02] border border-white/5 rounded-[40px] p-12 shadow-2xl backdrop-blur-3xl animate-in fade-in slide-in-from-right-8 duration-1000 min-h-[600px] hover:border-white/10 transition-apple">
<div v-show="activeTab === 'profile'" class="animate-in fade-in duration-500">
<Profile :token="token" />
</div>
<div v-show="activeTab === 'strategies'" class="animate-in fade-in duration-300">
<h2 class="text-lg font-semibold mb-6 border-b border-white/10 pb-4">Custom Generation Strategies</h2>
<div v-show="activeTab === 'strategies'" class="animate-in fade-in duration-500">
<Strategies :token="token" />
</div>
<div v-show="activeTab === 'competitors'" class="animate-in fade-in duration-300">
<h2 class="text-lg font-semibold mb-6 border-b border-white/10 pb-4">Competitor Monitoring</h2>
<div v-show="activeTab === 'competitors'" class="animate-in fade-in duration-500">
<Competitors :token="token" />
</div>
<div v-show="activeTab === 'hottweets'" class="animate-in fade-in duration-300 h-full">
<div v-show="activeTab === 'hottweets'" class="animate-in fade-in duration-500 h-full">
<HotTweets :token="token" />
</div>
</div>
</main>
</div>
</div>
</div>
</template>
<style scoped>
.sidebar-link {
@apply flex items-center gap-4 px-4 py-3.5 rounded-2xl text-[13px] font-bold transition-apple tracking-tight active:scale-95;
@apply text-zinc-500 hover:text-zinc-200 hover:bg-white/[0.03];
}
.sidebar-link.active {
@apply bg-rose-500/10 text-rose-500 border border-rose-500/20 shadow-[0_4px_12px_rgba(244,63,94,0.1)];
}
.sidebar-link.active-orange {
@apply bg-orange-500/10 text-orange-500 border border-orange-500/20 shadow-[0_4px_12px_rgba(249,115,22,0.1)];
}
.sidebar-link .icon {
@apply transition-apple;
}
.sidebar-link.active .icon {
@apply text-rose-500;
}
.sidebar-link.active-orange .icon {
@apply text-orange-500;
}
</style>

View File

@@ -10,7 +10,7 @@ const isSaving = ref(false)
const savedMessage = ref('')
const errorMsg = ref('')
// Default LLM Options based on the API docs GET /sys/config/llms (mocking for now as we didn't build that API fully)
// Default LLM Options
const providers = ['openai', 'anthropic', 'gemini', 'deepseek']
const form = ref({
@@ -43,7 +43,6 @@ const fetchProfile = async () => {
default_llm_model: p.default_llm_model || ''
}
// Sync relevance keywords to local storage for Content Script
chrome.storage.local.set({ relevance_keywords: form.value.relevance_keywords })
}
} catch (err: any) {
@@ -74,11 +73,10 @@ const saveProfile = async () => {
throw new Error(data.message || 'Failed to save profile')
}
// Sync relevance keywords to local storage for Content Script
chrome.storage.local.set({ relevance_keywords: form.value.relevance_keywords })
savedMessage.value = 'Profile saved successfully!'
setTimeout(() => { savedMessage.value = '' }, 3000)
savedMessage.value = 'Profile successfully synchronized.'
setTimeout(() => { savedMessage.value = '' }, 4000)
} catch (err: any) {
errorMsg.value = err.message
@@ -95,121 +93,120 @@ onMounted(() => {
</script>
<template>
<div v-if="isLoading" class="p-10 flex justify-center">
<div class="w-6 h-6 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
<div v-if="isLoading" class="py-20 flex justify-center">
<div class="w-8 h-8 border-2 border-white/10 border-t-rose-500 rounded-full animate-spin"></div>
</div>
<form v-else @submit.prevent="saveProfile" class="space-y-6">
<div v-if="errorMsg" class="p-3 bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg">
{{ errorMsg }}
</div>
<div v-if="savedMessage" class="p-3 bg-green-500/10 border border-green-500/20 text-green-400 text-sm rounded-lg">
{{ savedMessage }}
</div>
<div v-else class="space-y-12 animate-in fade-in duration-700">
<header class="space-y-1">
<h2 class="text-2xl font-bold tracking-tight">Product DNA</h2>
<p class="text-sm text-zinc-500 font-medium">Shape your AI's core knowledge about what you're building.</p>
</header>
<div class="grid grid-cols-2 gap-6">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Product Name</label>
<input
v-model="form.product_name"
type="text"
required
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. SwiftBiu"
/>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Industry / Niche</label>
<input
v-model="form.industry"
type="text"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. AI Tools, Developer Productivity"
/>
</div>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Target Audience</label>
<input
v-model="form.target_audience"
type="text"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. Indie hackers building on MacOS"
/>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300 flex items-center gap-2">
Core Features
<span class="text-[10px] text-zinc-500 font-normal">What does your product do?</span>
</label>
<textarea
v-model="form.core_features"
rows="3"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors resize-none"
placeholder="e.g. One-click screenshot translation, local OCR, native macOS support..."
></textarea>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300 flex items-center gap-2">
User Intent / Pitch Angle
<span class="text-[10px] text-zinc-500 font-normal">How do you usually reply to people?</span>
</label>
<textarea
v-model="form.user_intent"
rows="2"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors resize-none"
placeholder="e.g. I generally want to help people solve translation problems and mention that SwiftBiu is a fast native solution."
></textarea>
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-300">Relevance Keywords (Comma separated)</label>
<input
v-model="form.relevance_keywords"
type="text"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. translation, OCR, macos app, bob alternative"
/>
</div>
<div class="pt-4 border-t border-white/10 pb-2">
<h3 class="text-sm font-medium text-zinc-300 mb-4">Advanced: Preferred LLM Override</h3>
<div class="grid grid-cols-2 gap-6">
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-400">Provider</label>
<select
v-model="form.default_llm_provider"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 appearance-none"
>
<option value="">System Default (Recommended)</option>
<option v-for="p in providers" :key="p" :value="p">{{ p.charAt(0).toUpperCase() + p.slice(1) }}</option>
</select>
<form @submit.prevent="saveProfile" class="space-y-10">
<!-- Notifications -->
<transition enter-active-class="transition duration-300 transform" enter-from-class="opacity-0 -translate-y-2" enter-to-class="opacity-100 translate-y-0">
<div v-if="errorMsg" class="p-4 bg-rose-500/10 border border-rose-500/20 text-rose-400 text-xs font-bold rounded-2xl flex items-center gap-3">
<span class="text-base"></span>
{{ errorMsg }}
</div>
<div class="space-y-1.5">
<label class="text-xs font-medium text-zinc-400">Model Name</label>
<input
v-model="form.default_llm_model"
type="text"
class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 transition-colors"
placeholder="e.g. gpt-4o, claude-3-5-sonnet"
/>
</transition>
<transition enter-active-class="transition duration-300 transform" enter-from-class="opacity-0 -translate-y-2" enter-to-class="opacity-100 translate-y-0">
<div v-if="savedMessage" class="p-4 bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-xs font-bold rounded-2xl flex items-center gap-3">
<span class="text-base"></span>
{{ savedMessage }}
</div>
</div>
</div>
</transition>
<div class="pt-4 flex justify-end">
<button
type="submit"
:disabled="isSaving"
class="px-6 py-2.5 bg-brand-primary hover:bg-brand-primary/90 text-white rounded-lg text-sm font-medium transition-all shadow-lg flex items-center justify-center gap-2 disabled:opacity-70 disabled:cursor-not-allowed"
>
<span v-if="isSaving" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></span>
{{ isSaving ? 'Saving...' : 'Save Profile' }}
</button>
</div>
</form>
<!-- Basic Info Section -->
<section class="space-y-6">
<div class="grid grid-cols-2 gap-8">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Product Name</label>
<input v-model="form.product_name" required class="dashboard-input" placeholder="e.g. InsightReply" />
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Industry / Domain</label>
<input v-model="form.industry" class="dashboard-input" placeholder="e.g. AI-Powered Marketing" />
</div>
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Target Persona</label>
<input v-model="form.target_audience" class="dashboard-input" placeholder="e.g. Founders & Indie Hackers on X" />
</div>
</section>
<!-- Knowledge Base Section -->
<section class="space-y-8 pt-4">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1 flex items-center gap-2">
Value Propositions
<span class="text-[9px] text-zinc-700 font-black lowercase tracking-normal bg-zinc-900 px-2 py-0.5 rounded border border-white/5 italic">essential knowledge</span>
</label>
<textarea v-model="form.core_features" rows="4" class="dashboard-input resize-none py-4" placeholder="Distill 3-5 unique features that set your product apart."></textarea>
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">The "Hook" / Conversation Intent</label>
<textarea v-model="form.user_intent" rows="3" class="dashboard-input resize-none py-4" placeholder="How do you want to position yourself in replies? Helpful advisor, sharp critic, etc."></textarea>
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Radar Keywords <span class="text-zinc-700">(comma-separated)</span></label>
<input v-model="form.relevance_keywords" class="dashboard-input" placeholder="e.g. marketing, automation, twitter growth, productivity" />
</div>
</section>
<!-- System Logic Section -->
<section class="pt-8 border-t border-white/5 space-y-6">
<header class="space-y-1">
<h3 class="text-sm font-bold text-zinc-400">Advanced: Neutral Intelligence</h3>
<p class="text-[11px] text-zinc-600 font-medium">Override the primary engine models if you have specific performance needs.</p>
</header>
<div class="grid grid-cols-2 gap-8">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">LLM Provider</label>
<div class="relative">
<select v-model="form.default_llm_provider" class="dashboard-input appearance-none cursor-pointer">
<option value="">Global Default (Automated)</option>
<option v-for="p in providers" :key="p" :value="p">{{ p.charAt(0).toUpperCase() + p.slice(1) }}</option>
</select>
<div class="absolute right-5 top-1/2 -translate-y-1/2 pointer-events-none text-zinc-600">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
</div>
</div>
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Engine Model Override</label>
<input v-model="form.default_llm_model" class="dashboard-input" placeholder="e.g. gpt-4o, claude-3-5-sonnet" />
</div>
</div>
</section>
<!-- Action -->
<footer class="pt-10 flex justify-end">
<button
type="submit"
:disabled="isSaving"
class="px-10 py-4 bg-rose-500 hover:bg-rose-400 text-white rounded-2xl text-[15px] font-bold transition-apple shadow-xl shadow-rose-900/40 flex items-center gap-3 active:scale-95 disabled:opacity-50"
>
<div v-if="isSaving" class="w-5 h-5 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
<svg v-else xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="text-rose-100"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
{{ isSaving ? 'Committing Changes...' : 'Synchronize Product DNA' }}
</button>
</footer>
</form>
</div>
</template>
<style scoped>
.dashboard-input {
@apply w-full bg-black/40 border border-white/5 rounded-2xl px-5 py-3.5 text-sm font-semibold;
@apply transition-apple focus:outline-none focus:ring-4 focus:ring-rose-500/10 focus:border-rose-500/40 placeholder:text-zinc-700;
}
</style>

View File

@@ -50,7 +50,6 @@ const createStrategy = async () => {
throw new Error(data.message || 'Failed to create strategy')
}
// Reset form & reload
form.value = { strategy_key: '', label: '', description: '' }
showForm.value = false
await fetchStrategies()
@@ -84,75 +83,91 @@ onMounted(() => {
</script>
<template>
<div class="space-y-6">
<div class="space-y-12">
<div v-if="isLoading" class="p-10 flex justify-center">
<div class="w-6 h-6 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
<header class="flex justify-between items-end">
<div class="space-y-1">
<h2 class="text-2xl font-bold tracking-tight">AI Content Strategies</h2>
<p class="text-sm text-zinc-500 font-medium">Fine-tune how your AI assistant approaches engagement for different personas.</p>
</div>
<button
v-if="!showForm"
@click="showForm = true"
class="px-5 py-2.5 bg-rose-500 hover:bg-rose-400 text-white rounded-[14px] text-sm font-bold transition-apple shadow-lg shadow-rose-900/20 active:scale-95 flex items-center gap-2"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
New Strategy
</button>
</header>
<div v-if="isLoading" class="py-20 flex justify-center">
<div class="w-8 h-8 border-2 border-white/10 border-t-rose-500 rounded-full animate-spin"></div>
</div>
<div v-else>
<div class="flex justify-between items-center mb-6">
<p class="text-sm text-zinc-400">These custom prompt angles will appear dynamically in your Twitter sidebar.</p>
<button
v-if="!showForm"
@click="showForm = true"
class="px-4 py-2 bg-brand-primary/20 text-brand-primary border border-brand-primary/30 rounded-lg text-xs font-semibold hover:bg-brand-primary hover:text-white transition-colors flex items-center gap-1"
>
+ Create Custom Strategy
</button>
</div>
<!-- Create Form -->
<form v-if="showForm" @submit.prevent="createStrategy" class="bg-white/5 border border-white/10 rounded-xl p-6 space-y-4 mb-8">
<div class="flex justify-between items-center mb-2">
<h3 class="text-sm font-semibold text-white">New Strategy</h3>
<button type="button" @click="showForm = false" class="text-zinc-500 hover:text-white"></button>
</div>
<div v-if="errorMsg" class="p-3 bg-red-500/10 border border-red-500/20 text-red-400 text-xs rounded-lg">
{{ errorMsg }}
</div>
<div class="grid grid-cols-2 gap-4">
<div class="space-y-1.5">
<label class="text-[11px] font-medium text-zinc-400 uppercase tracking-widest">Internal ID</label>
<input v-model="form.strategy_key" required class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50" placeholder="e.g. startup_pitch" />
<div v-else class="space-y-8">
<!-- Create Form Modal View -->
<transition enter-active-class="transition duration-500 ease-out transform" enter-from-class="opacity-0 scale-95 -translate-y-4" enter-to-class="opacity-100 scale-100 translate-y-0">
<form v-if="showForm" @submit.prevent="createStrategy" class="bg-white/[0.03] border border-white/5 rounded-[32px] p-8 space-y-8 shadow-2xl relative">
<div class="flex justify-between items-center">
<h3 class="text-lg font-bold">New Prompt Angle</h3>
<button type="button" @click="showForm = false" class="p-2 rounded-full hover:bg-white/5 transition-apple">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
<div class="space-y-1.5">
<label class="text-[11px] font-medium text-zinc-400 uppercase tracking-widest">Display Label (Sidebar)</label>
<input v-model="form.label" required class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50" placeholder="e.g. Startup Pitch" />
<div v-if="errorMsg" class="p-4 bg-rose-500/10 border border-rose-500/20 text-rose-400 text-xs font-bold rounded-xl animate-pulse">
{{ errorMsg }}
</div>
</div>
<div class="space-y-1.5">
<label class="text-[11px] font-medium text-zinc-400 uppercase tracking-widest">Prompt Instructions</label>
<textarea v-model="form.description" required rows="3" class="w-full bg-[#0A0A0A] border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-brand-primary/50 resize-none" placeholder="Instruct the AI exactly how to respond using this strategy. e.g. Be concise, act like a VC, ask challenging questions."></textarea>
</div>
<div class="flex justify-end pt-2">
<button type="submit" :disabled="isSubmitting" class="px-5 py-2 bg-brand-primary hover:bg-brand-primary/90 text-white rounded-lg text-sm font-medium transition-all shadow-lg flex items-center justify-center gap-2 disabled:opacity-70 disabled:cursor-not-allowed">
<span v-if="isSubmitting" class="w-3 h-3 border-2 border-white/20 border-t-white rounded-full animate-spin"></span>
{{ isSubmitting ? 'Saving...' : 'Add Strategy' }}
</button>
</div>
</form>
<!-- List -->
<div v-if="strategies.length === 0 && !showForm" class="text-center p-12 border border-dashed border-white/10 rounded-xl text-zinc-500">
You haven't created any custom strategies yet.
</div>
<div class="space-y-4">
<div v-for="s in strategies" :key="s.id" class="bg-white/5 border border-white/10 rounded-xl p-5 flex justify-between items-start group hover:border-white/20 transition-colors">
<div class="space-y-2">
<div class="flex items-center gap-3">
<span class="text-sm font-semibold text-white">{{ s.label }}</span>
<span class="text-[10px] font-mono text-brand-primary bg-brand-primary/10 px-2 py-0.5 rounded-full">{{ s.strategy_key }}</span>
<div class="grid grid-cols-2 gap-8">
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Internal Reference ID</label>
<input v-model="form.strategy_key" required class="dashboard-input" placeholder="e.g. vc_advisor" />
</div>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Display Label</label>
<input v-model="form.label" required class="dashboard-input" placeholder="e.g. VC Advisor" />
</div>
<p class="text-xs text-zinc-400 leading-relaxed max-w-2xl">{{ s.description }}</p>
</div>
<button @click="deleteStrategy(s.id)" class="opacity-0 group-hover:opacity-100 transition-opacity text-red-500 hover:text-red-400 p-2 rounded-lg hover:bg-red-500/10">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
<div class="space-y-3">
<label class="text-[10px] font-bold text-zinc-500 uppercase tracking-[0.2em] ml-1">Prompt Instructions & constraints</label>
<textarea v-model="form.description" required rows="4" class="dashboard-input resize-none py-4" placeholder="Be authoritative yet encouraging. Focus on market metrics. Avoid safe 'that's great' comments."></textarea>
</div>
<div class="flex justify-end">
<button type="submit" :disabled="isSubmitting" class="px-8 py-3.5 bg-rose-500 hover:bg-rose-400 text-white rounded-2xl text-[15px] font-bold transition-apple shadow-xl shadow-rose-900/30 flex items-center gap-3 active:scale-95 disabled:opacity-50">
<div v-if="isSubmitting" class="w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"></div>
{{ isSubmitting ? 'Architecting...' : 'Save Strategy' }}
</button>
</div>
</form>
</transition>
<!-- Strategy List -->
<div v-if="strategies.length === 0 && !showForm" class="text-center py-20 bg-white/[0.01] border-2 border-dashed border-white/5 rounded-[40px] space-y-4">
<div class="w-16 h-16 bg-white/[0.03] rounded-3xl mx-auto flex items-center justify-center border border-white/5">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-zinc-700"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>
</div>
<p class="text-zinc-500 font-bold tracking-tight">No custom strategies deployed yet.</p>
</div>
<div class="grid grid-cols-1 gap-4">
<div v-for="s in strategies" :key="s.id" class="group bg-white/[0.02] border border-white/5 rounded-[28px] p-6 flex justify-between items-center transition-apple hover:bg-white/[0.04] hover:border-white/10 hover:shadow-2xl">
<div class="flex items-center gap-6">
<div class="w-14 h-14 bg-rose-500/5 border border-rose-500/10 rounded-2xl flex items-center justify-center text-rose-500 group-hover:scale-110 transition-apple">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>
</div>
<div class="space-y-1.5">
<div class="flex items-center gap-3">
<span class="text-[17px] font-black tracking-tight group-hover:text-rose-400 transition-apple">{{ s.label }}</span>
<span class="text-[9px] font-black font-mono text-zinc-500 bg-black/40 px-2 py-0.5 rounded-md border border-white/5 uppercase tracking-tighter">{{ s.strategy_key }}</span>
</div>
<p class="text-[13px] text-zinc-500 leading-relaxed font-medium max-w-xl group-hover:text-zinc-400 transition-apple">{{ s.description }}</p>
</div>
</div>
<button @click="deleteStrategy(s.id)" class="p-4 rounded-2xl text-zinc-700 hover:text-rose-500 hover:bg-rose-500/10 transition-apple opacity-0 group-hover:opacity-100 active:scale-95">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
</button>
</div>
</div>
@@ -160,3 +175,10 @@ onMounted(() => {
</div>
</div>
</template>
<style scoped>
.dashboard-input {
@apply w-full bg-black/40 border border-white/5 rounded-2xl px-5 py-3.5 text-sm font-semibold;
@apply transition-apple focus:outline-none focus:ring-4 focus:ring-rose-500/10 focus:border-rose-500/40 placeholder:text-zinc-700;
}
</style>

View File

@@ -1,79 +1,54 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
--apple-bg-base: #09090b;
--apple-bg-translucent: rgba(9, 9, 11, 0.7);
--apple-border: rgba(255, 255, 255, 0.08);
--apple-text-primary: #f8fafc;
--apple-text-secondary: #94a3b8;
--apple-accent-rose: #881337;
--apple-accent-blue: #3b82f6;
--apple-blur: blur(20px) saturate(180%);
font-family: 'Inter', system-ui, -apple-system, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
padding: 0;
background-color: transparent; /* Allows glassmorphism */
color: var(--apple-text-primary);
overflow: hidden;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
/* Custom Scrollbar - Apple Style */
::-webkit-scrollbar {
width: 5px;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
::-webkit-scrollbar-track {
background: transparent;
}
.card {
padding: 2em;
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.2);
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
/* Base Transitions */
.transition-apple {
transition: all 400ms cubic-bezier(0.23, 1, 0.32, 1);
}
/* Glass Card */
.glass-card {
background: var(--apple-bg-translucent);
backdrop-filter: var(--apple-blur);
-webkit-backdrop-filter: var(--apple-blur);
border: 1px solid var(--apple-border);
}

View File

@@ -4,7 +4,7 @@ globs: *.ts, *.tsx, *.vue, *.css, *.html
---
# InsightReply 前端 UI/UX 编码规范与实现方案
本文档基于 `ui-ux-pro-max` 高级设计理念以及现代前端工程化标准,定义了 InsightReply 浏览器插件和 Web 后台的开发规范。
本文档基于 /Users/zs/.agents/skills `ui-ux-pro-max` 高级设计理念以及现代前端工程化标准,定义了 InsightReply 浏览器插件和 Web 后台的开发规范。
## 一、 核心视觉原则 (ui-ux-pro-max 特性)