Create new Vite + React frontend
- New web-client-new/ directory with Vite + React + TypeScript + Tailwind CSS 4 - Ported auth-client, api, and ws libraries with Vite env vars (VITE_*) - Created main pages: LoginPage, ProjectPage, CreateProjectPage, SettingsPage, AgentsPage - WebSocket client now uses JWT token in query parameter for direct Tracker auth - All components use react-router-dom instead of Next.js navigation - Builds successfully with dist/ output
This commit is contained in:
parent
77b5b4c735
commit
f3c7f5b07e
1
tracker
Submodule
1
tracker
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit dbd20ff550311f01d353cd04fc09fa419ca2a6b5
|
||||
2
web-client-new/.env
Normal file
2
web-client-new/.env
Normal file
@ -0,0 +1,2 @@
|
||||
VITE_API_URL=https://dev.team.uix.su
|
||||
VITE_WS_URL=wss://dev.team.uix.su
|
||||
24
web-client-new/.gitignore
vendored
Normal file
24
web-client-new/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
73
web-client-new/README.md
Normal file
73
web-client-new/README.md
Normal file
@ -0,0 +1,73 @@
|
||||
# React + TypeScript + Vite
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||
|
||||
## React Compiler
|
||||
|
||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||
|
||||
## Expanding the ESLint configuration
|
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
|
||||
```js
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
tseslint.configs.stylisticTypeChecked,
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from 'eslint-plugin-react-x'
|
||||
import reactDom from 'eslint-plugin-react-dom'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs['recommended-typescript'],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
23
web-client-new/eslint.config.js
Normal file
23
web-client-new/eslint.config.js
Normal file
@ -0,0 +1,23 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
},
|
||||
])
|
||||
13
web-client-new/index.html
Normal file
13
web-client-new/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>web-client-new</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
3849
web-client-new/package-lock.json
generated
Normal file
3849
web-client-new/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
web-client-new/package.json
Normal file
33
web-client-new/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "web-client-new",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.2.1",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"react-router-dom": "^7.13.1",
|
||||
"tailwindcss": "^4.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"globals": "^16.5.0",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.48.0",
|
||||
"vite": "^7.3.1"
|
||||
}
|
||||
}
|
||||
1
web-client-new/public/vite.svg
Normal file
1
web-client-new/public/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
42
web-client-new/src/App.css
Normal file
42
web-client-new/src/App.css
Normal file
@ -0,0 +1,42 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
87
web-client-new/src/App.tsx
Normal file
87
web-client-new/src/App.tsx
Normal file
@ -0,0 +1,87 @@
|
||||
import { BrowserRouter as Router, Routes, Route, Navigate } from "react-router-dom";
|
||||
import LoginPage from "./pages/LoginPage";
|
||||
import ProjectPage from "./pages/ProjectPage";
|
||||
import CreateProjectPage from "./pages/CreateProjectPage";
|
||||
import SettingsPage from "./pages/SettingsPage";
|
||||
import AgentsPage from "./pages/AgentsPage";
|
||||
import AuthGuard from "./components/AuthGuard";
|
||||
import { isAuthenticated } from "./lib/auth-client";
|
||||
import { wsClient } from "./lib/ws";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
function RedirectToFirstProject() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const redirect = () => {
|
||||
if (wsClient.connected && wsClient.projects.length > 0) {
|
||||
window.location.href = `/projects/${wsClient.projects[0].slug}`;
|
||||
} else if (wsClient.connected) {
|
||||
window.location.href = "/projects/new";
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
if (wsClient.connected) {
|
||||
redirect();
|
||||
return;
|
||||
}
|
||||
|
||||
const unsubscribe = wsClient.on("auth.ok", redirect);
|
||||
return () => {
|
||||
if (unsubscribe) unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center text-[var(--muted)]">
|
||||
Загрузка...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path="/login" element={
|
||||
isAuthenticated() ? <Navigate to="/" replace /> : <LoginPage />
|
||||
} />
|
||||
|
||||
<Route path="/" element={
|
||||
<AuthGuard>
|
||||
<RedirectToFirstProject />
|
||||
</AuthGuard>
|
||||
} />
|
||||
|
||||
<Route path="/projects/new" element={
|
||||
<AuthGuard>
|
||||
<CreateProjectPage />
|
||||
</AuthGuard>
|
||||
} />
|
||||
|
||||
<Route path="/projects/:slug" element={
|
||||
<AuthGuard>
|
||||
<ProjectPage />
|
||||
</AuthGuard>
|
||||
} />
|
||||
|
||||
<Route path="/settings" element={
|
||||
<AuthGuard>
|
||||
<SettingsPage />
|
||||
</AuthGuard>
|
||||
} />
|
||||
|
||||
<Route path="/settings/agents" element={
|
||||
<AuthGuard>
|
||||
<AgentsPage />
|
||||
</AuthGuard>
|
||||
} />
|
||||
</Routes>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
34
web-client-new/src/components/AuthGuard.tsx
Normal file
34
web-client-new/src/components/AuthGuard.tsx
Normal file
@ -0,0 +1,34 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { isAuthenticated } from "@/lib/auth-client";
|
||||
import { wsClient } from "@/lib/ws";
|
||||
|
||||
export default function AuthGuard({ children }: { children: React.ReactNode }) {
|
||||
const navigate = useNavigate();
|
||||
const [checked, setChecked] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated()) {
|
||||
navigate("/login", { replace: true });
|
||||
} else {
|
||||
setChecked(true);
|
||||
// Connect WebSocket after auth check
|
||||
if (!wsClient.connected) {
|
||||
wsClient.connect();
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
// Don't disconnect on unmount — singleton stays alive
|
||||
};
|
||||
}, [navigate]);
|
||||
|
||||
if (!checked) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center text-[var(--muted)]">
|
||||
Загрузка...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
16
web-client-new/src/index.css
Normal file
16
web-client-new/src/index.css
Normal file
@ -0,0 +1,16 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--bg: #0a0a0a;
|
||||
--fg: #ededed;
|
||||
--accent: #3b82f6;
|
||||
--border: #262626;
|
||||
--card: #141414;
|
||||
--muted: #737373;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
}
|
||||
279
web-client-new/src/lib/api.ts
Normal file
279
web-client-new/src/lib/api.ts
Normal file
@ -0,0 +1,279 @@
|
||||
/**
|
||||
* API client for Team Board Tracker (direct connection).
|
||||
*/
|
||||
|
||||
const API_BASE = import.meta.env.VITE_API_URL!; // Required — set in .env
|
||||
|
||||
function getToken(): string | null {
|
||||
if (typeof window === "undefined") return null;
|
||||
return localStorage.getItem("tb_token");
|
||||
}
|
||||
|
||||
async function request<T = any>(path: string, options: RequestInit = {}): Promise<T> {
|
||||
const token = getToken();
|
||||
const headers: Record<string, string> = {
|
||||
"Content-Type": "application/json",
|
||||
...(options.headers as Record<string, string>),
|
||||
};
|
||||
if (token) headers["Authorization"] = `Bearer ${token}`;
|
||||
|
||||
const res = await fetch(`${API_BASE}${path}`, { ...options, headers });
|
||||
if (!res.ok) {
|
||||
if (res.status === 401 && typeof window !== "undefined") {
|
||||
localStorage.removeItem("tb_token");
|
||||
window.location.href = "/login";
|
||||
throw new Error("Unauthorized");
|
||||
}
|
||||
const err = await res.json().catch(() => ({ error: res.statusText }));
|
||||
throw new Error(err.error || `HTTP ${res.status}`);
|
||||
}
|
||||
if (res.status === 204) return {} as T;
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// --- Types ---
|
||||
|
||||
export interface AgentConfig {
|
||||
capabilities: string[];
|
||||
chat_listen: string;
|
||||
task_listen: string;
|
||||
prompt: string | null;
|
||||
model: string | null;
|
||||
}
|
||||
|
||||
export interface Member {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
type: "human" | "agent";
|
||||
role: string;
|
||||
status: string;
|
||||
avatar_url: string | null;
|
||||
agent_config: AgentConfig | null;
|
||||
token?: string | null;
|
||||
}
|
||||
|
||||
export interface MemberCreateResponse extends Member {
|
||||
token?: string;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description: string | null;
|
||||
repo_urls: string[];
|
||||
status: string;
|
||||
task_counter: number;
|
||||
chat_id: string | null;
|
||||
}
|
||||
|
||||
export interface Step {
|
||||
id: string;
|
||||
title: string;
|
||||
done: boolean;
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
id: string;
|
||||
project_id: string;
|
||||
parent_id: string | null;
|
||||
number: number;
|
||||
key: string;
|
||||
title: string;
|
||||
description: string | null;
|
||||
type: string;
|
||||
status: string;
|
||||
priority: string;
|
||||
labels: string[];
|
||||
assignee_slug: string | null;
|
||||
reviewer_slug: string | null;
|
||||
watchers: string[];
|
||||
depends_on: string[];
|
||||
position: number;
|
||||
time_spent: number;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
export interface Attachment {
|
||||
id: string;
|
||||
filename: string;
|
||||
mime_type: string | null;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
id: string;
|
||||
chat_id: string | null;
|
||||
task_id: string | null;
|
||||
parent_id: string | null;
|
||||
author_type: string;
|
||||
author_slug: string;
|
||||
content: string;
|
||||
mentions: string[];
|
||||
voice_url: string | null;
|
||||
attachments: Attachment[];
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// --- Auth ---
|
||||
|
||||
export async function login(login: string, password: string) {
|
||||
return request("/api/auth/login", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ login, password }),
|
||||
});
|
||||
}
|
||||
|
||||
// --- Projects ---
|
||||
|
||||
export async function getProjects(): Promise<Project[]> {
|
||||
return request("/api/v1/projects");
|
||||
}
|
||||
|
||||
export async function getProject(slug: string): Promise<Project> {
|
||||
return request(`/api/v1/projects/${slug}`);
|
||||
}
|
||||
|
||||
export async function createProject(data: { name: string; slug: string; description?: string }): Promise<Project> {
|
||||
return request("/api/v1/projects", { method: "POST", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function updateProject(slug: string, data: Partial<Pick<Project, "name" | "description" | "repo_urls" | "status">>): Promise<Project> {
|
||||
return request(`/api/v1/projects/${slug}`, { method: "PATCH", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function deleteProject(slug: string): Promise<void> {
|
||||
await request(`/api/v1/projects/${slug}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
// --- Tasks ---
|
||||
|
||||
export async function getTasks(projectId: string): Promise<Task[]> {
|
||||
return request(`/api/v1/tasks?project_id=${projectId}`);
|
||||
}
|
||||
|
||||
export async function getTask(taskId: string): Promise<Task> {
|
||||
return request(`/api/v1/tasks/${taskId}`);
|
||||
}
|
||||
|
||||
export async function createTask(projectSlug: string, data: Partial<Task>): Promise<Task> {
|
||||
return request(`/api/v1/tasks?project_slug=${projectSlug}`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateTask(taskId: string, data: Partial<Task>): Promise<Task> {
|
||||
return request(`/api/v1/tasks/${taskId}`, { method: "PATCH", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function deleteTask(taskId: string): Promise<void> {
|
||||
await request(`/api/v1/tasks/${taskId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export async function takeTask(taskId: string, slug: string): Promise<Task> {
|
||||
return request(`/api/v1/tasks/${taskId}/take?slug=${slug}`, { method: "POST" });
|
||||
}
|
||||
|
||||
export async function rejectTask(taskId: string, reason: string): Promise<{ok: boolean; reason: string; old_assignee: string}> {
|
||||
return request(`/api/v1/tasks/${taskId}/reject`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ reason })
|
||||
});
|
||||
}
|
||||
|
||||
export async function assignTask(taskId: string, assigneeSlug: string): Promise<Task> {
|
||||
return request(`/api/v1/tasks/${taskId}/assign`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ assignee_slug: assigneeSlug })
|
||||
});
|
||||
}
|
||||
|
||||
export async function watchTask(taskId: string, slug: string): Promise<{ok: boolean; watchers: string[]}> {
|
||||
return request(`/api/v1/tasks/${taskId}/watch?slug=${slug}`, { method: "POST" });
|
||||
}
|
||||
|
||||
export async function unwatchTask(taskId: string, slug: string): Promise<{ok: boolean; watchers: string[]}> {
|
||||
return request(`/api/v1/tasks/${taskId}/watch?slug=${slug}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
// --- Steps ---
|
||||
|
||||
export async function getSteps(taskId: string): Promise<Step[]> {
|
||||
return request(`/api/v1/tasks/${taskId}/steps`);
|
||||
}
|
||||
|
||||
export async function createStep(taskId: string, title: string): Promise<Step> {
|
||||
return request(`/api/v1/tasks/${taskId}/steps`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ title }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateStep(taskId: string, stepId: string, data: Partial<Step>): Promise<Step> {
|
||||
return request(`/api/v1/tasks/${taskId}/steps/${stepId}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteStep(taskId: string, stepId: string): Promise<void> {
|
||||
await request(`/api/v1/tasks/${taskId}/steps/${stepId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
// --- Messages (unified: chat + task comments) ---
|
||||
|
||||
export async function getMessages(params: { chat_id?: string; task_id?: string; limit?: number }): Promise<Message[]> {
|
||||
const qs = new URLSearchParams();
|
||||
if (params.chat_id) qs.set("chat_id", params.chat_id);
|
||||
if (params.task_id) qs.set("task_id", params.task_id);
|
||||
if (params.limit) qs.set("limit", String(params.limit));
|
||||
return request(`/api/v1/messages?${qs}`);
|
||||
}
|
||||
|
||||
export async function sendMessage(data: {
|
||||
chat_id?: string;
|
||||
task_id?: string;
|
||||
content: string;
|
||||
mentions?: string[];
|
||||
}): Promise<Message> {
|
||||
return request("/api/v1/messages", { method: "POST", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
// --- Members ---
|
||||
|
||||
export async function getMembers(): Promise<Member[]> {
|
||||
return request("/api/v1/members");
|
||||
}
|
||||
|
||||
export async function getMember(slug: string): Promise<Member> {
|
||||
return request(`/api/v1/members/${slug}`);
|
||||
}
|
||||
|
||||
export async function createMember(data: {
|
||||
name: string;
|
||||
slug: string;
|
||||
type?: string;
|
||||
agent_config?: Partial<AgentConfig>;
|
||||
}): Promise<MemberCreateResponse> {
|
||||
return request("/api/v1/members", { method: "POST", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function updateMember(slug: string, data: {
|
||||
name?: string;
|
||||
role?: string;
|
||||
status?: string;
|
||||
agent_config?: Partial<AgentConfig>;
|
||||
}): Promise<Member> {
|
||||
return request(`/api/v1/members/${slug}`, { method: "PATCH", body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export async function regenerateToken(slug: string): Promise<{ token: string }> {
|
||||
return request(`/api/v1/members/${slug}/regenerate-token`, { method: "POST" });
|
||||
}
|
||||
|
||||
export async function revokeToken(slug: string): Promise<void> {
|
||||
await request(`/api/v1/members/${slug}/revoke-token`, { method: "POST" });
|
||||
}
|
||||
28
web-client-new/src/lib/auth-client.ts
Normal file
28
web-client-new/src/lib/auth-client.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Client-side JWT auth.
|
||||
* Token stored in localStorage, sent as Authorization: Bearer header.
|
||||
*/
|
||||
|
||||
const TOKEN_KEY = "tb_token";
|
||||
|
||||
export function getToken(): string | null {
|
||||
if (typeof window === "undefined") return null;
|
||||
return localStorage.getItem(TOKEN_KEY);
|
||||
}
|
||||
|
||||
export function setToken(token: string) {
|
||||
localStorage.setItem(TOKEN_KEY, token);
|
||||
}
|
||||
|
||||
export function clearToken() {
|
||||
localStorage.removeItem(TOKEN_KEY);
|
||||
}
|
||||
|
||||
export function isAuthenticated(): boolean {
|
||||
return !!getToken();
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
clearToken();
|
||||
window.location.href = "/login";
|
||||
}
|
||||
120
web-client-new/src/lib/ws.ts
Normal file
120
web-client-new/src/lib/ws.ts
Normal file
@ -0,0 +1,120 @@
|
||||
/**
|
||||
* WebSocket client for Team Board.
|
||||
* Connects directly to Tracker with JWT token in query parameter.
|
||||
*/
|
||||
|
||||
type MessageHandler = (data: any) => void;
|
||||
|
||||
class WSClient {
|
||||
private ws: WebSocket | null = null;
|
||||
private handlers: Map<string, Set<MessageHandler>> = new Map();
|
||||
private reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
private pendingQueue: any[] = [];
|
||||
private authenticated = false;
|
||||
private _lobbyId: string | null = null;
|
||||
private _projects: Array<{ id: string; slug: string; name: string }> = [];
|
||||
private _online: string[] = [];
|
||||
|
||||
get lobbyId() { return this._lobbyId; }
|
||||
get projects() { return this._projects; }
|
||||
get online() { return this._online; }
|
||||
get connected() { return this.ws?.readyState === WebSocket.OPEN; }
|
||||
|
||||
connect() {
|
||||
const token = localStorage.getItem("tb_token");
|
||||
if (!token) return;
|
||||
|
||||
const wsBase = import.meta.env.VITE_WS_URL;
|
||||
if (!wsBase) {
|
||||
console.error("VITE_WS_URL is not set!");
|
||||
return;
|
||||
}
|
||||
|
||||
this.authenticated = false;
|
||||
// Send JWT token in query parameter for direct authentication
|
||||
this.ws = new WebSocket(`${wsBase}/ws?token=${encodeURIComponent(token)}`);
|
||||
|
||||
this.ws.onmessage = (event) => {
|
||||
try {
|
||||
const msg = JSON.parse(event.data);
|
||||
const type = msg.type;
|
||||
|
||||
// Handle auth.ok — flush pending queue
|
||||
if (type === "auth.ok") {
|
||||
this._lobbyId = msg.data?.lobby_chat_id || null;
|
||||
this._projects = msg.data?.projects || [];
|
||||
this._online = msg.data?.online || [];
|
||||
this.authenticated = true;
|
||||
// Flush queued messages
|
||||
for (const queued of this.pendingQueue) {
|
||||
this.ws!.send(JSON.stringify(queued));
|
||||
}
|
||||
this.pendingQueue = [];
|
||||
}
|
||||
|
||||
// Dispatch to handlers
|
||||
const fns = this.handlers.get(type);
|
||||
if (fns) fns.forEach((fn) => fn(msg.data || msg));
|
||||
|
||||
// Also dispatch to wildcard
|
||||
const all = this.handlers.get("*");
|
||||
if (all) all.forEach((fn) => fn(msg));
|
||||
} catch (e) {
|
||||
console.error("WS parse error:", e);
|
||||
}
|
||||
};
|
||||
|
||||
this.ws.onclose = () => {
|
||||
this.authenticated = false;
|
||||
this.reconnectTimer = setTimeout(() => this.connect(), 3000);
|
||||
};
|
||||
|
||||
this.ws.onerror = () => {};
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
|
||||
this.ws?.close();
|
||||
this.ws = null;
|
||||
this.authenticated = false;
|
||||
this.pendingQueue = [];
|
||||
}
|
||||
|
||||
on(type: string, handler: MessageHandler) {
|
||||
if (!this.handlers.has(type)) this.handlers.set(type, new Set());
|
||||
this.handlers.get(type)!.add(handler);
|
||||
return () => this.handlers.get(type)?.delete(handler);
|
||||
}
|
||||
|
||||
send(data: any) {
|
||||
if (this.ws?.readyState === WebSocket.OPEN && this.authenticated) {
|
||||
this.ws.send(JSON.stringify(data));
|
||||
} else {
|
||||
// Queue until connected + authenticated
|
||||
this.pendingQueue.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
// Convenience methods
|
||||
subscribeProject(projectId: string) {
|
||||
this.send({ type: "project.subscribe", project_id: projectId });
|
||||
}
|
||||
|
||||
unsubscribeProject(projectId: string) {
|
||||
this.send({ type: "project.unsubscribe", project_id: projectId });
|
||||
}
|
||||
|
||||
sendChat(chatId: string, content: string, mentions: string[] = []) {
|
||||
this.send({ type: "chat.send", chat_id: chatId, content, mentions });
|
||||
}
|
||||
|
||||
sendTaskComment(taskId: string, content: string, mentions: string[] = []) {
|
||||
this.send({ type: "chat.send", task_id: taskId, content, mentions });
|
||||
}
|
||||
|
||||
heartbeat(status: string = "online") {
|
||||
this.send({ type: "heartbeat", status });
|
||||
}
|
||||
}
|
||||
|
||||
export const wsClient = new WSClient();
|
||||
10
web-client-new/src/main.tsx
Normal file
10
web-client-new/src/main.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
128
web-client-new/src/pages/AgentsPage.tsx
Normal file
128
web-client-new/src/pages/AgentsPage.tsx
Normal file
@ -0,0 +1,128 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { getMembers, type Member } from "@/lib/api";
|
||||
import { logout } from "@/lib/auth-client";
|
||||
|
||||
const MENU = [
|
||||
{ href: "/settings", label: "Общие", icon: "⚙️" },
|
||||
{ href: "/settings/agents", label: "Агенты", icon: "🤖" },
|
||||
];
|
||||
|
||||
export default function AgentsPage() {
|
||||
const [agents, setAgents] = useState<Member[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const load = async () => {
|
||||
try {
|
||||
const members = await getMembers();
|
||||
setAgents(members.filter((m) => m.type === "agent"));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="h-screen flex overflow-hidden">
|
||||
<aside className="w-52 shrink-0 border-r border-[var(--border)] bg-[var(--card)] flex flex-col">
|
||||
<div className="p-4 border-b border-[var(--border)] flex items-center gap-2">
|
||||
<Link to="/" className="text-[var(--muted)] hover:text-[var(--fg)] transition-colors cursor-pointer" title="Назад">
|
||||
←
|
||||
</Link>
|
||||
<h2 className="text-sm font-bold uppercase text-[var(--muted)]">Настройки</h2>
|
||||
</div>
|
||||
<nav className="flex-1 p-2 space-y-1">
|
||||
{MENU.map((item) => {
|
||||
const active = location.pathname === item.href;
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
to={item.href}
|
||||
className={`flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${
|
||||
active
|
||||
? "bg-[var(--accent)]/10 text-[var(--accent)]"
|
||||
: "text-[var(--fg)] hover:bg-white/5"
|
||||
}`}
|
||||
>
|
||||
<span>{item.icon}</span>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<div className="p-3 border-t border-[var(--border)]">
|
||||
<button
|
||||
onClick={logout}
|
||||
className="text-xs text-[var(--muted)] hover:text-[var(--fg)] w-full text-left"
|
||||
>
|
||||
Выйти
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<div className="p-6">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h1 className="text-2xl font-bold">🤖 Агенты</h1>
|
||||
<button
|
||||
disabled
|
||||
className="px-4 py-2 bg-[var(--card)] border border-[var(--border)] text-[var(--muted)]
|
||||
rounded-lg text-sm cursor-not-allowed opacity-50"
|
||||
>
|
||||
+ Создать агента (TODO)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div className="text-[var(--muted)] text-sm">Загрузка...</div>
|
||||
) : agents.length === 0 ? (
|
||||
<div className="text-[var(--muted)] text-sm">Нет агентов</div>
|
||||
) : (
|
||||
<div className="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
|
||||
{agents.map((agent) => (
|
||||
<div
|
||||
key={agent.id}
|
||||
className="bg-[var(--card)] border border-[var(--border)] rounded-xl p-4"
|
||||
>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<h3 className="font-semibold">{agent.name}</h3>
|
||||
<span
|
||||
className={`text-xs px-2 py-0.5 rounded-full ${
|
||||
agent.status === "online"
|
||||
? "bg-green-500/20 text-green-400"
|
||||
: "bg-gray-500/20 text-gray-400"
|
||||
}`}
|
||||
>
|
||||
{agent.status === "online" ? "online" : "offline"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-xs text-[var(--muted)] mb-3">@{agent.slug}</div>
|
||||
|
||||
{agent.agent_config?.capabilities && agent.agent_config.capabilities.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mb-3">
|
||||
{agent.agent_config.capabilities.map((cap) => (
|
||||
<span
|
||||
key={cap}
|
||||
className="text-xs px-2 py-0.5 bg-[var(--accent)]/10 text-[var(--accent)] rounded"
|
||||
>
|
||||
{cap}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="text-xs text-[var(--muted)] space-y-1">
|
||||
<div>💬 chat: {agent.agent_config?.chat_listen || "—"}</div>
|
||||
<div>📋 tasks: {agent.agent_config?.task_listen || "—"}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
89
web-client-new/src/pages/CreateProjectPage.tsx
Normal file
89
web-client-new/src/pages/CreateProjectPage.tsx
Normal file
@ -0,0 +1,89 @@
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { createProject } from "@/lib/api";
|
||||
|
||||
export default function CreateProjectPage() {
|
||||
const navigate = useNavigate();
|
||||
const [name, setName] = useState("");
|
||||
const [slug, setSlug] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim() || !slug.trim()) return;
|
||||
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
const project = await createProject({ name, slug, description: description || undefined });
|
||||
navigate(`/projects/${project.slug}`);
|
||||
} catch (err: any) {
|
||||
setError(err.message || "Ошибка создания проекта");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center">
|
||||
<form onSubmit={handleSubmit} className="w-full max-w-md px-4">
|
||||
<h1 className="text-2xl font-bold mb-6 text-center">Создать проект</h1>
|
||||
|
||||
{error && (
|
||||
<div className="mb-4 p-2 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Название проекта"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="w-full mb-3 px-4 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
outline-none focus:border-[var(--accent)] text-sm"
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Slug (например: my-project)"
|
||||
value={slug}
|
||||
onChange={(e) => setSlug(e.target.value)}
|
||||
className="w-full mb-3 px-4 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
outline-none focus:border-[var(--accent)] text-sm"
|
||||
/>
|
||||
|
||||
<textarea
|
||||
placeholder="Описание (опционально)"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full mb-4 px-4 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
outline-none focus:border-[var(--accent)] text-sm resize-none"
|
||||
/>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate("/")}
|
||||
className="flex-1 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
hover:bg-white/5 transition-colors text-sm"
|
||||
>
|
||||
Отмена
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading || !name.trim() || !slug.trim()}
|
||||
className="flex-1 py-2.5 bg-[var(--accent)] text-white rounded-lg hover:opacity-90
|
||||
transition-opacity text-sm font-medium disabled:opacity-50"
|
||||
>
|
||||
{loading ? "..." : "Создать"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
84
web-client-new/src/pages/LoginPage.tsx
Normal file
84
web-client-new/src/pages/LoginPage.tsx
Normal file
@ -0,0 +1,84 @@
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { setToken } from "@/lib/auth-client";
|
||||
import { login } from "@/lib/api";
|
||||
|
||||
export default function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setError("");
|
||||
setLoading(true);
|
||||
try {
|
||||
const data = await login(username, password);
|
||||
if (data.token) {
|
||||
setToken(data.token);
|
||||
navigate("/", { replace: true });
|
||||
} else {
|
||||
setError("Ошибка авторизации");
|
||||
}
|
||||
} catch (err: any) {
|
||||
setError(err.message || "Ошибка соединения");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center">
|
||||
<form onSubmit={handleSubmit} className="w-full max-w-80 px-4">
|
||||
<h1 className="text-3xl font-bold mb-1 text-center">Team Board</h1>
|
||||
<p className="text-[var(--muted)] mb-6 text-center text-sm">AI Agent Collaboration Platform</p>
|
||||
|
||||
{error && (
|
||||
<div className="mb-4 p-2 bg-red-500/10 border border-red-500/30 rounded text-red-400 text-sm text-center">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Логин"
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
className="w-full mb-3 px-4 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
outline-none focus:border-[var(--accent)] text-sm"
|
||||
autoFocus
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Пароль"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
className="w-full mb-4 px-4 py-2.5 bg-[var(--card)] border border-[var(--border)] rounded-lg
|
||||
outline-none focus:border-[var(--accent)] text-sm"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="w-full py-2.5 bg-[var(--accent)] text-white rounded-lg hover:opacity-90
|
||||
transition-opacity text-sm font-medium disabled:opacity-50"
|
||||
>
|
||||
{loading ? "..." : "Войти"}
|
||||
</button>
|
||||
|
||||
<div className="mt-6 text-center">
|
||||
<div className="text-xs text-[var(--muted)] mb-2">или</div>
|
||||
<button
|
||||
type="button"
|
||||
disabled
|
||||
className="w-full py-2.5 bg-[var(--card)] border border-[var(--border)] text-[var(--muted)]
|
||||
rounded-lg text-sm cursor-not-allowed opacity-50"
|
||||
>
|
||||
Войти через Authentik (скоро)
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
75
web-client-new/src/pages/ProjectPage.tsx
Normal file
75
web-client-new/src/pages/ProjectPage.tsx
Normal file
@ -0,0 +1,75 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getProjects, type Project } from "@/lib/api";
|
||||
|
||||
const TABS = [
|
||||
{ key: "board", label: "📋 Доска" },
|
||||
{ key: "chat", label: "💬 Чат" },
|
||||
{ key: "files", label: "📁 Файлы" },
|
||||
{ key: "settings", label: "⚙️ Настройки" },
|
||||
];
|
||||
|
||||
export default function ProjectPage() {
|
||||
const { slug } = useParams<{ slug: string }>();
|
||||
const [projects, setProjects] = useState<Project[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [activeTab, setActiveTab] = useState("board");
|
||||
|
||||
useEffect(() => {
|
||||
getProjects()
|
||||
.then(setProjects)
|
||||
.catch(() => {})
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
const project = projects.find((p) => p.slug === slug);
|
||||
|
||||
if (loading) {
|
||||
return <div className="flex h-screen items-center justify-center text-[var(--muted)]">Загрузка...</div>;
|
||||
}
|
||||
|
||||
if (!project) {
|
||||
return <div className="flex h-screen items-center justify-center text-[var(--muted)]">Проект не найден</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-screen">
|
||||
<main className="flex-1 flex flex-col overflow-hidden">
|
||||
<header className="border-b border-[var(--border)] px-6 py-3">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold">{project.name}</h1>
|
||||
{project.description && (
|
||||
<p className="text-sm text-[var(--muted)]">{project.description}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-1">
|
||||
{TABS.map((tab) => (
|
||||
<button
|
||||
key={tab.key}
|
||||
onClick={() => setActiveTab(tab.key)}
|
||||
className={`px-3 py-1.5 rounded text-sm transition-colors ${
|
||||
activeTab === tab.key
|
||||
? "bg-[var(--accent)]/10 text-[var(--accent)]"
|
||||
: "text-[var(--muted)] hover:bg-white/5 hover:text-[var(--fg)]"
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="flex-1 overflow-hidden flex items-center justify-center">
|
||||
<div className="text-[var(--muted)]">
|
||||
{activeTab === "board" && "📋 Kanban Board (TODO)"}
|
||||
{activeTab === "chat" && "💬 Chat Panel (TODO)"}
|
||||
{activeTab === "files" && "📁 Project Files (TODO)"}
|
||||
{activeTab === "settings" && "⚙️ Project Settings (TODO)"}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
55
web-client-new/src/pages/SettingsPage.tsx
Normal file
55
web-client-new/src/pages/SettingsPage.tsx
Normal file
@ -0,0 +1,55 @@
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { logout } from "@/lib/auth-client";
|
||||
|
||||
const MENU = [
|
||||
{ href: "/settings", label: "Общие", icon: "⚙️" },
|
||||
{ href: "/settings/agents", label: "Агенты", icon: "🤖" },
|
||||
];
|
||||
|
||||
export default function SettingsPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<div className="h-screen flex overflow-hidden">
|
||||
<aside className="w-52 shrink-0 border-r border-[var(--border)] bg-[var(--card)] flex flex-col">
|
||||
<div className="p-4 border-b border-[var(--border)] flex items-center gap-2">
|
||||
<Link to="/" className="text-[var(--muted)] hover:text-[var(--fg)] transition-colors cursor-pointer" title="Назад">
|
||||
←
|
||||
</Link>
|
||||
<h2 className="text-sm font-bold uppercase text-[var(--muted)]">Настройки</h2>
|
||||
</div>
|
||||
<nav className="flex-1 p-2 space-y-1">
|
||||
{MENU.map((item) => {
|
||||
const active = location.pathname === item.href;
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
to={item.href}
|
||||
className={`flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${
|
||||
active
|
||||
? "bg-[var(--accent)]/10 text-[var(--accent)]"
|
||||
: "text-[var(--fg)] hover:bg-white/5"
|
||||
}`}
|
||||
>
|
||||
<span>{item.icon}</span>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<div className="p-3 border-t border-[var(--border)]">
|
||||
<button
|
||||
onClick={logout}
|
||||
className="text-xs text-[var(--muted)] hover:text-[var(--fg)] w-full text-left"
|
||||
>
|
||||
Выйти
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
<div className="flex-1 overflow-y-auto p-6">
|
||||
<h1 className="text-2xl font-bold mb-6">Общие настройки</h1>
|
||||
<div className="text-[var(--muted)]">Пока что здесь пусто 🤷♂️</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
34
web-client-new/tsconfig.app.json
Normal file
34
web-client-new/tsconfig.app.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Path mapping */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
},
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
web-client-new/tsconfig.json
Normal file
7
web-client-new/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
26
web-client-new/tsconfig.node.json
Normal file
26
web-client-new/tsconfig.node.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
13
web-client-new/vite.config.ts
Normal file
13
web-client-new/vite.config.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': '/src'
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user