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:
2026-01-08 21:23:46 +00:00
parent 0d521e76da
commit 9f65a1b01b
6 changed files with 252 additions and 39 deletions

View File

@@ -94,11 +94,33 @@ def get_project_data(project_id):
conn.close()
def get_all_projects():
"""Lists all projects."""
"""Lists all projects with key details extracted from the JSON data."""
conn = get_db_connection()
try:
projects = conn.execute('SELECT id, name, created_at, updated_at FROM gtm_projects ORDER BY updated_at DESC').fetchall()
return [dict(ix) for ix in projects]
query = """
SELECT
id,
name,
updated_at,
json_extract(data, '$.phases.phase1_result.specs.metadata.model_name') AS productName,
json_extract(data, '$.phases.phase1_result.specs.metadata.category') AS productCategory,
json_extract(data, '$.phases.phase1_result.specs.metadata.description') AS productDescription
FROM gtm_projects
ORDER BY updated_at DESC
"""
projects = conn.execute(query).fetchall()
# Convert row objects to dictionaries, handling potential None values
project_list = []
for row in projects:
project_dict = dict(row)
if project_dict.get('productName') is None:
project_dict['productName'] = project_dict['name'] # Fallback to project name
if project_dict.get('productCategory') is None:
project_dict['productCategory'] = "Uncategorized" # Default category
if project_dict.get('productDescription') is None:
project_dict['productDescription'] = "No description available." # Default description
project_list.append(project_dict)
return project_list
finally:
if conn:
conn.close()