Redesign teams portal and add user autocomplete for member invitations

- Redesign TeamsPage with modern card-based layout including stats bar,
  search functionality, and empty states
- Add UserAutocomplete component with debounced search and keyboard
  navigation for selecting existing users
- Add /api/v1/users/search endpoint for username prefix search
- Update TeamMembersPage to use UserAutocomplete instead of free text input
This commit is contained in:
Mondo Diaz
2026-01-28 15:42:55 +00:00
parent 69f3737303
commit 86f2f031db
8 changed files with 835 additions and 162 deletions

View File

@@ -1,89 +1,117 @@
.teams-page {
padding: 1.5rem 0;
max-width: 1200px;
margin: 0 auto;
}
.page-header {
/* Header */
.teams-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 1.5rem;
margin-bottom: 2rem;
gap: 1rem;
}
.page-header h1 {
.teams-header__content h1 {
margin: 0;
font-size: 1.75rem;
font-weight: 600;
}
.page-subtitle {
.teams-header__subtitle {
margin: 0.25rem 0 0;
color: var(--color-text-muted);
font-size: 0.9375rem;
}
.team-name-cell {
/* Stats */
.teams-stats {
display: flex;
flex-direction: column;
gap: 0.125rem;
}
.team-name-link {
font-weight: 500;
color: var(--color-text);
text-decoration: none;
}
.team-name-link:hover {
color: var(--color-primary);
}
.team-slug {
font-size: 0.8125rem;
color: var(--color-text-muted);
}
.team-description {
color: var(--color-text-secondary);
font-size: 0.875rem;
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Empty state */
.empty-state {
text-align: center;
padding: 4rem 2rem;
gap: 2rem;
padding: 1rem 1.5rem;
background: var(--color-bg-secondary);
border-radius: var(--radius-lg);
margin-bottom: 1.5rem;
}
.teams-stat {
display: flex;
flex-direction: column;
align-items: center;
}
.teams-stat__value {
font-size: 1.5rem;
font-weight: 600;
color: var(--color-text);
}
.teams-stat__label {
font-size: 0.75rem;
color: var(--color-text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Search */
.teams-search {
position: relative;
margin-bottom: 1.5rem;
}
.teams-search__icon {
position: absolute;
left: 0.875rem;
top: 50%;
transform: translateY(-50%);
color: var(--color-text-muted);
pointer-events: none;
}
.teams-search__input {
width: 100%;
padding: 0.625rem 2.5rem 0.625rem 2.75rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: var(--color-bg);
color: var(--color-text);
font-size: 0.875rem;
}
.empty-state svg {
color: var(--color-text-muted);
margin-bottom: 1rem;
.teams-search__input:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px var(--color-primary-alpha, rgba(59, 130, 246, 0.1));
}
.empty-state h2 {
margin: 0 0 0.5rem;
font-size: 1.25rem;
}
.empty-state p {
margin: 0 0 1.5rem;
.teams-search__input::placeholder {
color: var(--color-text-muted);
}
/* Loading state */
.loading-state {
text-align: center;
padding: 4rem 2rem;
.teams-search__clear {
position: absolute;
right: 0.5rem;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
padding: 0.375rem;
cursor: pointer;
color: var(--color-text-muted);
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-sm);
}
/* Error message */
.error-message {
.teams-search__clear:hover {
color: var(--color-text);
background: var(--color-bg-secondary);
}
/* Error */
.teams-error {
display: flex;
align-items: center;
justify-content: space-between;
@@ -96,7 +124,7 @@
font-size: 0.875rem;
}
.error-dismiss {
.teams-error__dismiss {
background: none;
border: none;
font-size: 1.25rem;
@@ -106,6 +134,145 @@
line-height: 1;
}
/* Loading */
.teams-loading {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
padding: 4rem 2rem;
color: var(--color-text-muted);
}
.teams-loading__spinner {
width: 32px;
height: 32px;
border: 3px solid var(--color-border);
border-top-color: var(--color-primary);
border-radius: 50%;
animation: teams-spin 0.8s linear infinite;
}
@keyframes teams-spin {
to { transform: rotate(360deg); }
}
/* Empty State */
.teams-empty-state {
text-align: center;
padding: 4rem 2rem;
background: var(--color-bg-secondary);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
}
.teams-empty-icon {
color: var(--color-text-muted);
margin-bottom: 1rem;
}
.teams-empty-state h2 {
margin: 0 0 0.5rem;
font-size: 1.25rem;
}
.teams-empty-state p {
margin: 0 0 1.5rem;
color: var(--color-text-muted);
}
/* Grid */
.teams-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem;
}
/* Team Card */
.team-card {
background: var(--color-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius-lg);
padding: 1.25rem;
cursor: pointer;
transition: all 0.15s ease;
}
.team-card:hover {
border-color: var(--color-primary);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.team-card__header {
display: flex;
align-items: flex-start;
gap: 0.75rem;
margin-bottom: 0.75rem;
}
.team-card__avatar {
width: 40px;
height: 40px;
border-radius: var(--radius-md);
background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover, #2563eb));
color: white;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 1.125rem;
flex-shrink: 0;
}
.team-card__title {
flex: 1;
min-width: 0;
}
.team-card__title h3 {
margin: 0;
font-size: 1rem;
font-weight: 600;
color: var(--color-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.team-card__slug {
font-size: 0.8125rem;
color: var(--color-text-muted);
}
.team-card__description {
font-size: 0.875rem;
color: var(--color-text-secondary);
margin: 0 0 1rem;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.team-card__footer {
display: flex;
gap: 1rem;
padding-top: 0.75rem;
border-top: 1px solid var(--color-border);
}
.team-card__stat {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.8125rem;
color: var(--color-text-muted);
}
.team-card__stat svg {
opacity: 0.7;
}
/* Modal */
.modal-overlay {
position: fixed;
@@ -124,15 +291,43 @@
.modal-content {
background: var(--color-bg);
border-radius: var(--radius-lg);
padding: 1.5rem;
width: 100%;
max-width: 480px;
box-shadow: var(--shadow-xl);
overflow: hidden;
}
.modal-content h2 {
margin: 0 0 1.5rem;
font-size: 1.25rem;
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.25rem 1.5rem;
border-bottom: 1px solid var(--color-border);
}
.modal-header h2 {
margin: 0;
font-size: 1.125rem;
font-weight: 600;
}
.modal-close {
background: none;
border: none;
padding: 0.25rem;
cursor: pointer;
color: var(--color-text-muted);
display: flex;
border-radius: var(--radius-sm);
}
.modal-close:hover {
color: var(--color-text);
background: var(--color-bg-secondary);
}
.modal-content form {
padding: 1.5rem;
}
/* Form */
@@ -147,13 +342,18 @@
font-size: 0.875rem;
}
.form-group .optional {
font-weight: 400;
color: var(--color-text-muted);
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 0.5rem 0.75rem;
padding: 0.625rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
font-size: 0.9375rem;
font-size: 0.875rem;
background: var(--color-bg);
color: var(--color-text);
}
@@ -162,13 +362,34 @@
.form-group textarea:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 2px var(--color-primary-bg);
box-shadow: 0 0 0 3px var(--color-primary-alpha, rgba(59, 130, 246, 0.1));
}
.input-with-prefix {
display: flex;
align-items: stretch;
}
.input-prefix {
display: flex;
align-items: center;
padding: 0 0.75rem;
background: var(--color-bg-secondary);
border: 1px solid var(--color-border);
border-right: none;
border-radius: var(--radius-md) 0 0 var(--radius-md);
color: var(--color-text-muted);
font-size: 0.875rem;
}
.input-with-prefix input {
border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.form-hint {
display: block;
margin-top: 0.25rem;
font-size: 0.8125rem;
font-size: 0.75rem;
color: var(--color-text-muted);
}
@@ -177,6 +398,8 @@
justify-content: flex-end;
gap: 0.75rem;
margin-top: 1.5rem;
padding-top: 1rem;
border-top: 1px solid var(--color-border);
}
/* Buttons */
@@ -216,3 +439,23 @@
.btn-secondary:hover:not(:disabled) {
background: var(--color-bg-tertiary);
}
/* Responsive */
@media (max-width: 640px) {
.teams-header {
flex-direction: column;
align-items: stretch;
}
.teams-header .btn {
justify-content: center;
}
.teams-stats {
justify-content: space-around;
}
.teams-grid {
grid-template-columns: 1fr;
}
}