Skip to content

Commit e797964

Browse files
committed
Refactor development
1 parent 6f0c2ad commit e797964

31 files changed

+686
-710
lines changed

src/assets/collapse.svg

Lines changed: 4 additions & 8 deletions
Loading

src/assets/expand.svg

Lines changed: 4 additions & 8 deletions
Loading

src/assets/tag.svg

Lines changed: 8 additions & 0 deletions
Loading

src/components/FilterInput/AutoCompleteFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const AutoCompleteFilter: React.FC<Props> = ({ autoCompleteSettings, onClear, op
7878
};
7979

8080
const Content = styled.div`
81-
width: max-content;
81+
width: auto;
8282
`;
8383

8484
const FilterPopupHeading = styled.div`

src/components/FilterInput/FilterRows.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export const FilterClickableRow = styled.div<{ disabled?: boolean; danger?: bool
2626
opacity: ${(p) => (p.disabled ? 0.2 : 1)};
2727
color: ${(p) => (p.danger ? 'var(--color-text-danger)' : 'var(--color-text-primary)')};
2828
29+
white-space: normal;
30+
2931
&:hover {
3032
background: var(--color-bg-secondary);
3133
}

src/components/Icon/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { ReactComponent as SearchNotFound } from '@assets/search-not-found.svg';
4040
import { ReactComponent as Search } from '@assets/search.svg';
4141
import { ReactComponent as Sort } from '@assets/sort.svg';
4242
import { ReactComponent as Success } from '@assets/success.svg';
43+
import { ReactComponent as Tag } from '@assets/tag.svg';
4344
import { ReactComponent as Timeline } from '@assets/timeline.svg';
4445
import { ReactComponent as Times } from '@assets/times.svg';
4546
import { ReactComponent as ToTopArrow } from '@assets/to_top_arrow.svg';
@@ -88,6 +89,7 @@ const icons = {
8889
searchNotFound: SearchNotFound,
8990
sort: Sort,
9091
success: Success,
92+
tag: Tag,
9193
timeline: Timeline,
9294
times: Times,
9395
trash: Trash,

src/components/Table/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ export const TR = styled.tr<{ clickable?: boolean; stale?: boolean; active?: boo
110110
: ''}
111111
`;
112112

113-
const HeaderColumnWrapper = styled.div`
113+
const HeaderColumnWrapper = styled.div<{ alignment: 'left' | 'right' | 'center' }>`
114114
display: flex;
115115
align-items: center;
116116
min-height: 1.25rem;
117+
justify-content: ${(p) =>
118+
p.alignment === 'right' ? 'flex-end' : p.alignment === 'center' ? 'center' : 'flex-start'};
117119
`;
118120

119121
interface HeaderColumnProps {
@@ -123,6 +125,7 @@ interface HeaderColumnProps {
123125
onSort: (ord: string) => void;
124126
sortable: boolean;
125127
maxWidth?: string;
128+
alignment?: 'left' | 'right' | 'center';
126129
}
127130

128131
export const HeaderColumn: React.FC<HeaderColumnProps> = ({
@@ -132,6 +135,7 @@ export const HeaderColumn: React.FC<HeaderColumnProps> = ({
132135
sortable = true,
133136
onSort,
134137
maxWidth,
138+
alignment = 'left',
135139
...rest
136140
}) => {
137141
const [direction, orderParam] = currentOrder ? parseOrderParam(currentOrder) : ['down' as const, ''];
@@ -147,12 +151,12 @@ export const HeaderColumn: React.FC<HeaderColumnProps> = ({
147151
maxWidth
148152
? {
149153
maxWidth: maxWidth + (maxWidth.indexOf('%') > -1 ? '' : 'px'),
150-
width: maxWidth + (maxWidth.indexOf('%') > -1 ? '' : 'px'),
154+
// width: maxWidth + (maxWidth.indexOf('%') > -1 ? '' : 'px'),
151155
}
152156
: {}
153157
}
154158
>
155-
<HeaderColumnWrapper>
159+
<HeaderColumnWrapper alignment={alignment}>
156160
{label}
157161
{sortable && (
158162
<SortIconContainer>

src/components/Tooltip/index.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ import styled from 'styled-components';
1414
const Tooltip: React.FC<TooltipProps> = ({ children, ...props }) => {
1515
return (
1616
<CustomTooltip>
17-
<ReactTooltip className="custom-tooltip" delayHide={250} place="bottom" effect="solid" {...props}>
17+
<ReactTooltip
18+
className="custom-tooltip"
19+
delayHide={250}
20+
place="bottom"
21+
effect="solid"
22+
arrowColor="transparent"
23+
{...props}
24+
>
1825
{children}
1926
</ReactTooltip>
2027
</CustomTooltip>
@@ -29,25 +36,22 @@ const CustomTooltip = styled.div`
2936
.custom-tooltip {
3037
cursor: auto;
3138
max-width: 37.5rem;
32-
background: #fff;
33-
color: #333;
34-
padding: 1rem;
39+
padding: 0.25rem 0.5rem;
40+
background: #31302fe5;
41+
color: #fff;
3542
font-size: 0.75rem;
3643
border-radius: var(--radius-primary);
37-
border: 1px solid #d0d0d0;
38-
box-shadow: 2px 2px 4px rgb(0 0 0 / 25%);
3944
white-space: pre;
4045
pointer-events: auto;
4146
47+
&::before {
48+
display: none;
49+
}
50+
4251
&.show {
4352
opacity: 1;
4453
}
4554
46-
&.place-bottom::after,
47-
&.place-top::after {
48-
border-bottom-color: #fff;
49-
background: #fff;
50-
}
5155
&:hover {
5256
visibility: visible;
5357
opacity: 1;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import Tooltip from '@/components/Tooltip';
4+
import { TriggerEventsValue } from '@/components/Trigger';
5+
6+
type TriggerBadgeInfo =
7+
| {
8+
type: 'user';
9+
data: string;
10+
}
11+
| { type: 'trigger'; data: TriggerEventsValue[] };
12+
13+
type Props = {
14+
id: number;
15+
content: TriggerBadgeInfo;
16+
};
17+
18+
const TriggeredByBadge: React.FC<Props> = ({ id, content }) => {
19+
if (content.type === 'user') {
20+
return <Badge badgeType="user">{content.data}</Badge>;
21+
}
22+
23+
const tooltipId = `trigger-tooltip-${id}`;
24+
25+
return (
26+
<Badges>
27+
{content.data.slice(0, 1).map((item) => (
28+
<Badge key={item.name} badgeType={item.type}>
29+
{item.name}
30+
</Badge>
31+
))}
32+
{content.data.length > 1 && (
33+
<Badge badgeType="event" data-tip data-for={tooltipId}>
34+
+{content.data.length - 1}
35+
</Badge>
36+
)}
37+
<Tooltip id={tooltipId} place="bottom">
38+
{content.data.map((item) => (
39+
<div key={item.name}>{item.name}</div>
40+
))}
41+
</Tooltip>
42+
</Badges>
43+
);
44+
};
45+
46+
const Badges = styled.div`
47+
display: flex;
48+
flex-wrap: nowrap;
49+
gap: 0.25rem;
50+
`;
51+
52+
const Badge = styled.div<{ badgeType: 'user' | 'event' | 'run' }>`
53+
border: 1px solid;
54+
border-radius: 6px;
55+
padding: 0.25rem;
56+
border-color: ${(p) => (p.badgeType === 'run' ? '#4E7CA766' : '#6A68674D')};
57+
color: var(--color-text-light);
58+
text-overflow: ellipsis;
59+
width: max-content;
60+
max-width: 150px;
61+
white-space: nowrap;
62+
overflow: hidden;
63+
`;
64+
65+
export default TriggeredByBadge;

src/components/VerticalToggle/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Props = {
1919
const VerticalToggle: React.FC<Props> = ({ visible, active, onClick }) => {
2020
return (
2121
<ToggleContainer data-testid="vertical-toggle" onClick={onClick} show={visible}>
22-
<Icon name="chevron" size="sm" rotate={active ? 180 : 0} />
22+
<Icon name={active ? 'collapse' : 'expand'} size="xs" />
2323
</ToggleContainer>
2424
);
2525
};

0 commit comments

Comments
 (0)