Yuyao Huang 01ae9c964a fix: add position: relative to scroll-view for correct offsetTop
Without position: relative, .task-item offsetParent is the body element,
causing offsetTop to be measured from document root rather than the
scroll container. This makes scrollToTask calculate wrong scrollTop.
2026-05-09 16:06:06 +08:00

308 lines
5.1 KiB
CSS

.tasks-page {
padding: 1rem;
}
.tasks-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
flex-wrap: wrap;
gap: 1rem;
}
.tasks-header h1 {
color: #2c3e50;
}
.goal-selector-container {
display: flex;
align-items: center;
gap: 0.5rem;
}
.goal-selector-container label {
font-weight: 500;
color: #555;
}
.goal-selector-container select {
padding: 0.5rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1rem;
min-width: 200px;
}
.tasks-container {
display: flex;
gap: 2rem;
margin-bottom: 2rem;
}
.scroll-view {
flex: 1;
height: 600px;
overflow-y: auto;
position: relative;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.tasks-list {
padding: 45vh 2rem;
}
.task-item {
padding: 0.75rem 1rem;
border-radius: 6px;
cursor: pointer;
transition: all 0.15s ease;
border: 2px solid transparent;
background: #f8f9fa;
min-height: 60px;
margin-bottom: 0.5rem;
opacity: 0.5;
transform: scale(0.95);
}
.task-item:last-child {
margin-bottom: 0;
}
.task-item.in-focus {
opacity: 1;
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.task-item.in-focus.doing {
background: #fff3cd;
border-color: #ffc107;
}
.task-item.in-focus.todo {
background: #f8f9fa;
border-color: #667eea;
}
.task-item.in-focus.pending {
background: #e7f3ff;
border-color: #2196F3;
}
.task-item.in-focus.done {
background: #d4edda;
border-color: #28a745;
}
.task-item:hover {
background: #e9ecef;
}
.task-item.doing {
background: #fff3cd;
border-color: #ffc107;
transform: scale(1.02);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.task-item.todo {
background: #f8f9fa;
}
.task-item.pending {
background: #e7f3ff;
border-color: #2196F3;
}
.task-item.done {
background: #d4edda;
border-color: #28a745;
opacity: 0.7;
}
.task-title {
font-weight: 600;
margin-bottom: 0.25rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.task-status-badge {
display: inline-block;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
text-transform: uppercase;
}
.task-status-badge.todo {
background: #6c757d;
color: white;
}
.task-status-badge.doing {
background: #ffc107;
color: #333;
}
.task-status-badge.pending {
background: #2196F3;
color: white;
}
.task-status-badge.done {
background: #28a745;
color: white;
}
.task-item.sortable-ghost {
opacity: 0.4;
}
.task-item.sortable-chosen {
box-shadow: 0 8px 16px rgba(0,0,0,0.2);
opacity: 1;
}
.side-panel-header {
padding: 1rem;
border-bottom: 1px solid #ddd;
display: flex;
justify-content: space-between;
align-items: center;
}
.side-panel-header h2 {
color: #2c3e50;
font-size: 1.2rem;
}
.side-panel-close {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: #666;
}
.side-panel-content {
padding: 1rem;
flex: 1;
overflow-y: auto;
}
.side-panel-actions {
display: flex;
gap: 1rem;
margin-top: 1rem;
}
@media (orientation: portrait), (max-width: 1023px) {
.side-panel {
position: fixed;
top: 0;
right: -100%;
width: 85%;
max-width: 400px;
height: 100%;
background: white;
box-shadow: -2px 0 8px rgba(0,0,0,0.1);
transition: right 0.3s ease;
z-index: 1000;
display: flex;
flex-direction: column;
}
.side-panel.active {
right: 0;
}
.scroll-view {
height: 55vh;
}
}
@media (max-width: 480px) {
.scroll-view {
height: 50vh;
}
.tasks-list {
padding: 30vh 1rem;
}
.goal-selector-container {
min-width: 0;
width: 100%;
}
.goal-selector-container select {
min-width: 0;
width: 100%;
max-width: 100%;
}
}
@media (orientation: landscape) and (min-width: 1024px) {
.tasks-page {
display: flex;
flex-direction: column;
gap: 1rem;
height: calc(100vh - 2rem);
}
.tasks-header {
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
}
.tasks-main {
display: flex;
gap: 1rem;
flex: 1;
min-height: 0;
}
.tasks-container {
flex: 1;
display: flex;
margin-bottom: 0;
overflow: hidden;
}
.scroll-view {
height: auto;
flex: 1;
}
.side-panel {
position: relative;
right: 0;
width: 350px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border-radius: 8px;
z-index: 1;
flex-shrink: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.side-panel-close {
display: none;
}
}
.empty-state {
text-align: center;
padding: 3rem;
color: #7f8c8d;
}