ui enhancements

ui enhancements
This commit is contained in:
Ashwin Kumar 2025-12-10 18:32:06 +05:30 committed by GitHub
commit 9112a4fd6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 6608 additions and 2041 deletions

View file

@ -286,33 +286,61 @@ class AccountDetailView(APIView):
account_object.contacts.clear()
if data.get("contacts"):
contacts_list = json.loads(data.get("contacts"))
contacts_list = data.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
if contacts:
account_object.contacts.add(*contacts)
account_object.tags.clear()
if data.get("tags"):
tags = json.loads(data.get("tags"))
tags = data.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
account_object.tags.add(*tag_objs)
account_object.teams.clear()
if data.get("teams"):
teams_list = json.loads(data.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
teams_list = data.get("teams")
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
if teams:
account_object.teams.add(*teams)
account_object.assigned_to.clear()
if data.get("assigned_to"):
assigned_to_list = json.loads(data.get("assigned_to"))
assigned_to_list = data.get("assigned_to")
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
if profiles:
account_object.assigned_to.add(*profiles)
@ -595,8 +623,13 @@ class AccountDetailView(APIView):
if contacts_list:
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
account_object.contacts.add(*contacts)
@ -606,8 +639,13 @@ class AccountDetailView(APIView):
if tags:
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
account_object.tags.add(*tag_objs)
@ -617,8 +655,13 @@ class AccountDetailView(APIView):
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(
id__in=teams_list, org=request.profile.org
id__in=team_ids, org=request.profile.org
)
account_object.teams.add(*teams)
@ -628,8 +671,13 @@ class AccountDetailView(APIView):
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
account_object.assigned_to.add(*profiles)

View file

@ -171,22 +171,43 @@ class CaseListView(APIView, LimitOffsetPagination):
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
if contacts:
cases_obj.contacts.add(*contacts)
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
if teams.exists():
cases_obj.teams.add(*teams)
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
if profiles:
cases_obj.assigned_to.add(*profiles)
@ -195,8 +216,13 @@ class CaseListView(APIView, LimitOffsetPagination):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
cases_obj.tags.add(*tag_objs)
@ -290,8 +316,15 @@ class CaseDetailView(APIView):
cases_object.contacts.clear()
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
if contacts:
cases_object.contacts.add(*contacts)
@ -299,15 +332,29 @@ class CaseDetailView(APIView):
cases_object.teams.clear()
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
if teams.exists():
cases_object.teams.add(*teams)
cases_object.assigned_to.clear()
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
if profiles:
cases_object.assigned_to.add(*profiles)
@ -317,8 +364,13 @@ class CaseDetailView(APIView):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
cases_object.tags.add(*tag_objs)
@ -617,8 +669,15 @@ class CaseDetailView(APIView):
cases_object.contacts.clear()
contacts_list = params.get("contacts")
if contacts_list:
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
cases_object.contacts.add(*contacts)
@ -626,8 +685,15 @@ class CaseDetailView(APIView):
cases_object.teams.clear()
teams_list = params.get("teams")
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(
id__in=teams_list, org=request.profile.org
id__in=team_ids, org=request.profile.org
)
cases_object.teams.add(*teams)
@ -635,8 +701,15 @@ class CaseDetailView(APIView):
cases_object.assigned_to.clear()
assigned_to_list = params.get("assigned_to")
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
cases_object.assigned_to.add(*profiles)
@ -646,8 +719,13 @@ class CaseDetailView(APIView):
if tags_list:
if isinstance(tags_list, str):
tags_list = json.loads(tags_list)
# Extract IDs if tags_list contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags_list
]
tag_objs = Tags.objects.filter(
id__in=tags_list, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
cases_object.tags.add(*tag_objs)

View file

@ -54,6 +54,13 @@ class OrgAwareRefreshToken(RefreshToken):
"""
token = cls.for_user(user)
# Add user info to token (avoids extra API calls for display)
if user:
token["user_email"] = user.email
# Build display name from email (User model doesn't have first/last name)
token["user_name"] = user.email.split("@")[0] if user.email else ""
token["user_profile_pic"] = user.profile_pic or ""
# Add org context to the token payload
if org:
org_id = str(org.id) if hasattr(org, "id") else str(org)

View file

@ -132,8 +132,8 @@ class GoogleOAuthCallbackView(APIView):
user.last_login = timezone.now()
user.save(update_fields=["last_login"])
# Generate JWT tokens
token = RefreshToken.for_user(user)
# Generate JWT tokens (with user info embedded)
token = OrgAwareRefreshToken.for_user_and_org(user, None)
return Response(
{
@ -219,8 +219,8 @@ class LoginView(APIView):
user, default_org, profile
)
else:
# User has no orgs - generate token without org context
token = RefreshToken.for_user(user)
# User has no orgs - generate token without org context (but with user info)
token = OrgAwareRefreshToken.for_user_and_org(user, None)
# Audit log successful login
audit_log.login_success(user, default_org, request)
@ -387,8 +387,8 @@ class OrgAwareTokenRefreshView(APIView):
new_token = OrgAwareRefreshToken.for_user_and_org(user, org, profile)
audit_log.token_refresh(user, org, request)
else:
# No org context - standard refresh
new_token = BaseRefreshToken.for_user(user)
# No org context - refresh with user info only
new_token = OrgAwareRefreshToken.for_user_and_org(user, None)
audit_log.token_refresh(user, None, request)
return Response(

View file

@ -164,14 +164,28 @@ class DocumentListView(APIView, LimitOffsetPagination):
)
if params.get("shared_to"):
assinged_to_list = params.get("shared_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
if profiles:
doc.shared_to.add(*profiles)
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
if teams:
doc.teams.add(*teams)
@ -333,8 +347,15 @@ class DocumentDetailView(APIView):
doc.shared_to.clear()
if params.get("shared_to"):
assinged_to_list = params.get("shared_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
if profiles:
doc.shared_to.add(*profiles)
@ -342,7 +363,14 @@ class DocumentDetailView(APIView):
doc.teams.clear()
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
if teams:
doc.teams.add(*teams)
return Response(

View file

@ -157,13 +157,27 @@ class ContactsListView(APIView, LimitOffsetPagination):
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
contact_obj.teams.add(*teams)
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
contact_obj.assigned_to.add(*profiles)
@ -171,8 +185,13 @@ class ContactsListView(APIView, LimitOffsetPagination):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
contact_obj.tags.add(*tag_objs)
@ -252,15 +271,29 @@ class ContactDetailView(APIView):
contact_obj = contact_serializer.save()
contact_obj.teams.clear()
if data.get("teams"):
teams_list = json.loads(data.get("teams"))
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
teams_list = data.get("teams")
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
contact_obj.teams.add(*teams)
contact_obj.assigned_to.clear()
if data.get("assigned_to"):
assinged_to_list = json.loads(data.get("assigned_to"))
assinged_to_list = data.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
contact_obj.assigned_to.add(*profiles)
@ -269,8 +302,13 @@ class ContactDetailView(APIView):
tags = data.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
contact_obj.tags.add(*tag_objs)
@ -566,7 +604,12 @@ class ContactDetailView(APIView):
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
contact_obj.teams.add(*teams)
if "assigned_to" in data:
@ -575,8 +618,13 @@ class ContactDetailView(APIView):
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
contact_obj.assigned_to.add(*profiles)
@ -586,8 +634,13 @@ class ContactDetailView(APIView):
if tags_list:
if isinstance(tags_list, str):
tags_list = json.loads(tags_list)
# Extract IDs if tags_list contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags_list
]
tag_objs = Tags.objects.filter(
id__in=tags_list, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
contact_obj.tags.add(*tag_objs)

View file

@ -247,13 +247,27 @@ class LeadListView(APIView, LimitOffsetPagination):
if data.get("teams", None):
teams_list = data.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
lead_obj.teams.add(*teams)
if data.get("assigned_to", None):
assinged_to_list = data.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
lead_obj.assigned_to.add(*profiles)
@ -578,22 +592,44 @@ class LeadDetailView(APIView):
lead_obj.contacts.clear()
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
obj_contact = Contact.objects.filter(
id__in=params.get("contacts"), org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
lead_obj.contacts.add(*obj_contact)
lead_obj.teams.clear()
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
lead_obj.teams.add(*teams)
lead_obj.assigned_to.clear()
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
lead_obj.assigned_to.add(*profiles)
@ -714,8 +750,15 @@ class LeadDetailView(APIView):
lead_obj.tags.clear()
tags = params.get("tags")
if tags:
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
lead_obj.tags.add(*tag_objs)
@ -723,8 +766,15 @@ class LeadDetailView(APIView):
lead_obj.contacts.clear()
contacts_list = params.get("contacts")
if contacts_list:
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
obj_contact = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
lead_obj.contacts.add(*obj_contact)
@ -732,8 +782,15 @@ class LeadDetailView(APIView):
lead_obj.teams.clear()
teams_list = params.get("teams")
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(
id__in=teams_list, org=request.profile.org
id__in=team_ids, org=request.profile.org
)
lead_obj.teams.add(*teams)
@ -741,8 +798,15 @@ class LeadDetailView(APIView):
lead_obj.assigned_to.clear()
assigned_to_list = params.get("assigned_to")
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org
id__in=assigned_ids, org=request.profile.org
)
lead_obj.assigned_to.add(*profiles)

View file

@ -177,15 +177,29 @@ class OpportunityListView(APIView, LimitOffsetPagination):
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
opportunity_obj.contacts.add(*contacts)
if params.get("tags"):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
opportunity_obj.tags.add(*tag_objs)
@ -196,13 +210,27 @@ class OpportunityListView(APIView, LimitOffsetPagination):
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
opportunity_obj.teams.add(*teams)
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
opportunity_obj.assigned_to.add(*profiles)
@ -294,16 +322,30 @@ class OpportunityDetailView(APIView):
opportunity_object.contacts.clear()
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
opportunity_object.contacts.add(*contacts)
opportunity_object.tags.clear()
if params.get("tags"):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
opportunity_object.tags.add(*tag_objs)
@ -315,14 +357,28 @@ class OpportunityDetailView(APIView):
opportunity_object.teams.clear()
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
opportunity_object.teams.add(*teams)
opportunity_object.assigned_to.clear()
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
opportunity_object.assigned_to.add(*profiles)
@ -626,8 +682,15 @@ class OpportunityDetailView(APIView):
opportunity_object.contacts.clear()
contacts_list = params.get("contacts")
if contacts_list:
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
opportunity_object.contacts.add(*contacts)
@ -635,8 +698,15 @@ class OpportunityDetailView(APIView):
opportunity_object.tags.clear()
tags = params.get("tags")
if tags:
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
opportunity_object.tags.add(*tag_objs)
@ -644,8 +714,15 @@ class OpportunityDetailView(APIView):
opportunity_object.teams.clear()
teams_list = params.get("teams")
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(
id__in=teams_list, org=request.profile.org
id__in=team_ids, org=request.profile.org
)
opportunity_object.teams.add(*teams)
@ -653,8 +730,15 @@ class OpportunityDetailView(APIView):
opportunity_object.assigned_to.clear()
assigned_to_list = params.get("assigned_to")
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
opportunity_object.assigned_to.add(*profiles)

View file

@ -168,20 +168,41 @@ class TaskListView(APIView, LimitOffsetPagination):
)
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
task_obj.contacts.add(*contacts)
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
task_obj.teams.add(*teams)
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
task_obj.assigned_to.add(*profiles)
@ -189,8 +210,13 @@ class TaskListView(APIView, LimitOffsetPagination):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
task_obj.tags.add(*tag_objs)
@ -450,22 +476,43 @@ class TaskDetailView(APIView):
task_obj.contacts.clear()
if params.get("contacts"):
contacts_list = params.get("contacts")
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
task_obj.contacts.add(*contacts)
task_obj.teams.clear()
if params.get("teams"):
teams_list = params.get("teams")
teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org)
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org)
task_obj.teams.add(*teams)
task_obj.assigned_to.clear()
if params.get("assigned_to"):
assinged_to_list = params.get("assigned_to")
if isinstance(assinged_to_list, str):
assinged_to_list = json.loads(assinged_to_list)
# Extract IDs if assinged_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assinged_to_list
]
profiles = Profile.objects.filter(
id__in=assinged_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
task_obj.assigned_to.add(*profiles)
@ -474,8 +521,13 @@ class TaskDetailView(APIView):
tags = params.get("tags")
if isinstance(tags, str):
tags = json.loads(tags)
# Extract IDs if tags contains objects with 'id' field
tag_ids = [
item.get("id") if isinstance(item, dict) else item
for item in tags
]
tag_objs = Tags.objects.filter(
id__in=tags, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
task_obj.tags.add(*tag_objs)
@ -567,8 +619,15 @@ class TaskDetailView(APIView):
task_obj.contacts.clear()
contacts_list = params.get("contacts")
if contacts_list:
if isinstance(contacts_list, str):
contacts_list = json.loads(contacts_list)
# Extract IDs if contacts_list contains objects with 'id' field
contact_ids = [
item.get("id") if isinstance(item, dict) else item
for item in contacts_list
]
contacts = Contact.objects.filter(
id__in=contacts_list, org=request.profile.org
id__in=contact_ids, org=request.profile.org
)
task_obj.contacts.add(*contacts)
@ -576,8 +635,15 @@ class TaskDetailView(APIView):
task_obj.teams.clear()
teams_list = params.get("teams")
if teams_list:
if isinstance(teams_list, str):
teams_list = json.loads(teams_list)
# Extract IDs if teams_list contains objects with 'id' field
team_ids = [
item.get("id") if isinstance(item, dict) else item
for item in teams_list
]
teams = Teams.objects.filter(
id__in=teams_list, org=request.profile.org
id__in=team_ids, org=request.profile.org
)
task_obj.teams.add(*teams)
@ -585,8 +651,15 @@ class TaskDetailView(APIView):
task_obj.assigned_to.clear()
assigned_to_list = params.get("assigned_to")
if assigned_to_list:
if isinstance(assigned_to_list, str):
assigned_to_list = json.loads(assigned_to_list)
# Extract IDs if assigned_to_list contains objects with 'id' field
assigned_ids = [
item.get("id") if isinstance(item, dict) else item
for item in assigned_to_list
]
profiles = Profile.objects.filter(
id__in=assigned_to_list, org=request.profile.org, is_active=True
id__in=assigned_ids, org=request.profile.org, is_active=True
)
task_obj.assigned_to.add(*profiles)
@ -596,8 +669,13 @@ class TaskDetailView(APIView):
if tags_list:
if isinstance(tags_list, str):
tags_list = json.loads(tags_list)
# Extract IDs if tags_list contains objects with 'id' field
tag_ids = [
tag.get("id") if isinstance(tag, dict) else tag
for tag in tags_list
]
tag_objs = Tags.objects.filter(
id__in=tags_list, org=request.profile.org, is_active=True
id__in=tag_ids, org=request.profile.org, is_active=True
)
task_obj.tags.add(*tag_objs)

View file

@ -4,88 +4,133 @@
@custom-variant dark (&:is(.dark *));
/* ═══════════════════════════════════════════════════════════════════════════
OBSIDIAN LUXE - Premium Dark-First CRM Design System
A sophisticated aesthetic with vivid accents and glass-morphism effects
═══════════════════════════════════════════════════════════════════════════ */
/* Google Fonts Import - Plus Jakarta Sans (geometric, modern) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,500&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');
:root {
/* Base radius for components */
--radius: 0.5rem;
--radius: 0.625rem;
/* shadcn color tokens (Neutral base) */
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
/* ─────────────────────────────────────────────────────────────────────────
LIGHT MODE - Clean, airy with subtle warmth
───────────────────────────────────────────────────────────────────────── */
/* Core surfaces */
--background: oklch(0.985 0.002 250);
--foreground: oklch(0.15 0.02 260);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--card-foreground: oklch(0.15 0.02 260);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--popover-foreground: oklch(0.15 0.02 260);
/* Chart colors */
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
/* Primary - Deep teal */
--primary: oklch(0.55 0.15 195);
--primary-foreground: oklch(0.98 0 0);
/* Sidebar colors */
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
/* Secondary */
--secondary: oklch(0.96 0.01 250);
--secondary-foreground: oklch(0.25 0.02 260);
/* Muted */
--muted: oklch(0.96 0.005 250);
--muted-foreground: oklch(0.45 0.02 260);
/* Accent - Warm amber */
--accent: oklch(0.96 0.02 80);
--accent-foreground: oklch(0.25 0.05 80);
/* Destructive */
--destructive: oklch(0.55 0.22 25);
/* Borders & inputs */
--border: oklch(0.91 0.005 250);
--input: oklch(0.91 0.005 250);
--ring: oklch(0.55 0.15 195);
/* Chart colors - Vibrant palette */
--chart-1: oklch(0.65 0.18 195);
--chart-2: oklch(0.7 0.16 145);
--chart-3: oklch(0.75 0.15 80);
--chart-4: oklch(0.6 0.2 280);
--chart-5: oklch(0.65 0.2 350);
/* Sidebar - HubSpot Style Light */
--sidebar: oklch(0.995 0 0);
--sidebar-foreground: oklch(0.25 0.02 250);
--sidebar-primary: oklch(0.62 0.2 25);
--sidebar-primary-foreground: oklch(0.995 0 0);
--sidebar-accent: oklch(0.97 0.005 250);
--sidebar-accent-foreground: oklch(0.2 0.02 250);
--sidebar-border: oklch(0.94 0.005 250);
--sidebar-ring: oklch(0.62 0.2 25);
/* HubSpot Brand Colors */
--hubspot-orange: #ff7a59;
--hubspot-orange-hover: #ff5c35;
--hubspot-orange-light: #fff1ee;
--hubspot-navy: #2d3e50;
--hubspot-navy-light: #516f90;
--hubspot-teal: #00bda5;
--hubspot-teal-light: #e5f8f6;
/* ─────────────────────────────────────────────────────────────────────────
SEMANTIC LAYERS
───────────────────────────────────────────────────────────────────────── */
/* Background Layers */
--bg-base: #ffffff;
--bg-subtle: #fafafa;
--bg-muted: #f5f5f5;
--bg-emphasis: #ededed;
--bg-base: #fafbfc;
--bg-subtle: #f4f6f8;
--bg-muted: #eef1f4;
--bg-emphasis: #e4e8ec;
/* Border Colors */
--border-default: #e5e5e5;
--border-strong: #d4d4d4;
--border-subtle: #f0f0f0;
--border-default: #e2e6eb;
--border-strong: #c9d0d8;
--border-subtle: #f0f2f5;
/* Text Colors */
--text-primary: #171717;
--text-secondary: #525252;
--text-tertiary: #a3a3a3;
--text-primary: #0f172a;
--text-secondary: #475569;
--text-tertiary: #94a3b8;
--text-inverse: #ffffff;
/* Accent Colors */
--accent-primary: #2563eb;
--accent-primary-hover: #1d4ed8;
--accent-primary-subtle: #eff6ff;
/* Accent Colors - Teal/Cyan primary */
--accent-primary: #0891b2;
--accent-primary-hover: #0e7490;
--accent-primary-subtle: #ecfeff;
/* Secondary Accent - Warm Amber */
--accent-secondary: #f59e0b;
--accent-secondary-hover: #d97706;
--accent-secondary-subtle: #fffbeb;
/* Status Colors */
--status-success: #16a34a;
--status-success-bg: #f0fdf4;
--status-warning: #ca8a04;
--status-warning-bg: #fefce8;
--status-success: #059669;
--status-success-bg: #ecfdf5;
--status-warning: #d97706;
--status-warning-bg: #fffbeb;
--status-danger: #dc2626;
--status-danger-bg: #fef2f2;
--status-info: #0284c7;
--status-info-bg: #f0f9ff;
--status-info: #0891b2;
--status-info-bg: #ecfeff;
/* Stage Colors (Pipeline) */
--stage-prospecting: #6b7280;
--stage-qualified: #2563eb;
--stage-proposal: #7c3aed;
--stage-negotiation: #ea580c;
--stage-won: #16a34a;
/* Stage Colors (Pipeline) - Refined palette */
--stage-prospecting: #64748b;
--stage-qualified: #0891b2;
--stage-proposal: #8b5cf6;
--stage-negotiation: #f59e0b;
--stage-won: #059669;
--stage-lost: #dc2626;
/* Spacing Scale (4px base) */
/* ─────────────────────────────────────────────────────────────────────────
SPACING & LAYOUT
───────────────────────────────────────────────────────────────────────── */
--space-0: 0px;
--space-1: 4px;
--space-2: 8px;
@ -97,11 +142,12 @@
--space-10: 40px;
--space-12: 48px;
/* Border Radius */
--radius-sm: 4px;
--radius-md: 6px;
--radius-lg: 8px;
--radius-xl: 12px;
/* Border Radius - Slightly larger for premium feel */
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
--radius-2xl: 20px;
--radius-full: 9999px;
/* Z-Index Layers */
@ -114,81 +160,149 @@
--z-toast: 80;
--z-tooltip: 90;
/* Animation Timing */
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
/* Animation Timing - Refined easing */
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
--ease-in: cubic-bezier(0.7, 0, 0.84, 0);
--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--ease-bounce: cubic-bezier(0.68, -0.6, 0.32, 1.6);
/* Animation Durations */
--duration-instant: 0ms;
--duration-fast: 100ms;
--duration-fast: 120ms;
--duration-normal: 200ms;
--duration-slow: 300ms;
--duration-slower: 400ms;
--duration-slow: 350ms;
--duration-slower: 500ms;
/* Layout Dimensions */
--sidebar-width: 240px;
--sidebar-width-collapsed: 64px;
--drawer-width: 480px;
--header-height: 56px;
--content-padding: 24px;
--content-max-width: 1200px;
--sidebar-width: 260px;
--sidebar-width-collapsed: 72px;
--drawer-width: 520px;
--header-height: 60px;
--content-padding: 28px;
--content-max-width: 1400px;
/* Typography */
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-sans: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-body: 'DM Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
/* Glass morphism properties */
--glass-bg: rgba(255, 255, 255, 0.8);
--glass-border: rgba(255, 255, 255, 0.3);
--glass-blur: 12px;
}
/* Dark Mode */
/* ═══════════════════════════════════════════════════════════════════════════
DARK MODE - Obsidian Luxe
Deep, rich darks with vivid accent colors and subtle glow effects
═══════════════════════════════════════════════════════════════════════════ */
.dark {
/* shadcn dark mode colors */
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.269 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.371 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.439 0 0);
/* Core surfaces - Deep obsidian with subtle blue undertone */
--background: oklch(0.12 0.015 260);
--foreground: oklch(0.95 0.005 250);
--card: oklch(0.16 0.015 260);
--card-foreground: oklch(0.95 0.005 250);
--popover: oklch(0.18 0.018 260);
--popover-foreground: oklch(0.95 0.005 250);
/* BottleCRM dark mode overrides */
--bg-base: #191919;
--bg-subtle: #212121;
--bg-muted: #2a2a2a;
--bg-emphasis: #333333;
--border-default: #333333;
--border-strong: #404040;
--border-subtle: #262626;
--text-primary: #fafafa;
--text-secondary: #a3a3a3;
--text-tertiary: #737373;
/* Primary - Vivid cyan */
--primary: oklch(0.75 0.16 195);
--primary-foreground: oklch(0.12 0.015 260);
/* Secondary */
--secondary: oklch(0.22 0.015 260);
--secondary-foreground: oklch(0.92 0.005 250);
/* Muted */
--muted: oklch(0.22 0.012 260);
--muted-foreground: oklch(0.65 0.01 260);
/* Accent - Amber glow */
--accent: oklch(0.25 0.04 80);
--accent-foreground: oklch(0.85 0.12 80);
/* Destructive */
--destructive: oklch(0.65 0.2 25);
/* Borders & inputs - Subtle with glow potential */
--border: oklch(0.28 0.015 260);
--input: oklch(0.24 0.015 260);
--ring: oklch(0.7 0.14 195);
/* Chart colors - Vibrant neon-ish */
--chart-1: oklch(0.75 0.18 195);
--chart-2: oklch(0.72 0.18 155);
--chart-3: oklch(0.78 0.15 85);
--chart-4: oklch(0.7 0.2 290);
--chart-5: oklch(0.72 0.2 10);
/* Sidebar - HubSpot Style Dark */
--sidebar: oklch(0.16 0.015 250);
--sidebar-foreground: oklch(0.92 0.005 250);
--sidebar-primary: oklch(0.7 0.18 25);
--sidebar-primary-foreground: oklch(0.12 0.015 260);
--sidebar-accent: oklch(0.22 0.02 250);
--sidebar-accent-foreground: oklch(0.92 0.005 250);
--sidebar-border: oklch(0.28 0.015 250);
--sidebar-ring: oklch(0.7 0.18 25);
/* Background Layers - Obsidian depth */
--bg-base: #0c0d12;
--bg-subtle: #121318;
--bg-muted: #181a21;
--bg-emphasis: #1f222b;
/* Border Colors */
--border-default: #262a36;
--border-strong: #363b4a;
--border-subtle: #1c1f28;
/* Text Colors */
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--text-tertiary: #64748b;
--text-inverse: #0c0d12;
/* Accent Colors - Cyan glow */
--accent-primary: #22d3ee;
--accent-primary-hover: #06b6d4;
--accent-primary-subtle: rgba(34, 211, 238, 0.1);
/* Secondary Accent - Warm Amber */
--accent-secondary: #fbbf24;
--accent-secondary-hover: #f59e0b;
--accent-secondary-subtle: rgba(251, 191, 36, 0.1);
/* Status Colors - Vivid in dark */
--status-success: #34d399;
--status-success-bg: rgba(52, 211, 153, 0.12);
--status-warning: #fbbf24;
--status-warning-bg: rgba(251, 191, 36, 0.12);
--status-danger: #f87171;
--status-danger-bg: rgba(248, 113, 113, 0.12);
--status-info: #22d3ee;
--status-info-bg: rgba(34, 211, 238, 0.12);
/* Stage Colors - Neon variants */
--stage-prospecting: #94a3b8;
--stage-qualified: #22d3ee;
--stage-proposal: #a78bfa;
--stage-negotiation: #fbbf24;
--stage-won: #34d399;
--stage-lost: #f87171;
/* Glass morphism - Dark variant */
--glass-bg: rgba(18, 19, 24, 0.8);
--glass-border: rgba(255, 255, 255, 0.08);
--glass-blur: 16px;
}
/* Tailwind theme inline configuration */
/* ═══════════════════════════════════════════════════════════════════════════
TAILWIND THEME INTEGRATION
═══════════════════════════════════════════════════════════════════════════ */
@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
@ -227,14 +341,304 @@
--color-sidebar-ring: var(--sidebar-ring);
}
/* Base layer styles */
/* ═══════════════════════════════════════════════════════════════════════════
BASE STYLES
═══════════════════════════════════════════════════════════════════════════ */
@layer base {
* {
@apply border-border outline-ring/50;
}
html {
font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
@apply bg-background text-foreground;
font-family: var(--font-sans);
letter-spacing: -0.01em;
}
/* Refined scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border-strong);
border-radius: var(--radius-full);
border: 2px solid transparent;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
border: 2px solid transparent;
background-clip: content-box;
}
/* Selection styling */
::selection {
background: var(--accent-primary);
color: var(--text-inverse);
}
}
/* ═══════════════════════════════════════════════════════════════════════════
UTILITY CLASSES - Premium Effects
═══════════════════════════════════════════════════════════════════════════ */
@layer utilities {
/* Glass morphism card */
.glass-card {
background: var(--glass-bg);
backdrop-filter: blur(var(--glass-blur));
-webkit-backdrop-filter: blur(var(--glass-blur));
border: 1px solid var(--glass-border);
}
/* Glow effects */
.glow-sm {
box-shadow: 0 0 15px -3px var(--accent-primary);
}
.glow-md {
box-shadow: 0 0 25px -5px var(--accent-primary);
}
.glow-lg {
box-shadow: 0 0 40px -8px var(--accent-primary);
}
/* Gradient text */
.text-gradient {
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
/* Subtle noise texture overlay */
.noise-overlay {
position: relative;
}
.noise-overlay::before {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
opacity: 0.03;
pointer-events: none;
mix-blend-mode: overlay;
}
.dark .noise-overlay::before {
opacity: 0.04;
}
/* Gradient mesh background */
.gradient-mesh {
background:
radial-gradient(at 40% 20%, var(--accent-primary-subtle) 0px, transparent 50%),
radial-gradient(at 80% 0%, var(--accent-secondary-subtle) 0px, transparent 50%),
radial-gradient(at 0% 50%, var(--accent-primary-subtle) 0px, transparent 50%),
radial-gradient(at 80% 80%, var(--accent-secondary-subtle) 0px, transparent 50%),
var(--background);
}
/* Animated border gradient */
.border-gradient {
position: relative;
background: var(--card);
border-radius: var(--radius-lg);
}
.border-gradient::before {
content: '';
position: absolute;
inset: 0;
padding: 1px;
border-radius: inherit;
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
background-size: 200% 200%;
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
animation: border-rotate 4s linear infinite;
}
@keyframes border-rotate {
0% { background-position: 0% 0%; }
100% { background-position: 200% 200%; }
}
/* Shimmer loading effect */
.shimmer {
background: linear-gradient(
90deg,
var(--muted) 0%,
var(--bg-emphasis) 50%,
var(--muted) 100%
);
background-size: 200% 100%;
animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Smooth fade in animation */
.animate-in-up {
animation: fade-in-up 0.4s var(--ease-out) forwards;
}
@keyframes fade-in-up {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Staggered animation delays */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }
/* Hover lift effect */
.hover-lift {
transition: transform var(--duration-normal) var(--ease-out),
box-shadow var(--duration-normal) var(--ease-out);
}
.hover-lift:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1),
0 4px 10px -3px rgba(0, 0, 0, 0.05);
}
.dark .hover-lift:hover {
box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.4),
0 0 20px -5px var(--accent-primary-subtle);
}
/* Premium card style */
.premium-card {
@apply glass-card rounded-xl;
transition: all var(--duration-normal) var(--ease-out);
}
.premium-card:hover {
border-color: var(--border-strong);
}
.dark .premium-card:hover {
border-color: var(--accent-primary);
box-shadow: 0 0 30px -10px var(--accent-primary);
}
}
/* ═══════════════════════════════════════════════════════════════════════════
COMPONENT OVERRIDES
═══════════════════════════════════════════════════════════════════════════ */
/* Card refinements */
[data-slot="card"] {
transition: all var(--duration-normal) var(--ease-out);
}
/* Button refinements */
button, [role="button"] {
font-family: var(--font-sans);
font-weight: 500;
letter-spacing: -0.01em;
}
/* Input refinements */
input, textarea, select {
font-family: var(--font-body);
}
/* Badge refinements */
[data-slot="badge"] {
font-weight: 600;
letter-spacing: 0.02em;
}
/* ═══════════════════════════════════════════════════════════════════════════
HUBSPOT-STYLE SIDEBAR ENHANCEMENTS
═══════════════════════════════════════════════════════════════════════════ */
/* Sidebar base styling */
[data-slot="sidebar"] {
transition: width 0.2s ease, transform 0.2s ease;
}
/* HubSpot-style menu button refinements */
[data-slot="sidebar-menu-button"] {
letter-spacing: -0.01em;
}
/* HubSpot-style active state with left accent bar */
[data-slot="sidebar-menu-button"][data-active="true"] {
position: relative;
}
/* Smooth hover transitions */
[data-slot="sidebar-menu-button"]:hover {
transform: translateX(1px);
}
[data-slot="sidebar-menu-button"][data-active="true"]:hover {
transform: none;
}
/* Group label styling - HubSpot uppercase sections */
[data-slot="sidebar-group-label"] {
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--sidebar-foreground);
opacity: 0.4;
padding: 0 12px;
margin-bottom: 4px;
}
/* Submenu refinements */
[data-slot="sidebar-menu-sub"] {
margin-top: 4px;
}
/* Rail hover effect */
[data-slot="sidebar-rail"]:hover {
background: linear-gradient(90deg, transparent, rgba(255, 122, 89, 0.1));
}
/* Collapsed state icon centering */
[data-collapsible="icon"] [data-slot="sidebar-menu-button"] {
justify-content: center;
}
/* Footer divider */
[data-slot="sidebar-footer"] {
background: linear-gradient(180deg, transparent, var(--sidebar) 8px);
}

View file

@ -16,7 +16,7 @@ const API_BASE_URL = `${env.PUBLIC_DJANGO_API_URL}/api`;
/**
* @typedef {{ default_currency?: string, currency_symbol?: string, default_country?: string|null }} OrgSettingsPayload
* @typedef {{ org_id?: string, org_name?: string, role?: string, user_id?: string, exp?: number, iat?: number, org_settings?: OrgSettingsPayload }} JWTPayload
* @typedef {{ org_id?: string, org_name?: string, role?: string, user_id?: string, user_name?: string, user_email?: string, user_profile_pic?: string, exp?: number, iat?: number, org_settings?: OrgSettingsPayload }} JWTPayload
* @typedef {{ id: string, name: string }} OrgInfo
* @typedef {{ org: OrgInfo, role?: string }} ProfileInfo
* @typedef {{ id?: string, organizations?: Array<{ id: string, name: string }> }} UserInfo
@ -158,7 +158,12 @@ export async function handle({ event, resolve }) {
// Set user in locals from JWT payload (no API call needed!)
if (jwtPayload) {
// Build user object from JWT claims
event.locals.user = { id: jwtPayload.user_id };
event.locals.user = {
id: jwtPayload.user_id,
name: jwtPayload.user_name || '',
email: jwtPayload.user_email || '',
profilePhoto: jwtPayload.user_profile_pic || ''
};
// Check if org cookie is set and token has org context
if (orgId) {

View file

@ -1,5 +1,4 @@
<script>
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import {
Activity,
@ -9,7 +8,8 @@
Eye,
MessageSquare,
UserPlus,
ChevronRight
ChevronRight,
Clock
} from '@lucide/svelte';
/**
@ -35,23 +35,44 @@
let showAll = $state(false);
const actionIcons = /** @type {Record<string, typeof Activity>} */ ({
CREATE: Plus,
UPDATE: Pencil,
DELETE: Trash2,
VIEW: Eye,
COMMENT: MessageSquare,
ASSIGN: UserPlus
const actionConfig = /** @type {Record<string, { icon: typeof Activity, bg: string, text: string }>} */ ({
CREATE: {
icon: Plus,
bg: 'bg-emerald-500/10 dark:bg-emerald-500/20',
text: 'text-emerald-600 dark:text-emerald-400'
},
UPDATE: {
icon: Pencil,
bg: 'bg-cyan-500/10 dark:bg-cyan-500/20',
text: 'text-cyan-600 dark:text-cyan-400'
},
DELETE: {
icon: Trash2,
bg: 'bg-rose-500/10 dark:bg-rose-500/20',
text: 'text-rose-600 dark:text-rose-400'
},
VIEW: {
icon: Eye,
bg: 'bg-slate-500/10 dark:bg-slate-500/20',
text: 'text-slate-600 dark:text-slate-400'
},
COMMENT: {
icon: MessageSquare,
bg: 'bg-violet-500/10 dark:bg-violet-500/20',
text: 'text-violet-600 dark:text-violet-400'
},
ASSIGN: {
icon: UserPlus,
bg: 'bg-amber-500/10 dark:bg-amber-500/20',
text: 'text-amber-600 dark:text-amber-400'
}
});
const actionColors = /** @type {Record<string, string>} */ ({
CREATE: 'bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400',
UPDATE: 'bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400',
DELETE: 'bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400',
VIEW: 'bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400',
COMMENT: 'bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400',
ASSIGN: 'bg-orange-100 text-orange-600 dark:bg-orange-900/30 dark:text-orange-400'
});
const defaultConfig = {
icon: Activity,
bg: 'bg-muted',
text: 'text-muted-foreground'
};
/**
* Get date category for grouping
@ -109,56 +130,64 @@
const groupedActivities = $derived(groupByDate(displayedActivities));
</script>
<Card.Root class="flex h-full flex-col">
<Card.Header class="flex-row items-center justify-between space-y-0 pb-3">
<div class="flex items-center gap-2">
<Activity class="text-muted-foreground h-4 w-4" />
<Card.Title class="text-foreground text-sm font-medium">Recent Activity</Card.Title>
<div class="overflow-hidden rounded-xl border border-border/50 bg-card/80 backdrop-blur-sm dark:bg-card/50">
<!-- Header -->
<div class="flex items-center justify-between border-b border-border/50 px-5 py-4">
<div class="flex items-center gap-3">
<div class="flex size-8 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500/10 to-purple-500/10 dark:from-violet-500/20 dark:to-purple-500/20">
<Activity class="size-4 text-violet-600 dark:text-violet-400" />
</div>
<h3 class="text-foreground text-sm font-semibold tracking-tight">Recent Activity</h3>
</div>
<Button variant="ghost" size="sm" href="/activities" class="text-xs">
<Button variant="ghost" size="sm" href="/activities" class="gap-1 text-xs font-medium">
View all
<ChevronRight class="ml-1 h-3 w-3" />
<ChevronRight class="size-3.5" />
</Button>
</Card.Header>
<Card.Content class="flex-1 overflow-auto p-0 px-4 pb-4">
</div>
<!-- Activity list -->
<div class="p-5">
{#if activities.length === 0}
<div
class="text-muted-foreground flex h-full flex-col items-center justify-center py-8 text-center"
>
<Activity class="text-muted-foreground/30 mb-2 h-10 w-10" />
<p class="text-sm">No recent activity</p>
<div class="flex flex-col items-center justify-center py-10 text-center">
<div class="mb-3 flex size-12 items-center justify-center rounded-xl bg-muted/50">
<Clock class="text-muted-foreground/50 size-6" />
</div>
<p class="text-muted-foreground text-sm font-medium">No recent activity</p>
<p class="text-muted-foreground/70 text-xs">Actions will appear here</p>
</div>
{:else}
<div class="space-y-4">
<div class="space-y-5">
{#each groupedActivities as group}
<div>
<p class="text-muted-foreground mb-2 text-xs font-medium tracking-wider uppercase">
<p class="text-muted-foreground mb-3 text-[10px] font-semibold uppercase tracking-widest">
{group.category}
</p>
<div class="space-y-2">
{#each group.items as activity (activity.id)}
{@const Icon = actionIcons[activity.action || ''] || Activity}
{@const colorClass =
actionColors[activity.action || ''] || 'bg-muted text-muted-foreground'}
{@const config = actionConfig[activity.action || ''] || defaultConfig}
{@const Icon = config.icon}
<div
class="hover:bg-muted/50 -mx-2 flex items-start gap-3 rounded-md px-2 py-1.5 transition-colors"
class="group -mx-2 flex items-start gap-3 rounded-lg px-2 py-2 transition-all duration-200 hover:bg-muted/30"
>
<!-- Icon -->
<div
class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full {colorClass}"
class="flex size-7 shrink-0 items-center justify-center rounded-lg transition-transform duration-200 group-hover:scale-105 {config.bg}"
>
<Icon class="h-3 w-3" />
<Icon class="size-3.5 {config.text}" />
</div>
<!-- Content -->
<div class="min-w-0 flex-1">
<p class="text-foreground text-sm">
<p class="text-foreground text-sm leading-snug">
{activity.description ||
activity.message ||
`${activity.action} ${activity.entityType}: ${activity.entityName}`}
</p>
<p class="text-muted-foreground text-xs">
{activity.user?.name || 'System'} &middot; {formatTime(
activity.timestamp || activity.createdAt
)}
</p>
<div class="text-muted-foreground mt-1 flex items-center gap-1.5 text-xs">
<span class="font-medium">{activity.user?.name || 'System'}</span>
<span class="text-muted-foreground/50">&middot;</span>
<span>{formatTime(activity.timestamp || activity.createdAt)}</span>
</div>
</div>
</div>
{/each}
@ -166,16 +195,17 @@
</div>
{/each}
</div>
{#if activities.length > 5 && !showAll}
<Button
variant="ghost"
size="sm"
class="mt-3 w-full text-xs"
class="mt-4 w-full text-xs font-medium"
onclick={() => (showAll = true)}
>
Show more ({activities.length - 5} more)
</Button>
{/if}
{/if}
</Card.Content>
</Card.Root>
</div>
</div>

View file

@ -1,5 +1,5 @@
<script>
import { AlertCircle, Calendar, Phone, Flame } from '@lucide/svelte';
import { AlertCircle, Calendar, Phone, Flame, Zap } from '@lucide/svelte';
/**
* @typedef {Object} Props
@ -16,7 +16,8 @@
{
href: '/tasks?filter=overdue',
icon: AlertCircle,
iconClass: 'text-red-500',
iconClass: 'text-rose-500 dark:text-rose-400',
bgClass: 'bg-rose-500/10 dark:bg-rose-500/15',
count: overdueCount,
label: 'Overdue',
show: overdueCount > 0
@ -24,7 +25,8 @@
{
href: '/tasks?filter=today',
icon: Calendar,
iconClass: 'text-orange-500',
iconClass: 'text-amber-500 dark:text-amber-400',
bgClass: 'bg-amber-500/10 dark:bg-amber-500/15',
count: todayCount,
label: 'Due Today',
show: true
@ -32,7 +34,8 @@
{
href: '/leads?filter=followup_today',
icon: Phone,
iconClass: 'text-blue-500',
iconClass: 'text-cyan-500 dark:text-cyan-400',
bgClass: 'bg-cyan-500/10 dark:bg-cyan-500/15',
count: followupsCount,
label: 'Follow-ups',
show: true
@ -40,7 +43,8 @@
{
href: '/leads?rating=HOT',
icon: Flame,
iconClass: 'text-red-500',
iconClass: 'text-orange-500 dark:text-orange-400',
bgClass: 'bg-orange-500/10 dark:bg-orange-500/15',
count: hotLeadsCount,
label: 'Hot Leads',
show: hotLeadsCount > 0
@ -53,25 +57,45 @@
{#if visibleItems.length > 0}
<div
class="flex items-center gap-2 overflow-x-auto rounded-lg border px-4 py-2.5 sm:gap-4 sm:px-6
{hasUrgentItems
? 'border-red-200 bg-red-50/50 dark:border-red-900/50 dark:bg-red-950/20'
: 'border-border/50 bg-muted/30'}"
class="relative overflow-hidden rounded-xl border px-4 py-3 backdrop-blur-sm transition-all duration-300 sm:px-6
{hasUrgentItems
? 'border-rose-300/50 bg-rose-50/50 dark:border-rose-500/20 dark:bg-rose-950/20'
: 'border-border/50 bg-card/50 dark:bg-card/30'}"
>
<span class="text-muted-foreground hidden text-xs font-medium tracking-wider uppercase sm:block"
>Today's Focus</span
>
<div class="flex items-center gap-1 sm:gap-3">
{#each visibleItems as item}
<a
href={item.href}
class="hover:bg-muted/50 flex items-center gap-1.5 rounded-md px-2 py-1.5 transition-colors sm:gap-2 sm:px-3"
>
<item.icon class="h-4 w-4 {item.iconClass}" />
<span class="text-foreground text-sm font-semibold tabular-nums">{item.count}</span>
<span class="text-muted-foreground hidden text-xs sm:inline">{item.label}</span>
</a>
{/each}
<!-- Subtle gradient overlay -->
<div class="pointer-events-none absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent dark:via-white/[0.02]"></div>
<div class="relative flex items-center gap-3 sm:gap-5">
<!-- Label with icon -->
<div class="hidden items-center gap-2 sm:flex">
<div class="flex size-7 items-center justify-center rounded-lg bg-gradient-to-br from-cyan-500/10 to-teal-500/10 dark:from-cyan-500/20 dark:to-teal-500/20">
<Zap class="size-4 text-cyan-600 dark:text-cyan-400" />
</div>
<span class="text-muted-foreground text-xs font-semibold uppercase tracking-wider">
Today's Focus
</span>
</div>
<!-- Divider -->
<div class="hidden h-6 w-px bg-border/50 sm:block"></div>
<!-- Items -->
<div class="flex flex-1 items-center gap-1 overflow-x-auto sm:gap-2">
{#each visibleItems as item}
<a
href={item.href}
class="group flex items-center gap-2 rounded-lg px-3 py-2 transition-all duration-200 hover:bg-white/50 dark:hover:bg-white/5 sm:gap-2.5 sm:px-4"
>
<div class="flex size-8 items-center justify-center rounded-lg transition-transform duration-200 group-hover:scale-110 {item.bgClass}">
<item.icon class="size-4 {item.iconClass}" />
</div>
<div class="flex items-center gap-2">
<span class="text-foreground text-base font-bold tabular-nums">{item.count}</span>
<span class="text-muted-foreground hidden text-xs font-medium sm:inline">{item.label}</span>
</div>
</a>
{/each}
</div>
</div>
</div>
{/if}

View file

@ -1,8 +1,7 @@
<script>
import * as Card from '$lib/components/ui/card/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import { Flame, Phone, Mail, ChevronRight, Calendar } from '@lucide/svelte';
import { Flame, Phone, Mail, ChevronRight, Calendar, Sparkles } from '@lucide/svelte';
/**
* @typedef {Object} Lead
@ -23,10 +22,25 @@
/** @type {Props} */
let { leads = [] } = $props();
const ratingConfig = /** @type {Record<string, { color: string }>} */ ({
HOT: { color: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400' },
WARM: { color: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400' },
COLD: { color: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400' }
const ratingConfig = /** @type {Record<string, { bg: string, text: string, border: string, iconColor: string }>} */ ({
HOT: {
bg: 'bg-orange-500/10 dark:bg-orange-500/15',
text: 'text-orange-600 dark:text-orange-400',
border: 'border-orange-500/30 dark:border-orange-400/20',
iconColor: 'text-orange-500 dark:text-orange-400'
},
WARM: {
bg: 'bg-amber-500/10 dark:bg-amber-500/15',
text: 'text-amber-600 dark:text-amber-400',
border: 'border-amber-500/30 dark:border-amber-400/20',
iconColor: 'text-amber-500 dark:text-amber-400'
},
COLD: {
bg: 'bg-cyan-500/10 dark:bg-cyan-500/15',
text: 'text-cyan-600 dark:text-cyan-400',
border: 'border-cyan-500/30 dark:border-cyan-400/20',
iconColor: 'text-cyan-500 dark:text-cyan-400'
}
});
/**
@ -75,73 +89,92 @@
}
</script>
<Card.Root class="flex h-full flex-col">
<Card.Header class="flex-row items-center justify-between space-y-0 pb-3">
<div class="flex items-center gap-2">
<Flame class="h-4 w-4 text-red-500" />
<Card.Title class="text-foreground text-sm font-medium">Hot Leads</Card.Title>
<div class="flex h-full flex-col overflow-hidden rounded-xl border border-border/50 bg-card/80 backdrop-blur-sm dark:bg-card/50">
<!-- Header -->
<div class="flex items-center justify-between border-b border-border/50 px-5 py-4">
<div class="flex items-center gap-3">
<div class="flex size-8 items-center justify-center rounded-lg bg-gradient-to-br from-orange-500/10 to-red-500/10 dark:from-orange-500/20 dark:to-red-500/20">
<Flame class="size-4 text-orange-500 dark:text-orange-400" />
</div>
<h3 class="text-foreground text-sm font-semibold tracking-tight">Hot Leads</h3>
</div>
<Button variant="ghost" size="sm" href="/leads?rating=HOT" class="text-xs">
<Button variant="ghost" size="sm" href="/leads?rating=HOT" class="gap-1 text-xs font-medium">
View all
<ChevronRight class="ml-1 h-3 w-3" />
<ChevronRight class="size-3.5" />
</Button>
</Card.Header>
<Card.Content class="flex-1 overflow-auto p-0">
</div>
<!-- Leads list -->
<div class="flex-1 overflow-auto">
{#if leads.length === 0}
<div
class="text-muted-foreground flex h-full flex-col items-center justify-center py-8 text-center"
>
<Flame class="text-muted-foreground/30 mb-2 h-10 w-10" />
<p class="text-sm">No hot leads</p>
<div class="flex h-full flex-col items-center justify-center py-10 text-center">
<div class="mb-3 flex size-12 items-center justify-center rounded-xl bg-muted/50">
<Sparkles class="text-muted-foreground/50 size-6" />
</div>
<p class="text-muted-foreground text-sm font-medium">No hot leads</p>
<p class="text-muted-foreground/70 text-xs">Mark leads as "Hot" to see them here</p>
</div>
{:else}
<div class="divide-border/50 divide-y">
<div class="divide-y divide-border/30">
{#each leads as lead (lead.id)}
{@const config = ratingConfig[lead.rating || 'HOT'] || ratingConfig.HOT}
<a
href="/leads/{lead.id}"
class="hover:bg-muted/50 group flex items-center gap-3 px-4 py-2.5 transition-colors"
href="/leads?view={lead.id}"
class="group flex items-center gap-3 px-5 py-3 transition-all duration-200 hover:bg-muted/30"
>
<!-- Lead info -->
<div class="min-w-0 flex-1">
<p class="text-foreground truncate text-sm font-medium">
<p class="text-foreground truncate text-sm font-medium transition-colors group-hover:text-primary">
{getLeadName(lead)}
</p>
<p class="text-muted-foreground truncate text-xs">
<p class="text-muted-foreground mt-0.5 truncate text-xs">
{lead.company || 'No company'}
</p>
</div>
<!-- Rating badge -->
<Badge
class="{ratingConfig[lead.rating || 'HOT']?.color} flex-shrink-0 gap-1 text-[10px]"
class="flex-shrink-0 gap-1.5 border text-[10px] font-semibold {config.bg} {config.text} {config.border}"
>
<Flame class="h-3 w-3" />
<Flame class="size-3 {config.iconColor}" />
{lead.rating || 'HOT'}
</Badge>
<!-- Follow-up date -->
{#if lead.next_follow_up}
<div class="flex flex-shrink-0 items-center gap-1">
<Calendar class="text-muted-foreground h-3 w-3" />
<div class="flex flex-shrink-0 items-center gap-1.5">
<Calendar class="text-muted-foreground size-3.5" />
<span
class="text-xs tabular-nums {isOverdue(lead.next_follow_up)
? 'font-medium text-red-500'
: 'text-muted-foreground'}"
class="text-xs font-medium tabular-nums
{isOverdue(lead.next_follow_up) ? 'text-rose-500 dark:text-rose-400' : 'text-muted-foreground'}"
>
{formatFollowUp(lead.next_follow_up)}
</span>
</div>
{/if}
<!-- Hover actions -->
<div
class="flex flex-shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100"
>
<Button variant="ghost" size="icon" class="h-7 w-7" title="Call">
<Phone class="h-3.5 w-3.5" />
<div class="flex flex-shrink-0 gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100">
<Button
variant="ghost"
size="icon"
class="size-7 rounded-lg hover:bg-cyan-500/10 hover:text-cyan-600 dark:hover:bg-cyan-500/20 dark:hover:text-cyan-400"
title="Call"
>
<Phone class="size-3.5" />
</Button>
<Button variant="ghost" size="icon" class="h-7 w-7" title="Email">
<Mail class="h-3.5 w-3.5" />
<Button
variant="ghost"
size="icon"
class="size-7 rounded-lg hover:bg-violet-500/10 hover:text-violet-600 dark:hover:bg-violet-500/20 dark:hover:text-violet-400"
title="Email"
>
<Mail class="size-3.5" />
</Button>
</div>
</a>
{/each}
</div>
{/if}
</Card.Content>
</Card.Root>
</div>
</div>

View file

@ -1,7 +1,6 @@
<script>
import { cn } from '$lib/utils.js';
import { TrendingUp, TrendingDown } from '@lucide/svelte';
import * as Card from '$lib/components/ui/card/index.js';
/**
* @typedef {Object} Props
@ -11,9 +10,7 @@
* @property {import('svelte').Snippet} [icon] - Icon snippet to display
* @property {number} [trend] - Percentage change (positive or negative)
* @property {string} [trendLabel] - Label for trend (e.g., "vs last month")
* @property {string} [iconBgClass] - Background class for icon container
* @property {string} [iconClass] - Class for the icon
* @property {string} [borderColor] - Top border color class (Notion-style)
* @property {'cyan' | 'violet' | 'emerald' | 'amber' | 'rose'} [accentColor] - Accent color theme
* @property {string} [class] - Additional classes
*/
@ -25,62 +22,121 @@
icon,
trend,
trendLabel,
iconBgClass = 'bg-blue-100 dark:bg-blue-900/30',
iconClass = 'text-blue-600 dark:text-blue-400',
borderColor,
accentColor = 'cyan',
class: className,
...restProps
} = $props();
const hasTrend = $derived(trend !== undefined && trend !== null);
const isPositive = $derived(trend !== undefined && trend >= 0);
// Color configurations for different accent colors
const colorConfig = {
cyan: {
iconBg: 'bg-cyan-500/10 dark:bg-cyan-500/20',
iconColor: 'text-cyan-600 dark:text-cyan-400',
borderGlow: 'hover:border-cyan-500/30 dark:hover:border-cyan-400/30',
shadowGlow: 'dark:hover:shadow-cyan-500/10'
},
violet: {
iconBg: 'bg-violet-500/10 dark:bg-violet-500/20',
iconColor: 'text-violet-600 dark:text-violet-400',
borderGlow: 'hover:border-violet-500/30 dark:hover:border-violet-400/30',
shadowGlow: 'dark:hover:shadow-violet-500/10'
},
emerald: {
iconBg: 'bg-emerald-500/10 dark:bg-emerald-500/20',
iconColor: 'text-emerald-600 dark:text-emerald-400',
borderGlow: 'hover:border-emerald-500/30 dark:hover:border-emerald-400/30',
shadowGlow: 'dark:hover:shadow-emerald-500/10'
},
amber: {
iconBg: 'bg-amber-500/10 dark:bg-amber-500/20',
iconColor: 'text-amber-600 dark:text-amber-400',
borderGlow: 'hover:border-amber-500/30 dark:hover:border-amber-400/30',
shadowGlow: 'dark:hover:shadow-amber-500/10'
},
rose: {
iconBg: 'bg-rose-500/10 dark:bg-rose-500/20',
iconColor: 'text-rose-600 dark:text-rose-400',
borderGlow: 'hover:border-rose-500/30 dark:hover:border-rose-400/30',
shadowGlow: 'dark:hover:shadow-rose-500/10'
}
};
const colors = $derived(colorConfig[accentColor] || colorConfig.cyan);
</script>
<Card.Root
class={cn('px-5 py-4', borderColor && 'border-t-[3px]', borderColor, className)}
<div
class={cn(
'group relative overflow-hidden rounded-xl border border-border/50 bg-card/80 p-5 backdrop-blur-sm transition-all duration-300',
'hover:-translate-y-0.5 hover:shadow-lg',
'dark:bg-card/50 dark:hover:shadow-xl',
colors.borderGlow,
colors.shadowGlow,
className
)}
{...restProps}
>
<div class="flex items-start justify-between gap-4">
<div class="flex min-w-0 flex-col gap-1">
<p class="text-muted-foreground truncate text-xs font-medium tracking-wider uppercase">
<!-- Subtle gradient overlay on hover -->
<div class="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100">
<div class="absolute inset-0 bg-gradient-to-br from-white/5 via-transparent to-transparent dark:from-white/[0.02]"></div>
</div>
<div class="relative flex items-start justify-between gap-4">
<div class="flex min-w-0 flex-col gap-1.5">
<!-- Label -->
<p class="text-muted-foreground text-xs font-semibold uppercase tracking-wider">
{label}
</p>
<p class="text-foreground truncate text-3xl font-semibold tabular-nums">
<!-- Value -->
<p class="text-foreground truncate text-2xl font-bold tabular-nums tracking-tight lg:text-3xl">
{value}
</p>
<!-- Subtitle -->
{#if subtitle}
<p class="text-muted-foreground text-[10px]">{subtitle}</p>
<p class="text-muted-foreground/70 text-[10px] font-medium">{subtitle}</p>
{/if}
<!-- Trend indicator -->
{#if hasTrend}
<div class="mt-1 flex items-center gap-1">
<div class="mt-1 flex items-center gap-1.5">
{#if isPositive}
<TrendingUp class="h-3.5 w-3.5 text-[var(--status-success)]" />
<span class="text-xs font-medium text-[var(--status-success)]">
+{trend}%
</span>
<div class="flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 dark:bg-emerald-500/20">
<TrendingUp class="size-3 text-emerald-600 dark:text-emerald-400" />
<span class="text-xs font-semibold text-emerald-600 dark:text-emerald-400">
+{trend}%
</span>
</div>
{:else}
<TrendingDown class="h-3.5 w-3.5 text-[var(--status-danger)]" />
<span class="text-xs font-medium text-[var(--status-danger)]">
{trend}%
</span>
<div class="flex items-center gap-1 rounded-full bg-rose-500/10 px-2 py-0.5 dark:bg-rose-500/20">
<TrendingDown class="size-3 text-rose-600 dark:text-rose-400" />
<span class="text-xs font-semibold text-rose-600 dark:text-rose-400">
{trend}%
</span>
</div>
{/if}
{#if trendLabel}
<span class="text-muted-foreground text-xs">{trendLabel}</span>
<span class="text-muted-foreground text-[10px]">{trendLabel}</span>
{/if}
</div>
{/if}
</div>
<!-- Icon -->
{#if icon}
<div
class={cn(
'flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg',
iconBgClass
'flex size-11 flex-shrink-0 items-center justify-center rounded-xl transition-transform duration-300 group-hover:scale-105',
colors.iconBg
)}
>
<div class={iconClass}>
<div class={colors.iconColor}>
{@render icon()}
</div>
</div>
{/if}
</div>
</Card.Root>
</div>

View file

@ -1,6 +1,6 @@
<script>
import { Badge } from '$lib/components/ui/badge/index.js';
import { ChevronRight } from '@lucide/svelte';
import { ChevronRight, Trophy, XCircle } from '@lucide/svelte';
import { formatCurrency } from '$lib/utils/formatting.js';
/**
@ -20,37 +20,113 @@
let { pipelineData = {}, currency = 'USD' } = $props();
const stages = [
{ id: 'PROSPECTING', color: 'bg-gray-500' },
{ id: 'QUALIFICATION', color: 'bg-blue-500' },
{ id: 'PROPOSAL', color: 'bg-purple-500' },
{ id: 'NEGOTIATION', color: 'bg-orange-500' },
{ id: 'CLOSED_WON', color: 'bg-green-500' },
{ id: 'CLOSED_LOST', color: 'bg-red-500' }
{
id: 'PROSPECTING',
color: 'bg-slate-500',
textColor: 'text-slate-600 dark:text-slate-400',
bgColor: 'bg-slate-500/10 dark:bg-slate-500/15',
borderColor: 'border-slate-500/30 dark:border-slate-400/20',
glowColor: 'hover:shadow-slate-500/10'
},
{
id: 'QUALIFICATION',
color: 'bg-cyan-500',
textColor: 'text-cyan-600 dark:text-cyan-400',
bgColor: 'bg-cyan-500/10 dark:bg-cyan-500/15',
borderColor: 'border-cyan-500/30 dark:border-cyan-400/20',
glowColor: 'hover:shadow-cyan-500/10 dark:hover:shadow-cyan-400/20'
},
{
id: 'PROPOSAL',
color: 'bg-violet-500',
textColor: 'text-violet-600 dark:text-violet-400',
bgColor: 'bg-violet-500/10 dark:bg-violet-500/15',
borderColor: 'border-violet-500/30 dark:border-violet-400/20',
glowColor: 'hover:shadow-violet-500/10 dark:hover:shadow-violet-400/20'
},
{
id: 'NEGOTIATION',
color: 'bg-amber-500',
textColor: 'text-amber-600 dark:text-amber-400',
bgColor: 'bg-amber-500/10 dark:bg-amber-500/15',
borderColor: 'border-amber-500/30 dark:border-amber-400/20',
glowColor: 'hover:shadow-amber-500/10 dark:hover:shadow-amber-400/20'
},
{
id: 'CLOSED_WON',
color: 'bg-emerald-500',
textColor: 'text-emerald-600 dark:text-emerald-400',
bgColor: 'bg-emerald-500/10 dark:bg-emerald-500/15',
borderColor: 'border-emerald-500/30 dark:border-emerald-400/20',
glowColor: 'hover:shadow-emerald-500/10 dark:hover:shadow-emerald-400/20',
icon: Trophy
},
{
id: 'CLOSED_LOST',
color: 'bg-rose-500',
textColor: 'text-rose-600 dark:text-rose-400',
bgColor: 'bg-rose-500/10 dark:bg-rose-500/15',
borderColor: 'border-rose-500/30 dark:border-rose-400/20',
glowColor: 'hover:shadow-rose-500/10',
icon: XCircle
}
];
</script>
<div class="overflow-x-auto">
<div class="flex min-w-max items-center gap-1">
<div class="flex min-w-max items-center gap-2">
{#each stages as stage, index}
{@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }}
<a
href="/opportunities?stage={stage.id}"
class="group bg-muted/30 hover:border-border/50 hover:bg-muted/50 flex min-w-[120px] flex-col rounded-lg border border-transparent px-3 py-2.5 transition-all"
class="group relative min-w-[130px] flex-1 overflow-hidden rounded-xl border px-4 py-3.5 transition-all duration-300 hover:-translate-y-0.5 hover:shadow-lg {stage.borderColor} {stage.bgColor} {stage.glowColor}"
>
<div class="mb-1 flex items-center gap-1.5">
<div class="h-2 w-2 rounded-full {stage.color}"></div>
<span class="text-foreground text-xs font-medium">{data.label || stage.id}</span>
<Badge variant="secondary" class="ml-auto h-5 px-1.5 text-[10px]">{data.count}</Badge>
<!-- Gradient overlay on hover -->
<div class="pointer-events-none absolute inset-0 bg-gradient-to-br from-white/10 via-transparent to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100 dark:from-white/5"></div>
<div class="relative flex flex-col gap-2">
<!-- Stage header -->
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<div class="size-2.5 rounded-full {stage.color} shadow-sm"></div>
<span class="text-foreground text-xs font-semibold tracking-tight">
{data.label || stage.id.replace('_', ' ')}
</span>
</div>
<Badge
variant="secondary"
class="h-5 min-w-[1.5rem] justify-center px-1.5 text-[10px] font-bold {stage.textColor} {stage.bgColor} border {stage.borderColor}"
>
{data.count}
</Badge>
</div>
<!-- Value with optional icon -->
<div class="flex items-center gap-2">
{#if stage.icon}
<stage.icon class="size-4 {stage.textColor}" />
{/if}
<p class="text-foreground text-lg font-bold tabular-nums tracking-tight">
{formatCurrency(data.value, currency, true)}
</p>
</div>
</div>
<p class="text-foreground text-base font-semibold tabular-nums">
{formatCurrency(data.value, currency, true)}
</p>
</a>
{#if index < stages.length - 1 && index !== 3}
<ChevronRight class="text-muted-foreground/50 h-4 w-4 flex-shrink-0" />
<!-- Connector arrows between active stages -->
{#if index < 4}
<div class="flex-shrink-0 px-1">
<ChevronRight class="text-muted-foreground/30 size-5 transition-colors group-hover:text-muted-foreground/50" />
</div>
{/if}
<!-- Divider before closed stages -->
{#if index === 3}
<div class="bg-border mx-1 h-8 w-px flex-shrink-0"></div>
<div class="flex flex-shrink-0 flex-col items-center gap-1 px-2">
<div class="bg-border/50 h-4 w-px"></div>
<span class="text-muted-foreground/50 text-[8px] font-medium uppercase tracking-widest">Closed</span>
<div class="bg-border/50 h-4 w-px"></div>
</div>
{/if}
{/each}
</div>

View file

@ -1,9 +1,8 @@
<script>
import * as Card from '$lib/components/ui/card/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import { Progress } from '$lib/components/ui/progress/index.js';
import { Target, ChevronRight, Calendar } from '@lucide/svelte';
import { Sparkles, ChevronRight, Calendar } from '@lucide/svelte';
import { formatCurrency } from '$lib/utils/formatting.js';
/**
@ -27,30 +26,42 @@
/** @type {Props} */
let { opportunities = [] } = $props();
const stageConfig = /** @type {Record<string, { label: string, color: string }>} */ ({
const stageConfig = /** @type {Record<string, { label: string, bg: string, text: string, border: string }>} */ ({
PROSPECTING: {
label: 'Prospecting',
color: 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300'
bg: 'bg-slate-500/10 dark:bg-slate-500/15',
text: 'text-slate-600 dark:text-slate-400',
border: 'border-slate-500/30'
},
QUALIFICATION: {
label: 'Qualification',
color: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'
bg: 'bg-cyan-500/10 dark:bg-cyan-500/15',
text: 'text-cyan-600 dark:text-cyan-400',
border: 'border-cyan-500/30'
},
PROPOSAL: {
label: 'Proposal',
color: 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400'
bg: 'bg-violet-500/10 dark:bg-violet-500/15',
text: 'text-violet-600 dark:text-violet-400',
border: 'border-violet-500/30'
},
NEGOTIATION: {
label: 'Negotiation',
color: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400'
bg: 'bg-amber-500/10 dark:bg-amber-500/15',
text: 'text-amber-600 dark:text-amber-400',
border: 'border-amber-500/30'
},
CLOSED_WON: {
label: 'Won',
color: 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400'
bg: 'bg-emerald-500/10 dark:bg-emerald-500/15',
text: 'text-emerald-600 dark:text-emerald-400',
border: 'border-emerald-500/30'
},
CLOSED_LOST: {
label: 'Lost',
color: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400'
bg: 'bg-rose-500/10 dark:bg-rose-500/15',
text: 'text-rose-600 dark:text-rose-400',
border: 'border-rose-500/30'
}
});
@ -86,65 +97,83 @@
);
</script>
<Card.Root class="flex h-full flex-col">
<Card.Header class="flex-row items-center justify-between space-y-0 pb-3">
<div class="flex items-center gap-2">
<Target class="h-4 w-4 text-green-500" />
<Card.Title class="text-foreground text-sm font-medium">My Opportunities</Card.Title>
<div class="flex h-full flex-col overflow-hidden rounded-xl border border-border/50 bg-card/80 backdrop-blur-sm dark:bg-card/50">
<!-- Header -->
<div class="flex items-center justify-between border-b border-border/50 px-5 py-4">
<div class="flex items-center gap-3">
<div class="flex size-8 items-center justify-center rounded-lg bg-gradient-to-br from-emerald-500/10 to-teal-500/10 dark:from-emerald-500/20 dark:to-teal-500/20">
<Sparkles class="size-4 text-emerald-600 dark:text-emerald-400" />
</div>
<h3 class="text-foreground text-sm font-semibold tracking-tight">My Opportunities</h3>
</div>
<Button variant="ghost" size="sm" href="/opportunities" class="text-xs">
<Button variant="ghost" size="sm" href="/opportunities" class="gap-1 text-xs font-medium">
View all
<ChevronRight class="ml-1 h-3 w-3" />
<ChevronRight class="size-3.5" />
</Button>
</Card.Header>
<Card.Content class="flex-1 overflow-auto p-0">
</div>
<!-- Opportunities list -->
<div class="flex-1 overflow-auto">
{#if openOpportunities.length === 0}
<div
class="text-muted-foreground flex h-full flex-col items-center justify-center py-8 text-center"
>
<Target class="text-muted-foreground/30 mb-2 h-10 w-10" />
<p class="text-sm">No open opportunities</p>
<div class="flex h-full flex-col items-center justify-center py-10 text-center">
<div class="mb-3 flex size-12 items-center justify-center rounded-xl bg-muted/50">
<Sparkles class="text-muted-foreground/50 size-6" />
</div>
<p class="text-muted-foreground text-sm font-medium">No open opportunities</p>
<p class="text-muted-foreground/70 text-xs">Create one to start tracking</p>
</div>
{:else}
<div class="divide-border/50 divide-y">
<div class="divide-y divide-border/30">
{#each openOpportunities.slice(0, 5) as opp (opp.id)}
{@const daysUntilClose = getDaysUntilClose(opp.closed_on)}
{@const config = stageConfig[opp.stage] || stageConfig.PROSPECTING}
<a
href="/opportunities/{opp.id}"
class="hover:bg-muted/50 group block px-4 py-3 transition-colors"
href="/opportunities?view={opp.id}"
class="group block px-5 py-3.5 transition-all duration-200 hover:bg-muted/30"
>
<div class="mb-2 flex items-start justify-between gap-2">
<!-- Top row: Name and Amount -->
<div class="mb-2.5 flex items-start justify-between gap-3">
<div class="min-w-0 flex-1">
<p class="text-foreground truncate text-sm font-medium">
<p class="text-foreground truncate text-sm font-medium transition-colors group-hover:text-primary">
{opp.name}
</p>
<p class="text-muted-foreground truncate text-xs">
<p class="text-muted-foreground mt-0.5 truncate text-xs">
{opp.account?.name || 'No account'}
</p>
</div>
<span class="text-foreground flex-shrink-0 text-sm font-semibold tabular-nums">
<span class="text-foreground flex-shrink-0 text-base font-bold tabular-nums tracking-tight">
{formatCurrency(opp.amount, opp.currency || 'USD')}
</span>
</div>
<!-- Bottom row: Stage, Progress, Close Date -->
<div class="flex items-center gap-3">
<Badge class="{stageConfig[opp.stage]?.color} text-[10px]">
{stageConfig[opp.stage]?.label || opp.stage}
<!-- Stage badge -->
<Badge
class="flex-shrink-0 border text-[10px] font-semibold {config.bg} {config.text} {config.border}"
>
{config.label}
</Badge>
<!-- Probability progress -->
<div class="flex flex-1 items-center gap-2">
<Progress value={opp.probability || 0} class="h-1.5 flex-1" />
<span class="text-muted-foreground w-8 text-right text-xs tabular-nums">
<span class="text-muted-foreground w-8 text-right text-xs font-medium tabular-nums">
{opp.probability || 0}%
</span>
</div>
<!-- Close date -->
{#if daysUntilClose !== null}
<div class="flex items-center gap-1">
<Calendar class="text-muted-foreground h-3 w-3" />
<div class="flex flex-shrink-0 items-center gap-1.5">
<Calendar class="text-muted-foreground size-3.5" />
<span
class="text-xs tabular-nums {daysUntilClose < 0
? 'font-medium text-red-500'
: daysUntilClose <= 7
? 'text-orange-500'
: 'text-muted-foreground'}"
class="text-xs font-medium tabular-nums
{daysUntilClose < 0
? 'text-rose-500 dark:text-rose-400'
: daysUntilClose <= 7
? 'text-amber-500 dark:text-amber-400'
: 'text-muted-foreground'}"
>
{formatDaysUntilClose(daysUntilClose)}
</span>
@ -155,5 +184,5 @@
{/each}
</div>
{/if}
</Card.Content>
</Card.Root>
</div>
</div>

View file

@ -1,5 +1,5 @@
<script>
import * as Card from '$lib/components/ui/card/index.js';
import { BarChart3 } from '@lucide/svelte';
import { formatCurrency } from '$lib/utils/formatting.js';
/**
@ -20,50 +20,80 @@
// Only show open stages in the chart (not closed)
const stages = [
{ id: 'PROSPECTING', color: 'bg-gray-400 dark:bg-gray-500' },
{ id: 'QUALIFICATION', color: 'bg-blue-500' },
{ id: 'PROPOSAL', color: 'bg-purple-500' },
{ id: 'NEGOTIATION', color: 'bg-orange-500' }
{
id: 'PROSPECTING',
color: 'bg-slate-500',
bgLight: 'bg-slate-500/20',
text: 'text-slate-600 dark:text-slate-400'
},
{
id: 'QUALIFICATION',
color: 'bg-cyan-500',
bgLight: 'bg-cyan-500/20',
text: 'text-cyan-600 dark:text-cyan-400'
},
{
id: 'PROPOSAL',
color: 'bg-violet-500',
bgLight: 'bg-violet-500/20',
text: 'text-violet-600 dark:text-violet-400'
},
{
id: 'NEGOTIATION',
color: 'bg-amber-500',
bgLight: 'bg-amber-500/20',
text: 'text-amber-600 dark:text-amber-400'
}
];
const maxValue = $derived(Math.max(...stages.map((s) => pipelineData[s.id]?.value || 0), 1));
const totalPipeline = $derived(stages.reduce((sum, s) => sum + (pipelineData[s.id]?.value || 0), 0));
</script>
<Card.Root class="p-5">
<Card.Header class="p-0 pb-4">
<Card.Title class="text-foreground text-sm font-medium">Pipeline by Stage</Card.Title>
</Card.Header>
<Card.Content class="p-0">
<div class="space-y-3">
{#each stages as stage}
{@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }}
{@const percentage = maxValue > 0 ? (data.value / maxValue) * 100 : 0}
<div class="space-y-1.5">
<div class="flex items-center justify-between text-xs">
<span class="text-muted-foreground">{data.label || stage.id}</span>
<span class="text-foreground font-medium tabular-nums"
>{formatCurrency(data.value, currency, true)}</span
>
</div>
<div class="bg-muted h-2 w-full overflow-hidden rounded-full">
<div
class="h-full rounded-full transition-all duration-500 ease-out {stage.color}"
style="width: {percentage}%"
></div>
<div class="overflow-hidden rounded-xl border border-border/50 bg-card/80 p-6 backdrop-blur-sm dark:bg-card/50">
<!-- Header -->
<div class="mb-6 flex items-center gap-3">
<div class="flex size-8 items-center justify-center rounded-lg bg-gradient-to-br from-cyan-500/10 to-violet-500/10 dark:from-cyan-500/20 dark:to-violet-500/20">
<BarChart3 class="size-4 text-cyan-600 dark:text-cyan-400" />
</div>
<h3 class="text-foreground text-sm font-semibold tracking-tight">Pipeline by Stage</h3>
</div>
<!-- Bar chart -->
<div class="space-y-4">
{#each stages as stage}
{@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }}
{@const percentage = maxValue > 0 ? (data.value / maxValue) * 100 : 0}
<div class="group space-y-2">
<!-- Label row -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="size-2.5 rounded-full {stage.color}"></div>
<span class="text-muted-foreground text-xs font-medium">{data.label || stage.id}</span>
</div>
<span class="text-foreground text-sm font-bold tabular-nums tracking-tight">
{formatCurrency(data.value, currency, true)}
</span>
</div>
{/each}
</div>
<!-- Summary row -->
<div class="border-border/50 mt-4 flex justify-between border-t pt-3 text-xs">
<span class="text-muted-foreground">Total Open Pipeline</span>
<span class="text-foreground font-semibold tabular-nums">
{formatCurrency(
stages.reduce((sum, s) => sum + (pipelineData[s.id]?.value || 0), 0),
currency,
true
)}
</span>
</div>
</Card.Content>
</Card.Root>
<!-- Progress bar -->
<div class="relative h-3 w-full overflow-hidden rounded-full {stage.bgLight}">
<div
class="absolute inset-y-0 left-0 rounded-full transition-all duration-700 ease-out {stage.color}"
style="width: {percentage}%"
></div>
<!-- Shimmer effect on hover -->
<div class="absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100"></div>
</div>
</div>
{/each}
</div>
<!-- Summary -->
<div class="mt-6 flex items-center justify-between border-t border-border/50 pt-4">
<span class="text-muted-foreground text-xs font-medium">Total Open Pipeline</span>
<span class="text-foreground text-lg font-bold tabular-nums tracking-tight">
{formatCurrency(totalPipeline, currency, true)}
</span>
</div>
</div>

View file

@ -1,8 +1,7 @@
<script>
import * as Card from '$lib/components/ui/card/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import { Circle, CheckCircle2, ChevronRight } from '@lucide/svelte';
import { Circle, CheckCircle2, ChevronRight, ListTodo } from '@lucide/svelte';
/**
* @typedef {Object} Task
@ -80,16 +79,28 @@
);
/**
* Get priority badge class
* Get priority config
* @param {string} priority
*/
function getPriorityClass(priority) {
const classes = /** @type {Record<string, string>} */ ({
High: 'border-red-300 text-red-600 dark:border-red-700 dark:text-red-400',
Medium: 'border-orange-300 text-orange-600 dark:border-orange-700 dark:text-orange-400',
Low: 'border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400'
function getPriorityConfig(priority) {
const configs = /** @type {Record<string, { bg: string, text: string, border: string }>} */ ({
High: {
bg: 'bg-rose-500/10 dark:bg-rose-500/15',
text: 'text-rose-600 dark:text-rose-400',
border: 'border-rose-500/30 dark:border-rose-400/20'
},
Medium: {
bg: 'bg-amber-500/10 dark:bg-amber-500/15',
text: 'text-amber-600 dark:text-amber-400',
border: 'border-amber-500/30 dark:border-amber-400/20'
},
Low: {
bg: 'bg-slate-500/10 dark:bg-slate-500/15',
text: 'text-slate-600 dark:text-slate-400',
border: 'border-slate-500/30 dark:border-slate-400/20'
}
});
return classes[priority] || classes['Medium'];
return configs[priority] || configs['Medium'];
}
/**
@ -106,93 +117,102 @@
}
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
}
/** @type {{ id: 'all' | 'overdue' | 'today' | 'week', label: string }[]} */
const filterButtons = [
{ id: 'all', label: 'All' },
{ id: 'overdue', label: 'Overdue' },
{ id: 'today', label: 'Today' },
{ id: 'week', label: 'Week' }
];
</script>
<Card.Root class="flex h-full flex-col">
<Card.Header class="flex-row items-center justify-between space-y-0 pb-3">
<Card.Title class="text-foreground text-sm font-medium">My Tasks</Card.Title>
<Button variant="ghost" size="sm" href="/tasks" class="text-xs">
<div class="flex h-full flex-col overflow-hidden rounded-xl border border-border/50 bg-card/80 backdrop-blur-sm dark:bg-card/50">
<!-- Header -->
<div class="flex items-center justify-between border-b border-border/50 px-5 py-4">
<div class="flex items-center gap-3">
<div class="flex size-8 items-center justify-center rounded-lg bg-gradient-to-br from-cyan-500/10 to-teal-500/10 dark:from-cyan-500/20 dark:to-teal-500/20">
<ListTodo class="size-4 text-cyan-600 dark:text-cyan-400" />
</div>
<h3 class="text-foreground text-sm font-semibold tracking-tight">My Tasks</h3>
</div>
<Button variant="ghost" size="sm" href="/tasks" class="gap-1 text-xs font-medium">
View all
<ChevronRight class="ml-1 h-3 w-3" />
</Button>
</Card.Header>
<div class="border-border/50 flex gap-1 border-b px-4 pb-2">
<Button
variant={filter === 'all' ? 'secondary' : 'ghost'}
size="sm"
class="h-7 px-2.5 text-xs"
onclick={() => (filter = 'all')}
>
All
</Button>
<Button
variant={filter === 'overdue' ? 'secondary' : 'ghost'}
size="sm"
class="h-7 px-2.5 text-xs {overdueTasks.length > 0 ? 'text-red-600 dark:text-red-400' : ''}"
onclick={() => (filter = 'overdue')}
>
Overdue
{#if overdueTasks.length > 0}
<Badge variant="destructive" class="ml-1 h-4 px-1 text-[10px]">{overdueTasks.length}</Badge>
{/if}
</Button>
<Button
variant={filter === 'today' ? 'secondary' : 'ghost'}
size="sm"
class="h-7 px-2.5 text-xs"
onclick={() => (filter = 'today')}
>
Today
</Button>
<Button
variant={filter === 'week' ? 'secondary' : 'ghost'}
size="sm"
class="h-7 px-2.5 text-xs"
onclick={() => (filter = 'week')}
>
Week
<ChevronRight class="size-3.5" />
</Button>
</div>
<Card.Content class="flex-1 overflow-auto p-0">
<!-- Filter tabs -->
<div class="flex gap-1 border-b border-border/50 px-4 py-2">
{#each filterButtons as btn}
<Button
variant={filter === btn.id ? 'secondary' : 'ghost'}
size="sm"
class="h-7 px-3 text-xs font-medium transition-all duration-200
{filter === btn.id ? 'bg-secondary shadow-sm' : 'hover:bg-secondary/50'}"
onclick={() => (filter = btn.id)}
>
{btn.label}
{#if btn.id === 'overdue' && overdueTasks.length > 0}
<Badge class="ml-1.5 h-4 min-w-4 bg-rose-500 px-1 text-[10px] font-bold text-white">
{overdueTasks.length}
</Badge>
{/if}
</Button>
{/each}
</div>
<!-- Task list -->
<div class="flex-1 overflow-auto">
{#if filteredTasks().length === 0}
<div class="text-muted-foreground flex h-full items-center justify-center py-8 text-sm">
No tasks found
<div class="flex h-full flex-col items-center justify-center py-10 text-center">
<div class="mb-3 flex size-12 items-center justify-center rounded-xl bg-muted/50">
<ListTodo class="text-muted-foreground/50 size-6" />
</div>
<p class="text-muted-foreground text-sm font-medium">No tasks found</p>
<p class="text-muted-foreground/70 text-xs">All caught up!</p>
</div>
{:else}
<div class="divide-border/50 divide-y">
<div class="divide-y divide-border/30">
{#each filteredTasks() as task (task.id)}
{@const config = getPriorityConfig(task.priority)}
<a
href="/tasks/{task.id}"
class="hover:bg-muted/50 group flex items-center gap-3 px-4 py-2.5 transition-colors"
href="/tasks?view={task.id}"
class="group flex items-center gap-3 px-5 py-3 transition-all duration-200 hover:bg-muted/30"
>
<button class="text-muted-foreground hover:text-foreground flex-shrink-0">
<!-- Status icon -->
<button class="text-muted-foreground flex-shrink-0 transition-colors hover:text-foreground">
{#if task.status === 'Completed'}
<CheckCircle2 class="h-4 w-4 text-green-500" />
<CheckCircle2 class="size-5 text-emerald-500 dark:text-emerald-400" />
{:else}
<Circle class="h-4 w-4" />
<Circle class="size-5" />
{/if}
</button>
<!-- Task details -->
<div class="min-w-0 flex-1">
<p
class="text-foreground truncate text-sm font-medium {task.status === 'Completed'
? 'text-muted-foreground line-through'
: ''}"
class="text-foreground truncate text-sm font-medium transition-colors group-hover:text-primary
{task.status === 'Completed' ? 'text-muted-foreground line-through' : ''}"
>
{task.subject}
</p>
<p class="text-muted-foreground truncate text-xs">{task.status}</p>
<p class="text-muted-foreground mt-0.5 truncate text-xs">{task.status}</p>
</div>
<!-- Priority badge -->
<Badge
variant="outline"
class="flex-shrink-0 text-[10px] {getPriorityClass(task.priority)}"
class="flex-shrink-0 border text-[10px] font-semibold {config.bg} {config.text} {config.border}"
>
{task.priority}
</Badge>
<!-- Due date -->
{#if task.dueDate}
<span
class="flex-shrink-0 text-xs tabular-nums {isOverdue(task.dueDate)
? 'font-medium text-red-500'
: 'text-muted-foreground'}"
class="flex-shrink-0 text-xs font-medium tabular-nums
{isOverdue(task.dueDate) ? 'text-rose-500 dark:text-rose-400' : 'text-muted-foreground'}"
>
{formatDate(task.dueDate)}
</span>
@ -201,5 +221,5 @@
{/each}
</div>
{/if}
</Card.Content>
</Card.Root>
</div>
</div>

View file

@ -17,8 +17,9 @@
CheckSquare,
HelpCircle,
ChevronRight,
ChevronsLeft,
ChevronsRight,
ChevronDown,
PanelLeftClose,
PanelLeft,
Moon,
Sun,
Monitor,
@ -32,7 +33,11 @@
RefreshCw,
FileCode,
BarChart3,
Tag
Tag,
Sparkles,
Search,
Star,
Home
} from '@lucide/svelte';
/**
@ -106,6 +111,22 @@
/** @type {{ [key: string]: boolean }} */
let openDropdowns = $state({});
/** Track if profile image failed to load */
let profileImageError = $state(false);
/**
* Get user initials from name
* @param {string} name
*/
const getInitials = (name) => {
if (!name) return '?';
const parts = name.trim().split(/\s+/);
if (parts.length >= 2) {
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
return name.slice(0, 2).toUpperCase();
};
// Auto-open dropdown if a child is active
$effect(() => {
navigationItems.forEach((item) => {
@ -125,12 +146,12 @@
}
});
// Disable prefetch on all nav links - CRM pages load data that shouldn't be prefetched on hover
const navigationItems = [
// HubSpot-style navigation structure with sections
const crmItems = [
{
href: '/',
label: 'Dashboard',
icon: LayoutDashboard,
icon: Home,
type: 'link',
preload: 'off'
},
@ -150,21 +171,21 @@
},
{
href: '/accounts',
label: 'Accounts',
label: 'Companies',
icon: Building,
type: 'link',
preload: 'off'
},
{
href: '/opportunities',
label: 'Opportunities',
icon: Target,
label: 'Deals',
icon: Sparkles,
type: 'link',
preload: 'off'
},
{
href: '/cases',
label: 'Cases',
label: 'Tickets',
icon: Briefcase,
type: 'link',
preload: 'off'
@ -175,7 +196,10 @@
icon: CheckSquare,
type: 'link',
preload: 'off'
},
}
];
const salesItems = [
{
key: 'invoices',
label: 'Invoices',
@ -189,16 +213,22 @@
{ href: '/invoices/templates', label: 'Templates', icon: FileCode, preload: 'off' },
{ href: '/invoices/reports', label: 'Reports', icon: BarChart3, preload: 'off' }
]
},
}
];
const supportItems = [
{
href: '/support',
label: 'Support',
label: 'Help Desk',
icon: HelpCircle,
type: 'link',
preload: 'off'
}
];
// Combine for iteration
const navigationItems = [...crmItems, ...salesItems, ...supportItems];
/**
* Check if any child route is active
* @param {Array<{href: string}>} children
@ -218,77 +248,98 @@
};
</script>
<Sidebar.Root collapsible="icon" class="border-sidebar-border border-r">
<Sidebar.Header class="border-sidebar-border border-b">
<Sidebar.Root collapsible="icon" class="hubspot-sidebar border-r border-sidebar-border/60 bg-sidebar">
<!-- Header with Logo - HubSpot Style -->
<Sidebar.Header class="px-3 py-4">
<Sidebar.Menu>
<Sidebar.MenuItem>
<Sidebar.MenuButton size="lg" class="data-[state=open]:bg-sidebar-accent">
<Sidebar.MenuButton size="lg" class="group relative hover:bg-transparent">
{#snippet child({ props })}
<a href="/" {...props}>
<a href="/" {...props} class="flex items-center gap-3">
<!-- Logo Container -->
<div
class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
class="flex size-9 items-center justify-center rounded-lg bg-gradient-to-br from-[#ff7a59] to-[#ff5c35] shadow-md shadow-[#ff7a59]/20 transition-transform duration-200 group-hover:scale-105"
>
<img src={imgLogo} alt="Logo" class="size-6" />
<img src={imgLogo} alt="Logo" class="size-5" />
</div>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-semibold">{org_name}</span>
<span class="text-sidebar-foreground/60 truncate text-xs">CRM</span>
<div class="grid flex-1 text-left leading-tight group-data-[collapsible=icon]:hidden">
<span class="truncate text-[15px] font-semibold tracking-tight text-sidebar-foreground">{org_name}</span>
<span class="truncate text-[11px] font-medium text-sidebar-foreground/50">
CRM Platform
</span>
</div>
</a>
{/snippet}
</Sidebar.MenuButton>
<!-- Collapse Button (visible when expanded) -->
<Button
onclick={() => sidebar.toggle()}
variant="outline"
size="icon"
class="border-sidebar-border bg-sidebar text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground absolute top-1/2 right-1 size-6 -translate-y-1/2 rounded-md shadow-sm transition-all group-data-[collapsible=icon]:hidden hover:shadow-md"
title="Collapse Sidebar"
>
<ChevronsLeft class="size-3.5" />
</Button>
</Sidebar.MenuItem>
<!-- Expand Button (visible when collapsed) -->
<Sidebar.MenuItem class="hidden group-data-[collapsible=icon]:block">
<Sidebar.MenuButton
onclick={() => sidebar.toggle()}
tooltipContent="Expand Sidebar"
class="flex items-center justify-center"
>
{#snippet child({ props })}
<button {...props} class="flex w-full items-center justify-center">
<ChevronsRight class="size-4" />
</button>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
</Sidebar.Menu>
</Sidebar.Header>
<Sidebar.Content>
<!-- Quick Search Bar - HubSpot Style -->
<div class="mx-3 mb-3 group-data-[collapsible=icon]:mx-2 group-data-[collapsible=icon]:hidden">
<button
class="flex h-9 w-full items-center gap-2 rounded-lg border border-sidebar-border/60 bg-sidebar-accent/30 px-3 text-sm text-sidebar-foreground/60 transition-all hover:border-sidebar-border hover:bg-sidebar-accent/50"
>
<Search class="size-4" />
<span class="flex-1 text-left">Search...</span>
<kbd class="hidden rounded bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium text-sidebar-foreground/50 sm:inline-block">⌘K</kbd>
</button>
</div>
<Sidebar.Content class="px-2">
<!-- CRM Section -->
<Sidebar.Group>
<Sidebar.GroupLabel class="mb-1 px-3 text-[10px] font-bold uppercase tracking-widest text-sidebar-foreground/40 group-data-[collapsible=icon]:hidden">
CRM
</Sidebar.GroupLabel>
<Sidebar.GroupContent>
<Sidebar.Menu>
{#each navigationItems as item}
{#if item.type === 'link'}
<Sidebar.MenuItem>
<Sidebar.MenuButton
isActive={currentPath === item.href}
tooltipContent={item.label}
>
{#snippet child({ props })}
<a
href={item.href}
{...props}
data-sveltekit-preload-data={item.preload || 'hover'}
>
<item.icon class="size-4" />
<span>{item.label}</span>
</a>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
{:else if item.type === 'dropdown' && item.children}
<Sidebar.Menu class="space-y-0.5">
{#each crmItems as item}
<Sidebar.MenuItem>
<Sidebar.MenuButton
isActive={currentPath === item.href}
tooltipContent={item.label}
class="hubspot-menu-item group/item relative h-9 rounded-lg px-3 transition-all duration-150
{currentPath === item.href
? 'bg-[#fff1ee] text-[#ff5c35] dark:bg-[#ff7a59]/10 dark:text-[#ff7a59]'
: 'text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-foreground'}"
>
{#snippet child({ props })}
<a
href={item.href}
{...props}
data-sveltekit-preload-data={item.preload || 'hover'}
class="flex items-center gap-3"
>
<!-- Active indicator bar - HubSpot style left border -->
{#if currentPath === item.href}
<div class="absolute left-0 top-1/2 h-5 w-[3px] -translate-y-1/2 rounded-r-full bg-[#ff7a59]"></div>
{/if}
<div class="flex size-5 items-center justify-center">
<item.icon
class="size-[18px] transition-colors duration-150"
strokeWidth={currentPath === item.href ? 2.25 : 1.75}
/>
</div>
<span class="text-[13px] font-medium">{item.label}</span>
</a>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
{/each}
</Sidebar.Menu>
</Sidebar.GroupContent>
</Sidebar.Group>
<!-- Sales Section -->
<Sidebar.Group class="mt-4">
<Sidebar.GroupLabel class="mb-1 px-3 text-[10px] font-bold uppercase tracking-widest text-sidebar-foreground/40 group-data-[collapsible=icon]:hidden">
Sales
</Sidebar.GroupLabel>
<Sidebar.GroupContent>
<Sidebar.Menu class="space-y-0.5">
{#each salesItems as item}
{#if item.type === 'dropdown' && item.children}
<Collapsible.Root
open={openDropdowns[item.key ?? ''] || false}
onOpenChange={(open) => {
@ -303,24 +354,40 @@
{...props}
isActive={hasActiveChild(item.children ?? [])}
tooltipContent={item.label}
class="hubspot-menu-item group/item h-9 rounded-lg px-3 transition-all duration-150
{hasActiveChild(item.children ?? [])
? 'text-[#ff5c35] dark:text-[#ff7a59]'
: 'text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-foreground'}"
>
<item.icon class="size-4" />
<span>{item.label}</span>
<ChevronRight
class="ml-auto size-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
/>
<div class="flex w-full items-center gap-3">
<div class="flex size-5 items-center justify-center">
<item.icon class="size-[18px]" strokeWidth={1.75} />
</div>
<span class="text-[13px] font-medium">{item.label}</span>
<ChevronDown
class="ml-auto size-4 text-sidebar-foreground/40 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-180"
/>
</div>
</Sidebar.MenuButton>
{/snippet}
</Collapsible.Trigger>
<Collapsible.Content>
<Sidebar.MenuSub>
<Sidebar.MenuSub class="hubspot-submenu mt-1 border-l-2 border-sidebar-border/50 ml-[18px] pl-4 py-1">
{#each item.children as navChild}
<Sidebar.MenuSubItem>
<Sidebar.MenuSubButton isActive={currentPath === navChild.href}>
<Sidebar.MenuSubButton
isActive={currentPath === navChild.href}
class="hubspot-submenu-item group/subitem relative h-8 rounded-md px-2 transition-all duration-150
{currentPath === navChild.href
? 'bg-[#fff1ee] text-[#ff5c35] dark:bg-[#ff7a59]/10 dark:text-[#ff7a59]'
: 'text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground'}"
>
{#snippet child({ props })}
<a href={navChild.href} {...props}>
<navChild.icon class="size-4" />
<span>{navChild.label}</span>
<a href={navChild.href} {...props} class="flex items-center gap-2.5">
<div class="flex size-4 items-center justify-center">
<navChild.icon class="size-3.5" strokeWidth={1.75} />
</div>
<span class="text-[12px] font-medium">{navChild.label}</span>
</a>
{/snippet}
</Sidebar.MenuSubButton>
@ -335,46 +402,142 @@
</Sidebar.Menu>
</Sidebar.GroupContent>
</Sidebar.Group>
<!-- Support Section -->
<Sidebar.Group class="mt-4">
<Sidebar.GroupLabel class="mb-1 px-3 text-[10px] font-bold uppercase tracking-widest text-sidebar-foreground/40 group-data-[collapsible=icon]:hidden">
Support
</Sidebar.GroupLabel>
<Sidebar.GroupContent>
<Sidebar.Menu class="space-y-0.5">
{#each supportItems as item}
<Sidebar.MenuItem>
<Sidebar.MenuButton
isActive={currentPath === item.href}
tooltipContent={item.label}
class="hubspot-menu-item group/item relative h-9 rounded-lg px-3 transition-all duration-150
{currentPath === item.href
? 'bg-[#fff1ee] text-[#ff5c35] dark:bg-[#ff7a59]/10 dark:text-[#ff7a59]'
: 'text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-foreground'}"
>
{#snippet child({ props })}
<a
href={item.href}
{...props}
data-sveltekit-preload-data={item.preload || 'hover'}
class="flex items-center gap-3"
>
{#if currentPath === item.href}
<div class="absolute left-0 top-1/2 h-5 w-[3px] -translate-y-1/2 rounded-r-full bg-[#ff7a59]"></div>
{/if}
<div class="flex size-5 items-center justify-center">
<item.icon
class="size-[18px] transition-colors duration-150"
strokeWidth={currentPath === item.href ? 2.25 : 1.75}
/>
</div>
<span class="text-[13px] font-medium">{item.label}</span>
</a>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
{/each}
</Sidebar.Menu>
</Sidebar.GroupContent>
</Sidebar.Group>
</Sidebar.Content>
<Sidebar.Footer class="border-sidebar-border border-t">
<Sidebar.Menu>
<Sidebar.Footer class="border-t border-sidebar-border/60 px-2 py-3">
<Sidebar.Menu class="space-y-1">
<!-- Collapse/Expand Toggle - HubSpot Style -->
<Sidebar.MenuItem class="group-data-[collapsible=icon]:hidden">
<Sidebar.MenuButton
onclick={() => sidebar.toggle()}
tooltipContent="Collapse sidebar"
class="h-8 rounded-lg px-3 text-sidebar-foreground/60 transition-all duration-150 hover:bg-sidebar-accent hover:text-sidebar-foreground"
>
{#snippet child({ props })}
<button {...props} class="flex w-full items-center gap-3">
<PanelLeftClose class="size-4" strokeWidth={1.75} />
<span class="text-[12px] font-medium">Collapse</span>
</button>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
<!-- Expand button when collapsed -->
<Sidebar.MenuItem class="hidden group-data-[collapsible=icon]:block">
<Sidebar.MenuButton
onclick={() => sidebar.toggle()}
tooltipContent="Expand sidebar"
class="flex h-8 w-full items-center justify-center rounded-lg text-sidebar-foreground/60 transition-all duration-150 hover:bg-sidebar-accent hover:text-sidebar-foreground"
>
{#snippet child({ props })}
<button {...props} class="flex items-center justify-center">
<PanelLeft class="size-4" strokeWidth={1.75} />
</button>
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>
<!-- Theme Switcher -->
<Sidebar.MenuItem>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
{#snippet child({ props })}
<Sidebar.MenuButton {...props} tooltipContent="Theme">
{#if theme === 'dark'}
<Moon class="size-4" />
{:else if theme === 'light'}
<Sun class="size-4" />
{:else}
<Monitor class="size-4" />
{/if}
<span>Theme</span>
<span class="text-sidebar-foreground/60 ml-auto text-xs capitalize">{theme}</span>
<Sidebar.MenuButton
{...props}
tooltipContent="Theme"
class="h-8 rounded-lg px-3 text-sidebar-foreground/60 transition-all duration-150 hover:bg-sidebar-accent hover:text-sidebar-foreground"
>
<div class="flex size-4 items-center justify-center">
{#if theme === 'dark'}
<Moon class="size-4 text-[#ff7a59]" strokeWidth={1.75} />
{:else if theme === 'light'}
<Sun class="size-4 text-amber-500" strokeWidth={1.75} />
{:else}
<Monitor class="size-4" strokeWidth={1.75} />
{/if}
</div>
<span class="text-[12px] font-medium">Theme</span>
<span
class="ml-auto rounded-md bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium capitalize text-sidebar-foreground/50"
>
{theme}
</span>
</Sidebar.MenuButton>
{/snippet}
</DropdownMenu.Trigger>
<DropdownMenu.Content side="top" align="start" class="w-48">
<DropdownMenu.Item class="" inset={false} onclick={() => setTheme('light')}>
<Sun class="mr-2 size-4" />
<DropdownMenu.Content side="top" align="start" class="w-44">
<DropdownMenu.Item inset={false} onclick={() => setTheme('light')} class="gap-2.5">
<Sun class="size-4 text-amber-500" />
<span>Light</span>
{#if theme === 'light'}
<div class="ml-auto size-2 rounded-full bg-[#ff7a59]"></div>
{/if}
</DropdownMenu.Item>
<DropdownMenu.Item class="" inset={false} onclick={() => setTheme('dark')}>
<Moon class="mr-2 size-4" />
<DropdownMenu.Item inset={false} onclick={() => setTheme('dark')} class="gap-2.5">
<Moon class="size-4 text-[#ff7a59]" />
<span>Dark</span>
{#if theme === 'dark'}
<div class="ml-auto size-2 rounded-full bg-[#ff7a59]"></div>
{/if}
</DropdownMenu.Item>
<DropdownMenu.Item class="" inset={false} onclick={() => setTheme('system')}>
<Monitor class="mr-2 size-4" />
<DropdownMenu.Item inset={false} onclick={() => setTheme('system')} class="gap-2.5">
<Monitor class="size-4 text-muted-foreground" />
<span>System</span>
{#if theme === 'system'}
<div class="ml-auto size-2 rounded-full bg-[#ff7a59]"></div>
{/if}
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
</Sidebar.MenuItem>
<!-- User Menu -->
<!-- Divider -->
<div class="mx-3 my-2 h-px bg-sidebar-border/50 group-data-[collapsible=icon]:hidden"></div>
<!-- User Menu - HubSpot Style -->
<Sidebar.MenuItem>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@ -382,18 +545,30 @@
<Sidebar.MenuButton
size="lg"
{...props}
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
class="group/user h-12 rounded-lg px-2 transition-all duration-150 data-[state=open]:bg-sidebar-accent hover:bg-sidebar-accent"
>
<img
class="size-8 rounded-lg object-cover"
src={user.profilePhoto}
alt="User avatar"
/>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-semibold">{user.name}</span>
<span class="text-sidebar-foreground/60 truncate text-xs">{user.email}</span>
<!-- Avatar with status -->
<div class="relative">
{#if user.profilePhoto && !profileImageError}
<img
class="size-8 rounded-full object-cover ring-2 ring-sidebar-border/50 transition-all duration-150 group-hover/user:ring-[#ff7a59]/30"
src={user.profilePhoto}
alt="User avatar"
onerror={() => profileImageError = true}
/>
{:else}
<div class="flex size-8 items-center justify-center rounded-full bg-gradient-to-br from-[#ff7a59] to-[#ff5c35] text-xs font-semibold text-white ring-2 ring-sidebar-border/50 transition-all duration-150 group-hover/user:ring-[#ff7a59]/30">
{getInitials(user.name)}
</div>
{/if}
<!-- Online status indicator -->
<div class="absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-sidebar bg-emerald-500"></div>
</div>
<ChevronsUpDown class="ml-auto size-4" />
<div class="grid flex-1 text-left leading-tight">
<span class="truncate text-[13px] font-semibold text-sidebar-foreground">{user.name}</span>
<span class="truncate text-[11px] text-sidebar-foreground/50">{user.email}</span>
</div>
<ChevronsUpDown class="ml-auto size-4 text-sidebar-foreground/40" />
</Sidebar.MenuButton>
{/snippet}
</DropdownMenu.Trigger>
@ -402,45 +577,43 @@
align="start"
class="w-[--bits-dropdown-menu-anchor-width] min-w-56"
>
<DropdownMenu.Label class="">My Account</DropdownMenu.Label>
<DropdownMenu.Separator class="" />
<DropdownMenu.Group class="">
<DropdownMenu.Item class="" inset={false} onclick={() => navigateTo('/profile')}>
<User class="mr-2 size-4" />
<DropdownMenu.Label class="text-[10px] font-bold uppercase tracking-wider text-muted-foreground">
My Account
</DropdownMenu.Label>
<DropdownMenu.Separator />
<DropdownMenu.Group>
<DropdownMenu.Item inset={false} onclick={() => navigateTo('/profile')} class="gap-2.5">
<User class="size-4" />
<span>Profile</span>
</DropdownMenu.Item>
<DropdownMenu.Item class="" inset={false} onclick={() => navigateTo('/users')}>
<Users class="mr-2 size-4" />
<DropdownMenu.Item inset={false} onclick={() => navigateTo('/users')} class="gap-2.5">
<Users class="size-4" />
<span>Users & Teams</span>
</DropdownMenu.Item>
<DropdownMenu.Item class="" inset={false} onclick={() => navigateTo('/org')}>
<Building class="mr-2 size-4" />
<DropdownMenu.Item inset={false} onclick={() => navigateTo('/org')} class="gap-2.5">
<Building class="size-4" />
<span>Organizations</span>
</DropdownMenu.Item>
<DropdownMenu.Item
class=""
inset={false}
onclick={() => navigateTo('/settings/organization')}
class="gap-2.5"
>
<Settings class="mr-2 size-4" />
<Settings class="size-4" />
<span>Settings</span>
</DropdownMenu.Item>
<DropdownMenu.Item
class=""
inset={false}
onclick={() => navigateTo('/settings/tags')}
>
<Tag class="mr-2 size-4" />
<DropdownMenu.Item inset={false} onclick={() => navigateTo('/settings/tags')} class="gap-2.5">
<Tag class="size-4" />
<span>Tags</span>
</DropdownMenu.Item>
</DropdownMenu.Group>
<DropdownMenu.Separator class="" />
<DropdownMenu.Separator />
<DropdownMenu.Item
class="text-destructive focus:text-destructive"
class="gap-2.5 text-destructive focus:bg-destructive/10 focus:text-destructive"
inset={false}
onclick={() => navigateTo('/logout')}
>
<LogOut class="mr-2 size-4" />
<LogOut class="size-4" />
<span>Sign out</span>
</DropdownMenu.Item>
</DropdownMenu.Content>
@ -449,5 +622,50 @@
</Sidebar.Menu>
</Sidebar.Footer>
<Sidebar.Rail class="" />
<Sidebar.Rail />
</Sidebar.Root>
<style>
/* HubSpot-style sidebar refinements */
:global(.hubspot-sidebar) {
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
:global(.hubspot-sidebar [data-slot="sidebar-menu-button"]) {
font-weight: 500;
}
/* Smooth hover transition for menu items */
:global(.hubspot-menu-item) {
position: relative;
}
/* Active state animation */
:global(.hubspot-menu-item::before) {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 20px;
background: #ff7a59;
border-radius: 0 4px 4px 0;
transition: width 0.15s ease;
}
/* Submenu refinements */
:global(.hubspot-submenu) {
position: relative;
}
:global(.hubspot-submenu::before) {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: linear-gradient(180deg, transparent, var(--sidebar-border), transparent);
}
</style>

View file

@ -11,19 +11,53 @@
</script>
<header
class="bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 border-b backdrop-blur"
class="sticky top-0 z-10 border-b border-border/40 bg-gradient-to-r from-background via-background to-background/95 backdrop-blur-2xl supports-[backdrop-filter]:bg-background/60"
>
<div class="flex h-14 items-center justify-between px-4 md:px-6">
<div class="space-y-0.5">
<h1 class="text-foreground text-lg font-semibold">{title}</h1>
<!-- Ambient glow effect for dark mode -->
<div
class="pointer-events-none absolute inset-0 overflow-hidden"
aria-hidden="true"
>
<div
class="absolute -top-24 left-1/4 h-48 w-96 rounded-full bg-primary/5 blur-3xl dark:bg-primary/10"
></div>
<div
class="absolute -top-24 right-1/4 h-48 w-64 rounded-full bg-accent/5 blur-3xl dark:bg-cyan-500/8"
></div>
</div>
<div class="relative flex min-h-[4.5rem] items-center justify-between gap-6 px-6 py-4 md:px-8">
<!-- Title Section -->
<div class="flex flex-col gap-1">
<div class="flex items-baseline gap-3">
<h1
class="text-2xl font-bold tracking-tight text-foreground md:text-[1.75rem]"
style="letter-spacing: -0.025em;"
>
{title}
</h1>
{#if subtitle}
<span class="hidden items-center gap-2 sm:flex">
<span class="h-1 w-1 rounded-full bg-muted-foreground/30"></span>
<p class="text-sm font-medium text-muted-foreground/80">{subtitle}</p>
</span>
{/if}
</div>
{#if subtitle}
<p class="text-muted-foreground text-sm">{subtitle}</p>
<p class="text-sm font-medium text-muted-foreground/80 sm:hidden">{subtitle}</p>
{/if}
</div>
<!-- Actions Section -->
{#if actions}
<div class="flex items-center gap-2">
<div class="flex items-center gap-2 md:gap-3">
{@render actions()}
</div>
{/if}
</div>
<!-- Bottom accent line -->
<div
class="absolute bottom-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-border/60 to-transparent"
></div>
</header>

View file

@ -1,5 +1,5 @@
<script>
import { Building2, AlertTriangle } from '@lucide/svelte';
import { Building2, AlertTriangle, ShieldAlert, HelpCircle, AlertOctagon, FileWarning, Timer } from '@lucide/svelte';
/**
* @typedef {Object} Case
@ -18,19 +18,62 @@
/** @type {{ item: Case, onclick?: () => void, ondragstart?: (e: DragEvent) => void, ondragend?: () => void }} */
let { item, onclick, ondragstart, ondragend } = $props();
// Priority color mapping
const priorityColors = {
Urgent: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400',
High: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400',
Normal: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400',
Low: 'bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400'
// Priority configurations with icons and colors (matching LeadCard rating style)
const priorityConfig = {
Urgent: {
icon: AlertOctagon,
bg: 'bg-gradient-to-r from-rose-500/25 to-red-500/25',
text: 'text-rose-600 dark:text-rose-400',
border: 'border-rose-500/40',
glow: 'shadow-rose-500/20',
pulse: true
},
High: {
icon: AlertTriangle,
bg: 'bg-gradient-to-r from-orange-500/20 to-amber-500/20',
text: 'text-orange-600 dark:text-orange-400',
border: 'border-orange-500/30',
glow: 'shadow-orange-500/10',
pulse: false
},
Normal: {
icon: ShieldAlert,
bg: 'bg-gradient-to-r from-blue-500/15 to-indigo-500/15',
text: 'text-blue-600 dark:text-blue-400',
border: 'border-blue-500/25',
glow: 'shadow-blue-500/10',
pulse: false
},
Low: {
icon: ShieldAlert,
bg: 'bg-gradient-to-r from-slate-500/10 to-gray-500/10',
text: 'text-slate-600 dark:text-slate-400',
border: 'border-slate-500/20',
glow: 'shadow-slate-500/10',
pulse: false
}
};
// Case type labels
const caseTypeLabels = {
Question: 'Q',
Incident: 'I',
Problem: 'P'
// Case type configurations with icons and colors
const caseTypeConfig = {
Question: {
icon: HelpCircle,
bg: 'bg-gradient-to-r from-violet-500/15 to-purple-500/15',
text: 'text-violet-600 dark:text-violet-400',
label: 'Question'
},
Incident: {
icon: FileWarning,
bg: 'bg-gradient-to-r from-amber-500/15 to-yellow-500/15',
text: 'text-amber-600 dark:text-amber-400',
label: 'Incident'
},
Problem: {
icon: AlertOctagon,
bg: 'bg-gradient-to-r from-rose-500/15 to-red-500/15',
text: 'text-rose-600 dark:text-rose-400',
label: 'Problem'
}
};
// Computed values
@ -42,6 +85,8 @@
item.is_sla_breached || item.is_sla_first_response_breached || item.is_sla_resolution_breached
);
const assignees = $derived(item.assigned_to || []);
const config = $derived(priority ? priorityConfig[priority] : null);
const typeConfig = $derived(caseType ? caseTypeConfig[caseType] : null);
/**
* Get initials from assignee
@ -61,6 +106,20 @@
return assignee?.user_details?.email || assignee?.email || 'Unknown';
}
// Generate a consistent color from email for avatar (matching LeadCard style)
function getAvatarColor(email) {
const colors = [
'from-violet-500 to-purple-600',
'from-cyan-500 to-blue-600',
'from-emerald-500 to-teal-600',
'from-amber-500 to-orange-600',
'from-rose-500 to-pink-600',
'from-indigo-500 to-blue-600'
];
const hash = email.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
return colors[hash % colors.length];
}
/**
* Handle keyboard events
* @param {KeyboardEvent} e
@ -74,9 +133,15 @@
</script>
<div
class="case-card group cursor-pointer rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-all hover:shadow-md dark:border-gray-700 dark:bg-gray-900"
class:border-l-red-500={isSlaBreached}
class:border-l-[3px]={isSlaBreached}
class="case-card group relative cursor-pointer overflow-hidden rounded-xl border transition-all duration-300 ease-out
{isSlaBreached ? 'border-l-[3px] border-l-rose-500' : 'border-white/10 dark:border-white/[0.06]'}
bg-white/80 dark:bg-white/[0.03]
backdrop-blur-sm
hover:border-white/20 dark:hover:border-white/[0.1]
hover:shadow-lg hover:shadow-black/5 dark:hover:shadow-black/20
hover:-translate-y-0.5"
class:urgent-card={priority === 'Urgent'}
class:sla-breach-card={isSlaBreached}
draggable="true"
{onclick}
onkeydown={handleKeydown}
@ -85,77 +150,182 @@
role="button"
tabindex="0"
>
<!-- Title + SLA Warning -->
<div class="flex items-start gap-2">
<div class="min-w-0 flex-1 truncate font-medium text-gray-900 dark:text-gray-100">
{name}
<!-- Subtle gradient overlay for depth -->
<div class="pointer-events-none absolute inset-0 bg-gradient-to-br from-white/50 via-transparent to-transparent dark:from-white/[0.02]"></div>
<!-- Urgent/SLA breach animated glow -->
{#if priority === 'Urgent' || isSlaBreached}
<div class="urgent-glow pointer-events-none absolute -inset-[1px] rounded-xl bg-gradient-to-r from-rose-500/20 via-red-500/20 to-rose-500/20 opacity-0 blur-sm transition-opacity duration-300 group-hover:opacity-100"></div>
{/if}
<div class="relative p-3.5">
<!-- Header: Title + SLA Warning -->
<div class="flex items-start justify-between gap-2">
<h4 class="flex-1 truncate text-[0.9rem] font-semibold leading-tight tracking-tight text-gray-900 dark:text-white/95">
{name}
</h4>
{#if isSlaBreached}
<div class="sla-warning flex shrink-0 items-center gap-1 rounded-full bg-gradient-to-r from-rose-500/25 to-red-500/25 px-2 py-0.5 text-rose-600 dark:text-rose-400" title="SLA Breached">
<Timer class="h-3.5 w-3.5" />
<span class="text-[0.6rem] font-bold uppercase tracking-wider">SLA</span>
</div>
{/if}
</div>
{#if isSlaBreached}
<span title="SLA Breached">
<AlertTriangle class="h-4 w-4 shrink-0 text-red-500" />
</span>
<!-- Account -->
{#if accountName}
<div class="mt-1.5 flex items-center gap-1.5">
<Building2 class="h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-gray-500" />
<span class="truncate text-sm text-gray-600 dark:text-gray-400">{accountName}</span>
</div>
{/if}
<!-- Meta row: Case Type + Priority -->
<div class="mt-3 flex items-center gap-2">
{#if typeConfig}
{@const TypeIcon = typeConfig.icon}
<div class="flex items-center gap-1 rounded-lg px-2 py-1 {typeConfig.bg}">
<TypeIcon class="h-3.5 w-3.5 {typeConfig.text}" />
<span class="text-xs font-medium {typeConfig.text}">{typeConfig.label}</span>
</div>
{/if}
{#if config}
{@const PriorityIcon = config.icon}
<div class="priority-badge flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[0.65rem] font-bold uppercase tracking-wider {config.bg} {config.text} {config.border} border"
class:priority-pulse={config.pulse}>
<PriorityIcon class="h-3 w-3" />
{priority}
</div>
{/if}
</div>
<!-- Footer: Assignees -->
{#if assignees.length > 0}
<div class="mt-3 flex items-center justify-between">
<div class="flex items-center -space-x-2">
{#each assignees.slice(0, 3) as assignee, i (assignee.id)}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gradient-to-br {getAvatarColor(getAssigneeName(assignee))} text-[0.7rem] font-semibold text-white shadow-sm ring-2 ring-white dark:ring-gray-900"
style="z-index: {3 - i}"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gray-200 text-[0.65rem] font-bold text-gray-600 ring-2 ring-white dark:bg-gray-700 dark:text-gray-300 dark:ring-gray-900"
style="z-index: 0"
>
+{assignees.length - 3}
</div>
{/if}
</div>
<!-- Urgent indicator -->
{#if priority === 'Urgent' && !isSlaBreached}
<div class="flex items-center gap-1 text-rose-500 dark:text-rose-400" title="Urgent priority">
<AlertOctagon class="h-4 w-4" />
</div>
{/if}
</div>
{/if}
</div>
<!-- Account -->
{#if accountName}
<div class="mt-1 flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400">
<Building2 class="h-3.5 w-3.5 shrink-0" />
<span class="truncate">{accountName}</span>
</div>
{/if}
<!-- Meta row: Case Type + Priority -->
<div class="mt-2 flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
{#if caseType}
<span
class="rounded bg-gray-100 px-1.5 py-0.5 text-xs font-medium text-gray-600 dark:bg-gray-800 dark:text-gray-400"
>
{caseTypeLabels[caseType] || caseType}
</span>
{/if}
{#if priority}
<span
class="rounded-full px-2 py-0.5 text-xs font-medium {priorityColors[priority] ||
'bg-gray-100 text-gray-600'}"
>
{priority}
</span>
{/if}
</div>
</div>
<!-- Assignees -->
{#if assignees.length > 0}
<div class="mt-2 flex items-center -space-x-1">
{#each assignees.slice(0, 3) as assignee (assignee.id)}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-200 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-700 dark:text-gray-300"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-300 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-600 dark:text-gray-300"
>
+{assignees.length - 3}
</div>
{/if}
</div>
{/if}
</div>
<style>
.case-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
box-shadow: var(--card-shadow);
}
.case-card:hover {
--card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}
:global(.dark) .case-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
:global(.dark) .case-card:hover {
--card-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), 0 8px 20px -8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.case-card:active {
cursor: grabbing;
transform: rotate(1deg) scale(1.02);
transform: rotate(1.5deg) scale(1.03);
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
}
:global(.dark) .case-card:active {
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px -5px rgba(34, 211, 238, 0.15);
}
.case-card:focus-visible {
outline: 2px solid rgb(59 130 246);
outline: 2px solid rgb(34 211 238);
outline-offset: 2px;
}
/* Urgent card special styling */
.urgent-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 251, 250, 0.95) 100%);
}
:global(.dark) .urgent-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(251, 113, 133, 0.03) 100%);
}
/* SLA breach card special styling */
.sla-breach-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(254, 242, 242, 0.95) 100%);
}
:global(.dark) .sla-breach-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(239, 68, 68, 0.05) 100%);
}
/* SLA warning badge animation */
.sla-warning {
animation: sla-pulse 2s ease-in-out infinite;
}
@keyframes sla-pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}
/* Priority badge pulse for Urgent */
.priority-pulse {
animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
/* Urgent glow effect */
.urgent-glow {
background-size: 200% 100%;
animation: shimmer-glow 3s ease-in-out infinite;
}
@keyframes shimmer-glow {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
</style>

View file

@ -168,26 +168,30 @@
<Sheet.Root bind:open onOpenChange={(value) => onOpenChange?.(value)}>
<Sheet.Content
side="right"
class={cn('w-[440px] overflow-hidden p-0 sm:max-w-[440px]', className)}
class={cn('w-[480px] overflow-hidden border-l border-border/50 bg-background/95 p-0 backdrop-blur-xl sm:max-w-[480px]', className)}
>
{#if loading}
<!-- Loading skeleton -->
<!-- Loading skeleton with premium styling -->
<div class="flex h-full flex-col">
<div
class="flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-gray-800"
>
<Skeleton class="h-4 w-16" />
<Skeleton class="h-6 w-6 rounded" />
</div>
<div class="flex-1 overflow-y-auto">
<div class="px-6 pt-6 pb-4">
<Skeleton class="h-8 w-48" />
<!-- Header skeleton -->
<div class="relative border-b border-border/40 px-6 py-4">
<div class="flex items-center justify-between">
<Skeleton class="h-4 w-16 rounded-md" />
<Skeleton class="h-8 w-8 rounded-lg" />
</div>
<div class="space-y-3 px-4 pb-6">
</div>
<!-- Content skeleton -->
<div class="flex-1 overflow-y-auto">
<div class="px-6 pt-8 pb-6">
<Skeleton class="h-9 w-64 rounded-lg" />
</div>
<div class="space-y-2 px-6 pb-8">
{#each { length: 6 } as _}
<div class="flex items-center gap-2 py-2">
<Skeleton class="h-4 w-28" />
<Skeleton class="h-6 w-32" />
<div class="flex items-center gap-4 rounded-lg bg-muted/20 px-3 py-3">
<Skeleton class="h-6 w-6 rounded-md" />
<Skeleton class="h-4 w-24" />
<Skeleton class="ml-auto h-5 w-32 rounded-md" />
</div>
{/each}
</div>
@ -195,97 +199,60 @@
</div>
{:else}
<div class="flex h-full flex-col">
<!-- Header with close button -->
<div
class="flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-gray-800"
>
<span class="text-sm text-gray-500 dark:text-gray-400">{headerLabel}</span>
<button
onclick={closeDrawer}
class="rounded p-1 transition-colors duration-75 hover:bg-gray-100 dark:hover:bg-gray-800"
>
<X class="h-4 w-4 text-gray-400" />
</button>
<!-- Premium Header -->
<div class="relative border-b border-border/40 bg-gradient-to-b from-muted/30 to-transparent">
<!-- Ambient glow -->
<div class="pointer-events-none absolute inset-0 overflow-hidden" aria-hidden="true">
<div class="absolute -top-12 left-1/4 h-24 w-48 rounded-full bg-primary/5 blur-2xl"></div>
</div>
<div class="relative flex items-center justify-between px-6 py-4">
<div class="flex items-center gap-2">
<span class="rounded-md bg-primary/10 px-2 py-1 text-xs font-semibold uppercase tracking-wider text-primary">
{headerLabel}
</span>
{#if mode === 'create'}
<span class="text-xs text-muted-foreground">New</span>
{/if}
</div>
<button
onclick={closeDrawer}
class="flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition-all duration-150 hover:bg-muted/60 hover:text-foreground"
>
<X class="h-4 w-4" />
</button>
</div>
</div>
<!-- Scrollable content -->
<div class="flex-1 overflow-x-hidden overflow-y-auto">
<!-- Title section -->
<div class="px-6 pt-6 pb-4">
<!-- Title section with elegant styling -->
<div class="px-6 pt-8 pb-6">
{#if titleEditable}
<input
type="text"
value={titleValue}
oninput={handleTitleChange}
placeholder={titlePlaceholder}
class="w-full border-0 bg-transparent text-2xl font-semibold outline-none placeholder:text-gray-300 focus:ring-0 dark:placeholder:text-gray-600"
class="w-full border-0 bg-transparent text-2xl font-bold tracking-tight text-foreground outline-none placeholder:text-muted-foreground/30"
style="letter-spacing: -0.025em;"
/>
{:else}
<h2 class="text-2xl font-semibold text-gray-900 dark:text-gray-100">
<h2
class="text-2xl font-bold tracking-tight text-foreground"
style="letter-spacing: -0.025em;"
>
{titleValue || titlePlaceholder}
</h2>
{/if}
</div>
<!-- Properties section -->
<div class="px-4 pb-6">
<!-- Properties section with refined spacing -->
<div class="px-6 pb-8">
{#if enableProgressiveDisclosure && essentialColumns.length > 0}
<!-- Essential fields (always shown) -->
{#each essentialColumns as col (col.key)}
<CrmPropertyRow
label={col.label}
value={getFieldValue(col)}
type={col.type || 'text'}
icon={col.icon}
options={col.options}
placeholder={col.placeholder}
emptyText={col.emptyText}
editable={col.editable !== false}
prefix={col.prefix}
onchange={(value) => handleFieldChange(col.key, value)}
/>
{/each}
<!-- Progressive disclosure toggle button -->
{#if hiddenFieldsCount > 0 || showAllFields}
<button
type="button"
onclick={toggleShowAllFields}
class="group -mx-2 my-2 flex w-full items-center gap-2 rounded px-2 py-2 text-[13px] text-gray-500 transition-colors duration-75 hover:bg-gray-50/60 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/40 dark:hover:text-gray-300"
>
{#if showAllFields}
<ChevronUp class="h-4 w-4" />
<span>Hide additional fields</span>
{:else}
<ChevronDown class="h-4 w-4" />
<span
>Show {hiddenFieldsCount} more {hiddenFieldsCount === 1
? 'field'
: 'fields'}</span
>
{/if}
</button>
{/if}
<!-- Additional fields (conditionally shown) -->
{#each visibleAdditionalColumns as col (col.key)}
<CrmPropertyRow
label={col.label}
value={getFieldValue(col)}
type={col.type || 'text'}
icon={col.icon}
options={col.options}
placeholder={col.placeholder}
emptyText={col.emptyText}
editable={col.editable !== false}
prefix={col.prefix}
onchange={(value) => handleFieldChange(col.key, value)}
/>
{/each}
{:else}
<!-- Original behavior: show all fields when no essential fields defined -->
{#each columns as col (col.key)}
{#if col.key !== titleKey}
<!-- Essential fields section -->
<div class="space-y-1">
{#each essentialColumns as col (col.key)}
<CrmPropertyRow
label={col.label}
value={getFieldValue(col)}
@ -298,30 +265,92 @@
prefix={col.prefix}
onchange={(value) => handleFieldChange(col.key, value)}
/>
{/if}
{/each}
{/each}
</div>
<!-- Progressive disclosure toggle with refined styling -->
{#if hiddenFieldsCount > 0 || showAllFields}
<button
type="button"
onclick={toggleShowAllFields}
class="group -mx-3 my-4 flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-[13px] font-medium text-muted-foreground transition-all duration-150 hover:bg-muted/40 hover:text-foreground"
>
<div class="flex h-6 w-6 items-center justify-center rounded-md bg-muted/50 transition-colors group-hover:bg-muted">
{#if showAllFields}
<ChevronUp class="h-3.5 w-3.5" />
{:else}
<ChevronDown class="h-3.5 w-3.5" />
{/if}
</div>
{#if showAllFields}
<span>Hide additional fields</span>
{:else}
<span>Show {hiddenFieldsCount} more {hiddenFieldsCount === 1 ? 'field' : 'fields'}</span>
{/if}
</button>
{/if}
<!-- Additional fields -->
{#if visibleAdditionalColumns.length > 0}
<div class="space-y-1">
{#each visibleAdditionalColumns as col (col.key)}
<CrmPropertyRow
label={col.label}
value={getFieldValue(col)}
type={col.type || 'text'}
icon={col.icon}
options={col.options}
placeholder={col.placeholder}
emptyText={col.emptyText}
editable={col.editable !== false}
prefix={col.prefix}
onchange={(value) => handleFieldChange(col.key, value)}
/>
{/each}
</div>
{/if}
{:else}
<!-- Original behavior: show all fields when no essential fields defined -->
<div class="space-y-1">
{#each columns as col (col.key)}
{#if col.key !== titleKey}
<CrmPropertyRow
label={col.label}
value={getFieldValue(col)}
type={col.type || 'text'}
icon={col.icon}
options={col.options}
placeholder={col.placeholder}
emptyText={col.emptyText}
editable={col.editable !== false}
prefix={col.prefix}
onchange={(value) => handleFieldChange(col.key, value)}
/>
{/if}
{/each}
</div>
{/if}
</div>
<!-- Activity section (optional) -->
<!-- Activity section with refined styling -->
{#if activitySection}
<Separator class="mx-4" />
<div class="px-4 py-4">
<div class="mx-6 h-px bg-gradient-to-r from-transparent via-border to-transparent"></div>
<div class="px-6 py-6">
{@render activitySection()}
</div>
{/if}
</div>
<!-- Footer -->
<div class="mt-auto border-t border-gray-100 px-4 py-3 dark:border-gray-800">
<div class="flex items-center justify-between">
<!-- Premium Footer -->
<div class="relative mt-auto border-t border-border/40 bg-gradient-to-t from-muted/20 to-transparent">
<div class="flex items-center justify-between px-6 py-4">
<!-- Delete button -->
{#if onDelete && mode !== 'create'}
<button
onclick={handleDelete}
class="flex items-center gap-2 rounded px-3 py-1.5 text-sm text-red-600 transition-colors duration-75 hover:bg-red-50 dark:hover:bg-red-900/20"
class="group flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-destructive transition-all duration-150 hover:bg-destructive/10"
>
<Trash2 class="h-4 w-4" />
<Trash2 class="h-4 w-4 transition-transform group-hover:scale-110" />
Delete
</button>
{:else}

View file

@ -184,14 +184,16 @@
<div
class={cn(
'group -mx-2 flex min-h-[36px] items-center rounded px-2 transition-colors duration-75 hover:bg-gray-50/60 dark:hover:bg-gray-800/40',
'group -mx-3 flex min-h-[44px] items-center rounded-lg px-3 transition-all duration-150 hover:bg-muted/40',
className
)}
>
<!-- Label with icon -->
<div class="flex w-28 shrink-0 items-center gap-2 text-[13px] text-gray-500 dark:text-gray-400">
<div class="flex w-32 shrink-0 items-center gap-2.5 text-[13px] font-medium text-muted-foreground">
{#if Icon}
<Icon class="h-4 w-4 text-gray-400 dark:text-gray-500" />
<div class="flex h-6 w-6 items-center justify-center rounded-md bg-muted/50">
<Icon class="h-3.5 w-3.5 text-muted-foreground/70" />
</div>
{/if}
{label}
</div>
@ -205,12 +207,12 @@
oninput={handleInput}
{placeholder}
disabled={!editable}
class="w-full rounded border-0 bg-transparent px-2 py-1 text-sm transition-colors outline-none placeholder:text-gray-400 focus:bg-gray-50 dark:focus:bg-gray-800"
class="w-full rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-sm font-medium text-foreground transition-all outline-none placeholder:text-muted-foreground/40 focus:bg-muted/30 focus:ring-1 focus:ring-primary/20"
/>
{:else if type === 'number'}
<div class="flex items-center">
{#if prefix}
<span class="mr-1 text-sm text-gray-500">{prefix}</span>
<span class="mr-1.5 text-sm font-medium text-muted-foreground">{prefix}</span>
{/if}
<input
type="number"
@ -218,7 +220,7 @@
oninput={handleNumberInput}
{placeholder}
disabled={!editable}
class="w-full rounded border-0 bg-transparent px-1 py-1 text-sm transition-colors outline-none placeholder:text-gray-400 focus:bg-gray-50 dark:focus:bg-gray-800"
class="w-full rounded-lg border-0 bg-transparent px-2 py-1.5 text-sm font-medium text-foreground tabular-nums transition-all outline-none placeholder:text-muted-foreground/40 focus:bg-muted/30 focus:ring-1 focus:ring-primary/20"
/>
</div>
{:else if type === 'date'}
@ -229,11 +231,11 @@
{...props}
type="button"
class={cn(
'inline-flex w-full items-center gap-2 rounded px-2 py-0.5 text-sm transition-colors hover:bg-gray-50 dark:hover:bg-gray-800',
!value && 'text-gray-400'
'inline-flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all hover:bg-muted/30',
!value ? 'text-muted-foreground/50' : 'text-foreground'
)}
>
<CalendarIcon class="h-3.5 w-3.5 shrink-0" />
<CalendarIcon class="h-3.5 w-3.5 shrink-0 text-muted-foreground/60" />
{formatDateDisplay(value)}
</button>
{/snippet}
@ -247,8 +249,8 @@
oninput={handleInput}
{placeholder}
disabled={!editable}
rows={2}
class="w-full resize-none rounded border-0 bg-transparent px-2 py-1 text-sm transition-colors outline-none placeholder:text-gray-400 focus:bg-gray-50 dark:focus:bg-gray-800"
rows={3}
class="w-full resize-none rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-sm text-foreground transition-all outline-none placeholder:text-muted-foreground/40 focus:bg-muted/30 focus:ring-1 focus:ring-primary/20"
>{value || ''}</textarea
>
{:else if type === 'select'}
@ -258,26 +260,26 @@
<button
{...props}
type="button"
class="inline-flex items-center gap-1.5 rounded px-2 py-0.5 text-sm transition-opacity hover:opacity-90 {getOptionStyle(
class="inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-xs font-semibold shadow-sm ring-1 ring-inset ring-black/5 transition-all duration-150 hover:shadow dark:ring-white/10 {getOptionStyle(
value
)}"
>
<span class="h-2 w-2 rounded-full {getOptionBgColor(value)}"></span>
<span class="h-2 w-2 rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/20 {getOptionBgColor(value)}"></span>
{getOptionLabel(value)}
</button>
{/snippet}
</DropdownMenu.Trigger>
<DropdownMenu.Content align="start" class="min-w-48">
<DropdownMenu.Content align="start" class="min-w-48 p-1.5">
{#each options as option (option.value)}
<DropdownMenu.Item
onclick={() => handleSelectChange(option.value)}
class="flex items-center gap-2"
class="flex items-center gap-2.5 rounded-lg px-2.5 py-2"
>
<span class="h-2 w-2 rounded-full {option.color?.split(' ')[0] || 'bg-gray-400'}"
<span class="h-2.5 w-2.5 rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/20 {option.color?.split(' ')[0] || 'bg-gray-400'}"
></span>
{option.label}
<span class="font-medium">{option.label}</span>
{#if value === option.value}
<Check class="ml-auto h-4 w-4" />
<Check class="ml-auto h-4 w-4 text-primary" />
{/if}
</DropdownMenu.Item>
{/each}
@ -288,24 +290,24 @@
type="button"
onclick={handleCheckboxToggle}
disabled={!editable}
class="flex h-5 w-5 items-center justify-center rounded border transition-colors duration-75 {value
? 'border-blue-500 bg-blue-500'
: 'border-gray-300 hover:border-gray-400 dark:border-gray-600'}"
class="flex h-5 w-5 items-center justify-center rounded-md border-2 transition-all duration-150 {value
? 'border-primary bg-primary shadow-sm shadow-primary/25'
: 'border-muted-foreground/30 hover:border-muted-foreground/50'}"
>
{#if value}
<Check class="h-3.5 w-3.5 text-white" />
<Check class="h-3.5 w-3.5 text-primary-foreground" />
{/if}
</button>
{:else if type === 'color'}
<div class="flex items-center gap-2 px-2 py-1">
<div class="flex items-center gap-3 px-2 py-1">
<input
type="color"
value={value || '#3B82F6'}
oninput={handleColorInput}
disabled={!editable}
class="h-8 w-10 cursor-pointer rounded border border-gray-200 bg-transparent p-0.5 dark:border-gray-700"
class="h-8 w-10 cursor-pointer rounded-lg border border-border/50 bg-transparent p-0.5 shadow-sm"
/>
<span class="text-sm text-gray-600 dark:text-gray-400">{value || '#3B82F6'}</span>
<span class="font-mono text-xs text-muted-foreground">{value || '#3B82F6'}</span>
</div>
{:else if type === 'multiselect'}
<EditableMultiSelect
@ -317,11 +319,11 @@
onchange={handleMultiSelectChange}
/>
{:else if type === 'readonly'}
<span class="px-2 py-1 text-sm text-gray-700 dark:text-gray-300">
<span class="px-2.5 py-1.5 text-sm font-medium text-foreground">
{#if value}
{value}
{:else}
<span class="text-gray-400">{emptyText || 'Empty'}</span>
<span class="text-muted-foreground/40 italic">{emptyText || '—'}</span>
{/if}
</span>
{/if}

View file

@ -1,5 +1,5 @@
<script>
import { CalendarDays, ChevronDown, X } from '@lucide/svelte';
import { CalendarDays, ChevronDown, X, Clock, ArrowRight } from '@lucide/svelte';
import { cn } from '$lib/utils.js';
import * as Popover from '$lib/components/ui/popover/index.js';
import Calendar from '$lib/components/ui/calendar/Calendar.svelte';
@ -20,7 +20,7 @@
startDate = $bindable(''),
endDate = $bindable(''),
label = '',
placeholder = 'Select date range',
placeholder = 'Select dates',
class: className,
onchange
} = $props();
@ -34,10 +34,11 @@
const startDateValue = $derived(startDate ? parseDate(startDate) : undefined);
const endDateValue = $derived(endDate ? parseDate(endDate) : undefined);
/** @type {{ label: string, getRange: () => { start: string, end: string } }[]} */
/** @type {{ label: string, shortLabel: string, getRange: () => { start: string, end: string } }[]} */
const presets = [
{
label: 'Today',
shortLabel: 'Today',
getRange: () => {
const d = todayDate.toString();
return { start: d, end: d };
@ -45,6 +46,7 @@
},
{
label: 'Last 7 days',
shortLabel: '7d',
getRange: () => ({
start: todayDate.subtract({ days: 7 }).toString(),
end: todayDate.toString()
@ -52,6 +54,7 @@
},
{
label: 'Last 30 days',
shortLabel: '30d',
getRange: () => ({
start: todayDate.subtract({ days: 30 }).toString(),
end: todayDate.toString()
@ -59,6 +62,7 @@
},
{
label: 'This month',
shortLabel: 'Month',
getRange: () => ({
start: todayDate.set({ day: 1 }).toString(),
end: todayDate.toString()
@ -66,6 +70,7 @@
},
{
label: 'Last month',
shortLabel: 'Prev',
getRange: () => {
const lastMonth = todayDate.subtract({ months: 1 });
const lastDayOfLastMonth = lastMonth
@ -77,6 +82,14 @@
end: lastDayOfLastMonth.toString()
};
}
},
{
label: 'Last 90 days',
shortLabel: '90d',
getRange: () => ({
start: todayDate.subtract({ days: 90 }).toString(),
end: todayDate.toString()
})
}
];
@ -84,10 +97,10 @@
if (!startDate && !endDate) return placeholder;
if (startDate && endDate) {
if (startDate === endDate) return formatDate(startDate);
return `${formatDate(startDate)} - ${formatDate(endDate)}`;
return `${formatDateShort(startDate)} - ${formatDateShort(endDate)}`;
}
if (startDate) return `From ${formatDate(startDate)}`;
return `Until ${formatDate(endDate)}`;
if (startDate) return `From ${formatDateShort(startDate)}`;
return `Until ${formatDateShort(endDate)}`;
});
/**
@ -100,7 +113,16 @@
}
/**
* @param {{ label: string, getRange: () => { start: string, end: string } }} preset
* @param {string} dateStr
*/
function formatDateShort(dateStr) {
if (!dateStr) return '';
const date = new Date(dateStr);
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
}
/**
* @param {{ label: string, shortLabel: string, getRange: () => { start: string, end: string } }} preset
*/
function handlePreset(preset) {
const { start, end } = preset.getRange();
@ -145,9 +167,11 @@
const hasValue = $derived(!!startDate || !!endDate);
</script>
<div class={cn('flex flex-col gap-1', className)}>
<div class={cn('flex flex-col gap-1.5', className)}>
{#if label}
<span class="text-muted-foreground text-xs font-medium">{label}</span>
<span class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70">
{label}
</span>
{/if}
<Popover.Root
bind:open
@ -160,20 +184,51 @@
<button
type="button"
class={cn(
'border-input bg-background hover:bg-accent/50 focus-visible:ring-ring flex h-9 w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm shadow-xs transition-colors focus-visible:ring-2 focus-visible:outline-none',
hasValue && 'border-primary/50'
'date-filter-trigger group',
'relative flex h-9 w-full items-center justify-between gap-2',
'rounded-lg border px-3 py-2',
'bg-background/60 backdrop-blur-sm',
'text-sm transition-all duration-200',
'outline-none',
// Default state
'border-input/60',
'hover:border-input hover:bg-background/80',
// Focus state
'focus:border-primary/50 focus:bg-background',
'focus:ring-2 focus:ring-primary/20',
// Dark mode
'dark:bg-white/[0.03] dark:border-white/[0.08]',
'dark:hover:bg-white/[0.05] dark:hover:border-white/[0.12]',
'dark:focus:bg-white/[0.06] dark:focus:border-primary/40',
// Active state
hasValue && 'border-primary/40 bg-primary/[0.03] dark:border-primary/30 dark:bg-primary/[0.08]',
// Open state
open && 'ring-2 ring-primary/20 dark:ring-primary/30'
)}
{...props}
>
<div class="flex items-center gap-2">
<CalendarDays class="text-muted-foreground h-4 w-4" />
<span class={cn('truncate', !hasValue && 'text-muted-foreground')}>
<CalendarDays
class={cn(
'h-4 w-4 transition-colors duration-200',
hasValue ? 'text-primary' : 'text-muted-foreground'
)}
/>
<span
class={cn(
'truncate transition-colors duration-150',
hasValue ? 'text-foreground font-medium' : 'text-muted-foreground'
)}
>
{displayText}
</span>
</div>
<div class="flex items-center gap-1">
<div class="flex shrink-0 items-center gap-1">
{#if hasValue}
<!-- svelte-ignore node_invalid_placement_ssr -->
<!-- Active indicator -->
<div class="h-1.5 w-1.5 rounded-full bg-primary animate-in fade-in zoom-in duration-200"></div>
<!-- Clear button -->
<span
role="button"
tabindex="0"
@ -189,51 +244,187 @@
handleClear();
}
}}
class="hover:bg-muted cursor-pointer rounded p-0.5"
class={cn(
'flex h-5 w-5 items-center justify-center rounded-md',
'text-muted-foreground/60 transition-all duration-150',
'hover:bg-muted hover:text-foreground',
'active:scale-90'
)}
>
<X class="h-3 w-3" />
</span>
{/if}
<ChevronDown class="h-4 w-4 opacity-50" />
<ChevronDown
class={cn(
'h-4 w-4 text-muted-foreground/50 transition-transform duration-200',
open && 'rotate-180'
)}
/>
</div>
</button>
{/snippet}
</Popover.Trigger>
<Popover.Content align="start" class="w-auto p-0">
<Popover.Content
align="start"
sideOffset={4}
class={cn(
'date-filter-content',
'w-auto overflow-hidden rounded-xl p-0',
'border border-border/60 bg-popover/95 backdrop-blur-md',
'shadow-lg shadow-black/5',
'dark:border-white/[0.08] dark:bg-popover/90',
'dark:shadow-[0_8px_32px_-4px_rgba(0,0,0,0.5)]',
'animate-in fade-in-0 zoom-in-95 duration-150'
)}
>
<div class="flex">
<!-- Presets sidebar -->
<div class="flex flex-col gap-1 border-r p-2">
{#each presets as preset}
<div
class={cn(
'flex flex-col gap-0.5 border-r border-border/40 p-2',
'bg-muted/30 dark:bg-white/[0.02] dark:border-white/[0.04]'
)}
>
<div class="mb-1 px-2 py-1">
<span class="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/60">
Quick select
</span>
</div>
{#each presets as preset, i}
<Button
variant="ghost"
size="sm"
class="justify-start"
class={cn(
'h-8 justify-start px-3 text-xs font-medium',
'text-muted-foreground hover:text-foreground',
'hover:bg-primary/10 dark:hover:bg-primary/20',
'transition-all duration-150',
'animate-in fade-in slide-in-from-left-1'
)}
style="animation-delay: {i * 30}ms"
onclick={() => handlePreset(preset)}
>
<Clock class="mr-2 h-3 w-3 opacity-50" />
{preset.label}
</Button>
{/each}
</div>
<!-- Calendar -->
<div class="p-2">
<div class="text-muted-foreground mb-2 text-center text-sm">
<!-- Calendar section -->
<div class="p-3">
<!-- Date selection status -->
<div
class={cn(
'mb-3 flex items-center justify-center gap-2',
'rounded-lg bg-muted/50 px-3 py-2',
'dark:bg-white/[0.03]'
)}
>
{#if startDate}
<div class="flex items-center gap-1.5">
<div class="h-2 w-2 rounded-full bg-primary"></div>
<span class="text-xs font-medium text-foreground">
{formatDateShort(startDate)}
</span>
</div>
{:else}
<span class="text-xs text-muted-foreground">Start date</span>
{/if}
<ArrowRight class="h-3 w-3 text-muted-foreground/50" />
{#if endDate}
<div class="flex items-center gap-1.5">
<div class="h-2 w-2 rounded-full bg-primary"></div>
<span class="text-xs font-medium text-foreground">
{formatDateShort(endDate)}
</span>
</div>
{:else}
<span class="text-xs text-muted-foreground">
{selectingEnd ? 'Select end' : 'End date'}
</span>
{/if}
</div>
<!-- Selection hint -->
<div
class={cn(
'mb-2 text-center text-xs font-medium',
'transition-colors duration-200',
selectingEnd ? 'text-primary' : 'text-muted-foreground'
)}
>
{#if selectingEnd}
Select end date
<span class="animate-pulse">Click to select end date</span>
{:else}
Select start date
{/if}
</div>
<Calendar
value={selectingEnd ? endDateValue : startDateValue}
onValueChange={handleDateSelect}
/>
{#if startDate && !endDate}
<div class="text-muted-foreground mt-2 text-center text-xs">
Start: {formatDate(startDate)}
</div>
{/if}
<!-- Calendar -->
<div class="date-calendar-wrapper">
<Calendar
value={selectingEnd ? endDateValue : startDateValue}
onValueChange={handleDateSelect}
/>
</div>
</div>
</div>
</Popover.Content>
</Popover.Root>
</div>
<style>
.date-filter-trigger {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}
:global(.dark) .date-filter-trigger {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.date-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.02),
0 0 0 3px var(--ring);
}
:global(.dark) .date-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.1),
0 0 0 3px var(--ring),
0 0 20px -4px var(--primary);
}
/* Calendar wrapper refinements */
.date-calendar-wrapper :global([data-calendar-root]) {
--calendar-cell-size: 32px;
}
.date-calendar-wrapper :global(button[data-today]) {
position: relative;
}
.date-calendar-wrapper :global(button[data-today])::after {
content: '';
position: absolute;
bottom: 4px;
left: 50%;
transform: translateX(-50%);
width: 4px;
height: 4px;
border-radius: 50%;
background: var(--primary);
}
.date-calendar-wrapper :global(button[data-selected]) {
background: var(--primary) !important;
color: var(--primary-foreground) !important;
}
:global(.dark) .date-calendar-wrapper :global(button[data-selected]) {
box-shadow: 0 0 12px -2px var(--primary);
}
</style>

View file

@ -1,8 +1,7 @@
<script>
import { Filter, X, ChevronDown, ChevronUp } from '@lucide/svelte';
import { Filter, X, ChevronDown, ChevronUp, Sparkles } from '@lucide/svelte';
import { cn } from '$lib/utils.js';
import { Button } from '$lib/components/ui/button/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
/**
* @type {{
@ -27,7 +26,7 @@
children
} = $props();
// Use a function to capture initial value (avoids Svelte warning about prop reference)
// Use a function to capture initial value
let internalExpanded = $state((() => defaultExpanded)());
// Use external expanded if provided, otherwise use internal state
@ -35,56 +34,163 @@
</script>
{#if minimal}
<!-- Minimal mode: just filter content without header/border -->
<!-- Minimal mode: sleek inline filter row with glass effect -->
{#if isExpanded}
<div class={cn('flex flex-wrap items-end gap-3', className)}>
{@render children?.()}
<div
class={cn(
'filter-bar-minimal',
'relative flex flex-wrap items-end gap-3 px-4 py-3',
'from-muted/40 via-muted/20 to-muted/40 bg-gradient-to-r',
'border-border/50 border backdrop-blur-sm',
'dark:from-white/[0.02] dark:via-white/[0.04] dark:to-white/[0.02]',
'dark:border-white/[0.06]',
'transition-all duration-300 ease-out',
className
)}
>
<!-- Subtle gradient overlay -->
<div
class="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-500 group-hover:opacity-100 dark:opacity-[0.02]"
style="background: radial-gradient(ellipse at 50% 0%, var(--accent-primary) 0%, transparent 70%);"
></div>
<!-- Filter content -->
<div class="relative z-10 flex flex-wrap items-end gap-3">
{@render children?.()}
</div>
<!-- Clear button with animation -->
{#if activeCount > 0 && onClear}
<Button variant="ghost" size="sm" onclick={onClear} class="h-8 gap-1 px-2 text-xs">
<X class="h-3 w-3" />
Clear
</Button>
<div class="relative z-10 ml-auto flex items-center gap-2">
<div
class="bg-primary/10 dark:bg-primary/20 flex items-center gap-1.5 rounded-full px-2.5 py-1"
>
<Sparkles class="text-primary h-3 w-3" />
<span class="text-primary text-xs font-semibold">
{activeCount} active
</span>
</div>
<Button
variant="ghost"
size="sm"
onclick={onClear}
class="group/clear text-muted-foreground hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/20 h-8 gap-1.5 rounded-lg px-3 text-xs font-medium transition-all"
>
<X class="h-3.5 w-3.5 transition-transform group-hover/clear:rotate-90" />
Clear all
</Button>
</div>
{/if}
</div>
{/if}
{:else}
<div class={cn('bg-card rounded-lg border', className)}>
<!-- Full mode: Refined card with premium styling -->
<div
class={cn(
'filter-bar-full',
'overflow-hidden rounded-xl',
'bg-card/80 backdrop-blur-md',
'border-border/60 border',
'shadow-sm',
'dark:bg-card/60 dark:border-white/[0.08]',
'dark:shadow-[0_4px_24px_-4px_rgba(0,0,0,0.3)]',
'transition-all duration-300',
className
)}
>
<!-- Header -->
<div class="flex items-center justify-between px-4 py-2">
<div
class={cn(
'flex items-center justify-between px-4 py-2.5',
'from-muted/30 bg-gradient-to-r to-transparent',
'dark:from-white/[0.02] dark:to-transparent'
)}
>
<button
type="button"
class="flex items-center gap-2 text-sm font-medium"
class={cn(
'group flex items-center gap-2.5 text-sm font-semibold',
'text-foreground/80 hover:text-foreground transition-colors',
!collapsible && 'cursor-default'
)}
onclick={() => collapsible && (internalExpanded = !internalExpanded)}
disabled={!collapsible}
>
<Filter class="h-4 w-4" />
<span>Filters</span>
<div
class={cn(
'flex h-7 w-7 items-center justify-center rounded-lg',
'bg-primary/10 text-primary',
'dark:bg-primary/20',
'transition-all duration-200',
collapsible && 'group-hover:bg-primary/20 group-hover:scale-105'
)}
>
<Filter class="h-3.5 w-3.5" />
</div>
<span class="tracking-tight">Filters</span>
{#if activeCount > 0}
<Badge variant="secondary" class="h-5 px-1.5 text-xs">{activeCount}</Badge>
<span
class={cn(
'inline-flex items-center justify-center',
'h-5 min-w-5 rounded-full px-1.5',
'bg-primary text-primary-foreground text-[10px] font-bold',
'animate-in fade-in zoom-in duration-200'
)}
>
{activeCount}
</span>
{/if}
{#if collapsible}
{#if isExpanded}
<ChevronUp class="h-4 w-4" />
{:else}
<ChevronDown class="h-4 w-4" />
{/if}
<div class="ml-1 transition-transform duration-200" class:rotate-180={isExpanded}>
<ChevronDown class="h-4 w-4 opacity-50" />
</div>
{/if}
</button>
{#if activeCount > 0 && onClear}
<Button variant="ghost" size="sm" onclick={onClear} class="h-7 gap-1 px-2 text-xs">
<X class="h-3 w-3" />
<Button
variant="ghost"
size="sm"
onclick={onClear}
class="group/clear text-muted-foreground hover:bg-destructive/10 hover:text-destructive h-7 gap-1.5 rounded-lg px-2.5 text-xs font-medium transition-all"
>
<X class="h-3 w-3 transition-transform group-hover/clear:rotate-90" />
Clear all
</Button>
{/if}
</div>
<!-- Filter content -->
<!-- Filter content with smooth expand/collapse -->
{#if !collapsible || isExpanded}
<div class="border-t px-4 py-3">
<div class="flex flex-wrap items-end gap-3">
<div
class={cn(
'border-border/40 border-t px-4 py-4',
'dark:border-white/[0.04]',
'animate-in fade-in slide-in-from-top-2 duration-200'
)}
>
<div class="flex flex-wrap items-end gap-4">
{@render children?.()}
</div>
</div>
{/if}
</div>
{/if}
<style>
.filter-bar-minimal {
--filter-glow: 0 0 0 1px var(--border);
}
.filter-bar-minimal:focus-within {
--filter-glow: 0 0 0 1px var(--ring), 0 0 20px -8px var(--accent-primary);
}
:global(.dark) .filter-bar-minimal:focus-within {
--filter-glow: 0 0 0 1px var(--ring), 0 0 30px -10px var(--accent-primary);
}
.filter-bar-minimal {
box-shadow: var(--filter-glow);
}
</style>

View file

@ -1,11 +1,14 @@
<script>
import { Search, X } from '@lucide/svelte';
import { Search, X, Command } from '@lucide/svelte';
import { cn } from '$lib/utils.js';
/**
* @type {{
* value?: string,
* placeholder?: string,
* label?: string,
* showLabel?: boolean,
* showShortcut?: boolean,
* class?: string,
* onchange?: (value: string) => void,
* [key: string]: any
@ -14,6 +17,9 @@
let {
value = $bindable(''),
placeholder = 'Search...',
label = 'Search',
showLabel = true,
showShortcut = false,
class: className,
onchange,
...restProps
@ -58,6 +64,10 @@
if (e.key === 'Enter') {
inputEl?.blur();
}
if (e.key === 'Escape') {
handleClear();
inputEl?.blur();
}
}
function handleClear() {
@ -67,26 +77,137 @@
}
</script>
<div class={cn('relative', className)} {...restProps}>
<Search class="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" />
<input
bind:this={inputEl}
type="text"
value={inputValue}
oninput={handleInput}
onfocus={handleFocus}
onblur={handleBlur}
onkeydown={handleKeydown}
{placeholder}
class="border-input bg-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex h-9 w-full rounded-md border pr-9 pl-9 text-sm shadow-xs transition-colors outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"
/>
{#if inputValue}
<button
type="button"
onclick={handleClear}
class="text-muted-foreground hover:text-foreground absolute top-1/2 right-3 -translate-y-1/2"
<div class={cn('flex flex-col gap-1.5', className)} {...restProps}>
{#if showLabel && label}
<label
for="search-input"
class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70"
>
<X class="h-4 w-4" />
</button>
{label}
</label>
{/if}
<div class="search-input-wrapper group relative">
<!-- Search icon with pulse on focus -->
<div
class={cn(
'absolute left-3 top-1/2 -translate-y-1/2',
'transition-all duration-300 ease-out',
isFocused ? 'text-primary scale-110' : 'text-muted-foreground'
)}
>
<Search class="h-4 w-4" />
</div>
<!-- Input field -->
<input
id="search-input"
bind:this={inputEl}
type="text"
value={inputValue}
oninput={handleInput}
onfocus={handleFocus}
onblur={handleBlur}
onkeydown={handleKeydown}
{placeholder}
class={cn(
'search-input',
'flex h-9 w-full rounded-lg',
'bg-background/60 backdrop-blur-sm',
'border border-input/60',
'pl-9 pr-9 text-sm',
'placeholder:text-muted-foreground/50',
'transition-all duration-200 ease-out',
'outline-none',
'hover:border-input hover:bg-background/80',
'focus:border-primary/50 focus:bg-background',
'focus:ring-2 focus:ring-primary/20',
'dark:bg-white/[0.03] dark:border-white/[0.08]',
'dark:hover:bg-white/[0.05] dark:hover:border-white/[0.12]',
'dark:focus:bg-white/[0.06] dark:focus:border-primary/40',
'dark:focus:ring-primary/30',
inputValue && 'pr-16'
)}
/>
<!-- Right side: shortcut hint or clear button -->
<div class="absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1">
{#if inputValue}
<!-- Clear button -->
<button
type="button"
onclick={handleClear}
class={cn(
'flex h-6 w-6 items-center justify-center rounded-md',
'text-muted-foreground/70',
'transition-all duration-150',
'hover:bg-muted hover:text-foreground',
'active:scale-95'
)}
>
<X class="h-3.5 w-3.5" />
</button>
{:else if showShortcut}
<!-- Keyboard shortcut hint -->
<div
class={cn(
'hidden items-center gap-0.5 sm:flex',
'rounded-md border border-border/60 bg-muted/50 px-1.5 py-0.5',
'text-[10px] font-medium text-muted-foreground/60',
'dark:border-white/[0.06] dark:bg-white/[0.03]'
)}
>
<Command class="h-2.5 w-2.5" />
<span>K</span>
</div>
{/if}
</div>
<!-- Focus glow effect (dark mode) -->
<div
class={cn(
'pointer-events-none absolute inset-0 -z-10 rounded-lg',
'opacity-0 transition-opacity duration-300',
'dark:bg-[radial-gradient(ellipse_at_center,var(--primary)_0%,transparent_70%)]',
'dark:blur-xl',
isFocused && 'dark:opacity-[0.15]'
)}
></div>
</div>
</div>
<style>
.search-input-wrapper {
--glow-color: var(--primary);
}
.search-input::placeholder {
transition: color 0.2s ease;
}
.search-input:focus::placeholder {
color: transparent;
}
/* Subtle inner shadow for depth */
.search-input {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}
:global(.dark) .search-input {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.search-input:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.02),
0 0 0 3px var(--ring);
}
:global(.dark) .search-input:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.1),
0 0 0 3px var(--ring),
0 0 20px -4px var(--glow-color);
}
</style>

View file

@ -1,13 +1,13 @@
<script>
import { ChevronDown, Check, X } from '@lucide/svelte';
import { ChevronDown, Check, X, CircleDot } from '@lucide/svelte';
import { cn } from '$lib/utils.js';
import * as Popover from '$lib/components/ui/popover/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
/**
* @typedef {{
* value: string,
* label: string,
* icon?: any,
* }} Option
*/
@ -85,9 +85,11 @@
const hasValue = $derived(multiple ? selectedValues.length > 0 : value && value !== 'ALL');
</script>
<div class={cn('flex flex-col gap-1', className)}>
<div class={cn('flex flex-col gap-1.5', className)}>
{#if label}
<span class="text-muted-foreground text-xs font-medium">{label}</span>
<span class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70">
{label}
</span>
{/if}
<Popover.Root bind:open>
<Popover.Trigger asChild class="">
@ -95,17 +97,43 @@
<button
type="button"
class={cn(
'border-input bg-background hover:bg-accent/50 focus-visible:ring-ring flex h-9 w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm shadow-xs transition-colors focus-visible:ring-2 focus-visible:outline-none',
hasValue && 'border-primary/50'
'select-filter-trigger group',
'relative flex h-9 w-full items-center justify-between gap-2',
'rounded-lg border px-3 py-2',
'bg-background/60 backdrop-blur-sm',
'text-sm transition-all duration-200',
'outline-none',
// Default state
'border-input/60',
'hover:border-input hover:bg-background/80',
// Focus state
'focus:border-primary/50 focus:bg-background',
'focus:ring-2 focus:ring-primary/20',
// Dark mode
'dark:bg-white/[0.03] dark:border-white/[0.08]',
'dark:hover:bg-white/[0.05] dark:hover:border-white/[0.12]',
'dark:focus:bg-white/[0.06] dark:focus:border-primary/40',
// Active state
hasValue && 'border-primary/40 bg-primary/[0.03] dark:border-primary/30 dark:bg-primary/[0.08]',
// Open state
open && 'ring-2 ring-primary/20 dark:ring-primary/30'
)}
{...props}
>
<span class={cn('truncate', !hasValue && 'text-muted-foreground')}>
<span
class={cn(
'truncate transition-colors duration-150',
hasValue ? 'text-foreground font-medium' : 'text-muted-foreground'
)}
>
{displayText}
</span>
<div class="flex items-center gap-1">
<div class="flex shrink-0 items-center gap-1">
{#if hasValue}
<!-- svelte-ignore node_invalid_placement_ssr -->
<!-- Active indicator dot -->
<div class="h-1.5 w-1.5 rounded-full bg-primary animate-in fade-in zoom-in duration-200"></div>
<!-- Clear button -->
<span
role="button"
tabindex="0"
@ -121,72 +149,193 @@
handleClear();
}
}}
class="hover:bg-muted cursor-pointer rounded p-0.5"
class={cn(
'flex h-5 w-5 items-center justify-center rounded-md',
'text-muted-foreground/60 transition-all duration-150',
'hover:bg-muted hover:text-foreground',
'active:scale-90'
)}
>
<X class="h-3 w-3" />
</span>
{/if}
<ChevronDown class="h-4 w-4 opacity-50" />
<ChevronDown
class={cn(
'h-4 w-4 text-muted-foreground/50 transition-transform duration-200',
open && 'rotate-180'
)}
/>
</div>
</button>
{/snippet}
</Popover.Trigger>
<Popover.Content align="start" class="w-[200px] p-1">
<Popover.Content
align="start"
sideOffset={4}
class={cn(
'select-filter-content',
'w-[220px] overflow-hidden rounded-xl p-1',
'border border-border/60 bg-popover/95 backdrop-blur-md',
'shadow-lg shadow-black/5',
'dark:border-white/[0.08] dark:bg-popover/90',
'dark:shadow-[0_8px_32px_-4px_rgba(0,0,0,0.5)]',
'animate-in fade-in-0 zoom-in-95 duration-150'
)}
>
<!-- All option -->
{#if !multiple}
<button
type="button"
class={cn(
'hover:bg-accent relative flex w-full cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-none',
(!value || value === 'ALL') && 'bg-accent'
'select-option group',
'relative flex w-full cursor-pointer items-center gap-2.5',
'rounded-lg px-2.5 py-2 text-sm',
'transition-all duration-150',
'outline-none',
(!value || value === 'ALL')
? 'bg-primary/10 text-primary dark:bg-primary/20'
: 'text-foreground/80 hover:bg-muted/80 hover:text-foreground'
)}
onclick={() => handleSelect('ALL')}
>
{#if !value || value === 'ALL'}
<Check class="mr-2 h-4 w-4" />
{:else}
<span class="mr-2 w-4"></span>
{/if}
{allLabel}
<div
class={cn(
'flex h-4 w-4 items-center justify-center rounded-full',
'border transition-all duration-150',
(!value || value === 'ALL')
? 'border-primary bg-primary text-primary-foreground scale-100'
: 'border-border bg-transparent scale-90 group-hover:scale-100 group-hover:border-primary/50'
)}
>
{#if !value || value === 'ALL'}
<Check class="h-2.5 w-2.5" />
{/if}
</div>
<span class="font-medium">{allLabel}</span>
</button>
<div class="my-1 h-px bg-border/50 dark:bg-white/[0.06]"></div>
{/if}
{#each options as option}
{@const isSelected = multiple
? selectedValues.includes(option.value)
: value === option.value}
<button
type="button"
class={cn(
'hover:bg-accent relative flex w-full cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-none',
isSelected && 'bg-accent'
)}
onclick={() => handleSelect(option.value)}
>
{#if isSelected}
<Check class="mr-2 h-4 w-4" />
{:else}
<span class="mr-2 w-4"></span>
{/if}
{option.label}
</button>
{/each}
<!-- Options -->
<div class="max-h-[240px] overflow-y-auto">
{#each options as option, i}
{@const isSelected = multiple
? selectedValues.includes(option.value)
: value === option.value}
<button
type="button"
class={cn(
'select-option group',
'relative flex w-full cursor-pointer items-center gap-2.5',
'rounded-lg px-2.5 py-2 text-sm',
'transition-all duration-150',
'outline-none',
isSelected
? 'bg-primary/10 text-primary dark:bg-primary/20'
: 'text-foreground/80 hover:bg-muted/80 hover:text-foreground',
'animate-in fade-in-0 slide-in-from-left-1'
)}
style="animation-delay: {i * 20}ms"
onclick={() => handleSelect(option.value)}
>
<div
class={cn(
'flex h-4 w-4 shrink-0 items-center justify-center rounded-full',
'border transition-all duration-150',
isSelected
? 'border-primary bg-primary text-primary-foreground scale-100'
: 'border-border/60 bg-transparent scale-90 group-hover:scale-100 group-hover:border-primary/50'
)}
>
{#if isSelected}
<Check class="h-2.5 w-2.5" />
{/if}
</div>
<span class={cn('truncate', isSelected && 'font-medium')}>
{option.label}
</span>
</button>
{/each}
</div>
</Popover.Content>
</Popover.Root>
</div>
<!-- Multi-select badges (outside dropdown) -->
{#if multiple && selectedValues.length > 0}
<div class="mt-1 flex flex-wrap gap-1">
{#each selectedValues as val}
<div class="mt-2 flex flex-wrap gap-1.5">
{#each selectedValues as val, i}
{@const opt = options.find((o) => o.value === val)}
<Badge variant="secondary" class="gap-1 text-xs">
<span
class={cn(
'inline-flex items-center gap-1 rounded-full',
'bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary',
'dark:bg-primary/20',
'animate-in fade-in zoom-in duration-200'
)}
style="animation-delay: {i * 50}ms"
>
{opt?.label || val}
<button
type="button"
onclick={() => handleSelect(val)}
class="hover:bg-muted ml-1 rounded-full"
class={cn(
'flex h-4 w-4 items-center justify-center rounded-full',
'transition-all duration-150',
'hover:bg-primary/20 dark:hover:bg-primary/30',
'active:scale-90'
)}
>
<X class="h-3 w-3" />
<X class="h-2.5 w-2.5" />
</button>
</Badge>
</span>
{/each}
</div>
{/if}
<style>
.select-filter-trigger {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}
:global(.dark) .select-filter-trigger {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.select-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.02),
0 0 0 3px var(--ring);
}
:global(.dark) .select-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.1),
0 0 0 3px var(--ring),
0 0 20px -4px var(--primary);
}
.select-option {
position: relative;
}
.select-option::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
opacity: 0;
background: linear-gradient(
90deg,
transparent 0%,
var(--primary) 50%,
transparent 100%
);
transition: opacity 0.3s ease;
}
:global(.dark) .select-option:hover::before {
opacity: 0.03;
}
</style>

View file

@ -1,8 +1,7 @@
<script>
import { ChevronDown, Check, X } from '@lucide/svelte';
import { ChevronDown, Check, X, Tag, Hash } from '@lucide/svelte';
import { cn } from '$lib/utils.js';
import * as Popover from '$lib/components/ui/popover/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import { getTagColorClass } from '$lib/constants/colors.js';
/**
@ -42,7 +41,7 @@
const tag = tags.find((t) => t.id === selectedIds[0]);
return tag?.name || selectedIds[0];
}
return `${selectedIds.length} tags selected`;
return `${selectedIds.length} tags`;
});
/**
@ -63,11 +62,32 @@
const selectedTags = $derived(tags.filter((t) => selectedIds.includes(t.id)));
const hasSelection = $derived(selectedIds.length > 0);
/**
* Get vibrant color classes for tags
* @param {string | undefined} color
*/
function getTagStyle(color) {
const colorMap = {
blue: 'bg-blue-500/15 text-blue-600 border-blue-500/30 dark:bg-blue-500/25 dark:text-blue-400 dark:border-blue-400/30',
green: 'bg-emerald-500/15 text-emerald-600 border-emerald-500/30 dark:bg-emerald-500/25 dark:text-emerald-400 dark:border-emerald-400/30',
red: 'bg-rose-500/15 text-rose-600 border-rose-500/30 dark:bg-rose-500/25 dark:text-rose-400 dark:border-rose-400/30',
yellow: 'bg-amber-500/15 text-amber-600 border-amber-500/30 dark:bg-amber-500/25 dark:text-amber-400 dark:border-amber-400/30',
purple: 'bg-violet-500/15 text-violet-600 border-violet-500/30 dark:bg-violet-500/25 dark:text-violet-400 dark:border-violet-400/30',
pink: 'bg-pink-500/15 text-pink-600 border-pink-500/30 dark:bg-pink-500/25 dark:text-pink-400 dark:border-pink-400/30',
orange: 'bg-orange-500/15 text-orange-600 border-orange-500/30 dark:bg-orange-500/25 dark:text-orange-400 dark:border-orange-400/30',
cyan: 'bg-cyan-500/15 text-cyan-600 border-cyan-500/30 dark:bg-cyan-500/25 dark:text-cyan-400 dark:border-cyan-400/30',
gray: 'bg-slate-500/15 text-slate-600 border-slate-500/30 dark:bg-slate-500/25 dark:text-slate-400 dark:border-slate-400/30',
};
return colorMap[color || 'blue'] || colorMap.blue;
}
</script>
<div class={cn('flex flex-col gap-1', className)}>
<div class={cn('flex flex-col gap-1.5', className)}>
{#if label}
<span class="text-muted-foreground text-xs font-medium">{label}</span>
<span class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70">
{label}
</span>
{/if}
<Popover.Root bind:open>
<Popover.Trigger asChild class="">
@ -75,17 +95,59 @@
<button
type="button"
class={cn(
'border-input bg-background hover:bg-accent/50 focus-visible:ring-ring flex h-9 w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm shadow-xs transition-colors focus-visible:ring-2 focus-visible:outline-none',
hasSelection && 'border-primary/50'
'tag-filter-trigger group',
'relative flex h-9 w-full items-center justify-between gap-2',
'rounded-lg border px-3 py-2',
'bg-background/60 backdrop-blur-sm',
'text-sm transition-all duration-200',
'outline-none',
// Default state
'border-input/60',
'hover:border-input hover:bg-background/80',
// Focus state
'focus:border-primary/50 focus:bg-background',
'focus:ring-2 focus:ring-primary/20',
// Dark mode
'dark:bg-white/[0.03] dark:border-white/[0.08]',
'dark:hover:bg-white/[0.05] dark:hover:border-white/[0.12]',
'dark:focus:bg-white/[0.06] dark:focus:border-primary/40',
// Active state
hasSelection && 'border-primary/40 bg-primary/[0.03] dark:border-primary/30 dark:bg-primary/[0.08]',
// Open state
open && 'ring-2 ring-primary/20 dark:ring-primary/30'
)}
{...props}
>
<span class={cn('truncate', !hasSelection && 'text-muted-foreground')}>
{displayText}
</span>
<div class="flex items-center gap-1">
<div class="flex items-center gap-2">
<Tag
class={cn(
'h-4 w-4 transition-colors duration-200',
hasSelection ? 'text-primary' : 'text-muted-foreground'
)}
/>
<span
class={cn(
'truncate transition-colors duration-150',
hasSelection ? 'text-foreground font-medium' : 'text-muted-foreground'
)}
>
{displayText}
</span>
</div>
<div class="flex shrink-0 items-center gap-1">
{#if hasSelection}
<!-- svelte-ignore node_invalid_placement_ssr -->
<!-- Count badge -->
<span
class={cn(
'inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5',
'bg-primary text-[10px] font-bold text-primary-foreground',
'animate-in fade-in zoom-in duration-200'
)}
>
{selectedIds.length}
</span>
<!-- Clear button -->
<span
role="button"
tabindex="0"
@ -101,56 +163,209 @@
clearAll();
}
}}
class="hover:bg-muted cursor-pointer rounded p-0.5"
class={cn(
'flex h-5 w-5 items-center justify-center rounded-md',
'text-muted-foreground/60 transition-all duration-150',
'hover:bg-muted hover:text-foreground',
'active:scale-90'
)}
>
<X class="h-3 w-3" />
</span>
{/if}
<ChevronDown class="h-4 w-4 opacity-50" />
<ChevronDown
class={cn(
'h-4 w-4 text-muted-foreground/50 transition-transform duration-200',
open && 'rotate-180'
)}
/>
</div>
</button>
{/snippet}
</Popover.Trigger>
<Popover.Content align="start" class="max-h-[300px] w-[250px] overflow-y-auto p-1">
<Popover.Content
align="start"
sideOffset={4}
class={cn(
'tag-filter-content',
'w-[280px] overflow-hidden rounded-xl p-1',
'border border-border/60 bg-popover/95 backdrop-blur-md',
'shadow-lg shadow-black/5',
'dark:border-white/[0.08] dark:bg-popover/90',
'dark:shadow-[0_8px_32px_-4px_rgba(0,0,0,0.5)]',
'animate-in fade-in-0 zoom-in-95 duration-150'
)}
>
{#if tags.length === 0}
<p class="text-muted-foreground px-2 py-1.5 text-sm">No tags available</p>
<div class="flex flex-col items-center justify-center py-6 text-center">
<Tag class="mb-2 h-8 w-8 text-muted-foreground/30" />
<p class="text-sm font-medium text-muted-foreground">No tags available</p>
<p class="mt-1 text-xs text-muted-foreground/60">Create tags to organize your leads</p>
</div>
{:else}
{#each tags as tag (tag.id)}
{@const isSelected = selectedIds.includes(tag.id)}
<button
type="button"
<!-- Header with selected count -->
{#if selectedIds.length > 0}
<div
class={cn(
'hover:bg-accent relative flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none',
isSelected && 'bg-accent'
'mb-1 flex items-center justify-between rounded-lg px-2.5 py-2',
'bg-primary/5 dark:bg-primary/10'
)}
onclick={() => toggleTag(tag.id)}
>
{#if isSelected}
<Check class="h-4 w-4 shrink-0" />
{:else}
<span class="w-4 shrink-0"></span>
{/if}
<Badge class={cn('text-xs', getTagColorClass(tag.color || 'blue'))}>{tag.name}</Badge>
</button>
{/each}
<span class="text-xs font-medium text-primary">
{selectedIds.length} tag{selectedIds.length > 1 ? 's' : ''} selected
</span>
<button
type="button"
onclick={clearAll}
class="text-xs font-medium text-primary/70 hover:text-primary transition-colors"
>
Clear all
</button>
</div>
{/if}
<!-- Tags list -->
<div class="max-h-[280px] space-y-0.5 overflow-y-auto">
{#each tags as tag, i (tag.id)}
{@const isSelected = selectedIds.includes(tag.id)}
<button
type="button"
class={cn(
'tag-option group',
'relative flex w-full cursor-pointer items-center gap-2.5',
'rounded-lg px-2.5 py-2',
'transition-all duration-150',
'outline-none',
isSelected
? 'bg-primary/10 dark:bg-primary/15'
: 'hover:bg-muted/80',
'animate-in fade-in-0 slide-in-from-left-1'
)}
style="animation-delay: {i * 15}ms"
onclick={() => toggleTag(tag.id)}
>
<!-- Checkbox -->
<div
class={cn(
'flex h-4 w-4 shrink-0 items-center justify-center rounded',
'border transition-all duration-150',
isSelected
? 'border-primary bg-primary text-primary-foreground scale-100'
: 'border-border/60 bg-transparent scale-90 group-hover:scale-100 group-hover:border-primary/50'
)}
>
{#if isSelected}
<Check class="h-2.5 w-2.5" />
{/if}
</div>
<!-- Tag badge -->
<span
class={cn(
'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5',
'text-xs font-semibold',
'transition-all duration-150',
getTagStyle(tag.color),
isSelected && 'ring-1 ring-primary/20'
)}
>
<Hash class="h-3 w-3 opacity-60" />
{tag.name}
</span>
<!-- Selected indicator glow -->
{#if isSelected}
<div
class={cn(
'absolute right-2 h-2 w-2 rounded-full bg-primary',
'animate-in fade-in zoom-in duration-200'
)}
></div>
{/if}
</button>
{/each}
</div>
{/if}
</Popover.Content>
</Popover.Root>
</div>
<!-- Selected tags as inline badges -->
{#if selectedTags.length > 0}
<div class="mt-1 flex flex-wrap gap-1">
{#each selectedTags as tag (tag.id)}
<Badge class={cn('gap-1 text-xs', getTagColorClass(tag.color || 'blue'))}>
<div class="mt-2 flex flex-wrap gap-1.5">
{#each selectedTags as tag, i (tag.id)}
<span
class={cn(
'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1',
'text-xs font-semibold',
'transition-all duration-150',
getTagStyle(tag.color),
'animate-in fade-in zoom-in slide-in-from-bottom-1'
)}
style="animation-delay: {i * 40}ms"
>
<Hash class="h-3 w-3 opacity-60" />
{tag.name}
<button
type="button"
onclick={() => toggleTag(tag.id)}
class="ml-1 rounded-full hover:bg-black/10"
class={cn(
'flex h-4 w-4 items-center justify-center rounded-full',
'transition-all duration-150',
'hover:bg-black/10 dark:hover:bg-white/20',
'active:scale-90'
)}
>
<X class="h-3 w-3" />
<X class="h-2.5 w-2.5" />
</button>
</Badge>
</span>
{/each}
</div>
{/if}
<style>
.tag-filter-trigger {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}
:global(.dark) .tag-filter-trigger {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.tag-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.02),
0 0 0 3px var(--ring);
}
:global(.dark) .tag-filter-trigger:focus {
box-shadow:
inset 0 1px 2px rgba(0, 0, 0, 0.1),
0 0 0 3px var(--ring),
0 0 20px -4px var(--primary);
}
.tag-option {
position: relative;
}
.tag-option::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
opacity: 0;
background: linear-gradient(
90deg,
transparent 0%,
var(--primary) 50%,
transparent 100%
);
transition: opacity 0.3s ease;
}
:global(.dark) .tag-option:hover::before {
opacity: 0.02;
}
</style>

View file

@ -1,7 +1,7 @@
<script>
import { toast } from 'svelte-sonner';
import KanbanColumn from './KanbanColumn.svelte';
import { Loader2 } from '@lucide/svelte';
import { Loader2, TrendingUp, Users, Flame, Zap } from '@lucide/svelte';
/**
* @typedef {Object} Column
@ -75,6 +75,42 @@
}
});
// Calculate pipeline statistics
const pipelineStats = $derived(() => {
if (!localColumns || localColumns.length === 0) {
return { totalValue: 0, hotCount: 0, avgValue: 0 };
}
let totalValue = 0;
let hotCount = 0;
let itemCount = 0;
localColumns.forEach(col => {
col.items?.forEach(item => {
const amount = parseFloat(String(item.opportunity_amount || item.opportunityAmount || 0));
if (!isNaN(amount)) totalValue += amount;
if (item.rating === 'HOT') hotCount++;
itemCount++;
});
});
return {
totalValue,
hotCount,
avgValue: itemCount > 0 ? totalValue / itemCount : 0
};
});
// Format large numbers
function formatValue(value) {
if (value >= 1000000) {
return `${(value / 1000000).toFixed(1)}M`;
} else if (value >= 1000) {
return `${(value / 1000).toFixed(0)}K`;
}
return value.toFixed(0);
}
/**
* Handle drag start
* @param {DragEvent} e
@ -211,44 +247,114 @@
</script>
{#if loading}
<div class="flex h-64 items-center justify-center">
<Loader2 class="h-8 w-8 animate-spin text-gray-400" />
<div class="flex h-96 flex-col items-center justify-center gap-4">
<div class="relative">
<div class="absolute inset-0 animate-ping rounded-full bg-cyan-400/30"></div>
<div class="relative rounded-full bg-gradient-to-r from-cyan-500 to-blue-500 p-3">
<Loader2 class="h-6 w-6 animate-spin text-white" />
</div>
</div>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Loading pipeline...</p>
</div>
{:else if !data || sortedColumns.length === 0}
<div class="flex h-64 flex-col items-center justify-center text-center text-gray-500">
<p>{emptyMessage}</p>
<div class="flex h-96 flex-col items-center justify-center gap-4 text-center">
<div class="rounded-2xl bg-gray-100 p-6 dark:bg-white/5">
<Zap class="h-12 w-12 text-gray-300 dark:text-gray-600" />
</div>
<div>
<p class="text-lg font-semibold text-gray-600 dark:text-gray-300">{emptyMessage}</p>
<p class="mt-1 text-sm text-gray-400 dark:text-gray-500">Add some {itemNamePlural} to get started</p>
</div>
</div>
{:else}
<!-- Desktop: Horizontal scroll container with all columns -->
<div class="hidden gap-4 overflow-x-auto pb-4 md:flex" style="min-height: 400px">
{#each sortedColumns as column (column.id)}
<KanbanColumn
{column}
{itemName}
{CardComponent}
isDragOver={dragOverColumn === column.id}
onDragOver={(e) => handleDragOver(e, column.id)}
onDragLeave={handleDragLeave}
onDrop={(e) => handleDrop(e, column.id)}
{onCardClick}
onCardDragStart={(e, item) => handleDragStart(e, item, column.id)}
onCardDragEnd={handleDragEnd}
/>
{/each}
<div class="kanban-board hidden md:block">
<!-- Pipeline Stats Bar -->
{#if pipelineStats().totalValue > 0}
<div class="mb-5 flex items-center gap-6 rounded-xl border border-white/10 bg-white/60 px-5 py-3 backdrop-blur-sm dark:border-white/[0.04] dark:bg-white/[0.02]">
<div class="flex items-center gap-3">
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-gradient-to-br from-emerald-500 to-teal-500 shadow-lg shadow-emerald-500/20">
<TrendingUp class="h-4 w-4 text-white" />
</div>
<div>
<p class="text-[0.65rem] font-medium uppercase tracking-wider text-gray-400 dark:text-gray-500">Pipeline Value</p>
<p class="text-lg font-bold tracking-tight text-gray-800 dark:text-white">
AED {formatValue(pipelineStats().totalValue)}
</p>
</div>
</div>
<div class="h-8 w-px bg-gray-200 dark:bg-white/10"></div>
<div class="flex items-center gap-3">
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-gradient-to-br from-rose-500 to-orange-500 shadow-lg shadow-rose-500/20">
<Flame class="h-4 w-4 text-white" />
</div>
<div>
<p class="text-[0.65rem] font-medium uppercase tracking-wider text-gray-400 dark:text-gray-500">Hot Leads</p>
<p class="text-lg font-bold tracking-tight text-gray-800 dark:text-white">
{pipelineStats().hotCount}
</p>
</div>
</div>
<div class="h-8 w-px bg-gray-200 dark:bg-white/10"></div>
<div class="flex items-center gap-3">
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500 to-purple-500 shadow-lg shadow-violet-500/20">
<Users class="h-4 w-4 text-white" />
</div>
<div>
<p class="text-[0.65rem] font-medium uppercase tracking-wider text-gray-400 dark:text-gray-500">Total {itemNamePlural}</p>
<p class="text-lg font-bold tracking-tight text-gray-800 dark:text-white">
{totalCount}
</p>
</div>
</div>
</div>
{/if}
<!-- Kanban Columns -->
<div class="columns-container flex gap-4 overflow-x-auto pb-4" style="min-height: 400px">
{#each sortedColumns as column, index (column.id)}
<div class="column-animate" style="animation-delay: {index * 80}ms">
<KanbanColumn
{column}
{itemName}
{CardComponent}
isDragOver={dragOverColumn === column.id}
onDragOver={(e) => handleDragOver(e, column.id)}
onDragLeave={handleDragLeave}
onDrop={(e) => handleDrop(e, column.id)}
{onCardClick}
onCardDragStart={(e, item) => handleDragStart(e, item, column.id)}
onCardDragEnd={handleDragEnd}
/>
</div>
{/each}
</div>
</div>
<!-- Mobile: Tab-based single column view -->
<div class="md:hidden">
<!-- Column selector -->
<div class="mb-4">
<select
class="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100"
bind:value={mobileActiveColumn}
>
<!-- Column selector - Pill style -->
<div class="mb-4 overflow-x-auto">
<div class="flex gap-2 pb-2">
{#each sortedColumns as col (col.id)}
<option value={col.id}>{col.name} ({col.item_count})</option>
<button
class="shrink-0 rounded-full px-4 py-2 text-sm font-medium transition-all
{mobileActiveColumn === col.id
? 'bg-gradient-to-r from-cyan-500 to-blue-500 text-white shadow-lg shadow-cyan-500/25'
: 'bg-white/60 text-gray-600 hover:bg-white dark:bg-white/5 dark:text-gray-300 dark:hover:bg-white/10'}"
onclick={() => mobileActiveColumn = col.id}
>
{col.name}
<span class="ml-1.5 rounded-full bg-white/20 px-1.5 py-0.5 text-xs">
{col.item_count}
</span>
</button>
{/each}
</select>
</div>
</div>
<!-- Active column cards -->
@ -259,7 +365,7 @@
<CardComponent {item} onclick={() => onCardClick(item)} />
{:else}
<div
class="rounded-lg border border-gray-200 bg-white p-3 dark:border-gray-700 dark:bg-gray-900"
class="rounded-xl border border-white/10 bg-white/80 p-4 backdrop-blur-sm dark:border-white/[0.06] dark:bg-white/[0.03]"
onclick={() => onCardClick(item)}
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)}
role="button"
@ -274,9 +380,12 @@
{#if activeMobileColumn.items.length === 0}
<div
class="flex h-24 items-center justify-center rounded-lg border-2 border-dashed border-gray-300 text-sm text-gray-400"
class="flex h-32 flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed border-gray-200/60 text-center dark:border-white/[0.06]"
>
No {itemNamePlural} in this column
<div class="text-3xl opacity-30">📭</div>
<span class="text-sm font-medium text-gray-400 dark:text-gray-500">
No {itemNamePlural} in this stage
</span>
</div>
{/if}
</div>
@ -284,8 +393,61 @@
</div>
<!-- Total count footer -->
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
{totalCount}
{totalCount !== 1 ? itemNamePlural : itemName} total
<div class="mt-6 flex items-center justify-center gap-2 text-sm text-gray-400 dark:text-gray-500">
<div class="h-px flex-1 bg-gradient-to-r from-transparent via-gray-200 to-transparent dark:via-white/10"></div>
<span class="px-4 font-medium">
{totalCount} {totalCount !== 1 ? itemNamePlural : itemName} across {sortedColumns.length} stages
</span>
<div class="h-px flex-1 bg-gradient-to-r from-transparent via-gray-200 to-transparent dark:via-white/10"></div>
</div>
{/if}
<style>
/* Column entrance animation */
.column-animate {
opacity: 0;
animation: column-slide-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes column-slide-in {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Horizontal scroll with fade indicators */
.columns-container {
scrollbar-width: thin;
scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}
.columns-container::-webkit-scrollbar {
height: 6px;
}
.columns-container::-webkit-scrollbar-track {
background: transparent;
}
.columns-container::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.1);
border-radius: 100px;
}
:global(.dark) .columns-container::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
}
.columns-container::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.2);
}
:global(.dark) .columns-container::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.2);
}
</style>

View file

@ -1,4 +1,6 @@
<script>
import { TrendingUp, DollarSign } from '@lucide/svelte';
/**
* @typedef {Object} Column
* @property {string} id
@ -50,6 +52,51 @@
column.item_count ?? column.lead_count ?? column.task_count ?? column.items?.length ?? 0
);
// Calculate total pipeline value for this column
const columnValue = $derived(() => {
if (!column.items) return 0;
return column.items.reduce((sum, item) => {
const amount = parseFloat(String(item.opportunity_amount || item.opportunityAmount || 0));
return sum + (isNaN(amount) ? 0 : amount);
}, 0);
});
// Format column value
function formatColumnValue(value) {
if (value === 0) return null;
if (value >= 1000000) {
return `${(value / 1000000).toFixed(1)}M`;
} else if (value >= 1000) {
return `${(value / 1000).toFixed(0)}K`;
}
return value.toFixed(0);
}
// Get stage-specific gradient based on column color or name
function getColumnGradient(col) {
const name = col.name?.toLowerCase() || '';
const color = col.color?.toLowerCase() || '';
// Match by common stage names or colors
if (name.includes('closed') || name.includes('won') || color.includes('green')) {
return 'from-emerald-500 to-teal-500';
}
if (name.includes('lost') || name.includes('reject') || color.includes('red')) {
return 'from-rose-500 to-red-500';
}
if (name.includes('recycl') || name.includes('nurtur') || color.includes('purple')) {
return 'from-violet-500 to-purple-500';
}
if (name.includes('process') || name.includes('qualif') || color.includes('blue')) {
return 'from-blue-500 to-indigo-500';
}
if (name.includes('assign') || name.includes('new') || color.includes('cyan')) {
return 'from-cyan-500 to-blue-500';
}
// Default
return 'from-slate-500 to-gray-500';
}
/**
* Handle drag over
* @param {DragEvent} e
@ -62,7 +109,7 @@
</script>
<div
class="kanban-column flex w-72 shrink-0 flex-col rounded-lg bg-gray-100 dark:bg-gray-800/50"
class="kanban-column group flex w-[280px] shrink-0 flex-col rounded-2xl transition-all duration-300"
class:drag-over={isDragOver}
class:wip-exceeded={isAtWipLimit}
ondragover={handleDragOver}
@ -71,94 +118,204 @@
role="region"
aria-label="{column.name} column with {itemCount} {itemCount !== 1 ? 'items' : itemName}"
>
<!-- Column Header -->
<div
class="flex items-center justify-between rounded-t-lg border-t-[3px] px-3 py-2"
style="border-top-color: {column.color}"
>
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">
{column.name}
</h3>
<div class="flex items-center gap-2">
<span
class="rounded-full bg-gray-200 px-2 py-0.5 text-xs font-medium text-gray-600 dark:bg-gray-700 dark:text-gray-300"
>
{itemCount}
</span>
{#if column.wip_limit}
<span
class="rounded-full px-2 py-0.5 text-xs font-medium {isAtWipLimit
? 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400'
: 'bg-gray-200 text-gray-500 dark:bg-gray-700 dark:text-gray-400'}"
>
/{column.wip_limit}
</span>
<!-- Column Header - Glass with gradient accent -->
<div class="column-header relative overflow-hidden rounded-t-2xl">
<!-- Gradient background bar -->
<div class="absolute inset-x-0 top-0 h-1 bg-gradient-to-r {getColumnGradient(column)}"></div>
<!-- Glass header content -->
<div class="relative flex items-center justify-between px-4 py-3 backdrop-blur-sm
bg-white/60 dark:bg-white/[0.04]
border border-white/20 dark:border-white/[0.06]
border-b-0">
<div class="flex items-center gap-2.5">
<h3 class="text-sm font-bold tracking-tight text-gray-800 dark:text-white/90">
{column.name}
</h3>
<div class="flex items-center gap-1.5">
<span
class="flex h-5 min-w-[20px] items-center justify-center rounded-full bg-gradient-to-r {getColumnGradient(column)} px-1.5 text-[0.65rem] font-bold text-white shadow-sm"
>
{itemCount}
</span>
{#if column.wip_limit}
<span
class="rounded-full px-1.5 py-0.5 text-[0.6rem] font-semibold tracking-wide
{isAtWipLimit
? 'bg-rose-100 text-rose-600 dark:bg-rose-500/20 dark:text-rose-400'
: 'bg-gray-100 text-gray-500 dark:bg-white/5 dark:text-gray-400'}"
>
max {column.wip_limit}
</span>
{/if}
</div>
</div>
<!-- Column value indicator -->
{#if columnValue() > 0}
<div class="flex items-center gap-1 rounded-lg bg-emerald-50 px-2 py-1 dark:bg-emerald-500/10">
<TrendingUp class="h-3 w-3 text-emerald-600 dark:text-emerald-400" />
<span class="text-[0.7rem] font-bold text-emerald-700 dark:text-emerald-300">
{formatColumnValue(columnValue())}
</span>
</div>
{/if}
</div>
</div>
<!-- Column Content -->
<div class="flex-1 space-y-2 overflow-y-auto p-2" style="max-height: calc(100vh - 280px)">
{#each column.items as item (item.id)}
{#if CardComponent}
<CardComponent
{item}
onclick={() => onCardClick(item)}
ondragstart={(e) => onCardDragStart(e, item)}
ondragend={onCardDragEnd}
/>
{:else}
<!-- Default card rendering -->
<div
class="cursor-pointer rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-all hover:shadow-md dark:border-gray-700 dark:bg-gray-900"
draggable="true"
onclick={() => onCardClick(item)}
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)}
ondragstart={(e) => onCardDragStart(e, item)}
ondragend={onCardDragEnd}
role="button"
tabindex="0"
>
<div class="font-medium text-gray-900 dark:text-gray-100">
{item.title || item.name || 'Untitled'}
<!-- Column Content - Cards container -->
<div
class="column-content flex-1 space-y-2.5 overflow-y-auto px-2 py-3
bg-gradient-to-b from-gray-50/80 to-gray-100/50
dark:from-white/[0.02] dark:to-white/[0.01]
border-x border-white/20 dark:border-white/[0.04]"
style="max-height: calc(100vh - 280px)"
>
{#each column.items as item, index (item.id)}
<div
class="card-wrapper animate-in"
style="animation-delay: {Math.min(index * 40, 300)}ms"
>
{#if CardComponent}
<CardComponent
{item}
onclick={() => onCardClick(item)}
ondragstart={(e) => onCardDragStart(e, item)}
ondragend={onCardDragEnd}
/>
{:else}
<!-- Default card rendering -->
<div
class="cursor-pointer rounded-xl border border-white/10 bg-white/80 p-3.5 shadow-sm backdrop-blur-sm transition-all hover:-translate-y-0.5 hover:shadow-md dark:border-white/[0.06] dark:bg-white/[0.03]"
draggable="true"
onclick={() => onCardClick(item)}
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)}
ondragstart={(e) => onCardDragStart(e, item)}
ondragend={onCardDragEnd}
role="button"
tabindex="0"
>
<div class="font-medium text-gray-900 dark:text-gray-100">
{item.title || item.name || 'Untitled'}
</div>
</div>
</div>
{/if}
{/if}
</div>
{/each}
{#if column.items.length === 0}
<div
class="flex h-24 items-center justify-center rounded-lg border-2 border-dashed border-gray-300 text-sm text-gray-400 dark:border-gray-600 dark:text-gray-500"
class="flex h-28 flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed border-gray-200/60 text-center dark:border-white/[0.06]"
>
No {itemName}s
<div class="text-2xl opacity-30">📭</div>
<span class="text-xs font-medium text-gray-400 dark:text-gray-500">
No {itemName}s yet
</span>
</div>
{/if}
</div>
<!-- Column Footer - Subtle summary -->
<div
class="column-footer flex items-center justify-center rounded-b-2xl px-4 py-2
bg-white/40 dark:bg-white/[0.02]
border border-t-0 border-white/20 dark:border-white/[0.04]"
>
<span class="text-[0.65rem] font-medium uppercase tracking-wider text-gray-400 dark:text-gray-500">
{itemCount} {itemCount === 1 ? itemName : itemName + 's'}
</span>
</div>
</div>
<style>
.kanban-column {
transition:
background-color 150ms ease,
box-shadow 150ms ease;
--column-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--column-shadow);
}
:global(.dark) .kanban-column {
--column-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.3), 0 2px 6px -2px rgba(0, 0, 0, 0.2);
}
/* Drag over state - Glowing effect */
.kanban-column.drag-over {
background-color: rgb(239 246 255); /* blue-50 */
box-shadow:
inset 0 0 0 2px rgb(59 130 246),
0 0 12px rgba(59, 130, 246, 0.2);
--column-shadow: 0 0 0 2px rgba(34, 211, 238, 0.5), 0 0 30px -5px rgba(34, 211, 238, 0.3);
transform: scale(1.01);
}
:global(.dark) .kanban-column.drag-over {
background-color: rgba(59, 130, 246, 0.1);
.kanban-column.drag-over .column-content {
background: linear-gradient(
to bottom,
rgba(34, 211, 238, 0.08),
rgba(34, 211, 238, 0.03)
);
}
.kanban-column.wip-exceeded {
background-color: rgb(254 242 242); /* red-50 */
:global(.dark) .kanban-column.drag-over .column-content {
background: linear-gradient(
to bottom,
rgba(34, 211, 238, 0.1),
rgba(34, 211, 238, 0.02)
);
}
:global(.dark) .kanban-column.wip-exceeded {
background-color: rgba(239, 68, 68, 0.1);
/* WIP exceeded state */
.kanban-column.wip-exceeded .column-header {
background: linear-gradient(
to right,
rgba(251, 113, 133, 0.1),
rgba(251, 113, 133, 0.05)
);
}
:global(.dark) .kanban-column.wip-exceeded .column-header {
background: linear-gradient(
to right,
rgba(251, 113, 133, 0.15),
rgba(251, 113, 133, 0.05)
);
}
/* Card animation on load */
.card-wrapper {
opacity: 0;
animation: card-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes card-fade-in {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Scrollbar styling */
.column-content::-webkit-scrollbar {
width: 4px;
}
.column-content::-webkit-scrollbar-track {
background: transparent;
}
.column-content::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.1);
border-radius: 100px;
}
:global(.dark) .column-content::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
}
.column-content::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.2);
}
:global(.dark) .column-content::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.2);
}
</style>

View file

@ -1,6 +1,5 @@
<script>
import { Building2, Calendar, DollarSign } from '@lucide/svelte';
import { formatDate, getNameInitials } from '$lib/utils/formatting.js';
import { Building2, DollarSign, Flame, Snowflake, Thermometer, Sparkles } from '@lucide/svelte';
/**
* @typedef {Object} Lead
@ -26,25 +25,47 @@
/** @type {{ item: Lead, onclick?: () => void, ondragstart?: (e: DragEvent) => void, ondragend?: () => void }} */
let { item, onclick, ondragstart, ondragend } = $props();
// Rating color mapping
const ratingColors = {
HOT: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400',
WARM: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400',
COLD: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'
// Rating configurations with icons and colors
const ratingConfig = {
HOT: {
icon: Flame,
bg: 'bg-gradient-to-r from-rose-500/20 to-orange-500/20',
text: 'text-rose-500 dark:text-rose-400',
border: 'border-rose-500/30',
glow: 'shadow-rose-500/20',
pulse: true
},
WARM: {
icon: Thermometer,
bg: 'bg-gradient-to-r from-amber-500/15 to-yellow-500/15',
text: 'text-amber-600 dark:text-amber-400',
border: 'border-amber-500/30',
glow: 'shadow-amber-500/10',
pulse: false
},
COLD: {
icon: Snowflake,
bg: 'bg-gradient-to-r from-sky-500/15 to-cyan-500/15',
text: 'text-sky-600 dark:text-cyan-400',
border: 'border-sky-500/30',
glow: 'shadow-sky-500/10',
pulse: false
}
};
// Computed values
const title = $derived(item.title || item.full_name || item.fullName || 'Untitled Lead');
const company = $derived(item.company_name || item.company || '');
const amount = $derived(item.opportunity_amount || item.opportunityAmount);
const currency = $derived(item.currency || 'USD');
const currency = $derived(item.currency || 'AED');
const followUp = $derived(item.next_follow_up || item.nextFollowUp);
const isOverdue = $derived(item.is_follow_up_overdue || item.isFollowUpOverdue);
const rating = $derived(item.rating);
const assignees = $derived(item.assigned_to || item.assignedTo || []);
const config = $derived(rating ? ratingConfig[rating] : null);
/**
* Format currency amount
* Format currency amount with compact notation
* @param {number|string} value
* @param {string} curr
*/
@ -55,7 +76,8 @@
style: 'currency',
currency: curr,
minimumFractionDigits: 0,
maximumFractionDigits: 0
maximumFractionDigits: 0,
notation: num >= 100000 ? 'compact' : 'standard'
}).format(num);
}
@ -77,6 +99,20 @@
return assignee?.user_details?.email || assignee?.email || 'Unknown';
}
// Generate a consistent color from email for avatar
function getAvatarColor(email) {
const colors = [
'from-violet-500 to-purple-600',
'from-cyan-500 to-blue-600',
'from-emerald-500 to-teal-600',
'from-amber-500 to-orange-600',
'from-rose-500 to-pink-600',
'from-indigo-500 to-blue-600'
];
const hash = email.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
return colors[hash % colors.length];
}
/**
* Handle keyboard events
* @param {KeyboardEvent} e
@ -90,9 +126,14 @@
</script>
<div
class="lead-card group cursor-pointer rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-all hover:shadow-md dark:border-gray-700 dark:bg-gray-900"
class:border-l-red-500={isOverdue}
class:border-l-[3px]={isOverdue}
class="lead-card group relative cursor-pointer overflow-hidden rounded-xl border transition-all duration-300 ease-out
{isOverdue ? 'border-l-[3px] border-l-rose-500' : 'border-white/10 dark:border-white/[0.06]'}
bg-white/80 dark:bg-white/[0.03]
backdrop-blur-sm
hover:border-white/20 dark:hover:border-white/[0.1]
hover:shadow-lg hover:shadow-black/5 dark:hover:shadow-black/20
hover:-translate-y-0.5"
class:hot-card={rating === 'HOT'}
draggable="true"
{onclick}
onkeydown={handleKeydown}
@ -101,84 +142,153 @@
role="button"
tabindex="0"
>
<!-- Title -->
<div class="truncate font-medium text-gray-900 dark:text-gray-100">
{title}
</div>
<!-- Subtle gradient overlay for depth -->
<div class="pointer-events-none absolute inset-0 bg-gradient-to-br from-white/50 via-transparent to-transparent dark:from-white/[0.02]"></div>
<!-- Company -->
{#if company}
<div class="mt-1 flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400">
<Building2 class="h-3.5 w-3.5 shrink-0" />
<span class="truncate">{company}</span>
</div>
<!-- Hot lead animated glow -->
{#if rating === 'HOT'}
<div class="hot-glow pointer-events-none absolute -inset-[1px] rounded-xl bg-gradient-to-r from-rose-500/20 via-orange-500/20 to-rose-500/20 opacity-0 blur-sm transition-opacity duration-300 group-hover:opacity-100"></div>
{/if}
<!-- Amount -->
{#if amount}
<div
class="mt-1.5 flex items-center gap-1.5 text-sm font-medium text-gray-700 dark:text-gray-300"
>
<DollarSign class="h-3.5 w-3.5 shrink-0" />
{formatAmount(amount, currency)}
</div>
{/if}
<div class="relative p-3.5">
<!-- Header: Title + Rating -->
<div class="flex items-start justify-between gap-2">
<h4 class="flex-1 truncate text-[0.9rem] font-semibold leading-tight tracking-tight text-gray-900 dark:text-white/95">
{title}
</h4>
<!-- Meta row: Rating + Follow-up -->
<div class="mt-2 flex items-center justify-between gap-2">
{#if rating}
<span
class="rounded-full px-2 py-0.5 text-xs font-medium {ratingColors[rating] ||
'bg-gray-100 text-gray-600'}"
>
{rating}
</span>
{:else}
<span></span>
{/if}
{#if followUp}
<span
class="flex items-center gap-1 text-xs {isOverdue
? 'font-medium text-red-600 dark:text-red-400'
: 'text-gray-500 dark:text-gray-400'}"
>
<Calendar class="h-3 w-3" />
{formatDate(followUp)}
</span>
{/if}
</div>
<!-- Assignees -->
{#if assignees.length > 0}
<div class="mt-2 flex items-center -space-x-1">
{#each assignees.slice(0, 3) as assignee (assignee.id)}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-200 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-700 dark:text-gray-300"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-300 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-600 dark:text-gray-300"
>
+{assignees.length - 3}
{#if config}
{@const RatingIcon = config.icon}
<div class="rating-badge flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[0.65rem] font-bold uppercase tracking-wider {config.bg} {config.text} {config.border} border"
class:rating-pulse={config.pulse}>
<RatingIcon class="h-3 w-3" />
{rating}
</div>
{/if}
</div>
{/if}
<!-- Company -->
{#if company}
<div class="mt-1.5 flex items-center gap-1.5">
<Building2 class="h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-gray-500" />
<span class="truncate text-sm text-gray-600 dark:text-gray-400">{company}</span>
</div>
{/if}
<!-- Amount - Featured Display -->
{#if amount}
<div class="mt-3 flex items-center gap-2">
<div class="flex items-center gap-1.5 rounded-lg bg-gradient-to-r from-emerald-500/10 to-teal-500/10 px-2.5 py-1.5 dark:from-emerald-500/15 dark:to-teal-500/15">
<DollarSign class="h-4 w-4 text-emerald-600 dark:text-emerald-400" />
<span class="text-sm font-bold tracking-tight text-emerald-700 dark:text-emerald-300">
{formatAmount(amount, currency)}
</span>
</div>
</div>
{/if}
<!-- Footer: Assignees -->
{#if assignees.length > 0}
<div class="mt-3 flex items-center justify-between">
<div class="flex items-center -space-x-2">
{#each assignees.slice(0, 3) as assignee, i (assignee.id)}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gradient-to-br {getAvatarColor(getAssigneeName(assignee))} text-[0.7rem] font-semibold text-white shadow-sm ring-2 ring-white dark:ring-gray-900"
style="z-index: {3 - i}"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gray-200 text-[0.65rem] font-bold text-gray-600 ring-2 ring-white dark:bg-gray-700 dark:text-gray-300 dark:ring-gray-900"
style="z-index: 0"
>
+{assignees.length - 3}
</div>
{/if}
</div>
<!-- Quick sparkle indicator for high-value leads -->
{#if amount && parseFloat(String(amount)) > 300000}
<div class="flex items-center gap-1 text-amber-500 dark:text-amber-400" title="High-value lead">
<Sparkles class="h-4 w-4" />
</div>
{/if}
</div>
{/if}
</div>
</div>
<style>
.lead-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
box-shadow: var(--card-shadow);
}
.lead-card:hover {
--card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}
:global(.dark) .lead-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
:global(.dark) .lead-card:hover {
--card-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), 0 8px 20px -8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.lead-card:active {
cursor: grabbing;
transform: rotate(1deg) scale(1.02);
transform: rotate(1.5deg) scale(1.03);
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
}
:global(.dark) .lead-card:active {
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px -5px rgba(34, 211, 238, 0.15);
}
.lead-card:focus-visible {
outline: 2px solid rgb(59 130 246);
outline: 2px solid rgb(34 211 238);
outline-offset: 2px;
}
/* Hot card special styling */
.hot-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 251, 250, 0.95) 100%);
}
:global(.dark) .hot-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(251, 113, 133, 0.03) 100%);
}
/* Rating badge pulse for HOT leads */
.rating-pulse {
animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
/* Hot glow effect */
.hot-glow {
background-size: 200% 100%;
animation: shimmer-glow 3s ease-in-out infinite;
}
@keyframes shimmer-glow {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
</style>

View file

@ -1,5 +1,5 @@
<script>
import { ChevronLeft, ChevronRight } from '@lucide/svelte';
import { ChevronLeft, ChevronRight, ChevronsUpDown } from '@lucide/svelte';
import { Button } from '$lib/components/ui/button/index.js';
import * as Popover from '$lib/components/ui/popover/index.js';
import { cn } from '$lib/utils.js';
@ -57,80 +57,93 @@
{#if total > 0}
<div
class={cn(
'flex flex-col gap-3 border-t border-gray-100 pt-4 sm:flex-row sm:items-center sm:justify-between dark:border-gray-800',
'relative mt-6 flex flex-col items-center gap-4 px-1 sm:flex-row sm:justify-between',
className
)}
>
<!-- Left side: showing info -->
<div class="flex items-center gap-4">
<p class="text-muted-foreground text-sm">
Showing <span class="text-foreground font-medium">{startItem}</span>
to <span class="text-foreground font-medium">{endItem}</span>
of <span class="text-foreground font-medium">{total}</span> results
<!-- Left side: Results summary with refined typography -->
<div class="flex items-center gap-2">
<p class="text-sm text-muted-foreground">
Showing
<span class="mx-1 inline-flex items-center justify-center rounded-md bg-muted/50 px-2 py-0.5 font-semibold tabular-nums text-foreground">
{startItem}–{endItem}
</span>
of
<span class="ml-1 font-semibold text-foreground">{total}</span>
results
</p>
</div>
<!-- Right side: limit selector and page navigation -->
<div class="flex items-center gap-4">
<!-- Right side: Controls -->
<div class="flex items-center gap-3">
<!-- Rows per page selector -->
<div class="flex items-center gap-2">
<span class="text-muted-foreground text-sm">Rows per page:</span>
<span class="text-xs font-medium uppercase tracking-wide text-muted-foreground/70">Rows</span>
<Popover.Root bind:open={limitPopoverOpen}>
<Popover.Trigger asChild class="">
{#snippet child({ props })}
<button
type="button"
class="border-input bg-background hover:bg-accent/50 focus-visible:ring-ring flex h-8 items-center gap-1 rounded-md border px-2.5 text-sm shadow-xs focus-visible:ring-2 focus-visible:outline-none"
class="group inline-flex h-9 items-center gap-1.5 rounded-lg border border-border/60 bg-card/50 px-3 text-sm font-medium text-foreground shadow-sm backdrop-blur-sm transition-all duration-150 hover:border-border hover:bg-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
{...props}
>
{limit}
<ChevronRight class="h-3.5 w-3.5 rotate-90 opacity-50" />
<span class="tabular-nums">{limit}</span>
<ChevronsUpDown class="h-3.5 w-3.5 text-muted-foreground transition-colors group-hover:text-foreground" />
</button>
{/snippet}
</Popover.Trigger>
<Popover.Content align="end" class="w-24 p-1">
{#each limitOptions as option}
<button
type="button"
class={cn(
'hover:bg-accent relative flex w-full cursor-pointer items-center justify-center rounded-sm px-2 py-1.5 text-sm outline-none',
option === limit && 'bg-accent font-medium'
)}
onclick={() => handleLimitSelect(option)}
>
{option}
</button>
{/each}
<Popover.Content align="end" class="w-28 p-1.5">
<div class="flex flex-col gap-0.5">
{#each limitOptions as option}
<button
type="button"
class={cn(
'flex w-full items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-colors',
option === limit
? 'bg-primary text-primary-foreground'
: 'text-foreground hover:bg-muted'
)}
onclick={() => handleLimitSelect(option)}
>
{option}
</button>
{/each}
</div>
</Popover.Content>
</Popover.Root>
</div>
<!-- Divider -->
<div class="h-5 w-px bg-border/60"></div>
<!-- Page navigation -->
<div class="flex items-center gap-1">
<Button
variant="outline"
size="icon-sm"
<div class="flex items-center gap-1.5">
<button
type="button"
disabled={page <= 1}
onclick={handlePrevious}
aria-label="Previous page"
class="group inline-flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card/50 text-muted-foreground shadow-sm backdrop-blur-sm transition-all duration-150 hover:border-border hover:bg-card hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40"
>
<ChevronLeft class="h-4 w-4" />
</Button>
<ChevronLeft class="h-4 w-4 transition-transform group-hover:-translate-x-0.5" />
</button>
<span class="min-w-[100px] text-center text-sm">
Page <span class="font-medium">{page}</span> of
<span class="font-medium">{totalPages}</span>
</span>
<!-- Page indicator pill -->
<div class="flex min-w-[7rem] items-center justify-center gap-1 rounded-lg border border-border/40 bg-muted/30 px-3 py-1.5">
<span class="text-sm font-semibold tabular-nums text-foreground">{page}</span>
<span class="text-xs text-muted-foreground">/</span>
<span class="text-sm tabular-nums text-muted-foreground">{totalPages}</span>
</div>
<Button
variant="outline"
size="icon-sm"
<button
type="button"
disabled={page >= totalPages}
onclick={handleNext}
aria-label="Next page"
class="group inline-flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card/50 text-muted-foreground shadow-sm backdrop-blur-sm transition-all duration-150 hover:border-border hover:bg-card hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40"
>
<ChevronRight class="h-4 w-4" />
</Button>
<ChevronRight class="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
</button>
</div>
</div>
</div>

View file

@ -23,10 +23,10 @@
const mergedProps = $derived({
class: cn(
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground outline-hidden flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
size === 'sm' && 'text-xs',
size === 'md' && 'text-sm',
'text-sidebar-foreground/70 ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-foreground active:bg-sidebar-accent active:text-sidebar-foreground [&>svg]:text-sidebar-foreground/60 outline-hidden flex h-7 min-w-0 items-center gap-2.5 overflow-hidden rounded-md px-2 text-[12px] font-medium transition-all duration-150 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-3.5 [&>svg]:shrink-0',
'data-[active=true]:bg-[#fff1ee] data-[active=true]:text-[#ff5c35] dark:data-[active=true]:bg-[#ff7a59]/10 dark:data-[active=true]:text-[#ff7a59]',
size === 'sm' && 'text-[11px] h-6',
size === 'md' && 'text-[12px]',
'group-data-[collapsible=icon]:hidden',
className
),

View file

@ -16,7 +16,7 @@
data-slot="sidebar-menu-sub"
data-sidebar="menu-sub"
class={cn(
'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-s px-2.5 py-0.5',
'ml-[22px] flex min-w-0 flex-col gap-0.5 border-l-2 border-sidebar-border/40 pl-3.5 py-1',
'group-data-[collapsible=icon]:hidden',
className
)}

View file

@ -1,5 +1,5 @@
<script>
import { Calendar, Link, AlertCircle } from '@lucide/svelte';
import { Calendar, Link, AlertCircle, Flag, Clock, CheckCircle2, Circle, Zap } from '@lucide/svelte';
import { formatDate } from '$lib/utils/formatting.js';
/**
@ -17,14 +17,42 @@
/** @type {{ item: Task, onclick?: () => void, ondragstart?: (e: DragEvent) => void, ondragend?: () => void }} */
let { item, onclick, ondragstart, ondragend } = $props();
// Priority color mapping
const priorityColors = {
High: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400',
Medium: 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400',
Low: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'
// Priority configurations with icons and colors (matching LeadCard rating style)
const priorityConfig = {
High: {
icon: Flag,
bg: 'bg-gradient-to-r from-rose-500/20 to-red-500/20',
text: 'text-rose-600 dark:text-rose-400',
border: 'border-rose-500/30',
glow: 'shadow-rose-500/20',
pulse: true
},
Medium: {
icon: Flag,
bg: 'bg-gradient-to-r from-amber-500/15 to-orange-500/15',
text: 'text-amber-600 dark:text-amber-400',
border: 'border-amber-500/25',
glow: 'shadow-amber-500/10',
pulse: false
},
Low: {
icon: Flag,
bg: 'bg-gradient-to-r from-sky-500/15 to-blue-500/15',
text: 'text-sky-600 dark:text-sky-400',
border: 'border-sky-500/25',
glow: 'shadow-sky-500/10',
pulse: false
}
};
// Entity type labels
// Status configurations
const statusConfig = {
New: { icon: Circle, color: 'text-blue-500 dark:text-blue-400' },
'In Progress': { icon: Clock, color: 'text-amber-500 dark:text-amber-400' },
Completed: { icon: CheckCircle2, color: 'text-emerald-500 dark:text-emerald-400' }
};
// Entity type labels and icons
const entityLabels = {
account: 'Account',
lead: 'Lead',
@ -35,10 +63,13 @@
// Computed values
const title = $derived(item.title || 'Untitled Task');
const priority = $derived(item.priority);
const status = $derived(item.status || 'New');
const dueDate = $derived(item.due_date);
const isOverdue = $derived(item.is_overdue || false);
const assignees = $derived(item.assigned_to || []);
const relatedEntity = $derived(item.related_entity);
const config = $derived(priority ? priorityConfig[priority] : null);
const statusCfg = $derived(statusConfig[status] || statusConfig['New']);
/**
* Get initials from assignee
@ -58,6 +89,20 @@
return assignee?.user_details?.email || assignee?.email || 'Unknown';
}
// Generate a consistent color from email for avatar (matching LeadCard style)
function getAvatarColor(email) {
const colors = [
'from-violet-500 to-purple-600',
'from-cyan-500 to-blue-600',
'from-emerald-500 to-teal-600',
'from-amber-500 to-orange-600',
'from-rose-500 to-pink-600',
'from-indigo-500 to-blue-600'
];
const hash = email.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
return colors[hash % colors.length];
}
/**
* Handle keyboard events
* @param {KeyboardEvent} e
@ -71,9 +116,14 @@
</script>
<div
class="task-card group cursor-pointer rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-all hover:shadow-md dark:border-gray-700 dark:bg-gray-900"
class:border-l-red-500={isOverdue}
class:border-l-[3px]={isOverdue}
class="task-card group relative cursor-pointer overflow-hidden rounded-xl border transition-all duration-300 ease-out
{isOverdue ? 'border-l-[3px] border-l-rose-500' : 'border-white/10 dark:border-white/[0.06]'}
bg-white/80 dark:bg-white/[0.03]
backdrop-blur-sm
hover:border-white/20 dark:hover:border-white/[0.1]
hover:shadow-lg hover:shadow-black/5 dark:hover:shadow-black/20
hover:-translate-y-0.5"
class:high-priority-card={priority === 'High'}
draggable="true"
{onclick}
onkeydown={handleKeydown}
@ -82,80 +132,168 @@
role="button"
tabindex="0"
>
<!-- Title -->
<div class="truncate font-medium text-gray-900 dark:text-gray-100">
{title}
</div>
<!-- Subtle gradient overlay for depth -->
<div class="pointer-events-none absolute inset-0 bg-gradient-to-br from-white/50 via-transparent to-transparent dark:from-white/[0.02]"></div>
<!-- Related Entity -->
{#if relatedEntity}
<div class="mt-1 flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400">
<Link class="h-3.5 w-3.5 shrink-0" />
<span class="truncate">
{entityLabels[relatedEntity.type] || relatedEntity.type}: {relatedEntity.name}
</span>
</div>
<!-- High priority animated glow -->
{#if priority === 'High'}
<div class="priority-glow pointer-events-none absolute -inset-[1px] rounded-xl bg-gradient-to-r from-rose-500/20 via-red-500/20 to-rose-500/20 opacity-0 blur-sm transition-opacity duration-300 group-hover:opacity-100"></div>
{/if}
<!-- Meta row: Priority + Due date -->
<div class="mt-2 flex items-center justify-between gap-2">
{#if priority}
<span
class="rounded-full px-2 py-0.5 text-xs font-medium {priorityColors[priority] ||
'bg-gray-100 text-gray-600'}"
>
{priority}
</span>
{:else}
<span></span>
{/if}
<div class="relative p-3.5">
<!-- Header: Title + Priority -->
<div class="flex items-start justify-between gap-2">
<h4 class="flex-1 truncate text-[0.9rem] font-semibold leading-tight tracking-tight text-gray-900 dark:text-white/95">
{title}
</h4>
{#if dueDate}
<span
class="flex items-center gap-1 text-xs {isOverdue
? 'font-medium text-red-600 dark:text-red-400'
: 'text-gray-500 dark:text-gray-400'}"
>
{#if isOverdue}
<AlertCircle class="h-3 w-3" />
{:else}
<Calendar class="h-3 w-3" />
{/if}
{formatDate(dueDate)}
</span>
{/if}
</div>
<!-- Assignees -->
{#if assignees.length > 0}
<div class="mt-2 flex items-center -space-x-1">
{#each assignees.slice(0, 3) as assignee (assignee.id)}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-200 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-700 dark:text-gray-300"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-gray-300 text-xs font-medium text-gray-600 dark:border-gray-900 dark:bg-gray-600 dark:text-gray-300"
>
+{assignees.length - 3}
{#if config}
{@const PriorityIcon = config.icon}
<div class="priority-badge flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[0.65rem] font-bold uppercase tracking-wider {config.bg} {config.text} {config.border} border"
class:priority-pulse={config.pulse}>
<PriorityIcon class="h-3 w-3" />
{priority}
</div>
{/if}
</div>
{/if}
<!-- Related Entity -->
{#if relatedEntity}
<div class="mt-1.5 flex items-center gap-1.5">
<Link class="h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-gray-500" />
<span class="truncate text-sm text-gray-600 dark:text-gray-400">
{entityLabels[relatedEntity.type] || relatedEntity.type}: {relatedEntity.name}
</span>
</div>
{/if}
<!-- Due Date - Featured Display -->
{#if dueDate}
<div class="mt-3 flex items-center gap-2">
<div class="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5
{isOverdue
? 'bg-gradient-to-r from-rose-500/15 to-red-500/15 dark:from-rose-500/20 dark:to-red-500/20'
: 'bg-gradient-to-r from-slate-500/10 to-gray-500/10 dark:from-slate-500/15 dark:to-gray-500/15'}">
{#if isOverdue}
<AlertCircle class="h-4 w-4 text-rose-600 dark:text-rose-400" />
<span class="text-sm font-bold tracking-tight text-rose-700 dark:text-rose-300">
Overdue: {formatDate(dueDate)}
</span>
{:else}
<Calendar class="h-4 w-4 text-slate-600 dark:text-slate-400" />
<span class="text-sm font-medium tracking-tight text-slate-700 dark:text-slate-300">
{formatDate(dueDate)}
</span>
{/if}
</div>
</div>
{/if}
<!-- Footer: Assignees + Status -->
<div class="mt-3 flex items-center justify-between">
{#if assignees.length > 0}
<div class="flex items-center -space-x-2">
{#each assignees.slice(0, 3) as assignee, i (assignee.id)}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gradient-to-br {getAvatarColor(getAssigneeName(assignee))} text-[0.7rem] font-semibold text-white shadow-sm ring-2 ring-white dark:ring-gray-900"
style="z-index: {3 - i}"
title={getAssigneeName(assignee)}
>
{getAssigneeInitials(assignee)}
</div>
{/each}
{#if assignees.length > 3}
<div
class="relative flex h-7 w-7 items-center justify-center rounded-full bg-gray-200 text-[0.65rem] font-bold text-gray-600 ring-2 ring-white dark:bg-gray-700 dark:text-gray-300 dark:ring-gray-900"
style="z-index: 0"
>
+{assignees.length - 3}
</div>
{/if}
</div>
{:else}
<div></div>
{/if}
<!-- Status indicator -->
{#if statusCfg}
{@const StatusIcon = statusCfg.icon}
<div class="flex items-center gap-1.5 {statusCfg.color}" title={status}>
<StatusIcon class="h-4 w-4" />
</div>
{/if}
</div>
</div>
</div>
<style>
.task-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
box-shadow: var(--card-shadow);
}
.task-card:hover {
--card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}
:global(.dark) .task-card {
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
:global(.dark) .task-card:hover {
--card-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4), 0 8px 20px -8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.task-card:active {
cursor: grabbing;
transform: rotate(1deg) scale(1.02);
transform: rotate(1.5deg) scale(1.03);
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
}
:global(.dark) .task-card:active {
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px -5px rgba(34, 211, 238, 0.15);
}
.task-card:focus-visible {
outline: 2px solid rgb(59 130 246);
outline: 2px solid rgb(34 211 238);
outline-offset: 2px;
}
/* High priority card special styling */
.high-priority-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 251, 250, 0.95) 100%);
}
:global(.dark) .high-priority-card {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(251, 113, 133, 0.03) 100%);
}
/* Priority badge pulse for High priority */
.priority-pulse {
animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
/* Priority glow effect */
.priority-glow {
background-size: 200% 100%;
animation: shimmer-glow 3s ease-in-out infinite;
}
@keyframes shimmer-glow {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
</style>

View file

@ -1,5 +1,5 @@
<script>
import { DollarSign, TrendingUp, Target, Percent, AlertCircle } from '@lucide/svelte';
import { DollarSign, TrendingUp, Target, Percent, AlertCircle, Zap, Sparkles } from '@lucide/svelte';
import {
KPICard,
FocusBar,
@ -31,113 +31,149 @@
? `${orgCurrency} only (${otherCurrencyCount} in other currencies)`
: `${orgCurrency} only`
);
// Get current time of day for greeting
const getGreeting = () => {
const hour = new Date().getHours();
if (hour < 12) return 'Good morning';
if (hour < 17) return 'Good afternoon';
return 'Good evening';
};
</script>
<svelte:head>
<title>Dashboard - BottleCRM</title>
</svelte:head>
<div class="space-y-6 p-6">
<!-- Header -->
<div class="flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center">
<div>
<h1 class="text-foreground text-2xl font-semibold">Dashboard</h1>
<p class="text-muted-foreground text-sm">
Welcome back! Here's what's happening with your CRM.
</p>
</div>
</div>
<div class="relative min-h-screen">
<!-- Subtle gradient mesh background -->
<div class="gradient-mesh noise-overlay pointer-events-none fixed inset-0 -z-10 opacity-50 dark:opacity-30"></div>
{#if data.error}
<div
class="flex items-center gap-3 rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"
>
<AlertCircle class="h-5 w-5 text-red-500 dark:text-red-400" />
<span class="text-sm text-red-700 dark:text-red-300">{data.error}</span>
</div>
{:else}
<!-- Focus Bar - Urgent Items -->
<FocusBar
overdueCount={urgentCounts.overdue_tasks || 0}
todayCount={urgentCounts.tasks_due_today || 0}
followupsCount={urgentCounts.followups_today || 0}
hotLeadsCount={urgentCounts.hot_leads || 0}
/>
<!-- Pipeline Overview - Full Width -->
<div class="bg-card rounded-lg border p-4">
<div class="mb-3 flex items-center justify-between">
<h2 class="text-foreground text-sm font-medium">Sales Pipeline</h2>
<span class="text-muted-foreground text-[10px]">{currencyNote}</span>
<div class="space-y-8 p-6 md:p-8">
<!-- Header Section with gradient text -->
<header class="animate-in-up">
<div class="flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-end">
<div class="space-y-2">
<div class="flex items-center gap-3">
<div class="flex size-10 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500 to-teal-600 shadow-lg dark:shadow-cyan-500/20">
<Sparkles class="size-5 text-white" />
</div>
<div>
<p class="text-muted-foreground text-sm font-medium">{getGreeting()}</p>
<h1 class="text-foreground text-2xl font-bold tracking-tight md:text-3xl">
Dashboard
</h1>
</div>
</div>
<p class="text-muted-foreground max-w-md text-sm">
Here's what's happening with your CRM today. Stay on top of your pipeline and close more deals.
</p>
</div>
</div>
<MiniPipeline pipelineData={pipelineByStage} currency={orgCurrency} />
</div>
</header>
<!-- Revenue Metrics + Pipeline Chart -->
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<!-- Revenue Metrics - 2x2 Grid -->
<div class="grid grid-cols-2 gap-4">
{#if data.error}
<div
class="animate-in-up stagger-1 flex items-center gap-4 rounded-xl border border-red-200/50 bg-red-50/50 p-5 backdrop-blur-sm dark:border-red-800/30 dark:bg-red-900/10"
>
<div class="flex size-10 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900/30">
<AlertCircle class="size-5 text-red-500 dark:text-red-400" />
</div>
<div>
<p class="text-sm font-medium text-red-700 dark:text-red-300">Error loading dashboard</p>
<p class="text-xs text-red-600/80 dark:text-red-400/80">{data.error}</p>
</div>
</div>
{:else}
<!-- Focus Bar - Urgent Items with premium styling -->
<div class="animate-in-up stagger-1">
<FocusBar
overdueCount={urgentCounts.overdue_tasks || 0}
todayCount={urgentCounts.tasks_due_today || 0}
followupsCount={urgentCounts.followups_today || 0}
hotLeadsCount={urgentCounts.hot_leads || 0}
/>
</div>
<!-- Pipeline Overview - Full Width with glass effect -->
<div class="animate-in-up stagger-2 rounded-2xl border border-border/50 bg-card/80 p-6 shadow-sm backdrop-blur-sm dark:bg-card/50 dark:shadow-lg dark:shadow-black/10">
<div class="mb-5 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="flex size-9 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500/10 to-purple-500/10 dark:from-violet-500/20 dark:to-purple-500/20">
<TrendingUp class="size-5 text-violet-600 dark:text-violet-400" />
</div>
<div>
<h2 class="text-foreground text-base font-semibold tracking-tight">Sales Pipeline</h2>
<p class="text-muted-foreground text-xs">{currencyNote}</p>
</div>
</div>
</div>
<MiniPipeline pipelineData={pipelineByStage} currency={orgCurrency} />
</div>
<!-- Revenue Metrics Grid - 4 columns with hover effects -->
<div class="animate-in-up stagger-3 grid grid-cols-2 gap-4 lg:grid-cols-4">
<KPICard
label="Pipeline Value"
value={formatCurrency(revenueMetrics.pipeline_value || 0, orgCurrency, true)}
subtitle={currencyNote}
borderColor="border-t-blue-500"
accentColor="cyan"
>
{#snippet icon()}
<DollarSign class="h-5 w-5" />
<DollarSign class="size-5" />
{/snippet}
</KPICard>
<KPICard
label="Weighted Pipeline"
value={formatCurrency(revenueMetrics.weighted_pipeline || 0, orgCurrency, true)}
subtitle={currencyNote}
borderColor="border-t-purple-500"
iconBgClass="bg-purple-100 dark:bg-purple-900/30"
iconClass="text-purple-600 dark:text-purple-400"
accentColor="violet"
>
{#snippet icon()}
<TrendingUp class="h-5 w-5" />
<TrendingUp class="size-5" />
{/snippet}
</KPICard>
<KPICard
label="Won This Month"
value={formatCurrency(revenueMetrics.won_this_month || 0, orgCurrency, true)}
subtitle={currencyNote}
borderColor="border-t-green-500"
iconBgClass="bg-green-100 dark:bg-green-900/30"
iconClass="text-green-600 dark:text-green-400"
accentColor="emerald"
>
{#snippet icon()}
<Target class="h-5 w-5" />
<Target class="size-5" />
{/snippet}
</KPICard>
<KPICard
label="Conversion Rate"
value="{revenueMetrics.conversion_rate || 0}%"
borderColor="border-t-orange-500"
iconBgClass="bg-orange-100 dark:bg-orange-900/30"
iconClass="text-orange-600 dark:text-orange-400"
accentColor="amber"
>
{#snippet icon()}
<Percent class="h-5 w-5" />
<Percent class="size-5" />
{/snippet}
</KPICard>
</div>
<!-- Pipeline Chart -->
<PipelineChart pipelineData={pipelineByStage} currency={orgCurrency} />
</div>
<!-- Pipeline Chart + Hot Leads -->
<div class="animate-in-up stagger-4 grid grid-cols-1 gap-6 lg:grid-cols-5">
<div class="lg:col-span-3">
<PipelineChart pipelineData={pipelineByStage} currency={orgCurrency} />
</div>
<div class="lg:col-span-2">
<HotLeadsPanel leads={hotLeads} />
</div>
</div>
<!-- Tasks + Hot Leads -->
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<TaskList tasks={recentData.tasks || []} />
<HotLeadsPanel leads={hotLeads} />
</div>
<!-- Tasks + Opportunities -->
<div class="animate-in-up stagger-5 grid grid-cols-1 gap-6 lg:grid-cols-2">
<TaskList tasks={recentData.tasks || []} />
<OpportunitiesTable opportunities={recentData.opportunities || []} />
</div>
<!-- Opportunities + Activity Feed -->
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
<OpportunitiesTable opportunities={recentData.opportunities || []} />
<ActivityFeed activities={recentData.activities || []} />
</div>
{/if}
<!-- Activity Feed - Full Width -->
<div class="animate-in-up stagger-6">
<ActivityFeed activities={recentData.activities || []} />
</div>
{/if}
</div>
</div>

View file

@ -1571,6 +1571,7 @@
<SearchInput
value={filters.search}
placeholder="Search leads..."
showLabel={false}
onchange={(value) => updateFilters({ ...filters, search: value })}
class="w-64"
/>

View file

@ -2,10 +2,19 @@
import { enhance } from '$app/forms';
import { invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { Settings, Building2, Globe, Banknote } from '@lucide/svelte';
import {
Building2,
Globe,
Banknote,
Sparkles,
Check,
MapPin,
Hash,
FileText,
Loader2
} from '@lucide/svelte';
import { PageHeader } from '$lib/components/layout';
import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { CURRENCY_CODES } from '$lib/constants/filters.js';
@ -19,28 +28,28 @@
// Currency options for select
const currencyOptions = CURRENCY_CODES.filter((c) => c.value);
// Country options (simplified list of common countries)
// Country options with flag emojis
const countryOptions = [
{ value: '', label: 'Select Country' },
{ value: 'US', label: 'United States' },
{ value: 'GB', label: 'United Kingdom' },
{ value: 'CA', label: 'Canada' },
{ value: 'AU', label: 'Australia' },
{ value: 'DE', label: 'Germany' },
{ value: 'FR', label: 'France' },
{ value: 'IN', label: 'India' },
{ value: 'JP', label: 'Japan' },
{ value: 'SG', label: 'Singapore' },
{ value: 'AE', label: 'United Arab Emirates' },
{ value: 'BR', label: 'Brazil' },
{ value: 'MX', label: 'Mexico' },
{ value: 'CH', label: 'Switzerland' },
{ value: 'NL', label: 'Netherlands' },
{ value: 'ES', label: 'Spain' },
{ value: 'IT', label: 'Italy' }
{ value: '', label: 'Select Country', flag: '' },
{ value: 'US', label: 'United States', flag: '🇺🇸' },
{ value: 'GB', label: 'United Kingdom', flag: '🇬🇧' },
{ value: 'CA', label: 'Canada', flag: '🇨🇦' },
{ value: 'AU', label: 'Australia', flag: '🇦🇺' },
{ value: 'DE', label: 'Germany', flag: '🇩🇪' },
{ value: 'FR', label: 'France', flag: '🇫🇷' },
{ value: 'IN', label: 'India', flag: '🇮🇳' },
{ value: 'JP', label: 'Japan', flag: '🇯🇵' },
{ value: 'SG', label: 'Singapore', flag: '🇸🇬' },
{ value: 'AE', label: 'United Arab Emirates', flag: '🇦🇪' },
{ value: 'BR', label: 'Brazil', flag: '🇧🇷' },
{ value: 'MX', label: 'Mexico', flag: '🇲🇽' },
{ value: 'CH', label: 'Switzerland', flag: '🇨🇭' },
{ value: 'NL', label: 'Netherlands', flag: '🇳🇱' },
{ value: 'ES', label: 'Spain', flag: '🇪🇸' },
{ value: 'IT', label: 'Italy', flag: '🇮🇹' }
];
// Form state - initialized from settings via $effect
// Form state
let formName = $state('');
let formDomain = $state('');
let formDescription = $state('');
@ -65,22 +74,148 @@
toast.error(form.error);
}
});
// Get current country flag
const currentCountryFlag = $derived(
countryOptions.find(c => c.value === formCountry)?.flag || ''
);
// Get currency symbol
const currencySymbol = $derived(() => {
try {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: formCurrency
}).format(0).replace(/[\d.,\s]/g, '');
} catch {
return '$';
}
});
// Generate initials from org name
const orgInitials = $derived(
formName
.split(' ')
.map(word => word[0])
.join('')
.toUpperCase()
.slice(0, 2) || 'OR'
);
</script>
<svelte:head>
<title>Organization Settings - BottleCRM</title>
</svelte:head>
<style>
/* Custom animations */
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-8px) rotate(2deg); }
}
@keyframes pulse-ring {
0% { transform: scale(0.95); opacity: 0.5; }
50% { transform: scale(1.05); opacity: 0.3; }
100% { transform: scale(0.95); opacity: 0.5; }
}
@keyframes shimmer-slide {
0% { transform: translateX(-100%); }
100% { transform: translateX(100%); }
}
.org-avatar {
animation: float 6s ease-in-out infinite;
}
.pulse-ring {
animation: pulse-ring 3s ease-in-out infinite;
}
.shimmer::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
animation: shimmer-slide 3s ease-in-out infinite;
}
/* Custom select styling */
.custom-select {
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 12px center;
padding-right: 40px;
}
/* Gradient border effect */
.gradient-border {
position: relative;
background: var(--card);
border-radius: var(--radius-xl);
}
.gradient-border::before {
content: '';
position: absolute;
inset: 0;
padding: 1px;
border-radius: inherit;
background: linear-gradient(135deg, var(--accent-primary), transparent 50%, var(--accent-secondary));
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0.5;
transition: opacity 0.3s ease;
}
.gradient-border:hover::before {
opacity: 1;
}
/* Input focus glow */
.input-glow:focus-within {
box-shadow: 0 0 0 2px var(--accent-primary-subtle), 0 0 20px -5px var(--accent-primary);
}
/* Section reveal animation */
.section-reveal {
opacity: 0;
transform: translateY(20px);
animation: reveal 0.6s ease forwards;
}
@keyframes reveal {
to {
opacity: 1;
transform: translateY(0);
}
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
</style>
<PageHeader title="Organization Settings" subtitle="Manage your organization preferences">
{#snippet actions()}
<div class="flex items-center gap-2">
<Settings class="text-muted-foreground h-5 w-5" />
</div>
<Button type="submit" form="org-settings-form" disabled={isLoading} class="gap-2">
{#if isLoading}
<Loader2 class="h-4 w-4 animate-spin" />
Saving...
{:else}
<Check class="h-4 w-4" />
Save Changes
{/if}
</Button>
{/snippet}
</PageHeader>
<div class="flex-1 space-y-6 p-4 md:p-6">
<div class="flex-1 p-4 md:p-6 lg:p-8">
<form
id="org-settings-form"
method="POST"
action="?/update"
use:enhance={() => {
@ -90,137 +225,248 @@
isLoading = false;
};
}}
class="mx-auto max-w-4xl space-y-8"
>
<!-- Organization Details -->
<Card.Root class="mb-6">
<Card.Header class="pb-4">
<Card.Title class="flex items-center gap-2 text-lg">
<Building2 class="h-5 w-5" />
Organization Details
</Card.Title>
<Card.Description class="">Basic information about your organization</Card.Description>
</Card.Header>
<Card.Content class="space-y-4">
<div class="grid gap-4 md:grid-cols-2">
<div class="grid gap-2">
<Label class="" for="name">Organization Name</Label>
<Input
id="name"
name="name"
type="text"
bind:value={formName}
placeholder="Enter organization name"
/>
<!-- Hero Section: Organization Identity -->
<section class="section-reveal">
<div class="gradient-border overflow-hidden">
<div class="relative p-8 md:p-10">
<!-- Background decoration -->
<div class="pointer-events-none absolute inset-0 overflow-hidden">
<div class="absolute -right-20 -top-20 h-64 w-64 rounded-full bg-gradient-to-br from-[var(--accent-primary)] to-transparent opacity-10 blur-3xl"></div>
<div class="absolute -bottom-32 -left-32 h-80 w-80 rounded-full bg-gradient-to-tr from-[var(--accent-secondary)] to-transparent opacity-10 blur-3xl"></div>
</div>
<div class="grid gap-2">
<Label class="" for="domain">Domain</Label>
<div class="relative">
<Globe
class="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"
/>
<Input
id="domain"
name="domain"
type="text"
bind:value={formDomain}
placeholder="yourcompany.com"
class="pl-10"
/>
<div class="relative flex flex-col gap-8 md:flex-row md:items-start">
<!-- Organization Avatar -->
<div class="flex flex-col items-center gap-4">
<div class="relative">
<!-- Animated ring -->
<div class="pulse-ring absolute -inset-2 rounded-3xl bg-gradient-to-br from-[var(--accent-primary)] to-[var(--accent-secondary)] opacity-30"></div>
<!-- Avatar container -->
<div class="org-avatar relative flex h-28 w-28 items-center justify-center rounded-2xl bg-gradient-to-br from-[var(--accent-primary)] to-[var(--accent-secondary)] shadow-2xl">
<span class="text-3xl font-bold text-white">{orgInitials}</span>
</div>
</div>
</div>
<!-- Organization Details -->
<div class="flex-1 space-y-6">
<div class="space-y-1">
<div class="text-muted-foreground mb-2 flex items-center gap-2 text-xs font-medium uppercase tracking-wider">
<Building2 class="h-3.5 w-3.5" />
Organization Identity
</div>
</div>
<div class="grid gap-5 md:grid-cols-2">
<!-- Organization Name -->
<div class="space-y-2">
<Label for="name" class="text-muted-foreground flex items-center gap-2 text-sm">
<Hash class="h-3.5 w-3.5" />
Organization Name
</Label>
<div class="input-glow rounded-lg transition-shadow duration-300">
<Input
id="name"
name="name"
type="text"
bind:value={formName}
placeholder="Acme Corporation"
class="h-11 border-[var(--border-default)] bg-[var(--bg-subtle)] text-base transition-colors focus:border-[var(--accent-primary)] focus:bg-transparent"
/>
</div>
</div>
<!-- Domain -->
<div class="space-y-2">
<Label for="domain" class="text-muted-foreground flex items-center gap-2 text-sm">
<Globe class="h-3.5 w-3.5" />
Company Domain
</Label>
<div class="input-glow rounded-lg transition-shadow duration-300">
<div class="relative flex items-center">
<div class="pointer-events-none absolute left-3 flex items-center">
<Globe class="text-muted-foreground h-4 w-4" />
</div>
<Input
id="domain"
name="domain"
type="text"
bind:value={formDomain}
placeholder="yourcompany.com"
class="h-11 border-[var(--border-default)] bg-[var(--bg-subtle)] pl-10 text-base transition-colors focus:border-[var(--accent-primary)] focus:bg-transparent"
/>
</div>
</div>
</div>
</div>
<!-- Description -->
<div class="space-y-2">
<Label for="description" class="text-muted-foreground flex items-center gap-2 text-sm">
<FileText class="h-3.5 w-3.5" />
About Your Organization
</Label>
<div class="input-glow rounded-lg transition-shadow duration-300">
<textarea
id="description"
name="description"
rows="3"
bind:value={formDescription}
placeholder="Brief description of your organization, industry, and what you do..."
class="border-input bg-[var(--bg-subtle)] ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex min-h-[100px] w-full resize-none rounded-lg border px-4 py-3 text-base transition-colors focus:border-[var(--accent-primary)] focus:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"
></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="grid gap-2">
<Label class="" for="description">Description</Label>
<textarea
id="description"
name="description"
rows="3"
bind:value={formDescription}
placeholder="Describe your organization..."
class="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex min-h-[80px] w-full rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"
></textarea>
</div>
</Card.Content>
</Card.Root>
</div>
</section>
<!-- Locale Settings -->
<Card.Root class="mb-6">
<Card.Header class="pb-4">
<Card.Title class="flex items-center gap-2 text-lg">
<Globe class="h-5 w-5" />
Locale Settings
</Card.Title>
<Card.Description class="">
Configure default currency and country for your organization
</Card.Description>
</Card.Header>
<Card.Content class="space-y-4">
<div class="grid gap-4 md:grid-cols-2">
<div class="grid gap-2">
<Label class="" for="default_currency">Default Currency</Label>
<div class="relative">
<Banknote
class="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"
/>
<select
id="default_currency"
name="default_currency"
bind:value={formCurrency}
class="border-input bg-background w-full rounded-md border py-2 pr-3 pl-10 text-sm focus:ring-2 focus:ring-blue-500 focus:outline-none"
>
{#each currencyOptions as currency}
<option value={currency.value}>{currency.label}</option>
{/each}
</select>
</div>
<p class="text-muted-foreground text-xs">
This will be the default currency for new opportunities, leads, and invoices.
</p>
<!-- Locale & Currency Section -->
<section class="section-reveal delay-1">
<div class="gradient-border overflow-hidden">
<div class="relative p-8 md:p-10">
<!-- Background decoration -->
<div class="pointer-events-none absolute inset-0 overflow-hidden">
<div class="absolute -left-20 top-10 h-48 w-48 rounded-full bg-gradient-to-br from-[var(--status-success)] to-transparent opacity-10 blur-3xl"></div>
</div>
<div class="grid gap-2">
<Label class="" for="default_country">Default Country</Label>
<div class="relative">
<Globe
class="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"
/>
<select
id="default_country"
name="default_country"
bind:value={formCountry}
class="border-input bg-background w-full rounded-md border py-2 pr-3 pl-10 text-sm focus:ring-2 focus:ring-blue-500 focus:outline-none"
>
{#each countryOptions as country}
<option value={country.value}>{country.label}</option>
{/each}
</select>
<div class="relative space-y-8">
<!-- Section Header -->
<div class="flex items-center justify-between">
<div class="space-y-1">
<div class="text-muted-foreground mb-2 flex items-center gap-2 text-xs font-medium uppercase tracking-wider">
<Globe class="h-3.5 w-3.5" />
Regional Settings
</div>
<h3 class="text-lg font-semibold">Currency & Locale</h3>
<p class="text-muted-foreground text-sm">Configure default currency and regional preferences</p>
</div>
</div>
<p class="text-muted-foreground text-xs">
Default country for addresses and locale formatting.
</p>
<div class="grid gap-6 lg:grid-cols-2">
<!-- Currency Selection -->
<div class="space-y-3">
<Label for="default_currency" class="text-muted-foreground flex items-center gap-2 text-sm">
<Banknote class="h-3.5 w-3.5" />
Default Currency
</Label>
<div class="input-glow rounded-lg transition-shadow duration-300">
<div class="relative">
<select
id="default_currency"
name="default_currency"
bind:value={formCurrency}
class="custom-select border-input bg-[var(--bg-subtle)] h-12 w-full cursor-pointer rounded-lg border px-4 text-base transition-colors focus:border-[var(--accent-primary)] focus:bg-transparent focus:ring-2 focus:ring-[var(--accent-primary-subtle)] focus:outline-none"
>
{#each currencyOptions as currency}
<option value={currency.value}>{currency.label}</option>
{/each}
</select>
</div>
</div>
<p class="text-muted-foreground text-xs">
Applied to opportunities, invoices, and financial reports
</p>
</div>
<!-- Country Selection -->
<div class="space-y-3">
<Label for="default_country" class="text-muted-foreground flex items-center gap-2 text-sm">
<MapPin class="h-3.5 w-3.5" />
Default Country
</Label>
<div class="input-glow rounded-lg transition-shadow duration-300">
<div class="relative">
<select
id="default_country"
name="default_country"
bind:value={formCountry}
class="custom-select border-input bg-[var(--bg-subtle)] h-12 w-full cursor-pointer rounded-lg border px-4 text-base transition-colors focus:border-[var(--accent-primary)] focus:bg-transparent focus:ring-2 focus:ring-[var(--accent-primary-subtle)] focus:outline-none"
>
{#each countryOptions as country}
<option value={country.value}>{country.flag} {country.label}</option>
{/each}
</select>
</div>
</div>
<p class="text-muted-foreground text-xs">
Used for addresses, date formats, and locale settings
</p>
</div>
</div>
<!-- Currency Preview -->
{#if formCurrency}
<div class="relative overflow-hidden rounded-xl bg-gradient-to-br from-[var(--bg-subtle)] to-[var(--bg-muted)] p-6">
<div class="shimmer absolute inset-0"></div>
<div class="relative">
<div class="mb-3 flex items-center gap-2">
<Sparkles class="h-4 w-4 text-[var(--accent-secondary)]" />
<span class="text-muted-foreground text-sm font-medium">Currency Preview</span>
</div>
<div class="flex items-baseline gap-3">
<span class="text-gradient text-4xl font-bold tracking-tight md:text-5xl">
{new Intl.NumberFormat('en-US', {
style: 'currency',
currency: formCurrency,
minimumFractionDigits: 0,
maximumFractionDigits: 0
}).format(125000)}
</span>
<span class="text-muted-foreground text-lg">
{currentCountryFlag}
</span>
</div>
<div class="text-muted-foreground mt-2 text-sm">
Sample: {new Intl.NumberFormat('en-US', {
style: 'currency',
currency: formCurrency
}).format(12345.67)}
</div>
</div>
</div>
{/if}
</div>
</div>
</div>
</section>
<!-- Preview -->
{#if formCurrency}
<div class="bg-muted/50 rounded-lg p-4">
<p class="text-muted-foreground mb-2 text-sm font-medium">Preview</p>
<p class="text-foreground text-lg font-semibold">
{new Intl.NumberFormat('en-US', {
style: 'currency',
currency: formCurrency
}).format(12345.67)}
</p>
<!-- Quick Stats Footer -->
<section class="section-reveal delay-2">
<div class="flex flex-wrap items-center justify-between gap-4 rounded-xl border border-[var(--border-subtle)] bg-[var(--bg-subtle)] p-4">
<div class="flex items-center gap-6">
<div class="flex items-center gap-2">
<div class="h-2 w-2 rounded-full bg-[var(--status-success)]"></div>
<span class="text-muted-foreground text-sm">Settings synced</span>
</div>
{/if}
</Card.Content>
</Card.Root>
<!-- Save Button -->
<div class="flex justify-end">
<Button type="submit" disabled={isLoading}>
{isLoading ? 'Saving...' : 'Save Changes'}
</Button>
</div>
<div class="text-muted-foreground text-sm">
Last updated: {new Date().toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric'
})}
</div>
</div>
<Button
type="submit"
disabled={isLoading}
size="lg"
class="gap-2 bg-gradient-to-r from-[var(--accent-primary)] to-[var(--stage-qualified)] text-white shadow-lg shadow-[var(--accent-primary)]/25 transition-all hover:shadow-xl hover:shadow-[var(--accent-primary)]/30"
>
{#if isLoading}
<Loader2 class="h-4 w-4 animate-spin" />
Saving...
{:else}
<Check class="h-4 w-4" />
Save All Changes
{/if}
</Button>
</div>
</section>
</form>
</div>

View file

@ -2,15 +2,14 @@
import { enhance } from '$app/forms';
import { invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { Tag, Plus, Archive, RotateCcw, Pencil } from '@lucide/svelte';
import { Tag, Plus, Archive, RotateCcw, Pencil, Search, MoreHorizontal, Check, X } from '@lucide/svelte';
import { PageHeader } from '$lib/components/layout';
import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import { TAG_COLORS, getTagColorClass } from '$lib/constants/colors.js';
import { TAG_COLORS } from '$lib/constants/colors.js';
/** @type {{ data: any, form: any }} */
let { data, form } = $props();
@ -19,6 +18,22 @@
const activeTags = $derived(tags.filter((/** @type {any} */ t) => t.is_active));
const archivedTags = $derived(tags.filter((/** @type {any} */ t) => !t.is_active));
// Search and filter
let searchQuery = $state('');
let showArchived = $state(false);
const filteredActiveTags = $derived(
activeTags.filter((/** @type {any} */ tag) =>
tag.name.toLowerCase().includes(searchQuery.toLowerCase())
)
);
const filteredArchivedTags = $derived(
archivedTags.filter((/** @type {any} */ tag) =>
tag.name.toLowerCase().includes(searchQuery.toLowerCase())
)
);
// Dialog state
let createDialogOpen = $state(false);
let editDialogOpen = $state(false);
@ -71,107 +86,301 @@
toast.error(form.error);
}
});
// HubSpot-style color mapping - simple, clean colors
/**
* @param {string} color
*/
function getHubspotBadgeClass(color) {
const colorMap = {
gray: 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300',
red: 'bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-400',
orange: 'bg-orange-50 text-orange-700 dark:bg-orange-950 dark:text-orange-400',
amber: 'bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-400',
yellow: 'bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400',
lime: 'bg-lime-50 text-lime-700 dark:bg-lime-950 dark:text-lime-400',
green: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400',
emerald: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400',
teal: 'bg-teal-50 text-teal-700 dark:bg-teal-950 dark:text-teal-400',
cyan: 'bg-cyan-50 text-cyan-700 dark:bg-cyan-950 dark:text-cyan-400',
sky: 'bg-sky-50 text-sky-700 dark:bg-sky-950 dark:text-sky-400',
blue: 'bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-400',
indigo: 'bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-400',
violet: 'bg-violet-50 text-violet-700 dark:bg-violet-950 dark:text-violet-400',
purple: 'bg-purple-50 text-purple-700 dark:bg-purple-950 dark:text-purple-400',
fuchsia: 'bg-fuchsia-50 text-fuchsia-700 dark:bg-fuchsia-950 dark:text-fuchsia-400',
pink: 'bg-pink-50 text-pink-700 dark:bg-pink-950 dark:text-pink-400',
rose: 'bg-rose-50 text-rose-700 dark:bg-rose-950 dark:text-rose-400'
};
return colorMap[color] || colorMap.blue;
}
/**
* @param {string} color
*/
function getColorDotClass(color) {
const colorMap = {
gray: 'bg-slate-500',
red: 'bg-red-500',
orange: 'bg-orange-500',
amber: 'bg-amber-500',
yellow: 'bg-yellow-500',
lime: 'bg-lime-500',
green: 'bg-emerald-500',
emerald: 'bg-emerald-500',
teal: 'bg-teal-500',
cyan: 'bg-cyan-500',
sky: 'bg-sky-500',
blue: 'bg-blue-500',
indigo: 'bg-indigo-500',
violet: 'bg-violet-500',
purple: 'bg-purple-500',
fuchsia: 'bg-fuchsia-500',
pink: 'bg-pink-500',
rose: 'bg-rose-500'
};
return colorMap[color] || colorMap.blue;
}
</script>
<svelte:head>
<title>Tag Management - BottleCRM</title>
<title>Tags - BottleCRM</title>
</svelte:head>
<PageHeader title="Tag Management" subtitle="Create and manage tags for your CRM entities">
{#snippet actions()}
<Button onclick={openCreate}>
<Plus class="mr-2 h-4 w-4" />
New Tag
</Button>
{/snippet}
</PageHeader>
<div class="flex-1 space-y-6 p-4 md:p-6">
<!-- Active Tags -->
<Card.Root>
<Card.Header>
<Card.Title class="flex items-center gap-2">
<Tag class="h-5 w-5" />
Active Tags ({activeTags.length})
</Card.Title>
<Card.Description>Tags available for use across all entities</Card.Description>
</Card.Header>
<Card.Content>
{#if activeTags.length === 0}
<p class="text-muted-foreground text-sm">
No tags created yet. Click "New Tag" to create your first tag.
<!-- HubSpot-style header -->
<div class="border-b border-border bg-card">
<div class="px-6 py-5">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-semibold tracking-tight text-foreground">Tags</h1>
<p class="mt-1 text-sm text-muted-foreground">
Create and manage tags to organize contacts, companies, deals, and tickets.
</p>
{:else}
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{#each activeTags as tag (tag.id)}
<div class="flex items-center justify-between rounded-lg border p-3">
<div class="flex flex-col gap-1">
<Badge class={getTagColorClass(tag.color)}>{tag.name}</Badge>
{#if tag.description}
<span class="text-muted-foreground max-w-[200px] truncate text-xs">
{tag.description}
</span>
{/if}
</div>
<div class="flex gap-1">
<Button variant="ghost" size="icon" onclick={() => openEdit(tag)} title="Edit tag">
<Pencil class="h-4 w-4" />
</Button>
<form method="POST" action="?/archive" use:enhance>
<input type="hidden" name="tagId" value={tag.id} />
<Button variant="ghost" size="icon" type="submit" title="Archive tag">
<Archive class="h-4 w-4" />
</Button>
</form>
</div>
</div>
{/each}
</div>
{/if}
</Card.Content>
</Card.Root>
<!-- Archived Tags -->
{#if archivedTags.length > 0}
<Card.Root>
<Card.Header>
<Card.Title class="text-muted-foreground flex items-center gap-2">
<Archive class="h-5 w-5" />
Archived Tags ({archivedTags.length})
</Card.Title>
<Card.Description
>Hidden from selection but preserved in existing associations</Card.Description
>
</Card.Header>
<Card.Content>
<div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{#each archivedTags as tag (tag.id)}
<div
class="flex items-center justify-between rounded-lg border border-dashed p-3 opacity-60"
>
<Badge class={getTagColorClass(tag.color)}>{tag.name}</Badge>
<form method="POST" action="?/restore" use:enhance>
<input type="hidden" name="tagId" value={tag.id} />
<Button variant="ghost" size="sm" type="submit">
<RotateCcw class="mr-1.5 h-3.5 w-3.5" />
Restore
</Button>
</form>
</div>
{/each}
</div>
</Card.Content>
</Card.Root>
{/if}
</div>
<Button onclick={openCreate} class="bg-[#ff7a59] hover:bg-[#ff5c35] text-white border-0">
<Plus class="mr-2 h-4 w-4" />
Create tag
</Button>
</div>
</div>
</div>
<!-- Create Dialog -->
<div class="flex-1 bg-background">
<!-- Search and filter bar -->
<div class="border-b border-border bg-card px-6 py-3">
<div class="flex items-center gap-4">
<div class="relative flex-1 max-w-sm">
<Search class="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
type="text"
placeholder="Search tags..."
bind:value={searchQuery}
class="pl-9 h-9 bg-background"
/>
</div>
<div class="flex items-center gap-2">
<button
onclick={() => (showArchived = false)}
class="px-3 py-1.5 text-sm font-medium rounded-md transition-colors {!showArchived
? 'bg-secondary text-foreground'
: 'text-muted-foreground hover:text-foreground hover:bg-secondary/50'}"
>
Active ({activeTags.length})
</button>
<button
onclick={() => (showArchived = true)}
class="px-3 py-1.5 text-sm font-medium rounded-md transition-colors {showArchived
? 'bg-secondary text-foreground'
: 'text-muted-foreground hover:text-foreground hover:bg-secondary/50'}"
>
Archived ({archivedTags.length})
</button>
</div>
</div>
</div>
<!-- Tags table -->
<div class="px-6 py-4">
{#if !showArchived}
{#if filteredActiveTags.length === 0}
<div class="flex flex-col items-center justify-center py-16 text-center">
<div class="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-muted">
<Tag class="h-7 w-7 text-muted-foreground" />
</div>
{#if searchQuery}
<h3 class="text-lg font-medium text-foreground">No tags found</h3>
<p class="mt-1 text-sm text-muted-foreground">
No tags match "{searchQuery}". Try a different search term.
</p>
{:else}
<h3 class="text-lg font-medium text-foreground">No tags yet</h3>
<p class="mt-1 max-w-sm text-sm text-muted-foreground">
Tags help you organize and filter your CRM records. Create your first tag to get started.
</p>
<Button onclick={openCreate} class="mt-4 bg-[#ff7a59] hover:bg-[#ff5c35] text-white border-0">
<Plus class="mr-2 h-4 w-4" />
Create tag
</Button>
{/if}
</div>
{:else}
<div class="overflow-hidden rounded-lg border border-border">
<table class="w-full">
<thead>
<tr class="border-b border-border bg-muted/50">
<th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Tag name
</th>
<th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Description
</th>
<th class="px-4 py-3 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Actions
</th>
</tr>
</thead>
<tbody class="divide-y divide-border">
{#each filteredActiveTags as tag (tag.id)}
<tr class="group bg-card transition-colors hover:bg-muted/30">
<td class="px-4 py-3">
<div class="flex items-center gap-3">
<span class="inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm font-medium {getHubspotBadgeClass(tag.color)}">
<span class="h-2 w-2 rounded-full {getColorDotClass(tag.color)}"></span>
{tag.name}
</span>
</div>
</td>
<td class="px-4 py-3">
<span class="text-sm text-muted-foreground">
{tag.description || '—'}
</span>
</td>
<td class="px-4 py-3 text-right">
<div class="flex items-center justify-end gap-1 opacity-0 transition-opacity group-hover:opacity-100">
<Button
variant="ghost"
size="sm"
onclick={() => openEdit(tag)}
class="h-8 px-2 text-muted-foreground hover:text-foreground"
>
<Pencil class="h-4 w-4" />
<span class="ml-1.5">Edit</span>
</Button>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
<Button variant="ghost" size="icon" class="h-8 w-8 text-muted-foreground hover:text-foreground">
<MoreHorizontal class="h-4 w-4" />
</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<form method="POST" action="?/archive" use:enhance>
<input type="hidden" name="tagId" value={tag.id} />
<DropdownMenu.Item class="text-destructive focus:text-destructive">
<button type="submit" class="flex w-full items-center gap-2">
<Archive class="h-4 w-4" />
Archive tag
</button>
</DropdownMenu.Item>
</form>
</DropdownMenu.Content>
</DropdownMenu.Root>
</div>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
<p class="mt-3 text-xs text-muted-foreground">
Showing {filteredActiveTags.length} of {activeTags.length} active tags
</p>
{/if}
{:else}
{#if filteredArchivedTags.length === 0}
<div class="flex flex-col items-center justify-center py-16 text-center">
<div class="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-muted">
<Archive class="h-7 w-7 text-muted-foreground" />
</div>
{#if searchQuery}
<h3 class="text-lg font-medium text-foreground">No archived tags found</h3>
<p class="mt-1 text-sm text-muted-foreground">
No archived tags match "{searchQuery}".
</p>
{:else}
<h3 class="text-lg font-medium text-foreground">No archived tags</h3>
<p class="mt-1 text-sm text-muted-foreground">
Archived tags will appear here.
</p>
{/if}
</div>
{:else}
<div class="overflow-hidden rounded-lg border border-border">
<table class="w-full">
<thead>
<tr class="border-b border-border bg-muted/50">
<th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Tag name
</th>
<th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Description
</th>
<th class="px-4 py-3 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Actions
</th>
</tr>
</thead>
<tbody class="divide-y divide-border">
{#each filteredArchivedTags as tag (tag.id)}
<tr class="group bg-card opacity-60 transition-all hover:opacity-100">
<td class="px-4 py-3">
<div class="flex items-center gap-3">
<span class="inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm font-medium {getHubspotBadgeClass(tag.color)}">
<span class="h-2 w-2 rounded-full {getColorDotClass(tag.color)}"></span>
{tag.name}
</span>
</div>
</td>
<td class="px-4 py-3">
<span class="text-sm text-muted-foreground">
{tag.description || '—'}
</span>
</td>
<td class="px-4 py-3 text-right">
<form method="POST" action="?/restore" use:enhance class="inline">
<input type="hidden" name="tagId" value={tag.id} />
<Button
variant="ghost"
size="sm"
type="submit"
class="h-8 gap-1.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100"
>
<RotateCcw class="h-4 w-4" />
Restore
</Button>
</form>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
<p class="mt-3 text-xs text-muted-foreground">
Showing {filteredArchivedTags.length} of {archivedTags.length} archived tags
</p>
{/if}
{/if}
</div>
</div>
<!-- Create Dialog - HubSpot style -->
<Dialog.Root bind:open={createDialogOpen}>
<Dialog.Content class="sm:max-w-md">
<Dialog.Header>
<Dialog.Title>Create New Tag</Dialog.Title>
<Dialog.Description>Add a new tag to organize your CRM entities</Dialog.Description>
</Dialog.Header>
<Dialog.Content class="sm:max-w-md p-0 gap-0 overflow-hidden">
<div class="border-b border-border px-6 py-4">
<Dialog.Title class="text-lg font-semibold">Create a tag</Dialog.Title>
<Dialog.Description class="text-sm text-muted-foreground mt-1">
Tags help you organize and segment your records.
</Dialog.Description>
</div>
<form
method="POST"
action="?/create"
@ -183,66 +392,89 @@
};
}}
>
<div class="grid gap-4 py-4">
<div class="grid gap-2">
<Label for="name">Name</Label>
<div class="px-6 py-5 space-y-5">
<div class="space-y-2">
<Label for="name" class="text-sm font-medium">
Tag name <span class="text-destructive">*</span>
</Label>
<Input
id="name"
name="name"
bind:value={formName}
placeholder="e.g., VIP, Hot Lead, Priority"
placeholder="e.g., VIP Customer, Hot Lead"
class="h-10"
/>
</div>
<div class="grid gap-2">
<Label>Color</Label>
<div class="space-y-2">
<Label class="text-sm font-medium">Color</Label>
<div class="flex flex-wrap gap-2">
{#each TAG_COLORS as color}
<button
type="button"
onclick={() => (formColor = color.value)}
class="flex h-8 w-8 items-center justify-center rounded-full border-2 transition-all {color.class} {formColor ===
color.value
? 'ring-primary ring-2 ring-offset-2'
: 'hover:scale-110'}"
class="group relative flex h-7 w-7 items-center justify-center rounded-full transition-all {getColorDotClass(color.value)} {formColor === color.value ? 'ring-2 ring-offset-2 ring-offset-background ring-foreground scale-110' : 'hover:scale-110'}"
title={color.label}
>
{#if formColor === color.value}
<span class="text-xs font-bold">✓</span>
<Check class="h-3.5 w-3.5 text-white" />
{/if}
</button>
{/each}
</div>
<input type="hidden" name="color" value={formColor} />
</div>
<div class="grid gap-2">
<Label for="description">Description (optional)</Label>
<div class="space-y-2">
<Label for="description" class="text-sm font-medium">
Description <span class="text-muted-foreground font-normal">(optional)</span>
</Label>
<Input
id="description"
name="description"
bind:value={formDescription}
placeholder="What is this tag used for?"
placeholder="Describe what this tag is for..."
class="h-10"
/>
</div>
<!-- Preview -->
<div class="pt-2">
<Label class="text-sm font-medium text-muted-foreground">Preview</Label>
<div class="mt-2 flex items-center">
<span class="inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm font-medium {getHubspotBadgeClass(formColor)}">
<span class="h-2 w-2 rounded-full {getColorDotClass(formColor)}"></span>
{formName || 'Tag name'}
</span>
</div>
</div>
</div>
<Dialog.Footer>
<Button variant="outline" type="button" onclick={() => (createDialogOpen = false)}
>Cancel</Button
>
<Button type="submit" disabled={!formName.trim() || isLoading}>
{isLoading ? 'Creating...' : 'Create Tag'}
<div class="flex justify-end gap-2 border-t border-border bg-muted/30 px-6 py-4">
<Button variant="outline" type="button" onclick={() => (createDialogOpen = false)}>
Cancel
</Button>
</Dialog.Footer>
<Button
type="submit"
disabled={!formName.trim() || isLoading}
class="bg-[#ff7a59] hover:bg-[#ff5c35] text-white border-0"
>
{isLoading ? 'Creating...' : 'Create tag'}
</Button>
</div>
</form>
</Dialog.Content>
</Dialog.Root>
<!-- Edit Dialog -->
<!-- Edit Dialog - HubSpot style -->
<Dialog.Root bind:open={editDialogOpen}>
<Dialog.Content class="sm:max-w-md">
<Dialog.Header>
<Dialog.Title>Edit Tag</Dialog.Title>
<Dialog.Description>Update tag details</Dialog.Description>
</Dialog.Header>
<Dialog.Content class="sm:max-w-md p-0 gap-0 overflow-hidden">
<div class="border-b border-border px-6 py-4">
<Dialog.Title class="text-lg font-semibold">Edit tag</Dialog.Title>
<Dialog.Description class="text-sm text-muted-foreground mt-1">
Update the tag name, color, or description.
</Dialog.Description>
</div>
<form
method="POST"
action="?/update"
@ -255,45 +487,64 @@
}}
>
<input type="hidden" name="tagId" value={editingTag?.id} />
<div class="grid gap-4 py-4">
<div class="grid gap-2">
<Label for="edit-name">Name</Label>
<Input id="edit-name" name="name" bind:value={formName} />
<div class="px-6 py-5 space-y-5">
<div class="space-y-2">
<Label for="edit-name" class="text-sm font-medium">
Tag name <span class="text-destructive">*</span>
</Label>
<Input id="edit-name" name="name" bind:value={formName} class="h-10" />
</div>
<div class="grid gap-2">
<Label>Color</Label>
<div class="space-y-2">
<Label class="text-sm font-medium">Color</Label>
<div class="flex flex-wrap gap-2">
{#each TAG_COLORS as color}
<button
type="button"
onclick={() => (formColor = color.value)}
class="flex h-8 w-8 items-center justify-center rounded-full border-2 transition-all {color.class} {formColor ===
color.value
? 'ring-primary ring-2 ring-offset-2'
: 'hover:scale-110'}"
class="group relative flex h-7 w-7 items-center justify-center rounded-full transition-all {getColorDotClass(color.value)} {formColor === color.value ? 'ring-2 ring-offset-2 ring-offset-background ring-foreground scale-110' : 'hover:scale-110'}"
title={color.label}
>
{#if formColor === color.value}
<span class="text-xs font-bold">✓</span>
<Check class="h-3.5 w-3.5 text-white" />
{/if}
</button>
{/each}
</div>
<input type="hidden" name="color" value={formColor} />
</div>
<div class="grid gap-2">
<Label for="edit-description">Description</Label>
<Input id="edit-description" name="description" bind:value={formDescription} />
<div class="space-y-2">
<Label for="edit-description" class="text-sm font-medium">
Description <span class="text-muted-foreground font-normal">(optional)</span>
</Label>
<Input id="edit-description" name="description" bind:value={formDescription} class="h-10" />
</div>
<!-- Preview -->
<div class="pt-2">
<Label class="text-sm font-medium text-muted-foreground">Preview</Label>
<div class="mt-2 flex items-center">
<span class="inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm font-medium {getHubspotBadgeClass(formColor)}">
<span class="h-2 w-2 rounded-full {getColorDotClass(formColor)}"></span>
{formName || 'Tag name'}
</span>
</div>
</div>
</div>
<Dialog.Footer>
<Button variant="outline" type="button" onclick={() => (editDialogOpen = false)}
>Cancel</Button
>
<Button type="submit" disabled={!formName.trim() || isLoading}>
{isLoading ? 'Saving...' : 'Save Changes'}
<div class="flex justify-end gap-2 border-t border-border bg-muted/30 px-6 py-4">
<Button variant="outline" type="button" onclick={() => (editDialogOpen = false)}>
Cancel
</Button>
</Dialog.Footer>
<Button
type="submit"
disabled={!formName.trim() || isLoading}
class="bg-[#ff7a59] hover:bg-[#ff5c35] text-white border-0"
>
{isLoading ? 'Saving...' : 'Save'}
</Button>
</div>
</form>
</Dialog.Content>
</Dialog.Root>

View file

@ -9,12 +9,13 @@
Heart,
Users,
ExternalLink,
MessageCircle
Sparkles,
ArrowRight,
Zap,
Code2,
MessageSquareHeart
} from '@lucide/svelte';
import PageHeader from '$lib/components/layout/PageHeader.svelte';
import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import { Separator } from '$lib/components/ui/separator/index.js';
/** @type {{ data: import('./$types').PageData }} */
let { data } = $props();
@ -24,228 +25,699 @@
<title>Support - BottleCRM</title>
</svelte:head>
<PageHeader title="Help & Support" subtitle="Get help with BottleCRM" />
<div class="support-page">
<!-- Hero Section with Gradient Mesh -->
<header class="hero noise-overlay">
<div class="hero-glow"></div>
<div class="hero-content">
<div class="hero-badge animate-in-up">
<Sparkles class="h-3.5 w-3.5" />
<span>Open Source • Forever Free</span>
</div>
<h1 class="hero-title animate-in-up stagger-1">
Help & <span class="text-gradient">Support</span>
</h1>
<p class="hero-description animate-in-up stagger-2">
Join thousands of businesses using BottleCRM to manage customer relationships without the enterprise price tag.
</p>
</div>
</header>
<div class="flex-1 p-4 md:p-6">
<div class="mx-auto max-w-4xl space-y-6">
<!-- Mission Statement -->
<Card.Root
class="border-blue-100 bg-gradient-to-r from-blue-50 to-indigo-50 dark:border-blue-800 dark:from-blue-900/20 dark:to-indigo-900/20"
>
<Card.Content class="p-6">
<div class="flex items-start gap-4">
<div
class="flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-800"
>
<Heart class="h-6 w-6 text-blue-600 dark:text-blue-300" />
</div>
<div>
<h2 class="text-foreground text-xl font-semibold">Our Mission</h2>
<p class="text-muted-foreground mt-2 leading-relaxed">
BottleCRM addresses the high subscription costs of commercial CRM alternatives by
providing a completely free, open-source, and highly customizable solution. Clone it,
self-host it, and make it yours - forever free.
</p>
</div>
</div>
</Card.Content>
</Card.Root>
<!-- Support Options Grid -->
<div class="grid gap-4 md:grid-cols-2">
<!-- Community Support -->
<Card.Root class="transition-shadow hover:shadow-md">
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900/30"
>
<Github class="h-5 w-5 text-green-600 dark:text-green-400" />
</div>
<Card.Title class="">Community Support</Card.Title>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
Join our open-source community for free support, discussions, and collaboration.
</p>
<Button
variant="outline"
class="w-full"
onclick={() => window.open('https://github.com/MicroPyramid/Django-CRM', '_blank')}
>
<Github class="mr-2 h-4 w-4" />
Visit GitHub Repository
<ExternalLink class="ml-2 h-3 w-3" />
</Button>
</Card.Content>
</Card.Root>
<!-- Professional Support -->
<Card.Root class="transition-shadow hover:shadow-md">
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-purple-100 dark:bg-purple-900/30"
>
<Users class="h-5 w-5 text-purple-600 dark:text-purple-400" />
</div>
<Card.Title class="">Professional Support</Card.Title>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
Get priority support, hosting assistance, and custom development services.
</p>
<Button
variant="outline"
class="w-full"
onclick={() => (window.location.href = 'mailto:ashwin@micropyramid.com')}
>
<Mail class="mr-2 h-4 w-4" />
Contact for Paid Support
</Button>
</Card.Content>
</Card.Root>
<!-- Mission Card - Featured -->
<section class="content-area">
<div class="mission-card glass-card animate-in-up stagger-3">
<div class="mission-icon-wrap">
<Heart class="h-7 w-7" />
</div>
<div class="mission-content">
<h2>Our Mission</h2>
<p>
BottleCRM addresses the high subscription costs of commercial CRM alternatives by providing a
<strong>completely free, open-source, and highly customizable</strong> solution. Clone it, self-host it,
and make it yours — forever free.
</p>
</div>
<div class="mission-pattern"></div>
</div>
<!-- Feature Requests -->
<Card.Root>
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/30"
>
<Lightbulb class="h-5 w-5 text-blue-600 dark:text-blue-400" />
<!-- Bento Grid -->
<div class="bento-grid">
<!-- Community Support - Large Card -->
<article class="bento-card bento-featured hover-lift animate-in-up stagger-4">
<div class="card-header">
<div class="icon-box icon-github">
<Github class="h-6 w-6" />
</div>
<div>
<Card.Title class="">Feature Requests & Ideas</Card.Title>
<Card.Description class="">Have an idea to make BottleCRM better?</Card.Description>
<div class="card-badge">Community</div>
</div>
<h3>Join the Community</h3>
<p>
Collaborate with developers worldwide. Get free support, share ideas, and help shape the future of open-source CRM.
</p>
<div class="card-stats">
<div class="stat">
<Code2 class="h-4 w-4" />
<span>Open Source</span>
</div>
<div class="stat">
<Users class="h-4 w-4" />
<span>Active Community</span>
</div>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
We'd love to hear from you! Share your feature requests and help shape the future of
open-source CRM.
<Button
class="card-action"
onclick={() => window.open('https://github.com/MicroPyramid/Django-CRM', '_blank')}
>
<Github class="h-4 w-4" />
Visit GitHub
<ArrowRight class="h-4 w-4 ml-auto transition-transform group-hover:translate-x-1" />
</Button>
</article>
<!-- Professional Support -->
<article class="bento-card hover-lift animate-in-up stagger-5">
<div class="card-header">
<div class="icon-box icon-pro">
<Zap class="h-5 w-5" />
</div>
</div>
<h3>Professional Support</h3>
<p>
Priority support, hosting assistance, and custom development services from the core team.
</p>
<Button
variant="outline"
class="card-action-outline"
onclick={() => (window.location.href = 'mailto:ashwin@micropyramid.com')}
>
<Mail class="h-4 w-4" />
Contact Team
</Button>
</article>
<!-- Feature Requests -->
<article class="bento-card hover-lift animate-in-up stagger-5">
<div class="card-header">
<div class="icon-box icon-idea">
<Lightbulb class="h-5 w-5" />
</div>
</div>
<h3>Feature Requests</h3>
<p>
Have an idea? Share your requests and help shape the future of BottleCRM.
</p>
<Button
variant="outline"
class="card-action-outline"
onclick={() =>
window.open(
'https://github.com/MicroPyramid/Django-CRM/issues/new?template=feature_request.md',
'_blank'
)}
>
<Lightbulb class="mr-2 h-4 w-4" />
<Lightbulb class="h-4 w-4" />
Request Feature
<ExternalLink class="ml-2 h-3 w-3" />
<ExternalLink class="h-3 w-3" />
</Button>
</Card.Content>
</Card.Root>
</article>
<!-- Bug Reports -->
<Card.Root>
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-orange-100 dark:bg-orange-900/30"
>
<Bug class="h-5 w-5 text-orange-600 dark:text-orange-400" />
</div>
<div>
<Card.Title class="">Bug Reports</Card.Title>
<Card.Description class="">Found a bug? Help us improve BottleCRM</Card.Description>
<!-- Bug Reports -->
<article class="bento-card hover-lift animate-in-up stagger-6">
<div class="card-header">
<div class="icon-box icon-bug">
<Bug class="h-5 w-5" />
</div>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
Your feedback helps make the platform more stable for everyone.
<h3>Bug Reports</h3>
<p>
Found an issue? Your feedback helps make the platform more stable for everyone.
</p>
<Button
variant="outline"
class="card-action-outline"
onclick={() =>
window.open(
'https://github.com/MicroPyramid/Django-CRM/issues/new?template=bug_report.md',
'_blank'
)}
>
<Bug class="mr-2 h-4 w-4" />
<Bug class="h-4 w-4" />
Report Bug
<ExternalLink class="ml-2 h-3 w-3" />
<ExternalLink class="h-3 w-3" />
</Button>
</Card.Content>
</Card.Root>
</article>
<!-- Security Issues -->
<Card.Root class="border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-900/10">
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900/30"
>
<Shield class="h-5 w-5 text-red-600 dark:text-red-400" />
</div>
<div>
<Card.Title class="">Security Issues</Card.Title>
<Card.Description class="">Report security vulnerabilities privately</Card.Description>
<!-- Security - Emphasized -->
<article class="bento-card bento-security hover-lift animate-in-up stagger-6">
<div class="security-glow"></div>
<div class="card-header">
<div class="icon-box icon-security">
<Shield class="h-5 w-5" />
</div>
<div class="card-badge badge-security">Critical</div>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
<strong>Security is our priority.</strong> If you discover any security vulnerabilities, please
report them privately. Do not create public GitHub issues for security concerns.
<h3>Security Issues</h3>
<p>
<strong>Security is our priority.</strong> Report vulnerabilities privately.
Never create public issues for security concerns.
</p>
<Button
variant="destructive"
class="card-action-security"
onclick={() =>
(window.location.href =
'mailto:ashwin@micropyramid.com?subject=Security%20Issue%20-%20BottleCRM')}
>
<Mail class="mr-2 h-4 w-4" />
Report Security Issue
<Shield class="h-4 w-4" />
Report Privately
</Button>
</Card.Content>
</Card.Root>
</article>
</div>
<!-- Custom Development -->
<Card.Root
class="border-indigo-200 bg-gradient-to-r from-indigo-50 to-purple-50 dark:border-indigo-800 dark:from-indigo-900/20 dark:to-purple-900/20"
>
<Card.Header class="">
<div class="flex items-center gap-3">
<div
class="flex h-10 w-10 items-center justify-center rounded-lg bg-indigo-100 dark:bg-indigo-900/30"
>
<Wrench class="h-5 w-5 text-indigo-600 dark:text-indigo-400" />
</div>
<div>
<Card.Title class="">Custom CRM Development</Card.Title>
<Card.Description class="">Tailored to your specific business needs</Card.Description>
</div>
<!-- Custom Development Banner -->
<div class="custom-dev-banner animate-in-up stagger-6">
<div class="banner-content">
<div class="banner-icon">
<Wrench class="h-8 w-8" />
</div>
<div class="banner-text">
<h3>Need Custom CRM Development?</h3>
<p>
Tailored solutions including hosting, custom features, integrations, and ongoing support
for your specific business needs.
</p>
</div>
</Card.Header>
<Card.Content>
<p class="text-muted-foreground mb-4 text-sm">
Need BottleCRM tailored to your specific business needs? We offer professional
customization services including hosting, custom features, integrations, and ongoing
support.
</p>
<Button
size="lg"
class="banner-cta"
onclick={() =>
(window.location.href =
'mailto:ashwin@micropyramid.com?subject=Custom%20CRM%20Development%20Inquiry')}
>
<Mail class="mr-2 h-4 w-4" />
<MessageSquareHeart class="h-4 w-4" />
Get Custom Quote
<ArrowRight class="h-4 w-4" />
</Button>
</Card.Content>
</Card.Root>
<!-- Version Info -->
<div class="text-muted-foreground text-center text-sm">
<p>BottleCRM v1.0.0</p>
</div>
<div class="banner-pattern"></div>
</div>
</div>
<!-- Version -->
<footer class="version-footer">
<span>BottleCRM</span>
<span class="version-divider">•</span>
<span>v1.0.0</span>
</footer>
</section>
</div>
<style>
/* ═══════════════════════════════════════════════════════════════════════════
SUPPORT PAGE - Premium Knowledge Hub Aesthetic
═══════════════════════════════════════════════════════════════════════════ */
.support-page {
min-height: 100vh;
background: var(--background);
}
/* ─────────────────────────────────────────────────────────────────────────
HERO SECTION
───────────────────────────────────────────────────────────────────────── */
.hero {
position: relative;
padding: 3rem 1.5rem 2.5rem;
overflow: hidden;
background:
radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-primary-subtle), transparent),
radial-gradient(ellipse 60% 40% at 80% 0%, var(--accent-secondary-subtle), transparent),
var(--background);
}
:global(.dark) .hero {
background:
radial-gradient(ellipse 80% 50% at 50% -20%, rgba(34, 211, 238, 0.08), transparent),
radial-gradient(ellipse 60% 40% at 80% 0%, rgba(251, 191, 36, 0.05), transparent),
var(--background);
}
.hero-glow {
position: absolute;
top: -50%;
left: 50%;
transform: translateX(-50%);
width: 600px;
height: 400px;
background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
opacity: 0.04;
filter: blur(60px);
pointer-events: none;
}
:global(.dark) .hero-glow {
opacity: 0.08;
}
.hero-content {
position: relative;
max-width: 680px;
margin: 0 auto;
text-align: center;
}
.hero-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.375rem 0.875rem;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--accent-primary);
background: var(--accent-primary-subtle);
border: 1px solid color-mix(in oklch, var(--accent-primary) 20%, transparent);
border-radius: var(--radius-full);
margin-bottom: 1rem;
}
.hero-title {
font-family: var(--font-sans);
font-size: clamp(2rem, 5vw, 2.75rem);
font-weight: 800;
letter-spacing: -0.03em;
line-height: 1.1;
color: var(--text-primary);
margin-bottom: 0.75rem;
}
.hero-description {
font-size: 1rem;
line-height: 1.6;
color: var(--text-secondary);
max-width: 520px;
margin: 0 auto;
}
/* ─────────────────────────────────────────────────────────────────────────
CONTENT AREA
───────────────────────────────────────────────────────────────────────── */
.content-area {
padding: 0 1.5rem 3rem;
max-width: 1000px;
margin: 0 auto;
}
/* ─────────────────────────────────────────────────────────────────────────
MISSION CARD
───────────────────────────────────────────────────────────────────────── */
.mission-card {
position: relative;
display: flex;
align-items: flex-start;
gap: 1.25rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
border-radius: var(--radius-xl);
overflow: hidden;
background: var(--card);
border: 1px solid var(--border);
}
.mission-card::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, var(--accent-primary-subtle) 0%, transparent 50%);
pointer-events: none;
}
:global(.dark) .mission-card::before {
background: linear-gradient(135deg, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
}
.mission-icon-wrap {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 52px;
height: 52px;
flex-shrink: 0;
border-radius: var(--radius-lg);
background: linear-gradient(135deg, var(--accent-primary) 0%, color-mix(in oklch, var(--accent-primary) 80%, var(--accent-secondary)) 100%);
color: white;
box-shadow: 0 4px 12px -2px color-mix(in oklch, var(--accent-primary) 30%, transparent);
}
:global(.dark) .mission-icon-wrap {
box-shadow: 0 4px 20px -2px color-mix(in oklch, var(--accent-primary) 40%, transparent);
}
.mission-content {
position: relative;
flex: 1;
}
.mission-content h2 {
font-family: var(--font-sans);
font-size: 1.125rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.mission-content p {
font-size: 0.9375rem;
line-height: 1.65;
color: var(--text-secondary);
}
.mission-content strong {
color: var(--text-primary);
font-weight: 600;
}
.mission-pattern {
position: absolute;
top: 0;
right: 0;
width: 200px;
height: 100%;
background:
radial-gradient(circle at 100% 0%, var(--accent-secondary-subtle) 0%, transparent 50%);
pointer-events: none;
opacity: 0.6;
}
/* ─────────────────────────────────────────────────────────────────────────
BENTO GRID
───────────────────────────────────────────────────────────────────────── */
.bento-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
}
@media (max-width: 680px) {
.bento-grid {
grid-template-columns: 1fr;
}
.bento-featured {
grid-column: 1;
}
}
.bento-card {
position: relative;
padding: 1.25rem;
border-radius: var(--radius-lg);
background: var(--card);
border: 1px solid var(--border);
display: flex;
flex-direction: column;
transition: all var(--duration-normal) var(--ease-out);
}
.bento-card:hover {
border-color: var(--border-strong);
}
:global(.dark) .bento-card:hover {
border-color: color-mix(in oklch, var(--accent-primary) 40%, var(--border));
}
.bento-featured {
grid-column: span 2;
padding: 1.5rem;
background: linear-gradient(145deg, var(--card) 0%, color-mix(in oklch, var(--card) 95%, var(--accent-primary)) 100%);
}
@media (max-width: 680px) {
.bento-featured {
grid-column: span 1;
}
}
.bento-security {
grid-column: span 2;
background: color-mix(in oklch, var(--status-danger-bg) 50%, var(--card));
border-color: color-mix(in oklch, var(--status-danger) 20%, var(--border));
}
:global(.dark) .bento-security {
background: color-mix(in oklch, var(--status-danger-bg) 100%, var(--card));
}
.security-glow {
position: absolute;
top: -20px;
right: -20px;
width: 120px;
height: 120px;
background: radial-gradient(circle, var(--status-danger) 0%, transparent 70%);
opacity: 0.06;
filter: blur(30px);
pointer-events: none;
}
@media (max-width: 680px) {
.bento-security {
grid-column: span 1;
}
}
/* Card Header */
.card-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.875rem;
}
.icon-box {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: var(--radius-md);
transition: all var(--duration-normal) var(--ease-out);
}
.icon-github {
background: var(--bg-emphasis);
color: var(--text-primary);
}
:global(.dark) .icon-github {
background: color-mix(in oklch, var(--text-primary) 15%, transparent);
}
.icon-pro {
background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
color: white;
}
.icon-idea {
background: linear-gradient(135deg, var(--accent-secondary) 0%, #fcd34d 100%);
color: #78350f;
}
.icon-bug {
background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
color: white;
}
.icon-security {
background: linear-gradient(135deg, var(--status-danger) 0%, #f87171 100%);
color: white;
}
.card-badge {
font-size: 0.6875rem;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
padding: 0.25rem 0.5rem;
border-radius: var(--radius-full);
background: var(--accent-primary-subtle);
color: var(--accent-primary);
margin-left: auto;
}
.badge-security {
background: var(--status-danger-bg);
color: var(--status-danger);
}
/* Card Content */
.bento-card h3 {
font-family: var(--font-sans);
font-size: 1rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.375rem;
}
.bento-card p {
font-size: 0.875rem;
line-height: 1.55;
color: var(--text-secondary);
margin-bottom: 1rem;
flex: 1;
}
.bento-card strong {
color: var(--text-primary);
font-weight: 600;
}
.card-stats {
display: flex;
gap: 1rem;
margin-bottom: 1rem;
}
.stat {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.75rem;
font-weight: 500;
color: var(--text-tertiary);
}
/* Card Actions */
.bento-card :global(.card-action) {
width: 100%;
justify-content: flex-start;
gap: 0.5rem;
}
.bento-card :global(.card-action-outline) {
width: 100%;
justify-content: flex-start;
gap: 0.5rem;
}
.bento-card :global(.card-action-security) {
width: 100%;
justify-content: flex-start;
gap: 0.5rem;
}
/* ─────────────────────────────────────────────────────────────────────────
CUSTOM DEVELOPMENT BANNER
───────────────────────────────────────────────────────────────────────── */
.custom-dev-banner {
position: relative;
padding: 1.5rem;
border-radius: var(--radius-xl);
overflow: hidden;
background: linear-gradient(135deg,
color-mix(in oklch, var(--accent-primary) 12%, var(--card)) 0%,
color-mix(in oklch, var(--accent-secondary) 8%, var(--card)) 100%
);
border: 1px solid color-mix(in oklch, var(--accent-primary) 20%, var(--border));
}
:global(.dark) .custom-dev-banner {
background: linear-gradient(135deg,
color-mix(in oklch, var(--accent-primary) 8%, var(--card)) 0%,
color-mix(in oklch, var(--accent-secondary) 5%, var(--card)) 100%
);
border-color: color-mix(in oklch, var(--accent-primary) 30%, var(--border));
}
.banner-content {
position: relative;
display: flex;
align-items: center;
gap: 1.25rem;
flex-wrap: wrap;
}
.banner-icon {
display: flex;
align-items: center;
justify-content: center;
width: 56px;
height: 56px;
border-radius: var(--radius-lg);
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
color: white;
flex-shrink: 0;
}
:global(.dark) .banner-icon {
box-shadow: 0 4px 20px -4px color-mix(in oklch, var(--accent-primary) 50%, transparent);
}
.banner-text {
flex: 1;
min-width: 200px;
}
.banner-text h3 {
font-family: var(--font-sans);
font-size: 1.0625rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.25rem;
}
.banner-text p {
font-size: 0.875rem;
line-height: 1.5;
color: var(--text-secondary);
}
.custom-dev-banner :global(.banner-cta) {
gap: 0.5rem;
flex-shrink: 0;
box-shadow: 0 4px 12px -2px color-mix(in oklch, var(--accent-primary) 30%, transparent);
}
:global(.dark) .custom-dev-banner :global(.banner-cta) {
box-shadow: 0 4px 20px -4px color-mix(in oklch, var(--accent-primary) 40%, transparent);
}
.banner-pattern {
position: absolute;
top: 0;
right: 0;
width: 300px;
height: 100%;
background:
radial-gradient(circle at 100% 50%, var(--accent-secondary-subtle) 0%, transparent 50%);
pointer-events: none;
opacity: 0.5;
}
/* ─────────────────────────────────────────────────────────────────────────
VERSION FOOTER
───────────────────────────────────────────────────────────────────────── */
.version-footer {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding-top: 2rem;
font-size: 0.8125rem;
font-weight: 500;
color: var(--text-tertiary);
}
.version-divider {
opacity: 0.4;
}
</style>

File diff suppressed because it is too large Load diff