Skip to content

Commit d71da1f

Browse files
committed
Rename ApiManagerModal to PanelApiCallsModal and simplify its layout
- rename 'api manager modal' to 'panel api calls modal'
1 parent fbd2cdc commit d71da1f

6 files changed

Lines changed: 15 additions & 156 deletions

File tree

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { post_message } from './utils/post-message'
1212
import { ResponsePreview as UiResponsePreview } from '@ui/components/editor/panel/ResponsePreview'
1313
import { Modal as UiModal } from '@ui/components/editor/panel/modals/Modal'
1414
import { ProgressModal as UiProgressModal } from '@ui/components/editor/panel/modals/ProgressModal'
15-
import { ApiManagerModal as UiApiManagerModal } from '@ui/components/editor/panel/modals/ApiManagerModal'
15+
import { PanelApiCallsModal as UiPanelApiCallsModal } from '@ui/components/editor/panel/modals/PanelApiCallsModal'
1616
import { QRCodeModal as UiQRCodeModal } from '@ui/components/editor/panel/modals/QRCodeModal'
1717
import { AutoClosingModal as UiAutoClosingModal } from '@ui/components/editor/panel/modals/AutoClosingModal'
1818
import { use_panel } from './hooks/use-panel'
@@ -589,7 +589,7 @@ export const Panel = () => {
589589

590590
{Object.keys(api_manager_progress_state).length > 0 && (
591591
<div className={styles.slot}>
592-
<UiApiManagerModal
592+
<UiPanelApiCallsModal
593593
progress_items={Object.entries(api_manager_progress_state).map(
594594
([id, state]) => ({ id, ...state })
595595
)}

‎packages/ui/src/components/editor/panel/modals/ApiManagerModal/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ui/src/components/editor/panel/modals/ApiManagerModal/ApiManagerModal.module.scss renamed to packages/ui/src/components/editor/panel/modals/PanelApiCallsModal/PanelApiCallsModal.module.scss

Lines changed: 5 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
justify-content: flex-end;
1010
padding: 0 12px 48px 8px;
1111
pointer-events: none;
12+
13+
:global([data-modern-ui='true']) & {
14+
padding: 0 10px 38px 8px;
15+
}
1216
}
1317

1418
@keyframes slideIn {
@@ -32,74 +36,14 @@
3236
color: var(--vscode-editorWidget-foreground);
3337
background-color: var(--vscode-editorWidget-background);
3438
border: 1px solid var(--vscode-editorWidget-border);
35-
box-shadow: 0 4px 10px var(--vscode-widget-shadow);
39+
box-shadow: 0 3px 6px var(--vscode-widget-shadow);
3640
width: 100%;
3741
max-width: min(260px, 70vw);
3842
overflow: hidden;
3943
animation: slideIn var(--transition-duration-250)
4044
var(--transition-timing-function);
4145
}
4246

43-
.heading {
44-
display: flex;
45-
justify-content: space-between;
46-
font-weight: 500;
47-
font-size: 11px;
48-
font-weight: 600;
49-
text-transform: uppercase;
50-
display: flex;
51-
align-items: center;
52-
padding: 0 8px;
53-
height: 28px;
54-
background-image: linear-gradient(
55-
to right,
56-
var(--cwc-bg-secondary),
57-
var(--cwc-bg-secondary)
58-
);
59-
background-repeat: no-repeat;
60-
background-size: 0% 100%;
61-
animation: breathe-background 10s infinite linear;
62-
63-
> div {
64-
transform: translateY(2px);
65-
transition: transform var(--transition-duration-250)
66-
var(--transition-timing-function);
67-
}
68-
69-
&__title {
70-
color: var(--vscode-textLink-foreground);
71-
}
72-
73-
&--scrolled > div {
74-
transform: translateY(1px);
75-
}
76-
77-
&__breathing {
78-
position: relative;
79-
color: var(--cwc-text-color-dimmed);
80-
width: 60px;
81-
height: 100%;
82-
83-
&__text {
84-
position: absolute;
85-
top: 0;
86-
right: 0;
87-
height: 100%;
88-
display: flex;
89-
align-items: center;
90-
opacity: 0; // Hidden by default
91-
92-
&--inhale {
93-
animation: inhale-text 10s infinite linear;
94-
}
95-
96-
&--exhale {
97-
animation: exhale-text 10s infinite linear;
98-
}
99-
}
100-
}
101-
}
102-
10347
.requests-container {
10448
display: flex;
10549
flex-direction: column;
@@ -213,57 +157,3 @@
213157
background: transparent;
214158
}
215159
}
216-
217-
@keyframes breathe-background {
218-
0% {
219-
background-size: 0% 100%;
220-
}
221-
50% {
222-
background-size: 100% 100%;
223-
}
224-
100% {
225-
background-size: 0% 100%;
226-
}
227-
}
228-
229-
@keyframes inhale-text {
230-
0% {
231-
opacity: 0;
232-
letter-spacing: 0px;
233-
}
234-
5% {
235-
opacity: 1;
236-
}
237-
45% {
238-
opacity: 1;
239-
}
240-
50% {
241-
opacity: 0;
242-
letter-spacing: 2px;
243-
}
244-
100% {
245-
opacity: 0;
246-
letter-spacing: 2px;
247-
}
248-
}
249-
250-
@keyframes exhale-text {
251-
0% {
252-
opacity: 0;
253-
letter-spacing: 2px;
254-
}
255-
50% {
256-
opacity: 0;
257-
letter-spacing: 2px;
258-
}
259-
55% {
260-
opacity: 1;
261-
}
262-
95% {
263-
opacity: 1;
264-
}
265-
100% {
266-
opacity: 0;
267-
letter-spacing: 0px;
268-
}
269-
}

packages/ui/src/components/editor/panel/modals/ApiManagerModal/ApiManagerModal.stories.tsx renamed to packages/ui/src/components/editor/panel/modals/PanelApiCallsModal/PanelApiCallsModal.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useState } from 'react'
2-
import { ApiManagerModal } from './ApiManagerModal'
2+
import { PanelApiCallsModal } from './PanelApiCallsModal'
33

44
export default {
5-
component: ApiManagerModal
5+
component: PanelApiCallsModal
66
}
77

88
export const Default = () => {
@@ -20,7 +20,7 @@ export const Default = () => {
2020
}
2121

2222
return items.length > 0 ? (
23-
<ApiManagerModal progress_items={items} on_cancel={handle_cancel} />
23+
<PanelApiCallsModal progress_items={items} on_cancel={handle_cancel} />
2424
) : (
2525
<button
2626
onClick={() =>
@@ -150,7 +150,7 @@ export const MultipleItems = () => {
150150
}
151151

152152
return items.length > 0 ? (
153-
<ApiManagerModal progress_items={items} on_cancel={handle_cancel} />
153+
<PanelApiCallsModal progress_items={items} on_cancel={handle_cancel} />
154154
) : (
155155
<button onClick={() => set_items(initial_items)}>Reset</button>
156156
)

packages/ui/src/components/editor/panel/modals/ApiManagerModal/ApiManagerModal.tsx renamed to packages/ui/src/components/editor/panel/modals/PanelApiCallsModal/PanelApiCallsModal.tsx

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { useEffect, useState } from 'react'
2-
import cn from 'classnames'
32
import { Scrollable } from '../../../common/Scrollable'
43
import { use_progress_times } from '../../../../../hooks/use-progress-times'
5-
import styles from './ApiManagerModal.module.scss'
4+
import styles from './PanelApiCallsModal.module.scss'
65

76
type Props = {
87
progress_items: {
@@ -25,9 +24,8 @@ const format_tokens = (tokens: number): string => {
2524
return rounded.toString()
2625
}
2726

28-
export const ApiManagerModal: React.FC<Props> = (props) => {
27+
export const PanelApiCallsModal: React.FC<Props> = (props) => {
2928
const { start_times, now } = use_progress_times(props.progress_items)
30-
const [is_scrolled, set_is_scrolled] = useState(false)
3129
const [window_width, set_window_width] = useState(window.innerWidth)
3230

3331
useEffect(() => {
@@ -48,36 +46,7 @@ export const ApiManagerModal: React.FC<Props> = (props) => {
4846
}}
4947
>
5048
<div className={styles.container}>
51-
<div
52-
className={cn(styles.heading, {
53-
[styles['heading--scrolled']]: is_scrolled
54-
})}
55-
>
56-
<div className={styles.heading__title}>Chats</div>
57-
<div className={styles['heading__breathing']}>
58-
<span
59-
className={cn(
60-
styles['heading__breathing__text'],
61-
styles['heading__breathing__text--inhale']
62-
)}
63-
>
64-
INHALE
65-
</span>
66-
<span
67-
className={cn(
68-
styles['heading__breathing__text'],
69-
styles['heading__breathing__text--exhale']
70-
)}
71-
>
72-
EXHALE
73-
</span>
74-
</div>
75-
</div>
76-
<Scrollable
77-
top_shadow
78-
max_height="25vh"
79-
on_scrolled_change={set_is_scrolled}
80-
>
49+
<Scrollable top_shadow max_height="40vh">
8150
<div className={styles['requests-container']}>
8251
{props.progress_items.map((item) => {
8352
const item_start_time = start_times[item.id]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './PanelApiCallsModal'

0 commit comments

Comments
 (0)