v 0.9.1
parent
7a57d7949b
commit
b7ee731ced
|
|
@ -0,0 +1,29 @@
|
|||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{js,jsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
reactHooks.configs['recommended-latest'],
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
ecmaFeatures: { jsx: true },
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
|
||||
},
|
||||
},
|
||||
])
|
||||
|
|
@ -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>Vite + React</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.6.2",
|
||||
"lucide-react": "^0.294.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-router-dom": "^7.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"@vitejs/plugin-react": "^4.6.0",
|
||||
"eslint": "^9.30.1",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"globals": "^16.3.0",
|
||||
"vite": "^7.0.4"
|
||||
}
|
||||
}
|
||||
|
|
@ -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 |
|
|
@ -0,0 +1,150 @@
|
|||
/* Global Styles */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
background-color: #f8fafc;
|
||||
color: #1e293b;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.app-loading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid #e2e8f0;
|
||||
border-top: 3px solid #667eea;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Utility Classes */
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mt-1 { margin-top: 0.25rem; }
|
||||
.mt-2 { margin-top: 0.5rem; }
|
||||
.mt-3 { margin-top: 0.75rem; }
|
||||
.mt-4 { margin-top: 1rem; }
|
||||
|
||||
.mb-1 { margin-bottom: 0.25rem; }
|
||||
.mb-2 { margin-bottom: 0.5rem; }
|
||||
.mb-3 { margin-bottom: 0.75rem; }
|
||||
.mb-4 { margin-bottom: 1rem; }
|
||||
|
||||
.p-1 { padding: 0.25rem; }
|
||||
.p-2 { padding: 0.5rem; }
|
||||
.p-3 { padding: 0.75rem; }
|
||||
.p-4 { padding: 1rem; }
|
||||
|
||||
/* Button Styles */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.5rem 1rem;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(45deg, #667eea, #764ba2);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
/* Input Styles */
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border: 2px solid #e1e5e9;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
/* Card Styles */
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
/* Text Styles */
|
||||
.text-sm { font-size: 0.875rem; }
|
||||
.text-base { font-size: 1rem; }
|
||||
.text-lg { font-size: 1.125rem; }
|
||||
.text-xl { font-size: 1.25rem; }
|
||||
|
||||
.font-medium { font-weight: 500; }
|
||||
.font-semibold { font-weight: 600; }
|
||||
.font-bold { font-weight: 700; }
|
||||
|
||||
.text-gray-500 { color: #64748b; }
|
||||
.text-gray-600 { color: #475569; }
|
||||
.text-gray-700 { color: #334155; }
|
||||
.text-gray-900 { color: #0f172a; }
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import HomePage from './pages/HomePage';
|
||||
import Dashboard from './pages/Dashboard';
|
||||
import MeetingDetails from './pages/MeetingDetails';
|
||||
import CreateMeeting from './pages/CreateMeeting';
|
||||
import EditMeeting from './pages/EditMeeting';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
const [user, setUser] = useState(null);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
// Load user from localStorage on app start
|
||||
useEffect(() => {
|
||||
const savedUser = localStorage.getItem('iMeetingUser');
|
||||
console.log('Saved user from localStorage:', savedUser);
|
||||
if (savedUser) {
|
||||
try {
|
||||
const parsedUser = JSON.parse(savedUser);
|
||||
console.log('Parsed user:', parsedUser);
|
||||
setUser(parsedUser);
|
||||
} catch (error) {
|
||||
console.error('Error parsing saved user:', error);
|
||||
localStorage.removeItem('iMeetingUser');
|
||||
}
|
||||
}
|
||||
setIsLoading(false);
|
||||
}, []);
|
||||
|
||||
const handleLogin = (userData) => {
|
||||
setUser(userData);
|
||||
localStorage.setItem('iMeetingUser', JSON.stringify(userData));
|
||||
};
|
||||
|
||||
const handleLogout = () => {
|
||||
setUser(null);
|
||||
localStorage.removeItem('iMeetingUser');
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="app-loading">
|
||||
<div className="loading-spinner"></div>
|
||||
<p>加载中...</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Router>
|
||||
<div className="app">
|
||||
<Routes>
|
||||
<Route path="/" element={
|
||||
user ? <Navigate to="/dashboard" /> : <HomePage onLogin={handleLogin} />
|
||||
} />
|
||||
<Route path="/dashboard" element={
|
||||
user ? <Dashboard user={user} onLogout={handleLogout} /> : <Navigate to="/" />
|
||||
} />
|
||||
<Route path="/meetings/:meeting_id" element={
|
||||
user ? <MeetingDetails /> : <Navigate to="/" />
|
||||
} />
|
||||
<Route path="/meetings/create" element={
|
||||
user ? <CreateMeeting user={user} /> : <Navigate to="/" />
|
||||
} />
|
||||
<Route path="/meetings/edit/:meeting_id" element={
|
||||
user ? <EditMeeting user={user} /> : <Navigate to="/" />
|
||||
} />
|
||||
</Routes>
|
||||
</div>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
@ -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="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
|
|
@ -0,0 +1,12 @@
|
|||
.app-header {
|
||||
background-color: #ffffff;
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.app-header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8em;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import React from 'react';
|
||||
import './Header.css';
|
||||
|
||||
const Header = () => {
|
||||
return (
|
||||
<header className="app-header">
|
||||
<h1>iMeeting (智慧会议)</h1>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
|
||||
export default Header;
|
||||
|
|
@ -0,0 +1,511 @@
|
|||
/* Timeline Container */
|
||||
.timeline-container {
|
||||
position: relative;
|
||||
padding: 2rem 0;
|
||||
}
|
||||
|
||||
.timeline-line {
|
||||
position: absolute;
|
||||
left: 6rem; /* Centered timeline */
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 2px;
|
||||
background: linear-gradient(to bottom, #e2e8f0, #94a3b8);
|
||||
border-radius: 1px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Date Section */
|
||||
.timeline-date-section {
|
||||
position: relative;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
/* This is the new circular node on the timeline */
|
||||
.timeline-date-section::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6rem;
|
||||
top: 0.5rem; /* Align with date text */
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
background: white;
|
||||
border: 3px solid #667eea;
|
||||
border-radius: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.timeline-date-node {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 5rem; /* Area for the date text */
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.date-text {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
line-height: 1.8rem; /* Vertically center with the 1rem node */
|
||||
}
|
||||
|
||||
.meetings-for-date {
|
||||
padding-left: 8rem; /* Space for date and timeline */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem; /* Use gap for consistent spacing */
|
||||
}
|
||||
|
||||
/* Empty State */
|
||||
.timeline-empty {
|
||||
text-align: center;
|
||||
padding: 4rem 2rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.timeline-empty h3 {
|
||||
margin: 1rem 0 0.5rem 0;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.timeline-empty p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.meeting-card-link {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
display: block; /* Make the link fill the container */
|
||||
}
|
||||
|
||||
/* Meeting Cards */
|
||||
.meeting-card-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.meeting-card {
|
||||
position: relative;
|
||||
opacity: 0;
|
||||
animation: fadeInUp 0.6s ease forwards;
|
||||
}
|
||||
|
||||
.meeting-title-section {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.meeting-actions {
|
||||
position: relative;
|
||||
margin-left: 1rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dropdown-trigger {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0.25rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
color: #64748b;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.dropdown-trigger:hover {
|
||||
background: #f1f5f9;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
border: 1px solid #e2e8f0;
|
||||
min-width: 120px;
|
||||
z-index: 10;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: none;
|
||||
border: none;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 0.9rem;
|
||||
color: #334155;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.dropdown-item:hover {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.dropdown-item.delete-item {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.dropdown-item.delete-item:hover {
|
||||
background: #fef2f2;
|
||||
}
|
||||
|
||||
/* Delete Modal */
|
||||
.delete-modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.delete-modal {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.delete-modal h3 {
|
||||
margin: 0 0 1rem 0;
|
||||
color: #1e293b;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.delete-modal p {
|
||||
margin: 0 0 2rem 0;
|
||||
color: #64748b;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.btn-cancel, .btn-delete {
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.meeting-card:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-content {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
border-left: 4px solid;
|
||||
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.meeting-content:hover {
|
||||
transform: translateY(-4px) scale(1.02);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.meeting-content:active {
|
||||
transform: translateY(-2px) scale(1.01);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
/* Card color coding */
|
||||
.created-by-me .meeting-content {
|
||||
border-left-color: #667eea; /* Purple for created */
|
||||
}
|
||||
|
||||
.attended-by-me .meeting-content {
|
||||
border-left-color: #34d399; /* Green for attended */
|
||||
}
|
||||
|
||||
/* Meeting Header */
|
||||
.meeting-header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.meeting-title {
|
||||
margin: 0 0 0.75rem 0;
|
||||
color: #1e293b;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.meeting-meta {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: #64748b;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.meta-item svg {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
/* Meeting Body */
|
||||
.meeting-body {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.attendees-section {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.attendees-label {
|
||||
color: #374151;
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 0.5rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.attendees-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.attendee-tag {
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
/* Summary Section */
|
||||
.summary-section {
|
||||
background: #f8fafc;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.summary-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
color: #374151;
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.summary-header svg {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.summary-content {
|
||||
color: #4b5563;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.summary-more-hint {
|
||||
margin-top: 0.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.more-text {
|
||||
color: #667eea;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Markdown content styling */
|
||||
.markdown-content {
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.markdown-content h1,
|
||||
.markdown-content h2,
|
||||
.markdown-content h3,
|
||||
.markdown-content h4,
|
||||
.markdown-content h5,
|
||||
.markdown-content h6 {
|
||||
margin: 0.5rem 0 0.25rem 0;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.markdown-content h1 { font-size: 1rem; }
|
||||
.markdown-content h2 { font-size: 0.95rem; }
|
||||
.markdown-content h3 { font-size: 0.9rem; }
|
||||
.markdown-content h4,
|
||||
.markdown-content h5,
|
||||
.markdown-content h6 { font-size: 0.85rem; }
|
||||
|
||||
.markdown-content p {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.markdown-content ul,
|
||||
.markdown-content ol {
|
||||
margin: 0.25rem 0;
|
||||
padding-left: 1.2rem;
|
||||
}
|
||||
|
||||
.markdown-content li {
|
||||
margin: 0.1rem 0;
|
||||
}
|
||||
|
||||
.markdown-content strong {
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.markdown-content em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.markdown-content code {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
padding: 0.1rem 0.3rem;
|
||||
border-radius: 3px;
|
||||
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.markdown-content blockquote {
|
||||
border-left: 3px solid #e2e8f0;
|
||||
padding-left: 0.75rem;
|
||||
margin: 0.5rem 0;
|
||||
font-style: italic;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
/* Meeting Footer */
|
||||
.meeting-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.creator-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: #94a3b8;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.timeline-line {
|
||||
left: 1rem;
|
||||
}
|
||||
|
||||
.timeline-date-section::before {
|
||||
left: 1rem;
|
||||
}
|
||||
|
||||
.timeline-date-node {
|
||||
position: static;
|
||||
width: auto;
|
||||
text-align: left;
|
||||
padding: 0 0 1rem 2rem; /* Give space for the line and node */
|
||||
}
|
||||
|
||||
.meetings-for-date {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
.meeting-card {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.meeting-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.meeting-title {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.meeting-meta {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.attendees-list {
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.attendee-tag {
|
||||
font-size: 0.75rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Clock, Users, FileText, Calendar, User, Edit, Trash2, MoreVertical } from 'lucide-react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import './MeetingTimeline.css';
|
||||
|
||||
const MeetingTimeline = ({ meetingsByDate, currentUser, onDeleteMeeting }) => {
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(null);
|
||||
const [showDropdown, setShowDropdown] = useState(null);
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
React.useEffect(() => {
|
||||
const handleClickOutside = () => {
|
||||
setShowDropdown(null);
|
||||
};
|
||||
|
||||
if (showDropdown) {
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
return () => document.removeEventListener('click', handleClickOutside);
|
||||
}
|
||||
}, [showDropdown]);
|
||||
|
||||
const formatDateTime = (dateTimeString) => {
|
||||
if (!dateTimeString) return '时间待定';
|
||||
const date = new Date(dateTimeString);
|
||||
return date.toLocaleString('zh-CN', { hour: '2-digit', minute: '2-digit' });
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('zh-CN', { month: 'long', day: 'numeric' });
|
||||
};
|
||||
|
||||
const truncateSummary = (summary, maxLines = 3, maxLength = 80) => {
|
||||
if (!summary) return '暂无摘要';
|
||||
|
||||
// Split by lines and check line count
|
||||
const lines = summary.split('\n');
|
||||
const hasMoreLines = lines.length > maxLines;
|
||||
|
||||
// Also check character length
|
||||
const hasMoreChars = summary.length > maxLength;
|
||||
|
||||
if (hasMoreLines || hasMoreChars) {
|
||||
// Take first few lines or characters, whichever is shorter
|
||||
const truncatedByLines = lines.slice(0, maxLines).join('\n');
|
||||
const truncatedByChars = summary.substring(0, maxLength);
|
||||
|
||||
const result = truncatedByLines.length <= truncatedByChars.length
|
||||
? truncatedByLines
|
||||
: truncatedByChars;
|
||||
|
||||
return result + '...';
|
||||
}
|
||||
|
||||
return summary;
|
||||
};
|
||||
|
||||
const shouldShowMoreButton = (summary, maxLines = 3, maxLength = 80) => {
|
||||
if (!summary) return false;
|
||||
const lines = summary.split('\n');
|
||||
return lines.length > maxLines || summary.length > maxLength;
|
||||
};
|
||||
|
||||
const handleDeleteClick = (meetingId, e) => {
|
||||
e.preventDefault();
|
||||
setShowDeleteConfirm(meetingId);
|
||||
setShowDropdown(null);
|
||||
};
|
||||
|
||||
const handleConfirmDelete = async (meetingId) => {
|
||||
if (onDeleteMeeting) {
|
||||
await onDeleteMeeting(meetingId);
|
||||
}
|
||||
setShowDeleteConfirm(null);
|
||||
};
|
||||
|
||||
const toggleDropdown = (meetingId, e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setShowDropdown(showDropdown === meetingId ? null : meetingId);
|
||||
};
|
||||
|
||||
const sortedDates = Object.keys(meetingsByDate).sort((a, b) => new Date(b) - new Date(a));
|
||||
|
||||
if (sortedDates.length === 0) {
|
||||
return (
|
||||
<div className="timeline-empty">
|
||||
<Calendar size={48} />
|
||||
<h3>暂无会议记录</h3>
|
||||
<p>您还没有参与任何会议</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="timeline-container">
|
||||
<div className="timeline-line"></div>
|
||||
{sortedDates.map(date => (
|
||||
<div key={date} className="timeline-date-section">
|
||||
<div className="timeline-date-node">
|
||||
<span className="date-text">{formatDate(date)}</span>
|
||||
</div>
|
||||
<div className="meetings-for-date">
|
||||
{meetingsByDate[date].map(meeting => {
|
||||
const isCreator = meeting.creator_id === currentUser.user_id;
|
||||
const cardClass = isCreator ? 'created-by-me' : 'attended-by-me';
|
||||
|
||||
return (
|
||||
<div className="meeting-card-wrapper" key={meeting.meeting_id}>
|
||||
<Link to={`/meetings/${meeting.meeting_id}`}>
|
||||
<div className={`meeting-card ${cardClass} meeting-card-link`}>
|
||||
<div className="meeting-content">
|
||||
<div className="meeting-header">
|
||||
<div className="meeting-title-section">
|
||||
<h3 className="meeting-title">{meeting.title}</h3>
|
||||
{isCreator && (
|
||||
<div className="meeting-actions">
|
||||
<button
|
||||
className="dropdown-trigger"
|
||||
onClick={(e) => toggleDropdown(meeting.meeting_id, e)}
|
||||
>
|
||||
<MoreVertical size={18} />
|
||||
</button>
|
||||
{showDropdown === meeting.meeting_id && (
|
||||
<div className="dropdown-menu" onClick={(e) => e.stopPropagation()}>
|
||||
<Link
|
||||
to={`/meetings/edit/${meeting.meeting_id}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<span className="dropdown-item">
|
||||
<Edit size={16} />
|
||||
编辑
|
||||
</span>
|
||||
</Link>
|
||||
<button
|
||||
className="dropdown-item delete-item"
|
||||
onClick={(e) => handleDeleteClick(meeting.meeting_id, e)}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
删除
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="meeting-meta">
|
||||
<div className="meta-item">
|
||||
<Clock size={16} />
|
||||
<span>{formatDateTime(meeting.meeting_time)}</span>
|
||||
</div>
|
||||
<div className="meta-item">
|
||||
<Users size={16} />
|
||||
<span>{meeting.attendees.length} 人参会</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="meeting-body">
|
||||
{meeting.attendees && meeting.attendees.length > 0 && (
|
||||
<div className="attendees-section">
|
||||
<span className="attendees-label">参会人:</span>
|
||||
<div className="attendees-list">
|
||||
{meeting.attendees.map((attendee, idx) => (
|
||||
<span key={idx} className="attendee-tag">
|
||||
{typeof attendee === 'string' ? attendee : attendee.caption}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{meeting.summary && (
|
||||
<div className="summary-section">
|
||||
<div className="summary-header">
|
||||
<FileText size={16} />
|
||||
<span>会议摘要</span>
|
||||
</div>
|
||||
<div className="summary-content">
|
||||
<div className="markdown-content">
|
||||
<ReactMarkdown>
|
||||
{truncateSummary(meeting.summary)}
|
||||
</ReactMarkdown>
|
||||
</div>
|
||||
{shouldShowMoreButton(meeting.summary) && (
|
||||
<div className="summary-more-hint">
|
||||
<span className="more-text">点击查看完整摘要</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="meeting-footer">
|
||||
<div className="creator-info">
|
||||
<User size={14} />
|
||||
<span>创建人: {meeting.creator_username}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
{/* Delete Confirmation Modal */}
|
||||
{showDeleteConfirm === meeting.meeting_id && (
|
||||
<div className="delete-modal-overlay" onClick={() => setShowDeleteConfirm(null)}>
|
||||
<div className="delete-modal" onClick={(e) => e.stopPropagation()}>
|
||||
<h3>确认删除</h3>
|
||||
<p>确定要删除会议 "{meeting.title}" 吗?此操作无法撤销。</p>
|
||||
<div className="modal-actions">
|
||||
<button
|
||||
className="btn-cancel"
|
||||
onClick={() => setShowDeleteConfirm(null)}
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
className="btn-delete"
|
||||
onClick={() => handleConfirmDelete(meeting.meeting_id)}
|
||||
>
|
||||
确定删除
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MeetingTimeline;
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
// API配置文件
|
||||
const API_CONFIG = {
|
||||
BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000',
|
||||
ENDPOINTS: {
|
||||
AUTH: {
|
||||
LOGIN: '/api/auth/login'
|
||||
},
|
||||
USERS: {
|
||||
LIST: '/api/users',
|
||||
DETAIL: (userId) => `/api/users/${userId}`
|
||||
},
|
||||
MEETINGS: {
|
||||
LIST: '/api/meetings',
|
||||
DETAIL: (meetingId) => `/api/meetings/${meetingId}`,
|
||||
EDIT: (meetingId) => `/api/meetings/${meetingId}/edit`,
|
||||
CREATE: '/api/meetings',
|
||||
UPDATE: (meetingId) => `/api/meetings/${meetingId}`,
|
||||
DELETE: (meetingId) => `/api/meetings/${meetingId}`,
|
||||
TRANSCRIPT: (meetingId) => `/api/meetings/${meetingId}/transcript`,
|
||||
AUDIO: (meetingId) => `/api/meetings/${meetingId}/audio`,
|
||||
UPLOAD_AUDIO: '/api/meetings/upload-audio',
|
||||
REGENERATE_SUMMARY: (meetingId) => `/api/meetings/${meetingId}/regenerate-summary`
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 构建完整的API URL
|
||||
export const buildApiUrl = (endpoint) => {
|
||||
return `${API_CONFIG.BASE_URL}${endpoint}`;
|
||||
};
|
||||
|
||||
// 导出API端点
|
||||
export const API_ENDPOINTS = API_CONFIG.ENDPOINTS;
|
||||
|
||||
// 导出基础URL用于文件访问
|
||||
export const API_BASE_URL = API_CONFIG.BASE_URL;
|
||||
|
||||
export default API_CONFIG;
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
:root {
|
||||
font-family: system-ui, Avenir, Helvetica, Arial, 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;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.jsx'
|
||||
|
||||
createRoot(document.getElementById('root')).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
/* Create Meeting Page */
|
||||
.create-meeting-page {
|
||||
background-color: #f8fafc;
|
||||
min-height: 100vh;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.create-header {
|
||||
max-width: 800px;
|
||||
margin: 0 auto 1.5rem auto;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: #475569;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.back-link:hover {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.create-content {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.create-card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.create-card-header {
|
||||
padding: 2rem;
|
||||
background: linear-gradient(135deg, #f5f7fa, #eef2f7);
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.create-card-header h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
|
||||
.create-card-header p {
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.create-form {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
margin-bottom: 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.form-group input[type="text"],
|
||||
.form-group input[type="datetime-local"] {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
transition: all 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
/* Attendees Selection */
|
||||
.attendees-container {
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.selected-attendees {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.attendee-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.remove-attendee {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
min-width: 22px;
|
||||
min-height: 22px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
transition: background 0.3s ease;
|
||||
margin-left: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.remove-attendee:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.user-search-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.user-search-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: white;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.user-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.user-option:hover {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.user-username {
|
||||
font-size: 0.8rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.no-users {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: #64748b;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* File Upload */
|
||||
.file-upload-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.file-upload-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 2rem;
|
||||
border: 2px dashed #d1d5db;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.file-upload-label:hover {
|
||||
border-color: #667eea;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.file-upload-label span {
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.file-upload-label small {
|
||||
color: #64748b;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.selected-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.75rem 1rem;
|
||||
background: #f0f9ff;
|
||||
border: 1px solid #bae6fd;
|
||||
border-radius: 6px;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.remove-file {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem;
|
||||
border-radius: 4px;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.remove-file:hover {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
/* Error Message */
|
||||
.error-message {
|
||||
background: #fef2f2;
|
||||
color: #ef4444;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #fecaca;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* Form Actions */
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
padding-top: 2rem;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.75rem 1.5rem;
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
text-decoration: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.75rem 2rem;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-submit:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.create-meeting-page {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.create-card-header {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.create-form {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.selected-attendees {
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.attendee-chip {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import { ArrowLeft, Upload, Users, Calendar, FileText, X, User, Plus } from 'lucide-react';
|
||||
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
|
||||
import './CreateMeeting.css';
|
||||
|
||||
const CreateMeeting = ({ user }) => {
|
||||
const navigate = useNavigate();
|
||||
const [formData, setFormData] = useState({
|
||||
title: '',
|
||||
meeting_time: '',
|
||||
attendees: []
|
||||
});
|
||||
const [availableUsers, setAvailableUsers] = useState([]);
|
||||
const [userSearch, setUserSearch] = useState('');
|
||||
const [showUserDropdown, setShowUserDropdown] = useState(false);
|
||||
const [audioFile, setAudioFile] = useState(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
fetchUsers();
|
||||
}, []);
|
||||
|
||||
const fetchUsers = async () => {
|
||||
try {
|
||||
const response = await axios.get(buildApiUrl(API_ENDPOINTS.USERS.LIST));
|
||||
setAvailableUsers(response.data.filter(u => u.user_id !== user.user_id));
|
||||
} catch (err) {
|
||||
console.error('Error fetching users:', err);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
[name]: value
|
||||
}));
|
||||
};
|
||||
|
||||
const handleAddAttendee = (selectedUser) => {
|
||||
if (!formData.attendees.find(a => a.user_id === selectedUser.user_id)) {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
attendees: [...prev.attendees, selectedUser]
|
||||
}));
|
||||
}
|
||||
setUserSearch('');
|
||||
setShowUserDropdown(false);
|
||||
};
|
||||
|
||||
const handleRemoveAttendee = (userId) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
attendees: prev.attendees.filter(a => a.user_id !== userId)
|
||||
}));
|
||||
};
|
||||
|
||||
const handleFileChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
if (file) {
|
||||
// Check file type - include both MIME types and extensions
|
||||
const allowedMimeTypes = ['audio/mp3', 'audio/wav', 'audio/m4a', 'audio/mpeg', 'audio/mp4', 'audio/x-m4a'];
|
||||
const fileExtension = file.name.toLowerCase().split('.').pop();
|
||||
const allowedExtensions = ['mp3', 'wav', 'm4a', 'mpeg'];
|
||||
|
||||
if (!allowedMimeTypes.includes(file.type) && !allowedExtensions.includes(fileExtension)) {
|
||||
setError('请上传支持的音频格式 (MP3, WAV, M4A)');
|
||||
return;
|
||||
}
|
||||
// Check file size (max 100MB)
|
||||
if (file.size > 100 * 1024 * 1024) {
|
||||
setError('音频文件大小不能超过100MB');
|
||||
return;
|
||||
}
|
||||
setAudioFile(file);
|
||||
setError('');
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
if (!formData.title.trim()) {
|
||||
setError('请输入会议标题');
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
setError('');
|
||||
|
||||
try {
|
||||
// Create meeting
|
||||
const meetingData = {
|
||||
title: formData.title,
|
||||
meeting_time: formData.meeting_time || null,
|
||||
attendee_ids: formData.attendees.map(a => a.user_id)
|
||||
};
|
||||
|
||||
const response = await axios.post(buildApiUrl(API_ENDPOINTS.MEETINGS.CREATE), meetingData);
|
||||
const meetingId = response.data.meeting_id;
|
||||
|
||||
// Upload audio file if provided
|
||||
if (audioFile) {
|
||||
const formDataUpload = new FormData();
|
||||
formDataUpload.append('audio_file', audioFile);
|
||||
formDataUpload.append('meeting_id', meetingId);
|
||||
|
||||
await axios.post(buildApiUrl(API_ENDPOINTS.MEETINGS.UPLOAD_AUDIO), formDataUpload, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
navigate(`/meetings/${meetingId}`);
|
||||
} catch (err) {
|
||||
setError(err.response?.data?.detail || '创建会议失败,请重试');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const filteredUsers = availableUsers.filter(user => {
|
||||
// Exclude users already selected as attendees
|
||||
const isAlreadySelected = formData.attendees.some(attendee => attendee.user_id === user.user_id);
|
||||
if (isAlreadySelected) return false;
|
||||
|
||||
// Filter by search text
|
||||
return user.caption.toLowerCase().includes(userSearch.toLowerCase()) ||
|
||||
user.username.toLowerCase().includes(userSearch.toLowerCase());
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="create-meeting-page">
|
||||
<div className="create-header">
|
||||
<Link to="/dashboard">
|
||||
<span className="back-link">
|
||||
<ArrowLeft size={20} />
|
||||
<span>返回首页</span>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="create-content">
|
||||
<div className="create-card">
|
||||
<header className="create-card-header">
|
||||
<h1>新建会议纪要</h1>
|
||||
<p>创建新的会议记录并上传音频文件进行AI处理</p>
|
||||
</header>
|
||||
|
||||
<form onSubmit={handleSubmit} className="create-form">
|
||||
<div className="form-group">
|
||||
<label htmlFor="title">
|
||||
<FileText size={18} />
|
||||
会议标题 *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="title"
|
||||
name="title"
|
||||
value={formData.title}
|
||||
onChange={handleInputChange}
|
||||
placeholder="请输入会议标题"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label htmlFor="meeting_time">
|
||||
<Calendar size={18} />
|
||||
会议时间
|
||||
</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
id="meeting_time"
|
||||
name="meeting_time"
|
||||
value={formData.meeting_time}
|
||||
onChange={handleInputChange}
|
||||
onBlur={(e) => {
|
||||
// Force input to lose focus to save the value
|
||||
e.target.blur();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>
|
||||
<Users size={18} />
|
||||
参会人员
|
||||
</label>
|
||||
<div className="attendees-container">
|
||||
<div className="selected-attendees">
|
||||
{formData.attendees.map(attendee => (
|
||||
<div key={attendee.user_id} className="attendee-chip">
|
||||
<User size={16} />
|
||||
<span>{attendee.caption}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleRemoveAttendee(attendee.user_id)}
|
||||
className="remove-attendee"
|
||||
title="移除参会人"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="user-search-container">
|
||||
<input
|
||||
type="text"
|
||||
value={userSearch}
|
||||
onChange={(e) => {
|
||||
setUserSearch(e.target.value);
|
||||
setShowUserDropdown(true);
|
||||
}}
|
||||
onFocus={() => setShowUserDropdown(true)}
|
||||
onBlur={() => {
|
||||
// Delay hiding dropdown to allow click events
|
||||
setTimeout(() => setShowUserDropdown(false), 200);
|
||||
}}
|
||||
placeholder="搜索用户名或姓名添加参会人..."
|
||||
className="user-search-input"
|
||||
/>
|
||||
{showUserDropdown && userSearch && (
|
||||
<div className="user-dropdown">
|
||||
{filteredUsers.length > 0 ? (
|
||||
filteredUsers.map(user => (
|
||||
<div
|
||||
key={user.user_id}
|
||||
className="user-option"
|
||||
onClick={() => handleAddAttendee(user)}
|
||||
>
|
||||
<User size={16} />
|
||||
<div className="user-info">
|
||||
<span className="user-name">{user.caption}</span>
|
||||
<span className="user-username">@{user.username}</span>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="no-users">未找到匹配的用户</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>
|
||||
<Upload size={18} />
|
||||
会议录音
|
||||
</label>
|
||||
<div className="file-upload-container">
|
||||
<input
|
||||
type="file"
|
||||
id="audio-file"
|
||||
accept="audio/*"
|
||||
onChange={handleFileChange}
|
||||
className="file-input"
|
||||
/>
|
||||
<label htmlFor="audio-file" className="file-upload-label">
|
||||
<Plus size={20} />
|
||||
<span>选择音频文件</span>
|
||||
<small>支持 MP3, WAV, M4A 格式,最大100MB</small>
|
||||
</label>
|
||||
{audioFile && (
|
||||
<div className="selected-file">
|
||||
<span>已选择: {audioFile.name}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAudioFile(null)}
|
||||
className="remove-file"
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="error-message">{error}</div>
|
||||
)}
|
||||
|
||||
<div className="form-actions">
|
||||
<Link to="/dashboard">
|
||||
<span className="btn-cancel">取消</span>
|
||||
</Link>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-submit"
|
||||
disabled={isLoading}
|
||||
>
|
||||
{isLoading ? '创建中...' : '创建会议'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateMeeting;
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
/* Dashboard Styles */
|
||||
.dashboard {
|
||||
min-height: 100vh;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.dashboard-header {
|
||||
background: white;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem 2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.user-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.welcome-text {
|
||||
color: #64748b;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background: #dc2626;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Dashboard Content */
|
||||
.dashboard-content {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
/* User Info Section */
|
||||
.user-info-section {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: linear-gradient(45deg, #667eea, #764ba2);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.user-details h2 {
|
||||
margin: 0 0 0.5rem 0;
|
||||
color: #1e293b;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.user-email {
|
||||
color: #64748b;
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
|
||||
.join-date {
|
||||
color: #94a3b8;
|
||||
font-size: 0.9rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Stats Grid */
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
background: white;
|
||||
padding: 1.5rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.stat-card:nth-child(1) .stat-icon {
|
||||
background: linear-gradient(45deg, #06b6d4, #0891b2);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.stat-card:nth-child(2) .stat-icon {
|
||||
background: linear-gradient(45deg, #10b981, #059669);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.stat-card:nth-child(3) .stat-icon {
|
||||
background: linear-gradient(45deg, #f59e0b, #d97706);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.stat-info h3 {
|
||||
margin: 0;
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.stat-info p {
|
||||
margin: 0;
|
||||
color: #64748b;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Meetings Section */
|
||||
.meetings-section {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
padding: 2rem 2rem 1rem 2rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.section-title h2 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin: 0 0 0.5rem 0;
|
||||
color: #1e293b;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.section-title p {
|
||||
margin: 0;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.create-meeting-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.create-meeting-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Loading and Error States */
|
||||
.loading-container, .error-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 50vh;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid #e2e8f0;
|
||||
border-top: 3px solid #667eea;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
margin-top: 1rem;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.retry-btn:hover {
|
||||
background: #5a67d8;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.dashboard-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.user-info-section {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.user-actions {
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.welcome-text {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { LogOut, User, Calendar, Users, TrendingUp, Clock, MessageSquare, Plus } from 'lucide-react';
|
||||
import axios from 'axios';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
|
||||
import MeetingTimeline from '../components/MeetingTimeline';
|
||||
import './Dashboard.css';
|
||||
|
||||
const Dashboard = ({ user, onLogout }) => {
|
||||
const [userInfo, setUserInfo] = useState(null);
|
||||
const [meetings, setMeetings] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
fetchUserData();
|
||||
}, [user.user_id]);
|
||||
|
||||
const fetchUserData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
console.log('Fetching user data for user_id:', user.user_id);
|
||||
|
||||
const userResponse = await axios.get(buildApiUrl(API_ENDPOINTS.USERS.DETAIL(user.user_id)));
|
||||
console.log('User response:', userResponse.data);
|
||||
setUserInfo(userResponse.data);
|
||||
|
||||
const meetingsResponse = await axios.get(buildApiUrl(`${API_ENDPOINTS.MEETINGS.LIST}?user_id=${user.user_id}`));
|
||||
console.log('Meetings response:', meetingsResponse.data);
|
||||
setMeetings(meetingsResponse.data);
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching data:', err);
|
||||
setError('获取数据失败,请刷新重试');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteMeeting = async (meetingId) => {
|
||||
try {
|
||||
await axios.delete(buildApiUrl(API_ENDPOINTS.MEETINGS.DELETE(meetingId)));
|
||||
// Refresh meetings list
|
||||
const meetingsResponse = await axios.get(buildApiUrl(`${API_ENDPOINTS.MEETINGS.LIST}?user_id=${user.user_id}`));
|
||||
setMeetings(meetingsResponse.data);
|
||||
} catch (err) {
|
||||
console.error('Error deleting meeting:', err);
|
||||
// You might want to show an error message to the user here
|
||||
}
|
||||
};
|
||||
|
||||
const groupMeetingsByDate = (meetings) => {
|
||||
return meetings.reduce((acc, meeting) => {
|
||||
const date = new Date(meeting.meeting_time || meeting.created_at).toISOString().split('T')[0];
|
||||
if (!acc[date]) {
|
||||
acc[date] = [];
|
||||
}
|
||||
acc[date].push(meeting);
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<div className="loading-container">
|
||||
<div className="loading-spinner"></div>
|
||||
<p>加载中...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<div className="error-container">
|
||||
<p>{error}</p>
|
||||
<button onClick={fetchUserData} className="retry-btn">重试</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const groupedMeetings = groupMeetingsByDate(meetings);
|
||||
|
||||
return (
|
||||
<div className="dashboard">
|
||||
|
||||
{/* Header */}
|
||||
<header className="dashboard-header">
|
||||
<div className="header-content">
|
||||
<div className="logo">
|
||||
<MessageSquare className="logo-icon" />
|
||||
<span className="logo-text">iMeeting</span>
|
||||
</div>
|
||||
<div className="user-actions">
|
||||
<span className="welcome-text">欢迎,{userInfo?.caption}</span>
|
||||
<button className="logout-btn" onClick={onLogout}>
|
||||
<LogOut size={18} />
|
||||
退出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="dashboard-content">
|
||||
{/* User Info Section */}
|
||||
<section className="user-info-section">
|
||||
<div className="user-card">
|
||||
<div className="user-avatar">
|
||||
<User size={32} />
|
||||
</div>
|
||||
<div className="user-details">
|
||||
<h2>{userInfo?.caption}</h2>
|
||||
<p className="user-email">{userInfo?.email}</p>
|
||||
<p className="join-date">加入时间:{formatDate(userInfo?.created_at)}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stats Cards */}
|
||||
<div className="stats-grid">
|
||||
<div className="stat-card">
|
||||
<div className="stat-icon">
|
||||
<Calendar className="icon" />
|
||||
</div>
|
||||
<div className="stat-info">
|
||||
<h3>{userInfo?.meetings_created}</h3>
|
||||
<p>发起的会议</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="stat-card">
|
||||
<div className="stat-icon">
|
||||
<Users className="icon" />
|
||||
</div>
|
||||
<div className="stat-info">
|
||||
<h3>{userInfo?.meetings_attended}</h3>
|
||||
<p>参加的会议</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="stat-card">
|
||||
<div className="stat-icon">
|
||||
<TrendingUp className="icon" />
|
||||
</div>
|
||||
<div className="stat-info">
|
||||
<h3>{meetings.length}</h3>
|
||||
<p>相关会议总数</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Meetings Timeline Section */}
|
||||
<section className="meetings-section">
|
||||
<div className="section-header">
|
||||
<div className="section-title">
|
||||
<h2>
|
||||
<Clock size={24} />
|
||||
会议时间轴
|
||||
</h2>
|
||||
<p>按时间顺序展示您参与的所有会议</p>
|
||||
</div>
|
||||
<Link to="/meetings/create">
|
||||
<span className="create-meeting-btn">
|
||||
<Plus size={20} />
|
||||
新建会议纪要
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<MeetingTimeline
|
||||
meetingsByDate={groupedMeetings}
|
||||
currentUser={user}
|
||||
onDeleteMeeting={handleDeleteMeeting}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dashboard;
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
/* Edit Meeting Page */
|
||||
.edit-meeting-page {
|
||||
background-color: #f8fafc;
|
||||
min-height: 100vh;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.edit-header {
|
||||
max-width: 800px;
|
||||
margin: 0 auto 1.5rem auto;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: #475569;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.back-link:hover {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.edit-content {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.edit-card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.edit-card-header {
|
||||
padding: 2rem;
|
||||
background: linear-gradient(135deg, #fef3c7, #fde68a);
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.edit-card-header h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
|
||||
.edit-card-header p {
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.edit-form {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
margin-bottom: 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.form-group input[type="text"],
|
||||
.form-group input[type="datetime-local"] {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
transition: all 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
/* Summary Section */
|
||||
.summary-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.regenerate-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: linear-gradient(135deg, #f59e0b, #d97706);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
|
||||
}
|
||||
|
||||
.regenerate-btn:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
|
||||
}
|
||||
|
||||
.regenerate-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.summary-textarea {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
line-height: 1.6;
|
||||
resize: vertical;
|
||||
min-height: 300px;
|
||||
transition: all 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.summary-textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.markdown-hint {
|
||||
margin-top: 0.5rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
/* Attendees Selection (reuse from CreateMeeting) */
|
||||
.attendees-container {
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.selected-attendees {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.attendee-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.remove-attendee {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
min-width: 22px;
|
||||
min-height: 22px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
transition: background 0.3s ease;
|
||||
margin-left: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.remove-attendee:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.user-search-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.user-search-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: white;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.user-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.user-option:hover {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.user-username {
|
||||
font-size: 0.8rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.no-users {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: #64748b;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Error Message */
|
||||
.error-message {
|
||||
background: #fef2f2;
|
||||
color: #ef4444;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #fecaca;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* Loading State */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 50vh;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid #e2e8f0;
|
||||
border-top: 3px solid #667eea;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Form Actions */
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
padding-top: 2rem;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.75rem 1.5rem;
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
text-decoration: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 2rem;
|
||||
background: linear-gradient(135deg, #10b981, #059669);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
.btn-submit:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.edit-meeting-page {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.edit-card-header {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.edit-form {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.summary-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.regenerate-btn {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.selected-attendees {
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.attendee-chip {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,328 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import { ArrowLeft, Users, Calendar, FileText, X, User, Save, Zap } from 'lucide-react';
|
||||
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
|
||||
import './EditMeeting.css';
|
||||
|
||||
const EditMeeting = ({ user }) => {
|
||||
const navigate = useNavigate();
|
||||
const { meeting_id } = useParams();
|
||||
const [formData, setFormData] = useState({
|
||||
title: '',
|
||||
meeting_time: '',
|
||||
summary: '',
|
||||
attendees: []
|
||||
});
|
||||
const [availableUsers, setAvailableUsers] = useState([]);
|
||||
const [userSearch, setUserSearch] = useState('');
|
||||
const [showUserDropdown, setShowUserDropdown] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [isRegenerating, setIsRegenerating] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const [meeting, setMeeting] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetchMeetingData();
|
||||
fetchUsers();
|
||||
}, [meeting_id]);
|
||||
|
||||
const fetchMeetingData = async () => {
|
||||
try {
|
||||
const response = await axios.get(buildApiUrl(API_ENDPOINTS.MEETINGS.EDIT(meeting_id)));
|
||||
const meetingData = response.data;
|
||||
|
||||
// Check if current user is the creator
|
||||
if (meetingData.creator_id !== user.user_id) {
|
||||
navigate('/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
setMeeting(meetingData);
|
||||
setFormData({
|
||||
title: meetingData.title,
|
||||
meeting_time: meetingData.meeting_time ?
|
||||
new Date(meetingData.meeting_time).toISOString().slice(0, 16) : '',
|
||||
summary: meetingData.summary || '',
|
||||
attendees: meetingData.attendees || []
|
||||
});
|
||||
} catch (err) {
|
||||
setError('无法加载会议信息');
|
||||
console.error('Error fetching meeting:', err);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchUsers = async () => {
|
||||
try {
|
||||
const response = await axios.get(buildApiUrl(API_ENDPOINTS.USERS.LIST));
|
||||
setAvailableUsers(response.data.filter(u => u.user_id !== user.user_id));
|
||||
} catch (err) {
|
||||
console.error('Error fetching users:', err);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
[name]: value
|
||||
}));
|
||||
};
|
||||
|
||||
const handleAddAttendee = (selectedUser) => {
|
||||
if (!formData.attendees.find(a => a.user_id === selectedUser.user_id)) {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
attendees: [...prev.attendees, selectedUser]
|
||||
}));
|
||||
}
|
||||
setUserSearch('');
|
||||
setShowUserDropdown(false);
|
||||
};
|
||||
|
||||
const handleRemoveAttendee = (userId) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
attendees: prev.attendees.filter(a => a.user_id !== userId)
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
if (!formData.title.trim()) {
|
||||
setError('请输入会议标题');
|
||||
return;
|
||||
}
|
||||
|
||||
setIsSaving(true);
|
||||
setError('');
|
||||
|
||||
try {
|
||||
const updateData = {
|
||||
title: formData.title,
|
||||
meeting_time: formData.meeting_time || null,
|
||||
summary: formData.summary,
|
||||
attendee_ids: formData.attendees.map(a => a.user_id)
|
||||
};
|
||||
|
||||
await axios.put(buildApiUrl(API_ENDPOINTS.MEETINGS.UPDATE(meeting_id)), updateData);
|
||||
navigate(`/meetings/${meeting_id}`);
|
||||
} catch (err) {
|
||||
setError(err.response?.data?.detail || '更新会议失败,请重试');
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleRegenerateSummary = async () => {
|
||||
setIsRegenerating(true);
|
||||
setError('');
|
||||
|
||||
try {
|
||||
const response = await axios.post(buildApiUrl(API_ENDPOINTS.MEETINGS.REGENERATE_SUMMARY(meeting_id)));
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
summary: response.data.summary
|
||||
}));
|
||||
} catch (err) {
|
||||
setError('重新生成摘要失败,请重试');
|
||||
} finally {
|
||||
setIsRegenerating(false);
|
||||
}
|
||||
};
|
||||
|
||||
const filteredUsers = availableUsers.filter(user => {
|
||||
// Exclude users already selected as attendees
|
||||
const isAlreadySelected = formData.attendees.some(attendee => attendee.user_id === user.user_id);
|
||||
if (isAlreadySelected) return false;
|
||||
|
||||
// Filter by search text
|
||||
return user.caption.toLowerCase().includes(userSearch.toLowerCase()) ||
|
||||
user.username.toLowerCase().includes(userSearch.toLowerCase());
|
||||
});
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="edit-meeting-page">
|
||||
<div className="loading-container">
|
||||
<div className="loading-spinner"></div>
|
||||
<p>加载中...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="edit-meeting-page">
|
||||
<div className="edit-header">
|
||||
<Link to="/dashboard">
|
||||
<span className="back-link">
|
||||
<ArrowLeft size={20} />
|
||||
<span>返回首页</span>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="edit-content">
|
||||
<div className="edit-card">
|
||||
<header className="edit-card-header">
|
||||
<h1>编辑会议纪要</h1>
|
||||
<p>修改会议信息、参会人员和摘要内容</p>
|
||||
</header>
|
||||
|
||||
<form onSubmit={handleSubmit} className="edit-form">
|
||||
<div className="form-group">
|
||||
<label htmlFor="title">
|
||||
<FileText size={18} />
|
||||
会议标题 *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="title"
|
||||
name="title"
|
||||
value={formData.title}
|
||||
onChange={handleInputChange}
|
||||
placeholder="请输入会议标题"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label htmlFor="meeting_time">
|
||||
<Calendar size={18} />
|
||||
会议时间
|
||||
</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
id="meeting_time"
|
||||
name="meeting_time"
|
||||
value={formData.meeting_time}
|
||||
onChange={handleInputChange}
|
||||
onBlur={(e) => {
|
||||
// Force input to lose focus to save the value
|
||||
e.target.blur();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>
|
||||
<Users size={18} />
|
||||
参会人员
|
||||
</label>
|
||||
<div className="attendees-container">
|
||||
<div className="selected-attendees">
|
||||
{formData.attendees.map(attendee => (
|
||||
<div key={attendee.user_id} className="attendee-chip">
|
||||
<User size={16} />
|
||||
<span>{attendee.caption}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleRemoveAttendee(attendee.user_id)}
|
||||
className="remove-attendee"
|
||||
title="移除参会人"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="user-search-container">
|
||||
<input
|
||||
type="text"
|
||||
value={userSearch}
|
||||
onChange={(e) => {
|
||||
setUserSearch(e.target.value);
|
||||
setShowUserDropdown(true);
|
||||
}}
|
||||
onFocus={() => setShowUserDropdown(true)}
|
||||
onBlur={() => {
|
||||
// Delay hiding dropdown to allow click events
|
||||
setTimeout(() => setShowUserDropdown(false), 200);
|
||||
}}
|
||||
placeholder="搜索用户名或姓名添加参会人..."
|
||||
className="user-search-input"
|
||||
/>
|
||||
{showUserDropdown && userSearch && (
|
||||
<div className="user-dropdown">
|
||||
{filteredUsers.length > 0 ? (
|
||||
filteredUsers.map(user => (
|
||||
<div
|
||||
key={user.user_id}
|
||||
className="user-option"
|
||||
onClick={() => handleAddAttendee(user)}
|
||||
>
|
||||
<User size={16} />
|
||||
<div className="user-info">
|
||||
<span className="user-name">{user.caption}</span>
|
||||
<span className="user-username">@{user.username}</span>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="no-users">未找到匹配的用户</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<div className="summary-header">
|
||||
<label htmlFor="summary">
|
||||
<FileText size={18} />
|
||||
会议摘要
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleRegenerateSummary}
|
||||
className="regenerate-btn"
|
||||
disabled={isRegenerating}
|
||||
>
|
||||
<Zap size={16} />
|
||||
{isRegenerating ? 'AI生成中...' : '重新AI解析'}
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
id="summary"
|
||||
name="summary"
|
||||
value={formData.summary}
|
||||
onChange={handleInputChange}
|
||||
placeholder="会议摘要将显示在这里... 支持Markdown格式"
|
||||
rows="12"
|
||||
className="summary-textarea"
|
||||
/>
|
||||
<div className="markdown-hint">
|
||||
<small>支持Markdown格式:**粗体** *斜体* # 标题 - 列表</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="error-message">{error}</div>
|
||||
)}
|
||||
|
||||
<div className="form-actions">
|
||||
<Link to={`/meetings/${meeting_id}`}>
|
||||
<span className="btn-cancel">取消</span>
|
||||
</Link>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-submit"
|
||||
disabled={isSaving}
|
||||
>
|
||||
<Save size={16} />
|
||||
{isSaving ? '保存中...' : '保存更改'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditMeeting;
|
||||
|
|
@ -0,0 +1,308 @@
|
|||
/* HomePage Styles */
|
||||
.homepage {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.homepage-header {
|
||||
padding: 1rem 0;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
padding: 0.5rem 1.5rem;
|
||||
border-radius: 25px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.login-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Hero Section */
|
||||
.hero {
|
||||
padding: 6rem 2rem;
|
||||
text-align: center;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1.5rem;
|
||||
background: linear-gradient(45deg, #fff, #ffd700);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.hero-subtitle {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 3rem;
|
||||
opacity: 0.9;
|
||||
max-width: 600px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.cta-button {
|
||||
background: linear-gradient(45deg, #ffd700, #ffed4e);
|
||||
color: #333;
|
||||
border: none;
|
||||
padding: 1rem 2.5rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
|
||||
}
|
||||
|
||||
.cta-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Features Section */
|
||||
.features {
|
||||
padding: 6rem 2rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.features-container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.features-title {
|
||||
text-align: center;
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 4rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 2rem;
|
||||
border-radius: 20px;
|
||||
text-align: center;
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.feature-card:hover {
|
||||
transform: translateY(-5px);
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: #ffd700;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.feature-card h3 {
|
||||
font-size: 1.3rem;
|
||||
margin-bottom: 1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.feature-card p {
|
||||
opacity: 0.9;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Modal Styles */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
.login-modal {
|
||||
background: white;
|
||||
color: #333;
|
||||
padding: 2rem;
|
||||
border-radius: 20px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.modal-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
padding: 0.5rem;
|
||||
border-radius: 50%;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
background: #f5f5f5;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* Form Styles */
|
||||
.login-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: 500;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
padding: 0.75rem;
|
||||
border: 2px solid #e1e5e9;
|
||||
border-radius: 10px;
|
||||
font-size: 1rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background: #fee;
|
||||
color: #c53030;
|
||||
padding: 0.75rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #fed7d7;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background: linear-gradient(45deg, #667eea, #764ba2);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.75rem;
|
||||
border-radius: 10px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.demo-info {
|
||||
margin-top: 1.5rem;
|
||||
padding: 1rem;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.demo-info p {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.hero-title {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.hero-subtitle {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.login-modal {
|
||||
margin: 1rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Brain, Users, Calendar, TrendingUp, X, User, Lock } from 'lucide-react';
|
||||
import axios from 'axios';
|
||||
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
|
||||
import './HomePage.css';
|
||||
|
||||
const HomePage = ({ onLogin }) => {
|
||||
const [showLoginModal, setShowLoginModal] = useState(false);
|
||||
const [loginForm, setLoginForm] = useState({ username: '', password: '' });
|
||||
const [loginError, setLoginError] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleLogin = async (e) => {
|
||||
e.preventDefault();
|
||||
setIsLoading(true);
|
||||
setLoginError('');
|
||||
|
||||
try {
|
||||
const response = await axios.post(buildApiUrl(API_ENDPOINTS.AUTH.LOGIN), loginForm);
|
||||
onLogin(response.data);
|
||||
setShowLoginModal(false);
|
||||
} catch (error) {
|
||||
setLoginError(error.response?.data?.detail || '登录失败,请重试');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
setLoginForm({
|
||||
...loginForm,
|
||||
[e.target.name]: e.target.value
|
||||
});
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
setShowLoginModal(false);
|
||||
setLoginForm({ username: '', password: '' });
|
||||
setLoginError('');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="homepage">
|
||||
{/* Header */}
|
||||
<header className="homepage-header">
|
||||
<div className="header-content">
|
||||
<div className="logo">
|
||||
<Brain className="logo-icon" />
|
||||
<span className="logo-text">iMeeting</span>
|
||||
</div>
|
||||
<button
|
||||
className="login-btn"
|
||||
onClick={() => setShowLoginModal(true)}
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Hero Section */}
|
||||
<section className="hero">
|
||||
<div className="hero-content">
|
||||
<h1 className="hero-title">智慧会议,让会议更高效</h1>
|
||||
<p className="hero-subtitle">
|
||||
通过AI技术,将会议音视频转化为结构化信息,提升团队协作效率
|
||||
</p>
|
||||
<button
|
||||
className="cta-button"
|
||||
onClick={() => setShowLoginModal(true)}
|
||||
>
|
||||
开始使用
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Features Section */}
|
||||
<section className="features">
|
||||
<div className="features-container">
|
||||
<h2 className="features-title">核心功能</h2>
|
||||
<div className="features-grid">
|
||||
<div className="feature-card">
|
||||
<Brain className="feature-icon" />
|
||||
<h3>AI智能转录</h3>
|
||||
<p>自动将会议音频转为文字,并识别不同发言人</p>
|
||||
</div>
|
||||
<div className="feature-card">
|
||||
<Users className="feature-icon" />
|
||||
<h3>参会人管理</h3>
|
||||
<p>轻松管理会议参与者,追踪会议参与情况</p>
|
||||
</div>
|
||||
<div className="feature-card">
|
||||
<Calendar className="feature-icon" />
|
||||
<h3>时间轴视图</h3>
|
||||
<p>按时间顺序展示所有会议,快速回顾历史记录</p>
|
||||
</div>
|
||||
<div className="feature-card">
|
||||
<TrendingUp className="feature-icon" />
|
||||
<h3>智能摘要</h3>
|
||||
<p>AI自动生成会议摘要,提取关键信息和决策</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Login Modal */}
|
||||
{showLoginModal && (
|
||||
<div className="modal-overlay" onClick={closeModal}>
|
||||
<div className="login-modal" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-header">
|
||||
<h2>登录到iMeeting</h2>
|
||||
<button className="close-btn" onClick={closeModal}>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form className="login-form" onSubmit={handleLogin}>
|
||||
<div className="form-group">
|
||||
<label htmlFor="username">
|
||||
<User size={18} />
|
||||
用户名
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="username"
|
||||
name="username"
|
||||
value={loginForm.username}
|
||||
onChange={handleInputChange}
|
||||
placeholder="请输入用户名"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label htmlFor="password">
|
||||
<Lock size={18} />
|
||||
密码
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
value={loginForm.password}
|
||||
onChange={handleInputChange}
|
||||
placeholder="请输入密码"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
{loginError && (
|
||||
<div className="error-message">{loginError}</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="submit-btn"
|
||||
disabled={isLoading}
|
||||
>
|
||||
{isLoading ? '登录中...' : '登录'}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="demo-info">
|
||||
<p>测试账号:</p>
|
||||
<p>用户名: user1, 密码: hashed_password_1</p>
|
||||
<p>用户名: user2, 密码: hashed_password_2</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default HomePage;
|
||||
|
|
@ -0,0 +1,513 @@
|
|||
.meeting-details-page {
|
||||
background-color: #f8fafc;
|
||||
min-height: 100vh;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.details-header {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto 1.5rem auto;
|
||||
}
|
||||
|
||||
.details-layout {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 400px;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: #475569;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.back-link:hover {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.details-content-card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 2rem;
|
||||
background: linear-gradient(135deg, #f5f7fa, #eef2f7);
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.card-header h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
margin: 0 0 1.5rem 0;
|
||||
}
|
||||
|
||||
.meta-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.meta-item svg {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.meta-item strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.card-section {
|
||||
padding: 2rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.card-section:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.card-section h2 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
.summary-content {
|
||||
line-height: 1.7;
|
||||
color: #475569;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Markdown content styling */
|
||||
.markdown-content {
|
||||
font-size: 1rem;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.markdown-content h1,
|
||||
.markdown-content h2,
|
||||
.markdown-content h3,
|
||||
.markdown-content h4,
|
||||
.markdown-content h5,
|
||||
.markdown-content h6 {
|
||||
margin: 1rem 0 0.5rem 0;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.markdown-content h1 { font-size: 1.5rem; }
|
||||
.markdown-content h2 { font-size: 1.25rem; }
|
||||
.markdown-content h3 { font-size: 1.1rem; }
|
||||
.markdown-content h4,
|
||||
.markdown-content h5,
|
||||
.markdown-content h6 { font-size: 1rem; }
|
||||
|
||||
.markdown-content p {
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
.markdown-content ul,
|
||||
.markdown-content ol {
|
||||
margin: 0.75rem 0;
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.markdown-content li {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.markdown-content strong {
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.markdown-content em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.markdown-content code {
|
||||
background: #f1f5f9;
|
||||
padding: 0.2rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 0.9rem;
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.markdown-content pre {
|
||||
background: #f8fafc;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.markdown-content pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.markdown-content blockquote {
|
||||
border-left: 4px solid #667eea;
|
||||
padding-left: 1rem;
|
||||
margin: 1rem 0;
|
||||
font-style: italic;
|
||||
color: #64748b;
|
||||
background: #f8fafc;
|
||||
padding: 1rem;
|
||||
border-radius: 0 8px 8px 0;
|
||||
}
|
||||
|
||||
.markdown-content table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.markdown-content th,
|
||||
.markdown-content td {
|
||||
border: 1px solid #e2e8f0;
|
||||
padding: 0.5rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.markdown-content th {
|
||||
background: #f8fafc;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.markdown-content hr {
|
||||
border: none;
|
||||
height: 1px;
|
||||
background: #e2e8f0;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
.attendees-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.attendee-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background-color: #f1f5f9;
|
||||
color: #475569;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Audio file info */
|
||||
.audio-file-info {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
background: #f8fafc;
|
||||
border-radius: 6px;
|
||||
border-left: 3px solid #667eea;
|
||||
}
|
||||
|
||||
.audio-file-name {
|
||||
font-size: 0.9rem;
|
||||
color: #475569;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Audio Player Styles */
|
||||
.audio-section {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.audio-section h2 {
|
||||
color: white;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.audio-player {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.player-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.play-button {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.play-button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.time-info {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
min-width: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.progress-container {
|
||||
flex: 1;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding: 0 1rem;
|
||||
margin: 0 0.5rem;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border-radius: 3px;
|
||||
transition: width 0.1s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.progress-fill::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: white;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.progress-container:hover .progress-fill::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.volume-slider {
|
||||
width: 80px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
outline: none;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.volume-slider::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: white;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Transcript Sidebar */
|
||||
.transcript-sidebar {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
height: fit-content;
|
||||
max-height: calc(100vh - 200px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.transcript-header {
|
||||
padding: 1.5rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.transcript-header h3 {
|
||||
margin: 0;
|
||||
color: #334155;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.toggle-transcript {
|
||||
background: #f1f5f9;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 1rem;
|
||||
color: #475569;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.toggle-transcript:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.transcript-content {
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.transcript-item {
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 1rem;
|
||||
background: #f8fafc;
|
||||
border-radius: 8px;
|
||||
border-left: 3px solid #667eea;
|
||||
}
|
||||
|
||||
.transcript-header-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.speaker-name {
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.timestamp-button {
|
||||
background: #667eea;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 0.25rem 0.5rem;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.timestamp-button:hover {
|
||||
background: #5a67d8;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.transcript-text {
|
||||
color: #475569;
|
||||
line-height: 1.6;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
/* No Audio Display */
|
||||
.no-audio {
|
||||
text-align: center;
|
||||
padding: 3rem 2rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 12px;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.no-audio-icon {
|
||||
margin-bottom: 1rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.no-audio-message {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 0.5rem 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.no-audio-hint {
|
||||
font-size: 0.9rem;
|
||||
margin: 0;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.details-layout {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.transcript-sidebar {
|
||||
max-height: 500px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.meeting-details-page {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.player-controls {
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.progress-container {
|
||||
order: 3;
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
order: 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,333 @@
|
|||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import { ArrowLeft, Clock, Users, FileText, User, Calendar, Play, Pause, Volume2, MessageCircle } from 'lucide-react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import { buildApiUrl, API_ENDPOINTS, API_BASE_URL } from '../config/api';
|
||||
import './MeetingDetails.css';
|
||||
|
||||
const MeetingDetails = () => {
|
||||
const { meeting_id } = useParams();
|
||||
const [meeting, setMeeting] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
const [duration, setDuration] = useState(0);
|
||||
const [volume, setVolume] = useState(1);
|
||||
const [transcript, setTranscript] = useState([]);
|
||||
const [showTranscript, setShowTranscript] = useState(true);
|
||||
const [audioUrl, setAudioUrl] = useState(null);
|
||||
const [audioFileName, setAudioFileName] = useState(null);
|
||||
const audioRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetchMeetingDetails();
|
||||
}, [meeting_id]);
|
||||
|
||||
const fetchMeetingDetails = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
|
||||
// Fallback URL construction in case config fails
|
||||
const baseUrl = API_BASE_URL || 'http://localhost:8000';
|
||||
const detailEndpoint = API_ENDPOINTS?.MEETINGS?.DETAIL?.(meeting_id) || `/api/meetings/${meeting_id}`;
|
||||
const audioEndpoint = API_ENDPOINTS?.MEETINGS?.AUDIO?.(meeting_id) || `/api/meetings/${meeting_id}/audio`;
|
||||
const transcriptEndpoint = API_ENDPOINTS?.MEETINGS?.TRANSCRIPT?.(meeting_id) || `/api/meetings/${meeting_id}/transcript`;
|
||||
|
||||
const response = await axios.get(`${baseUrl}${detailEndpoint}`);
|
||||
setMeeting(response.data);
|
||||
|
||||
// Fetch audio file if available
|
||||
try {
|
||||
const audioResponse = await axios.get(`${baseUrl}${audioEndpoint}`);
|
||||
// Construct URL using uploads path and relative path from database
|
||||
setAudioUrl(`${baseUrl}/uploads/${audioResponse.data.file_path}`);
|
||||
setAudioFileName(audioResponse.data.file_name);
|
||||
} catch (audioError) {
|
||||
console.warn('No audio file available:', audioError);
|
||||
setAudioUrl(null);
|
||||
setAudioFileName(null);
|
||||
}
|
||||
|
||||
// Fetch transcript segments from database
|
||||
try {
|
||||
const transcriptResponse = await axios.get(`${baseUrl}${transcriptEndpoint}`);
|
||||
setTranscript(transcriptResponse.data);
|
||||
} catch (transcriptError) {
|
||||
console.warn('No transcript data available:', transcriptError);
|
||||
setTranscript([]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching meeting details:', err);
|
||||
setError('无法加载会议详情,请稍后重试。');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const formatDateTime = (dateTimeString) => {
|
||||
if (!dateTimeString) return '时间待定';
|
||||
const date = new Date(dateTimeString);
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric', month: 'long', day: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
};
|
||||
|
||||
const formatTime = (seconds) => {
|
||||
const mins = Math.floor(seconds / 60);
|
||||
const secs = Math.floor(seconds % 60);
|
||||
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
const handlePlayPause = () => {
|
||||
if (audioRef.current) {
|
||||
if (isPlaying) {
|
||||
audioRef.current.pause();
|
||||
} else {
|
||||
audioRef.current.play();
|
||||
}
|
||||
setIsPlaying(!isPlaying);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTimeUpdate = () => {
|
||||
if (audioRef.current) {
|
||||
setCurrentTime(audioRef.current.currentTime);
|
||||
}
|
||||
};
|
||||
|
||||
const handleLoadedMetadata = () => {
|
||||
if (audioRef.current) {
|
||||
setDuration(audioRef.current.duration);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSeek = (e) => {
|
||||
if (!audioRef.current || !duration) return;
|
||||
|
||||
const rect = e.currentTarget.getBoundingClientRect();
|
||||
const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
||||
const seekTime = percent * duration;
|
||||
|
||||
audioRef.current.currentTime = seekTime;
|
||||
setCurrentTime(seekTime);
|
||||
};
|
||||
|
||||
const handleProgressMouseDown = (e) => {
|
||||
e.preventDefault();
|
||||
const handleMouseMove = (moveEvent) => {
|
||||
handleSeek(moveEvent);
|
||||
};
|
||||
|
||||
const handleMouseUp = () => {
|
||||
document.removeEventListener('mousemove', handleMouseMove);
|
||||
document.removeEventListener('mouseup', handleMouseUp);
|
||||
};
|
||||
|
||||
document.addEventListener('mousemove', handleMouseMove);
|
||||
document.addEventListener('mouseup', handleMouseUp);
|
||||
|
||||
handleSeek(e);
|
||||
};
|
||||
|
||||
const handleVolumeChange = (e) => {
|
||||
const newVolume = parseFloat(e.target.value);
|
||||
setVolume(newVolume);
|
||||
if (audioRef.current) {
|
||||
audioRef.current.volume = newVolume;
|
||||
}
|
||||
};
|
||||
|
||||
const jumpToTime = (timestamp) => {
|
||||
if (audioRef.current) {
|
||||
audioRef.current.currentTime = timestamp;
|
||||
setCurrentTime(timestamp);
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading-container"><div className="loading-spinner"></div><p>加载中...</p></div>;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return <div className="error-container"><p>{error}</p><Link to="/dashboard"><span className="btn-secondary">返回首页</span></Link></div>;
|
||||
}
|
||||
|
||||
if (!meeting) {
|
||||
return <div className="error-container"><p>未找到会议信息。</p><Link to="/dashboard"><span className="btn-secondary">返回首页</span></Link></div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="meeting-details-page">
|
||||
<div className="details-header">
|
||||
<Link to="/dashboard">
|
||||
<span className="back-link">
|
||||
<ArrowLeft size={20} />
|
||||
<span>返回首页</span>
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="details-layout">
|
||||
<div className="main-content">
|
||||
<div className="details-content-card">
|
||||
<header className="card-header">
|
||||
<h1>{meeting.title}</h1>
|
||||
<div className="meta-grid">
|
||||
<div className="meta-item">
|
||||
<Calendar size={18} />
|
||||
<strong>会议日期:</strong>
|
||||
<span>{formatDateTime(meeting.meeting_time).split(' ')[0]}</span>
|
||||
</div>
|
||||
<div className="meta-item">
|
||||
<Clock size={18} />
|
||||
<strong>会议时间:</strong>
|
||||
<span>{formatDateTime(meeting.meeting_time).split(' ')[1]}</span>
|
||||
</div>
|
||||
<div className="meta-item">
|
||||
<User size={18} />
|
||||
<strong>创建人:</strong>
|
||||
<span>{meeting.creator_username}</span>
|
||||
</div>
|
||||
<div className="meta-item">
|
||||
<Users size={18} />
|
||||
<strong>参会人数:</strong>
|
||||
<span>{meeting.attendees.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Audio Player Section */}
|
||||
<section className="card-section audio-section">
|
||||
<h2><Volume2 size={20} /> 会议录音</h2>
|
||||
{audioUrl ? (
|
||||
<div className="audio-player">
|
||||
{audioFileName && (
|
||||
<div className="audio-file-info">
|
||||
<span className="audio-file-name">{audioFileName}</span>
|
||||
</div>
|
||||
)}
|
||||
<audio
|
||||
ref={audioRef}
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
onLoadedMetadata={handleLoadedMetadata}
|
||||
onEnded={() => setIsPlaying(false)}
|
||||
>
|
||||
<source src={audioUrl} type="audio/mpeg" />
|
||||
您的浏览器不支持音频播放。
|
||||
</audio>
|
||||
|
||||
<div className="player-controls">
|
||||
<button className="play-button" onClick={handlePlayPause}>
|
||||
{isPlaying ? <Pause size={24} /> : <Play size={24} />}
|
||||
</button>
|
||||
|
||||
<div className="time-info">
|
||||
<span>{formatTime(currentTime)}</span>
|
||||
</div>
|
||||
|
||||
<div className="progress-container"
|
||||
onClick={handleSeek}
|
||||
onMouseDown={handleProgressMouseDown}>
|
||||
<div className="progress-bar">
|
||||
<div
|
||||
className="progress-fill"
|
||||
style={{ width: `${duration ? (currentTime / duration) * 100 : 0}%` }}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="time-info">
|
||||
<span>{formatTime(duration)}</span>
|
||||
</div>
|
||||
|
||||
<div className="volume-control">
|
||||
<Volume2 size={18} />
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="1"
|
||||
step="0.1"
|
||||
value={volume}
|
||||
onChange={handleVolumeChange}
|
||||
className="volume-slider"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="no-audio">
|
||||
<div className="no-audio-icon">
|
||||
<Volume2 size={48} />
|
||||
</div>
|
||||
<p className="no-audio-message">该会议没有录音文件</p>
|
||||
<p className="no-audio-hint">录音功能可能未开启或录音文件丢失</p>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="card-section">
|
||||
<h2><FileText size={20} /> 会议摘要</h2>
|
||||
<div className="summary-content">
|
||||
<div className="markdown-content">
|
||||
<ReactMarkdown>
|
||||
{meeting.summary || '暂无摘要信息。'}
|
||||
</ReactMarkdown>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="card-section">
|
||||
<h2><Users size={20} /> 参会人员</h2>
|
||||
<div className="attendees-list">
|
||||
{meeting.attendees.map((attendee, index) => (
|
||||
<div key={index} className="attendee-chip">
|
||||
<User size={16} />
|
||||
<span>{typeof attendee === 'string' ? attendee : attendee.caption}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Transcript Sidebar */}
|
||||
<div className="transcript-sidebar">
|
||||
<div className="transcript-header">
|
||||
<h3><MessageCircle size={20} /> 对话转录</h3>
|
||||
<button
|
||||
className="toggle-transcript"
|
||||
onClick={() => setShowTranscript(!showTranscript)}
|
||||
>
|
||||
{showTranscript ? '隐藏' : '显示'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{showTranscript && (
|
||||
<div className="transcript-content">
|
||||
{transcript.map((item) => (
|
||||
<div key={item.segment_id} className="transcript-item">
|
||||
<div className="transcript-header-item">
|
||||
<span className="speaker-name">{item.speaker_tag}</span>
|
||||
<button
|
||||
className="timestamp-button"
|
||||
onClick={() => jumpToTime(item.start_time_ms / 1000)}
|
||||
title="跳转到此时间点"
|
||||
>
|
||||
{formatTime(item.start_time_ms / 1000)}
|
||||
</button>
|
||||
</div>
|
||||
<div className="transcript-text">{item.text_content}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MeetingDetails;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
||||
Loading…
Reference in New Issue