加入会议标签

main
mula.liu 2025-09-19 16:51:49 +08:00
parent c7846a9f03
commit 230a77c3cf
15 changed files with 1528 additions and 79 deletions

View File

@ -278,12 +278,33 @@
margin-bottom: 1rem;
}
/* Meeting Title and Tags Layout */
.title-and-tags {
flex: 1;
}
.meeting-title {
margin: 0 0 0.75rem 0;
color: #1e293b;
font-size: 1.25rem;
font-weight: 600;
line-height: 1.4;
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.meeting-title .inline-tags {
margin: 0;
}
.meeting-title .inline-tags .tag-item {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
font-size: 10px;
padding: 2px 8px;
border-radius: 12px;
}
.meeting-meta {

View File

@ -5,6 +5,7 @@ import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw';
import rehypeSanitize from 'rehype-sanitize';
import TagDisplay from './TagDisplay';
import './MeetingTimeline.css';
const MeetingTimeline = ({ meetingsByDate, currentUser, onDeleteMeeting }) => {
@ -116,7 +117,20 @@ const MeetingTimeline = ({ meetingsByDate, currentUser, onDeleteMeeting }) => {
<div className="meeting-content">
<div className="meeting-header">
<div className="meeting-title-section">
<h3 className="meeting-title">{meeting.title}</h3>
<div className="title-and-tags">
<h3 className="meeting-title">
{meeting.title}
{meeting.tags && meeting.tags.length > 0 && (
<TagDisplay
tags={meeting.tags.map(tag => tag.name)}
size="small"
maxDisplay={3}
showIcon={true}
className="inline-tags"
/>
)}
</h3>
</div>
{isCreator && (
<div className="meeting-actions">
<button

View File

@ -0,0 +1,397 @@
.tag-cloud-container {
background: white;
border-radius: 12px;
padding: 1.5rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border: 1px solid #e2e8f0;
position: relative;
overflow: hidden;
}
/* 背景动画效果 */
.tag-cloud-container::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
rgba(102, 126, 234, 0.03) 0%,
rgba(118, 75, 162, 0.03) 25%,
rgba(16, 185, 129, 0.03) 50%,
rgba(102, 126, 234, 0.03) 75%,
rgba(118, 75, 162, 0.03) 100%);
animation: backgroundShift 20s ease-in-out infinite;
pointer-events: none;
}
@keyframes backgroundShift {
0%, 100% { transform: translate(-25%, -25%) rotate(0deg); }
25% { transform: translate(-25%, -30%) rotate(90deg); }
50% { transform: translate(-30%, -25%) rotate(180deg); }
75% { transform: translate(-20%, -20%) rotate(270deg); }
}
.tag-cloud-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid #f1f5f9;
position: relative;
z-index: 1;
}
.tag-cloud-header h3 {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
color: #1e293b;
}
.tag-cloud-header small {
color: #64748b;
margin-left: auto;
opacity: 0;
animation: fadeInSlide 0.8s ease-out 0.5s forwards;
}
@keyframes fadeInSlide {
from {
opacity: 0;
transform: translateX(20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: baseline;
justify-content: center;
min-height: 120px;
padding: 1rem 0;
position: relative;
z-index: 1;
}
.tag-cloud-item {
display: inline-flex;
align-items: center;
gap: 4px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
color: #475569;
white-space: nowrap;
text-decoration: none;
font-family: inherit;
position: relative;
transform-origin: center;
opacity: 0;
transform: translateY(20px) scale(0.8);
animation: tagAppear 0.6s ease-out forwards;
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* 错开动画时间让标签依次出现 */
.tag-cloud-item:nth-child(1) { animation-delay: 0.1s; }
.tag-cloud-item:nth-child(2) { animation-delay: 0.15s; }
.tag-cloud-item:nth-child(3) { animation-delay: 0.2s; }
.tag-cloud-item:nth-child(4) { animation-delay: 0.25s; }
.tag-cloud-item:nth-child(5) { animation-delay: 0.3s; }
.tag-cloud-item:nth-child(6) { animation-delay: 0.35s; }
.tag-cloud-item:nth-child(7) { animation-delay: 0.4s; }
.tag-cloud-item:nth-child(8) { animation-delay: 0.45s; }
.tag-cloud-item:nth-child(9) { animation-delay: 0.5s; }
.tag-cloud-item:nth-child(10) { animation-delay: 0.55s; }
.tag-cloud-item:nth-child(n+11) { animation-delay: 0.6s; }
@keyframes tagAppear {
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* 悬停时的弹性动画 */
.tag-cloud-item:hover {
background: #667eea;
color: white;
transform: scale(1.08) translateY(-2px);
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
border-color: #667eea;
z-index: 10;
opacity: 1;
animation: none;
}
@keyframes bounce {
0%, 100% { transform: scale(1.08) translateY(-2px); }
50% { transform: scale(1.12) translateY(-4px); }
}
/* 选中状态的脉冲动画 */
.tag-cloud-item.selected {
background: #4f46e5;
color: white;
border-color: #4f46e5;
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% {
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
transform: scale(1);
}
50% {
box-shadow: 0 6px 16px rgba(79, 70, 229, 0.6);
transform: scale(1.02);
}
}
/* 不同大小的标签 - 模拟经典标签云效果 */
.tag-cloud-item.xs {
font-size: 11px;
padding: 3px 8px;
line-height: 1.2;
}
.tag-cloud-item.sm {
font-size: 12px;
padding: 4px 10px;
line-height: 1.3;
}
.tag-cloud-item.md {
font-size: 14px;
padding: 6px 12px;
line-height: 1.4;
font-weight: 600;
}
.tag-cloud-item.lg {
font-size: 16px;
padding: 8px 16px;
line-height: 1.4;
font-weight: 600;
}
.tag-cloud-item.xl {
font-size: 18px;
padding: 10px 20px;
line-height: 1.5;
font-weight: 700;
}
.tag-name {
line-height: 1;
}
.tag-count {
background: rgba(0, 0, 0, 0.1);
border-radius: 8px;
padding: 1px 5px;
font-size: 9px;
line-height: 1;
font-weight: 600;
margin-left: 2px;
transition: all 0.3s ease;
}
.tag-cloud-item.xs .tag-count {
font-size: 8px;
padding: 1px 4px;
}
.tag-cloud-item.sm .tag-count {
font-size: 9px;
padding: 1px 4px;
}
.tag-cloud-item.md .tag-count {
font-size: 10px;
padding: 2px 5px;
}
.tag-cloud-item.lg .tag-count {
font-size: 11px;
padding: 2px 6px;
}
.tag-cloud-item.xl .tag-count {
font-size: 12px;
padding: 3px 7px;
}
.tag-cloud-item:hover .tag-count,
.tag-cloud-item.selected .tag-count {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.1);
}
/* 选中标签的滑入动画 */
.selected-tags {
margin-top: 1rem;
padding-top: 0.75rem;
border-top: 1px solid #f1f5f9;
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
position: relative;
z-index: 1;
}
.selected-label {
font-size: 12px;
font-weight: 600;
color: #64748b;
margin-right: 4px;
}
.selected-tag {
display: inline-flex;
align-items: center;
gap: 4px;
background: #4f46e5;
color: white;
font-size: 11px;
font-weight: 500;
padding: 3px 8px;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
opacity: 0;
transform: translateX(-20px) scale(0.8);
animation: selectedTagSlide 0.4s ease-out forwards;
}
@keyframes selectedTagSlide {
to {
opacity: 1;
transform: translateX(0) scale(1);
}
}
.selected-tag:hover {
background: #3730a3;
transform: translateY(-2px) scale(1.05);
box-shadow: 0 4px 12px rgba(55, 48, 163, 0.3);
}
.remove-tag {
font-size: 14px;
font-weight: bold;
margin-left: 2px;
transition: transform 0.2s ease;
}
.selected-tag:hover .remove-tag {
transform: rotate(90deg);
}
.tag-cloud-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem 2rem;
text-align: center;
color: #64748b;
background: white;
border-radius: 12px;
border: 1px solid #e2e8f0;
min-height: 200px;
position: relative;
z-index: 1;
}
.tag-cloud-empty p {
margin: 0.5rem 0 0.25rem 0;
font-weight: 500;
opacity: 0;
animation: fadeInUp 0.6s ease-out 0.3s forwards;
}
.tag-cloud-empty small {
font-size: 12px;
color: #94a3b8;
opacity: 0;
animation: fadeInUp 0.6s ease-out 0.6s forwards;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.tag-cloud-container {
padding: 1rem;
}
.tag-cloud {
gap: 6px;
min-height: 100px;
padding: 0.5rem 0;
}
.tag-cloud-item {
gap: 3px;
}
.tag-cloud-item.xs {
font-size: 10px;
padding: 2px 6px;
}
.tag-cloud-item.sm {
font-size: 11px;
padding: 3px 8px;
}
.tag-cloud-item.md {
font-size: 12px;
padding: 4px 10px;
}
.tag-cloud-item.lg {
font-size: 14px;
padding: 6px 12px;
}
.tag-cloud-item.xl {
font-size: 16px;
padding: 8px 16px;
}
.tag-cloud-header small {
display: none;
}
/* 移动端动画性能优化 */
.tag-cloud-container::before {
animation: none;
}
.tag-cloud-item.selected {
animation: none;
}
}

View File

@ -0,0 +1,117 @@
import React, { useState, useEffect } from 'react';
import { Tag, TrendingUp } from 'lucide-react';
import apiClient from '../utils/apiClient';
import { buildApiUrl } from '../config/api';
import './TagCloud.css';
const TagCloud = ({
meetings = [],
onTagClick = null,
selectedTags = [],
maxTags = 20
}) => {
const [tagStats, setTagStats] = useState([]);
useEffect(() => {
calculateTagStats();
}, [meetings]);
const calculateTagStats = () => {
const tagCounts = {};
//
meetings.forEach(meeting => {
if (meeting.tags && meeting.tags.length > 0) {
meeting.tags.forEach(tag => {
const tagName = typeof tag === 'string' ? tag : tag.name;
tagCounts[tagName] = (tagCounts[tagName] || 0) + 1;
});
}
});
//
const stats = Object.entries(tagCounts)
.map(([name, count]) => ({ name, count }))
.sort((a, b) => b.count - a.count)
.slice(0, maxTags);
setTagStats(stats);
};
const getTagSize = (count, maxCount) => {
// 使
const ratio = count / maxCount;
if (ratio >= 0.8) return 'xl';
if (ratio >= 0.6) return 'lg';
if (ratio >= 0.4) return 'md';
if (ratio >= 0.2) return 'sm';
return 'xs';
};
const handleTagClick = (tagName) => {
if (onTagClick) {
onTagClick(tagName);
}
};
if (tagStats.length === 0) {
return (
<div className="tag-cloud-empty">
<Tag size={32} />
<p>暂无标签数据</p>
<small>创建会议时添加标签这里将显示标签云</small>
</div>
);
}
const maxCount = Math.max(...tagStats.map(tag => tag.count));
return (
<div className="tag-cloud-container">
<div className="tag-cloud-header">
<TrendingUp size={20} />
<h3>标签云</h3>
<small>点击标签筛选相关会议</small>
</div>
<div className="tag-cloud">
{tagStats.map((tag, index) => {
const size = getTagSize(tag.count, maxCount);
const isSelected = selectedTags.includes(tag.name);
return (
<button
key={index}
className={`tag-cloud-item ${size} ${isSelected ? 'selected' : ''}`}
onClick={() => handleTagClick(tag.name)}
title={`${tag.name} (${tag.count} 个会议)`}
>
<span className="tag-name">{tag.name}</span>
<span className="tag-count">{tag.count}</span>
</button>
);
})}
</div>
<div className="selected-tags">
<span className="selected-label">已选择</span>
{selectedTags.length > 0 ? (
selectedTags.map((tag, index) => (
<span
key={index}
className="selected-tag"
onClick={() => handleTagClick(tag)}
>
{tag}
<span className="remove-tag">×</span>
</span>
))
) : (
<span style={{ color: '#94a3b8', fontSize: '0.875rem' }}>暂未选择任何标签</span>
)}
</div>
</div>
);
};
export default TagCloud;

View File

@ -0,0 +1,136 @@
.tag-display {
display: inline-flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.tag-display.small {
gap: 4px;
}
.tag-display.large {
gap: 8px;
}
.tag-display-icon {
color: #6b7280;
flex-shrink: 0;
}
.tag-list {
display: inline-flex;
align-items: center;
gap: 4px;
flex-wrap: wrap;
}
.tag-item {
display: inline-block;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
font-size: 11px;
font-weight: 500;
border-radius: 12px;
padding: 2px 8px;
white-space: nowrap;
max-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
transition: all 0.2s ease;
}
.tag-display.small .tag-item {
font-size: 10px;
padding: 1px 6px;
border-radius: 10px;
max-width: 80px;
}
.tag-display.large .tag-item {
font-size: 12px;
padding: 4px 10px;
border-radius: 14px;
max-width: 120px;
}
.tag-item.clickable {
cursor: pointer;
}
.tag-item.clickable:hover {
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}
.tag-more {
display: inline-block;
background: #e5e7eb;
color: #6b7280;
font-size: 11px;
font-weight: 500;
border-radius: 12px;
padding: 2px 8px;
white-space: nowrap;
}
.tag-display.small .tag-more {
font-size: 10px;
padding: 1px 6px;
border-radius: 10px;
}
.tag-display.large .tag-more {
font-size: 12px;
padding: 4px 10px;
border-radius: 14px;
}
/* 适用于卡片内的标签显示 */
.meeting-card .tag-display {
margin-top: 8px;
}
.meeting-card .tag-display .tag-item {
background: rgba(79, 70, 229, 0.1);
color: #4f46e5;
border: 1px solid rgba(79, 70, 229, 0.2);
}
.meeting-card .tag-display .tag-item:hover {
background: rgba(79, 70, 229, 0.15);
border-color: rgba(79, 70, 229, 0.3);
}
/* 适用于详情页标题的标签显示 */
.meeting-header .tag-display {
margin-left: 12px;
}
.meeting-header .tag-display .tag-item {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
/* 响应式设计 */
@media (max-width: 768px) {
.tag-display {
gap: 3px;
}
.tag-list {
gap: 3px;
}
.tag-item {
font-size: 10px;
padding: 1px 6px;
max-width: 70px;
}
.tag-display.large .tag-item {
font-size: 11px;
padding: 2px 8px;
max-width: 90px;
}
}

View File

@ -0,0 +1,64 @@
import React from 'react';
import { Tag } from 'lucide-react';
import './TagDisplay.css';
const TagDisplay = ({
tags = [],
size = 'medium',
maxDisplay = null,
showIcon = false,
clickable = false,
onTagClick = null,
className = ''
}) => {
// tags
const tagArray = Array.isArray(tags) ? tags :
typeof tags === 'string' ? tags.split(',').map(t => t.trim()).filter(t => t) : [];
if (tagArray.length === 0) {
return null;
}
//
const displayTags = maxDisplay && tagArray.length > maxDisplay ?
tagArray.slice(0, maxDisplay) : tagArray;
const hasMore = maxDisplay && tagArray.length > maxDisplay;
const moreCount = hasMore ? tagArray.length - maxDisplay : 0;
const handleTagClick = (tag, event) => {
if (clickable && onTagClick) {
event.preventDefault();
event.stopPropagation();
onTagClick(tag);
}
};
return (
<div className={`tag-display ${size} ${className}`}>
{showIcon && (
<Tag size={size === 'small' ? 12 : size === 'large' ? 18 : 14} className="tag-display-icon" />
)}
<div className="tag-list">
{displayTags.map((tag, index) => (
<span
key={index}
className={`tag-item ${clickable ? 'clickable' : ''}`}
onClick={(e) => handleTagClick(tag, e)}
title={tag}
>
{tag}
</span>
))}
{hasMore && (
<span className="tag-more" title={`还有 ${moreCount} 个标签`}>
+{moreCount}
</span>
)}
</div>
</div>
);
};
export default TagDisplay;

View File

@ -0,0 +1,164 @@
.tag-editor-container {
position: relative;
width: 100%;
}
.tag-editor {
border: 2px solid #e2e8f0;
border-radius: 8px;
background: #ffffff;
min-height: 44px;
transition: all 0.2s ease;
position: relative;
}
.tag-editor.disabled {
background-color: #f8fafc;
border-color: #e2e8f0;
cursor: not-allowed;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px;
align-items: center;
min-height: 28px;
}
.tag-chip {
display: inline-flex;
align-items: center;
gap: 4px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 4px 8px;
border-radius: 20px;
font-size: 12px;
font-weight: 500;
white-space: nowrap;
transition: all 0.2s ease;
}
.tag-chip:hover {
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.tag-text {
line-height: 1;
}
.tag-remove {
background: none;
border: none;
color: white;
cursor: pointer;
padding: 2px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s ease;
margin-left: 2px;
}
.tag-remove:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.tag-input {
border: none;
outline: none;
background: transparent;
font-size: 14px;
padding: 4px;
flex: 1;
min-width: 120px;
color: #374151;
border-radius: 4px;
transition: all 0.2s ease;
}
.tag-input:focus {
background: #f8fafc;
box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
.tag-input::placeholder {
color: #9ca3af;
}
.tag-suggestions {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid #e2e8f0;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
z-index: 1000;
max-height: 200px;
overflow-y: auto;
margin-top: 4px;
}
.tag-suggestion {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
cursor: pointer;
transition: background-color 0.2s ease;
border-bottom: 1px solid #f1f5f9;
}
.tag-suggestion:last-child {
border-bottom: none;
}
.tag-suggestion:hover {
background-color: #f8fafc;
}
.tag-suggestion span {
font-size: 14px;
color: #374151;
}
.tag-editor-hint {
margin-top: 6px;
}
.tag-editor-hint small {
color: #6b7280;
font-size: 12px;
}
/* 响应式设计 */
@media (max-width: 768px) {
.tag-list {
gap: 4px;
padding: 6px;
}
.tag-chip {
font-size: 11px;
padding: 3px 6px;
}
.tag-input {
font-size: 13px;
min-width: 100px;
}
.tag-suggestions {
max-height: 150px;
}
.tag-suggestion {
padding: 6px 10px;
}
}

View File

@ -0,0 +1,181 @@
import React, { useState, useEffect, useRef } from 'react';
import { Tag, X, Plus } from 'lucide-react';
import apiClient from '../utils/apiClient';
import { buildApiUrl } from '../config/api';
import './TagEditor.css';
const TagEditor = ({
value = '',
onChange,
placeholder = '输入标签,按回车或逗号分隔',
disabled = false
}) => {
const [inputValue, setInputValue] = useState('');
const [tags, setTags] = useState([]);
const [availableTags, setAvailableTags] = useState([]);
const [showSuggestions, setShowSuggestions] = useState(false);
const [filteredSuggestions, setFilteredSuggestions] = useState([]);
const inputRef = useRef(null);
const containerRef = useRef(null);
//
useEffect(() => {
if (value) {
const initialTags = value.split(',').map(tag => tag.trim()).filter(tag => tag);
setTags(initialTags);
} else {
setTags([]);
}
}, [value]);
//
useEffect(() => {
fetchAvailableTags();
}, []);
//
useEffect(() => {
const handleClickOutside = (event) => {
if (containerRef.current && !containerRef.current.contains(event.target)) {
setShowSuggestions(false);
}
};
document.addEventListener('mousedown', handleClickOutside);
return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, []);
const fetchAvailableTags = async () => {
try {
const response = await apiClient.get(buildApiUrl('/api/tags/'));
setAvailableTags(response.data.map(tag => tag.name));
} catch (err) {
console.error('Error fetching tags:', err);
}
};
const updateParent = (newTags) => {
const tagString = newTags.join(', ');
onChange(tagString);
};
const addTag = (tagName) => {
const trimmedTag = tagName.trim();
if (trimmedTag && !tags.includes(trimmedTag)) {
const newTags = [...tags, trimmedTag];
setTags(newTags);
updateParent(newTags);
}
};
const removeTag = (indexToRemove) => {
const newTags = tags.filter((_, index) => index !== indexToRemove);
setTags(newTags);
updateParent(newTags);
};
const handleInputChange = (e) => {
const value = e.target.value;
setInputValue(value);
//
if (value.trim()) {
const filtered = availableTags.filter(tag =>
tag.toLowerCase().includes(value.toLowerCase()) &&
!tags.includes(tag)
);
setFilteredSuggestions(filtered);
setShowSuggestions(true);
} else {
setShowSuggestions(false);
}
};
const handleInputKeyDown = (e) => {
if (e.key === 'Enter' || e.key === ',') {
e.preventDefault();
if (inputValue.trim()) {
addTag(inputValue);
setInputValue('');
setShowSuggestions(false);
}
} else if (e.key === 'Backspace' && !inputValue && tags.length > 0) {
//
removeTag(tags.length - 1);
}
};
const handleSuggestionClick = (suggestion) => {
addTag(suggestion);
setInputValue('');
setShowSuggestions(false);
inputRef.current?.focus();
};
const handleInputFocus = () => {
if (inputValue.trim()) {
setShowSuggestions(true);
}
};
return (
<div className="tag-editor-container" ref={containerRef}>
<div className={`tag-editor ${disabled ? 'disabled' : ''}`}>
<div className="tag-list">
{tags.map((tag, index) => (
<div key={index} className="tag-chip">
<span className="tag-text">{tag}</span>
{!disabled && (
<button
type="button"
className="tag-remove"
onClick={() => removeTag(index)}
title="移除标签"
>
<X size={12} />
</button>
)}
</div>
))}
{!disabled && (
<input
ref={inputRef}
type="text"
value={inputValue}
onChange={handleInputChange}
onKeyDown={handleInputKeyDown}
onFocus={handleInputFocus}
placeholder={tags.length === 0 ? placeholder : ''}
className="tag-input"
/>
)}
</div>
{showSuggestions && filteredSuggestions.length > 0 && (
<div className="tag-suggestions">
{filteredSuggestions.slice(0, 10).map((suggestion, index) => (
<div
key={index}
className="tag-suggestion"
onClick={() => handleSuggestionClick(suggestion)}
>
<Tag size={14} />
<span>{suggestion}</span>
</div>
))}
</div>
)}
</div>
<div className="tag-editor-hint">
<small>
输入标签名称按回车或逗号添加点击建议的标签快速选择
</small>
</div>
</div>
);
};
export default TagEditor;

View File

@ -38,24 +38,24 @@
.create-card-header {
padding: 2rem;
background: linear-gradient(135deg, #f5f7fa, #eef2f7);
background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
border-bottom: 1px solid #e2e8f0;
text-align: center;
color: white;
}
.create-card-header h1 {
font-size: 2rem;
font-weight: 700;
color: #1e293b;
color: white;
margin: 0 0 0.5rem 0;
}
.create-card-header p {
color: #64748b;
margin: 0;
font-size: 1rem;
color: rgba(255, 255, 255, 0.9);
margin: 0;
}
.create-form {
padding: 2rem;
}
@ -302,19 +302,19 @@
display: inline-flex;
align-items: center;
padding: 0.75rem 2rem;
background: linear-gradient(135deg, #667eea, #764ba2);
background: linear-gradient(135deg, #3b82f6, #1e40af);
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);
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.btn-submit:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}
.btn-submit:disabled {

View File

@ -1,9 +1,10 @@
import React, { useState, useEffect } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import apiClient from '../utils/apiClient';
import { ArrowLeft, Upload, Users, Calendar, FileText, X, User, Plus } from 'lucide-react';
import { ArrowLeft, Upload, Users, Calendar, FileText, X, User, Plus, Tag } from 'lucide-react';
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
import DateTimePicker from '../components/DateTimePicker';
import TagEditor from '../components/TagEditor';
import './CreateMeeting.css';
const CreateMeeting = ({ user }) => {
@ -11,7 +12,8 @@ const CreateMeeting = ({ user }) => {
const [formData, setFormData] = useState({
title: '',
meeting_time: '',
attendees: []
attendees: [],
tags: ''
});
const [availableUsers, setAvailableUsers] = useState([]);
const [userSearch, setUserSearch] = useState('');
@ -98,7 +100,8 @@ const CreateMeeting = ({ user }) => {
user_id: user.user_id,
title: formData.title,
meeting_time: formData.meeting_time || null,
attendee_ids: formData.attendees.map(a => a.user_id)
attendee_ids: formData.attendees.map(a => a.user_id),
tags: formData.tags
};
const response = await apiClient.post(buildApiUrl(API_ENDPOINTS.MEETINGS.CREATE), meetingData);
@ -182,6 +185,18 @@ const CreateMeeting = ({ user }) => {
/>
</div>
<div className="form-group">
<label htmlFor="tags">
<Tag size={18} />
会议标签
</label>
<TagEditor
value={formData.tags}
onChange={(value) => setFormData(prev => ({ ...prev, tags: value }))}
placeholder="输入标签,按回车或逗号分隔"
/>
</div>
<div className="form-group">
<label>
<Users size={18} />

View File

@ -75,58 +75,194 @@
gap: 2rem;
}
/* User Info Section */
.user-info-section {
/* 仪表板概览 - 三栏布局 */
.dashboard-overview {
display: grid;
grid-template-columns: 1fr 2fr;
grid-template-columns: 300px 280px 1fr;
gap: 2rem;
margin-bottom: 2rem;
}
.user-card {
background: white;
padding: 2rem;
border-radius: 16px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
padding: 1.5rem;
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
gap: 1rem;
border: 1px solid #e2e8f0;
}
.tag-cloud-wrapper {
display: flex;
flex-direction: column;
gap: 1rem;
}
.filter-result-bar {
background: white;
padding: 1rem 1.5rem;
border-radius: 8px;
border: 1px solid #e2e8f0;
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.filter-result-bar .clear-filters-btn {
background: #ef4444;
color: white;
border: none;
padding: 6px 12px;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 4px;
}
.filter-result-bar .clear-filters-btn:hover {
background: #dc2626;
transform: translateY(-1px);
}
.filter-result {
color: #64748b;
font-size: 0.875rem;
font-weight: 500;
}
.user-avatar {
width: 80px;
height: 80px;
width: 48px;
height: 48px;
background: linear-gradient(45deg, #667eea, #764ba2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
margin-bottom: 1rem;
flex-shrink: 0;
}
.user-details {
flex: 1;
}
.user-details h2 {
margin: 0 0 0.5rem 0;
margin: 0 0 0.25rem 0;
color: #1e293b;
font-size: 1.5rem;
font-size: 1.25rem;
font-weight: 600;
}
.user-email {
color: #64748b;
margin: 0 0 0.5rem 0;
margin: 0 0 0.25rem 0;
font-size: 0.875rem;
}
.join-date {
color: #94a3b8;
font-size: 0.9rem;
font-size: 0.75rem;
margin: 0;
}
/* Stats Grid */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
/* 统一的统计卡片样式 */
.unified-stats-card {
background: white;
padding: 1.5rem;
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
border: 1px solid #e2e8f0;
}
.unified-stats-card h3 {
margin: 0 0 1rem 0;
color: #1e293b;
font-size: 1.1rem;
font-weight: 600;
}
.stats-rows {
display: flex;
flex-direction: column;
gap: 0;
}
.stat-row {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.75rem;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.stat-row:hover {
background: #f8fafc;
border-color: #c7d2fe;
}
.stat-row.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-color: #667eea;
}
.stat-row .stat-icon {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
background: #f1f5f9;
}
.stat-row.active .stat-icon {
background: rgba(255, 255, 255, 0.2);
}
.stat-row .stat-icon .icon {
color: #64748b;
}
.stat-row.active .stat-icon .icon {
color: white;
}
.stat-text {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
}
.stat-label {
font-size: 0.9rem;
color: #64748b;
font-weight: 500;
}
.stat-row.active .stat-label {
color: white;
}
.stat-value {
font-size: 1.25rem;
font-weight: 700;
color: #1e293b;
}
.stat-row.active .stat-value {
color: white;
}
.stat-card {
@ -138,11 +274,29 @@
align-items: center;
gap: 1rem;
transition: all 0.3s ease;
cursor: pointer;
border: 2px solid transparent;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border-color: #c7d2fe;
}
.stat-card.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-color: #667eea;
}
.stat-card.active .stat-icon .icon {
color: white;
}
.stat-card.active .stat-info h3,
.stat-card.active .stat-info p {
color: white;
}
.stat-icon {
@ -182,6 +336,69 @@
font-size: 0.9rem;
}
/* Filter Section */
.filter-section {
background: white;
border-radius: 16px;
padding: 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
margin-bottom: 2rem;
overflow: hidden;
}
.filter-header {
padding: 1.5rem 2rem;
border-bottom: 1px solid #f1f5f9;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(135deg, #f8fafc, #eef2f7);
}
.filter-title {
display: flex;
align-items: center;
gap: 8px;
}
.filter-title h2 {
margin: 0;
color: #1e293b;
font-size: 1.3rem;
font-weight: 600;
}
.clear-filters-btn {
background: #ef4444;
color: white;
border: none;
padding: 8px 16px;
border-radius: 8px;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.clear-filters-btn:hover {
background: #dc2626;
transform: translateY(-1px);
}
.filter-summary {
padding: 1rem 2rem;
background: #f8fafc;
border-top: 1px solid #f1f5f9;
text-align: center;
}
.filter-result {
color: #64748b;
font-size: 0.875rem;
font-weight: 500;
}
/* Meetings Section */
.meetings-section {
background: white;
@ -280,25 +497,22 @@
.dashboard-content {
padding: 1rem;
}
.user-info-section {
.dashboard-overview {
grid-template-columns: 1fr;
gap: 1rem;
}
.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;
}

View File

@ -1,14 +1,18 @@
import React, { useState, useEffect, useRef } from 'react';
import { LogOut, User, Calendar, Users, TrendingUp, Clock, MessageSquare, Plus, ChevronDown, KeyRound, Shield } from 'lucide-react';
import { LogOut, User, Calendar, Users, TrendingUp, Clock, MessageSquare, Plus, ChevronDown, KeyRound, Shield, Filter, X } from 'lucide-react';
import apiClient from '../utils/apiClient';
import { Link } from 'react-router-dom';
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
import MeetingTimeline from '../components/MeetingTimeline';
import TagCloud from '../components/TagCloud';
import './Dashboard.css';
const Dashboard = ({ user, onLogout }) => {
const [userInfo, setUserInfo] = useState(null);
const [meetings, setMeetings] = useState([]);
const [filteredMeetings, setFilteredMeetings] = useState([]);
const [selectedTags, setSelectedTags] = useState([]);
const [filterType, setFilterType] = useState('all'); // 'all', 'created', 'attended'
const [loading, setLoading] = useState(true);
const [error, setError] = useState('');
const [dropdownOpen, setDropdownOpen] = useState(false);
@ -24,6 +28,52 @@ const Dashboard = ({ user, onLogout }) => {
fetchUserData();
}, [user.user_id]);
//
useEffect(() => {
filterMeetings();
}, [meetings, selectedTags, filterType]);
const filterMeetings = () => {
let filtered = [...meetings];
// /
if (filterType === 'created') {
filtered = filtered.filter(meeting => String(meeting.creator_id) === String(user.user_id));
} else if (filterType === 'attended') {
filtered = filtered.filter(meeting => String(meeting.creator_id) !== String(user.user_id));
}
//
if (selectedTags.length > 0) {
filtered = filtered.filter(meeting => {
if (!meeting.tags || meeting.tags.length === 0) return false;
const meetingTags = meeting.tags.map(tag => typeof tag === 'string' ? tag : tag.name);
return selectedTags.some(selectedTag => meetingTags.includes(selectedTag));
});
}
setFilteredMeetings(filtered);
};
const handleTagClick = (tagName) => {
setSelectedTags(prev => {
if (prev.includes(tagName)) {
return prev.filter(tag => tag !== tagName);
} else {
return [...prev, tagName];
}
});
};
const handleFilterTypeChange = (type) => {
setFilterType(type);
};
const clearFilters = () => {
setSelectedTags([]);
setFilterType('all');
};
useEffect(() => {
const handleClickOutside = (event) => {
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
@ -102,8 +152,8 @@ const Dashboard = ({ user, onLogout }) => {
}
};
const groupMeetingsByDate = (meetings) => {
return meetings.reduce((acc, meeting) => {
const groupMeetingsByDate = (meetingsToGroup) => {
return meetingsToGroup.reduce((acc, meeting) => {
const date = new Date(meeting.meeting_time || meeting.created_at).toISOString().split('T')[0];
if (!acc[date]) {
acc[date] = [];
@ -144,7 +194,11 @@ const Dashboard = ({ user, onLogout }) => {
);
}
const groupedMeetings = groupMeetingsByDate(meetings);
const groupedMeetings = groupMeetingsByDate(filteredMeetings);
//
const createdMeetings = meetings.filter(m => String(m.creator_id) === String(user.user_id));
const attendedMeetings = meetings.filter(m => String(m.creator_id) !== String(user.user_id));
return (
<div className="dashboard">
@ -177,8 +231,8 @@ const Dashboard = ({ user, onLogout }) => {
</header>
<div className="dashboard-content">
{/* User Info Section */}
<section className="user-info-section">
{/* 用户信息、统计和标签云一行布局 */}
<section className="dashboard-overview">
<div className="user-card">
<div className="user-avatar">
<User size={32} />
@ -190,38 +244,60 @@ const Dashboard = ({ user, onLogout }) => {
</div>
</div>
{/* Stats Cards */}
<div className="stats-grid">
<div className="stat-card">
<div className="stat-icon">
<Calendar className="icon" />
{/* 统一的统计卡片 */}
<div className="unified-stats-card">
<h3>会议统计</h3>
<div className="stats-rows">
<div
className={`stat-row ${filterType === 'created' ? 'active' : ''}`}
onClick={() => handleFilterTypeChange('created')}
>
<div className="stat-icon">
<Calendar className="icon" />
</div>
<div className="stat-text">
<span className="stat-label">我创建的会议</span>
<span className="stat-value">{createdMeetings.length}</span>
</div>
</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
className={`stat-row ${filterType === 'attended' ? 'active' : ''}`}
onClick={() => handleFilterTypeChange('attended')}
>
<div className="stat-icon">
<Users className="icon" />
</div>
<div className="stat-text">
<span className="stat-label">我参加的会议</span>
<span className="stat-value">{attendedMeetings.length}</span>
</div>
</div>
<div
className={`stat-row ${filterType === 'all' ? 'active' : ''}`}
onClick={() => handleFilterTypeChange('all')}
>
<div className="stat-icon">
<TrendingUp className="icon" />
</div>
<div className="stat-text">
<span className="stat-label">全部会议</span>
<span className="stat-value">{meetings.length}</span>
</div>
</div>
</div>
</div>
{/* 标签云卡片 */}
<div className="tag-cloud-wrapper">
<TagCloud
meetings={meetings}
onTagClick={handleTagClick}
selectedTags={selectedTags}
/>
</div>
</section>
{/* Meetings Timeline Section */}

View File

@ -1,11 +1,12 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import { Link, useNavigate, useParams } from 'react-router-dom';
import apiClient from '../utils/apiClient';
import { ArrowLeft, Users, Calendar, FileText, X, User, Save, Upload, Plus, Image } from 'lucide-react';
import { ArrowLeft, Users, Calendar, FileText, X, User, Save, Upload, Plus, Image, Tag } from 'lucide-react';
import MDEditor, * as commands from '@uiw/react-md-editor';
import '@uiw/react-md-editor/markdown-editor.css';
import { buildApiUrl, API_ENDPOINTS, API_BASE_URL } from '../config/api';
import DateTimePicker from '../components/DateTimePicker';
import TagEditor from '../components/TagEditor';
import './EditMeeting.css';
const EditMeeting = ({ user }) => {
@ -16,7 +17,8 @@ const EditMeeting = ({ user }) => {
title: '',
meeting_time: '',
summary: '',
attendees: []
attendees: [],
tags: ''
});
const [availableUsers, setAvailableUsers] = useState([]);
const [userSearch, setUserSearch] = useState('');
@ -56,7 +58,8 @@ const EditMeeting = ({ user }) => {
title: meetingData.title,
meeting_time: meetingData.meeting_time || '',
summary: meetingData.summary || '',
attendees: meetingData.attendees || []
attendees: meetingData.attendees || [],
tags: meetingData.tags ? meetingData.tags.map(t => t.name).join(', ') : ''
});
} catch (err) {
setError('无法加载会议信息');
@ -139,7 +142,8 @@ const EditMeeting = ({ user }) => {
title: formData.title,
meeting_time: formData.meeting_time || null,
summary: formData.summary,
attendee_ids: formData.attendees.map(a => a.user_id)
attendee_ids: formData.attendees.map(a => a.user_id),
tags: formData.tags
};
await apiClient.put(buildApiUrl(API_ENDPOINTS.MEETINGS.UPDATE(meeting_id)), updateData);
@ -389,6 +393,18 @@ const EditMeeting = ({ user }) => {
/>
</div>
<div className="form-group">
<label htmlFor="tags">
<Tag size={18} />
会议标签
</label>
<TagEditor
value={formData.tags}
onChange={(value) => setFormData(prev => ({ ...prev, tags: value }))}
placeholder="输入标签,按回车或逗号分隔"
/>
</div>
<div className="form-group">
<label>
<Users size={18} />

View File

@ -100,11 +100,32 @@
border-bottom: 1px solid #e2e8f0;
}
.meeting-header-title {
margin-bottom: 1.5rem;
}
.card-header h1 {
font-size: 2rem;
font-weight: 700;
color: #1e293b;
margin: 0 0 1.5rem 0;
margin: 0;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
line-height: 1.2;
}
.card-header h1 .inline-title-tags {
margin: 0;
}
.card-header h1 .inline-title-tags .tag-item {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
font-size: 12px;
padding: 4px 10px;
border-radius: 14px;
}
.meta-grid {

View File

@ -9,6 +9,7 @@ import rehypeSanitize from 'rehype-sanitize';
import { buildApiUrl, API_ENDPOINTS, API_BASE_URL } from '../config/api';
import MindMap from '../components/MindMap';
import MeetingSummary from '../components/MeetingSummary';
import TagDisplay from '../components/TagDisplay';
import { Tabs } from 'antd';
import './MeetingDetails.css';
@ -772,7 +773,19 @@ const MeetingDetails = ({ user }) => {
<div className="main-content">
<div className="details-content-card">
<header className="card-header">
<h1>{meeting.title}</h1>
<div className="meeting-header-title">
<h1>
{meeting.title}
{meeting.tags && meeting.tags.length > 0 && (
<TagDisplay
tags={meeting.tags.map(tag => tag.name)}
size="medium"
showIcon={true}
className="inline-title-tags"
/>
)}
</h1>
</div>
<div className="meta-grid">
<div className="meta-item">
<Calendar size={18} />