Skip to content

Commit 6701a58

Browse files
authored
Remove EL-timeline (#2952)
Signed-off-by: Sameh16 <sameh_mohamed16@hotmail.com>
1 parent 8682cf6 commit 6701a58

File tree

3 files changed

+101
-99
lines changed

3 files changed

+101
-99
lines changed

frontend/src/assets/scss/index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
@import 'drawer';
1919
@import 'animations';
2020
@import 'confirm-dialog';
21-
@import 'timeline';
2221
@import 'badge';
2322
@import 'content';
2423
@import 'popover';

frontend/src/assets/scss/timeline.scss

Lines changed: 0 additions & 24 deletions
This file was deleted.

frontend/src/modules/activity/components/activity-timeline.vue

Lines changed: 101 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
class="w-40"
2020
@clear="reloadActivities"
2121
>
22-
<template
23-
v-if="
24-
platform && lfIdentities[platform]
25-
"
26-
#prefix
27-
>
22+
<template v-if="platform && lfIdentities[platform]" #prefix>
2823
<img
2924
v-if="lfIdentities[platform]"
3025
:alt="lfIdentities[platform].name"
3126
:src="lfIdentities[platform].image"
3227
class="min-w-4 h-4"
3328
/>
34-
<lf-icon v-else name="satellite-dish" :size="16" class="text-gray-400" />
29+
<lf-icon
30+
v-else
31+
name="satellite-dish"
32+
:size="16"
33+
class="text-gray-400"
34+
/>
3535
</template>
3636
<el-option
3737
v-for="enabledPlatform of enabledPlatforms"
@@ -52,7 +52,11 @@
5252
label="Other"
5353
@mouseleave="onSelectMouseLeave"
5454
>
55-
<lf-icon name="satellite-dish" :size="16" class="text-gray-400 mr-2" />
55+
<lf-icon
56+
name="satellite-dish"
57+
:size="16"
58+
class="text-gray-400 mr-2"
59+
/>
5660
Other
5761
</el-option>
5862
</el-select>
@@ -78,13 +82,10 @@
7882
</div>
7983
</div>
8084
<div>
81-
<el-timeline>
85+
<lf-timeline width="2.25rem">
8286
<template v-if="activities.length">
83-
<el-timeline-item
84-
v-for="activity in activities"
85-
:key="activity.id"
86-
>
87-
<div class="-mt-1.5">
87+
<lf-timeline-item v-for="activity in activities" :key="activity.id">
88+
<div class="text-sm pb-5 pl-4">
8889
<app-member-display-name
8990
v-if="entityType === 'organization'"
9091
:member="activity.member"
@@ -93,7 +94,7 @@
9394
class="bl"
9495
/>
9596
<div
96-
class="flex gap-4 justify-between min-h-9 -mt-1"
97+
class="flex gap-4 justify-between min-h-9"
9798
:class="{
9899
'items-center': !isMemberEntity,
99100
'items-start': isMemberEntity,
@@ -109,23 +110,28 @@
109110

110111
<div class="flex items-center flex-nowrap">
111112
<a
112-
v-if="
113-
activity.conversationId && isMemberEntity
114-
"
113+
v-if="activity.conversationId && isMemberEntity"
115114
class="text-xs font-medium flex items-center mr-4 cursor-pointer hover:underline"
116115
target="_blank"
117-
@click="
118-
conversationId = activity.conversationId
119-
"
116+
@click="conversationId = activity.conversationId"
120117
>
121118
<lf-icon name="eye" :size="14" class="mr-1" />
122-
<span class="block whitespace-nowrap">View {{ activity.platform !== Platform.GIT ? 'conversation' : 'commit' }}</span>
119+
<span class="block whitespace-nowrap">View
120+
{{
121+
activity.platform !== Platform.GIT
122+
? "conversation"
123+
: "commit"
124+
}}</span>
123125
</a>
124126
<app-activity-dropdown
125127
v-if="showAffiliations"
126128
:show-affiliations="true"
127129
:activity="activity"
128-
:organizations="entity.organizations ?? activity.member.organizations ?? []"
130+
:organizations="
131+
entity.organizations
132+
?? activity.member.organizations
133+
?? []
134+
"
129135
:disable-edit="true"
130136
@on-update="fetchActivities({ reset: true })"
131137
/>
@@ -134,10 +140,7 @@
134140

135141
<!-- For now only render a special UI for Git -->
136142
<div v-if="activity.platform === Platform.GIT">
137-
<lf-activity-display
138-
:activity="activity"
139-
in-profile
140-
/>
143+
<lf-activity-display :activity="activity" in-profile />
141144
</div>
142145
<div v-else>
143146
<app-lf-activity-parent
@@ -151,25 +154,36 @@
151154
:activity="activity"
152155
:show-more="true"
153156
>
154-
<template v-if="lfIdentities[activity.platform]?.activity?.showContentDetails" #details>
157+
<template
158+
v-if="
159+
lfIdentities[activity.platform]?.activity
160+
?.showContentDetails
161+
"
162+
#details
163+
>
155164
<div v-if="activity.attributes">
156165
<app-activity-content-footer
157-
:source-id="isMemberEntity && activity.parent ? activity.parent?.sourceId : activity.sourceId"
166+
:source-id="
167+
isMemberEntity && activity.parent
168+
? activity.parent?.sourceId
169+
: activity.sourceId
170+
"
158171
:changes="activity.attributes.lines"
159172
changes-copy="line"
160173
:insertions="activity.attributes.insertions"
161174
:deletions="activity.attributes.deletions"
162-
:display-source-id="isMemberEntity && activity.parent
163-
? activity.parent?.type === 'authored-commit' : activity.type === 'authored-commit'"
175+
:display-source-id="
176+
isMemberEntity && activity.parent
177+
? activity.parent?.type === 'authored-commit'
178+
: activity.type === 'authored-commit'
179+
"
164180
/>
165181
</div>
166182
</template>
167183

168184
<template #bottomLink>
169185
<div v-if="activity.url" class="pt-6">
170-
<app-activity-link
171-
:activity="activity"
172-
/>
186+
<app-activity-link :activity="activity" />
173187
</div>
174188
</template>
175189
</app-activity-content>
@@ -182,16 +196,19 @@
182196
>
183197
<img
184198
v-if="lfIdentities[activity.platform]"
185-
:src="
186-
lfIdentities[activity.platform].image
187-
"
199+
:src="lfIdentities[activity.platform].image"
188200
:alt="`${activity.platform}-icon`"
189201
class="min-w-4 h-4"
190202
/>
191-
<lf-icon name="satellite-dish" :size="16" class="text-gray-400" />
203+
<lf-icon
204+
v-else
205+
name="satellite-dish"
206+
:size="16"
207+
class="text-gray-400"
208+
/>
192209
</span>
193210
</template>
194-
</el-timeline-item>
211+
</lf-timeline-item>
195212
</template>
196213

197214
<app-empty-state-cta
@@ -200,12 +217,8 @@
200217
title="No activities found"
201218
description="We couldn't find any results that match your search criteria, please try a different query"
202219
/>
203-
</el-timeline>
204-
<div
205-
v-if="loading"
206-
v-loading="loading"
207-
class="app-page-spinner"
208-
/>
220+
</lf-timeline>
221+
<div v-if="loading" v-loading="loading" class="app-page-spinner" />
209222
<div v-if="!noMore" class="flex justify-center pt-4">
210223
<lf-button
211224
type="primary-ghost"
@@ -228,11 +241,7 @@
228241
<script setup lang="ts">
229242
import { useStore } from 'vuex';
230243
import {
231-
computed,
232-
ref,
233-
h,
234-
onMounted,
235-
watch,
244+
computed, ref, h, onMounted, watch,
236245
} from 'vue';
237246
import debounce from 'lodash/debounce';
238247
import AppActivityHeader from '@/modules/activity/components/activity-header.vue';
@@ -253,6 +262,9 @@ import LfButton from '@/ui-kit/button/Button.vue';
253262
import { IdentityConfig, lfIdentities } from '@/config/identities';
254263
import AppEmptyStateCta from '@/shared/empty-state/empty-state-cta.vue';
255264
import { dateHelper } from '@/shared/date-helper/date-helper';
265+
import LfTimeline from '@/ui-kit/timeline/Timeline.vue';
266+
import LfTimelineItem from '@/ui-kit/timeline/TimelineItem.vue';
267+
import LfIcon from '@/ui-kit/icon/Icon.vue';
256268
import { ActivityService } from '../activity-service';
257269
258270
const SearchIcon = h(
@@ -313,15 +325,23 @@ const subprojects = computed(() => projectGroups.value.list.reduce((acc, project
313325
314326
const segments = computed(() => {
315327
if (!props.entity.segments) {
316-
return getSegmentsFromProjectGroup(selectedProjectGroup.value)?.map((s) => subprojects.value[s]) || [];
328+
return (
329+
getSegmentsFromProjectGroup(selectedProjectGroup.value)?.map(
330+
(s) => subprojects.value[s],
331+
) || []
332+
);
317333
}
318-
return props.entity.segments?.map((s) => {
319-
if (typeof s === 'string') {
320-
return subprojects.value[s];
321-
}
322-
323-
return s;
324-
}).filter((s) => !!s) || [];
334+
return (
335+
props.entity.segments
336+
?.map((s) => {
337+
if (typeof s === 'string') {
338+
return subprojects.value[s];
339+
}
340+
341+
return s;
342+
})
343+
.filter((s) => !!s) || []
344+
);
325345
});
326346
327347
const fetchActivities = async ({ reset } = { reset: false }) => {
@@ -361,11 +381,17 @@ const fetchActivities = async ({ reset } = { reset: false }) => {
361381
lte: timestamp.value,
362382
},
363383
},
364-
...(timestamp.value ? [{
365-
timestamp: {
366-
gte: dateHelper(timestamp.value).subtract(1, 'month').toISOString(),
367-
},
368-
}] : []),
384+
...(timestamp.value
385+
? [
386+
{
387+
timestamp: {
388+
gte: dateHelper(timestamp.value)
389+
.subtract(1, 'month')
390+
.toISOString(),
391+
},
392+
},
393+
]
394+
: []),
369395
];
370396
371397
if (reset) {
@@ -384,7 +410,9 @@ const fetchActivities = async ({ reset } = { reset: false }) => {
384410
filter: filterToApply,
385411
orderBy: 'timestamp_DESC',
386412
limit: limit.value,
387-
segments: selectedSegment.value ? [selectedSegment.value] : segments.value.map((s) => s.id),
413+
segments: selectedSegment.value
414+
? [selectedSegment.value]
415+
: segments.value.map((s) => s.id),
388416
});
389417
390418
loading.value = false;
@@ -397,7 +425,9 @@ const fetchActivities = async ({ reset } = { reset: false }) => {
397425
activities.value = reset ? rows : [...activities.value, ...rows];
398426
399427
if (data.rows.length === 0) {
400-
timestamp.value = dateHelper(timestamp.value).subtract(1, 'month').toISOString();
428+
timestamp.value = dateHelper(timestamp.value)
429+
.subtract(1, 'month')
430+
.toISOString();
401431
} else {
402432
timestamp.value = dateHelper(data.rows.at(-1).timestamp).toISOString();
403433
}
@@ -425,7 +455,10 @@ watch(platform, async (newValue, oldValue) => {
425455
});
426456
427457
onMounted(async () => {
428-
await store.dispatch('integration/doFetch', segments.value.map((s) => s.id));
458+
await store.dispatch(
459+
'integration/doFetch',
460+
segments.value.map((s) => s.id),
461+
);
429462
await fetchActivities();
430463
});
431464
@@ -452,14 +485,8 @@ export default {
452485
.activity-header {
453486
@apply max-w-full overflow-visible;
454487
}
455-
.el-timeline-item__dot {
456-
@apply relative;
457-
}
458-
.el-timeline-item__wrapper {
459-
@apply top-1 pl-4;
460-
}
461-
.el-timeline-item__tail {
462-
@apply left-4;
488+
.c-timeline__prefix:after {
489+
width: 1.2px;
463490
}
464491
}
465492
</style>

0 commit comments

Comments
 (0)