feat: brain colored folders/tags — color + icon fields, mobile pills
Backend: - Added color (hex) and icon (lucide name) columns to folders and tags - Default folders seeded with colors: Home=green, Work=indigo, Travel=blue, etc. - API returns color/icon in sidebar and CRUD responses - Create/update endpoints accept color and icon Frontend: - Mobile: horizontal scrollable pill tabs with colored dots - Desktop sidebar: colored dots next to folder names - Active pill gets tinted border matching folder color Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,8 @@ class Folder(Base):
|
||||
user_id = Column(String(64), nullable=False, index=True)
|
||||
name = Column(String(128), nullable=False)
|
||||
slug = Column(String(128), nullable=False)
|
||||
color = Column(String(7), nullable=True) # hex like #4F46E5
|
||||
icon = Column(String(32), nullable=True) # lucide icon name like "home"
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
sort_order = Column(Integer, default=0, nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
@@ -46,6 +48,8 @@ class Tag(Base):
|
||||
user_id = Column(String(64), nullable=False, index=True)
|
||||
name = Column(String(128), nullable=False)
|
||||
slug = Column(String(128), nullable=False)
|
||||
color = Column(String(7), nullable=True)
|
||||
icon = Column(String(32), nullable=True)
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
sort_order = Column(Integer, default=0, nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
@@ -64,8 +68,16 @@ class ItemTag(Base):
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
|
||||
|
||||
# Default folders to seed for new users
|
||||
DEFAULT_FOLDERS = ["Home", "Family", "Work", "Travel", "Knowledge", "Faith", "Projects"]
|
||||
# Default folders with colors and icons
|
||||
DEFAULT_FOLDERS = [
|
||||
{"name": "Home", "color": "#059669", "icon": "home"},
|
||||
{"name": "Family", "color": "#D97706", "icon": "heart"},
|
||||
{"name": "Work", "color": "#4338CA", "icon": "briefcase"},
|
||||
{"name": "Travel", "color": "#0EA5E9", "icon": "plane"},
|
||||
{"name": "Knowledge", "color": "#8B5CF6", "icon": "book-open"},
|
||||
{"name": "Faith", "color": "#10B981", "icon": "moon"},
|
||||
{"name": "Projects", "color": "#F43F5E", "icon": "folder"},
|
||||
]
|
||||
|
||||
# Default tags to seed for new users
|
||||
DEFAULT_TAGS = [
|
||||
@@ -87,8 +99,9 @@ async def ensure_user_taxonomy(db, user_id: str):
|
||||
)).scalar() or 0
|
||||
|
||||
if folder_count == 0:
|
||||
for i, name in enumerate(DEFAULT_FOLDERS):
|
||||
db.add(Folder(id=new_id(), user_id=user_id, name=name, slug=slugify(name), sort_order=i))
|
||||
for i, f in enumerate(DEFAULT_FOLDERS):
|
||||
db.add(Folder(id=new_id(), user_id=user_id, name=f["name"], slug=slugify(f["name"]),
|
||||
color=f.get("color"), icon=f.get("icon"), sort_order=i))
|
||||
await db.flush()
|
||||
|
||||
tag_count = (await db.execute(
|
||||
|
||||
Reference in New Issue
Block a user