Skip to content

Commit 3f83a7a

Browse files
committed
day timeline transitions
1 parent b0da4c6 commit 3f83a7a

3 files changed

Lines changed: 37 additions & 18 deletions

File tree

src/components/ActivityBlockItem.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,24 @@
9898
filter: brightness(1.07);
9999
}
100100
101+
.activity-leave-active {
102+
transition: opacity 0.2s ease;
103+
pointer-events: none;
104+
}
105+
106+
.activity-leave-to {
107+
opacity: 0;
108+
}
109+
110+
.activity-enter-active {
111+
transition: opacity 0.3s ease;
112+
transition-delay: calc(0.2s + min(calc(var(--i, 0) * 20ms), 280ms));
113+
}
114+
115+
.activity-enter-from {
116+
opacity: 0;
117+
}
118+
101119
.app-name {
102120
display: block;
103121
font-size: 11px;

src/components/TimelineCanvas.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import EntryTrack from './EntryTrack.vue'
1010
import ProjectPickerModal from './ProjectPickerModal.vue'
1111
12+
defineOptions({ inheritAttrs: false })
13+
1214
const dayStore = useDayStore()
1315
const { totalHeight, hours, minuteToY } = useTimeline()
1416
const { pendingCreate, editingEntry } = useEntryModal()
@@ -71,7 +73,7 @@
7173
</script>
7274

7375
<template>
74-
<div class="timeline-canvas">
76+
<div class="timeline-canvas" v-bind="$attrs">
7577
<!-- Column headers -->
7678
<div class="col-headers">
7779
<div class="ruler-spacer" />
@@ -97,11 +99,14 @@
9799

98100
<!-- Activity track (left, read-only) -->
99101
<div class="activity-track" :style="{ height: totalHeight + 'px' }">
100-
<ActivityBlockItem
101-
v-for="(block, i) in dayStore.activityBlocks"
102-
:key="i"
103-
:block="block"
104-
/>
102+
<TransitionGroup name="activity">
103+
<ActivityBlockItem
104+
v-for="(block, i) in dayStore.activityBlocks"
105+
:key="block.startedAt"
106+
:style="{ '--i': i }"
107+
:block="block"
108+
/>
109+
</TransitionGroup>
105110
<div v-if="!dayStore.loading && dayStore.activityBlocks.length === 0" class="empty-track">
106111
No activity recorded
107112
</div>
@@ -200,6 +205,7 @@
200205
.activity-track {
201206
position: relative;
202207
flex: 1;
208+
overflow: hidden;
203209
border-left: 1px solid var(--border);
204210
min-width: 0;
205211
}

src/views/TimelineView.vue

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@
9090
</div>
9191

9292
<div class="main-area">
93-
<div v-if="dayStore.loading" class="loading">Loading…</div>
94-
<div v-else-if="dayStore.loadError" class="load-error">
93+
<TimelineCanvas class="timeline-col" />
94+
<div v-if="dayStore.loadError" class="load-error">
9595
Error loading data: {{ dayStore.loadError }}
9696
</div>
97-
<TimelineCanvas v-show="!dayStore.loading && !dayStore.loadError" class="timeline-col" />
9897
<WindowSummary />
9998
<ProjectSummary />
10099
</div>
@@ -134,29 +133,25 @@
134133
display: flex;
135134
flex: 1;
136135
overflow: hidden;
136+
position: relative;
137137
}
138138
139139
.timeline-col {
140140
flex: 1;
141141
min-width: 0;
142142
}
143143
144-
.loading {
145-
flex: 1;
146-
display: flex;
147-
align-items: center;
148-
justify-content: center;
149-
color: var(--text-muted);
150-
}
151-
152144
.load-error {
153-
flex: 1;
145+
position: absolute;
146+
inset: 0;
154147
display: flex;
155148
align-items: center;
156149
justify-content: center;
157150
color: #ef4444;
158151
padding: 16px;
159152
text-align: center;
160153
white-space: pre-wrap;
154+
background: var(--bg);
155+
z-index: 20;
161156
}
162157
</style>

0 commit comments

Comments
 (0)