feat(gtm): Implement Rich Session Browser UI
- Replaced the basic session list with a dedicated, card-based Session Browser page. - Each session card now displays product name, category, description, and a thumbnail placeholder for better usability. - Updated the backend DB manager to extract this rich information from the existing JSON data store. - Refactored the frontend (App.tsx, types.ts) to support the new UI and data structure. - Added new component SessionBrowser.tsx and its corresponding CSS. - Updated documentation to reflect the v2.6 changes.
This commit is contained in:
134
gtm-architect/components/SessionBrowser.css
Normal file
134
gtm-architect/components/SessionBrowser.css
Normal file
@@ -0,0 +1,134 @@
|
||||
.session-browser {
|
||||
padding: 20px;
|
||||
background-color: #f0f2f5;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
.session-browser h2 {
|
||||
text-align: center;
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.session-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.session-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.session-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.category-icon {
|
||||
font-size: 24px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.card-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
color: #1a1a1a;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.thumbnail-placeholder {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
background-color: #e9ecef;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #adb5bd;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.thumbnail-placeholder span {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.thumbnail-placeholder p {
|
||||
margin-top: 8px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
flex-grow: 1; /* Ensures content area expands */
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.9rem;
|
||||
color: #555;
|
||||
margin-bottom: 12px;
|
||||
height: 4.5em; /* Approximately 3 lines of text */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.last-updated {
|
||||
font-size: 0.8rem;
|
||||
color: #888;
|
||||
margin-top: auto; /* Pushes to the bottom if content is short */
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.card-actions button {
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 8px 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.load-btn {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.load-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
background-color: #fceeee;
|
||||
color: #d9534f;
|
||||
}
|
||||
|
||||
.delete-btn:hover {
|
||||
background-color: #f8d7da;
|
||||
color: #b0413e;
|
||||
}
|
||||
|
||||
58
gtm-architect/components/SessionBrowser.tsx
Normal file
58
gtm-architect/components/SessionBrowser.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import React from 'react';
|
||||
import { ProjectHistoryItem } from './types';
|
||||
import './SessionBrowser.css';
|
||||
|
||||
interface SessionBrowserProps {
|
||||
sessions: ProjectHistoryItem[];
|
||||
onLoadSession: (projectId: string) => void;
|
||||
onDeleteSession: (projectId: string) => void;
|
||||
}
|
||||
|
||||
const SessionBrowser: React.FC<SessionBrowserProps> = ({ sessions, onLoadSession, onDeleteSession }) => {
|
||||
|
||||
const getCategoryIcon = (category: string) => {
|
||||
switch (category.toLowerCase()) {
|
||||
case 'reinigungsroboter':
|
||||
return '🧹'; // Sweeping broom emoji
|
||||
case 'serviceroboter':
|
||||
return '🛎️'; // Bellhop bell emoji
|
||||
case 'transportroboter':
|
||||
return '📦'; // Package emoji
|
||||
case 'security roboter':
|
||||
return '🛡️'; // Shield emoji
|
||||
default:
|
||||
return '🤖'; // Default robot emoji
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="session-browser">
|
||||
<h2>Gespeicherte Sitzungen</h2>
|
||||
<div className="session-grid">
|
||||
{sessions.map((session) => (
|
||||
<div key={session.id} className="session-card">
|
||||
<div className="card-header">
|
||||
<span className="category-icon">{getCategoryIcon(session.productCategory)}</span>
|
||||
<h3 title={session.productName}>{session.productName}</h3>
|
||||
</div>
|
||||
{/* Thumbnail placeholder */}
|
||||
<div className="thumbnail-placeholder">
|
||||
<span>🖼️</span>
|
||||
<p>Thumbnail</p>
|
||||
</div>
|
||||
<div className="card-content">
|
||||
<p className="product-description">{session.productDescription}</p>
|
||||
<p className="last-updated">Zuletzt bearbeitet: {new Date(session.updated_at).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="card-actions">
|
||||
<button onClick={() => onLoadSession(session.id)} className="load-btn">Laden</button>
|
||||
<button onClick={() => onDeleteSession(session.id)} className="delete-btn">Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SessionBrowser;
|
||||
Reference in New Issue
Block a user