Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cody: vsce fix auto-scrolling and update loading page #53976

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/cody-ui/src/Chat.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
position: relative;
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 1rem;
gap: 0.25rem;
padding: 0.5rem;
}

.text-area-container {
Expand Down
9 changes: 2 additions & 7 deletions client/cody-ui/src/chat/Transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,17 @@ export const Transcript: React.FunctionComponent<
// We allow some small threshold for "what is considered not scrolled up" so that
// minimal scroll doesn't affect it (ie. if I'm not all the way scrolled down by like a
// pixel or two, I probably still want it to scroll).
const SCROLL_THRESHOLD = 100
const SCROLL_THRESHOLD = 25
const delta = Math.abs(
transcriptContainerRef.current.scrollHeight -
transcriptContainerRef.current.offsetHeight -
transcriptContainerRef.current.scrollTop
)
if (delta < SCROLL_THRESHOLD) {
if (delta <= SCROLL_THRESHOLD) {
transcriptContainerRef.current.scrollTo({
top: transcriptContainerRef.current.scrollHeight,
})
}

// scroll to the end when messages are loaded
transcriptContainerRef.current.scrollTo({
top: transcriptContainerRef.current.scrollHeight,
})
}
}, [transcript, transcriptContainerRef])

Expand Down
35 changes: 35 additions & 0 deletions client/cody/webviews/LoadingPage.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}

.dots-holder {
display: flex;
gap: 1rem;
}

.dot {
animation: 1s flash infinite;
width: calc(var(--vscode-editor-font-size) / 2) !important;
height: calc(var(--vscode-editor-font-size) / 2) !important;
border-radius: 5rem;
background-color: #b200f8;
}

.dot:nth-child(2) {
animation-delay: 250ms;
background-color: #ff5543;
}

.dot:nth-child(3) {
animation-delay: 500ms;
background-color: #00cbec;
}

@keyframes flash {
50% {
background-color: transparent;
}
}
16 changes: 11 additions & 5 deletions client/cody/webviews/LoadingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { VSCodeProgressRing } from '@vscode/webview-ui-toolkit/react'
import styles from './LoadingPage.module.css'

export const LoadingPage: React.FunctionComponent<{}> = () => (
<div className="outer-container">
<div className="inner-container">
<div className="non-transcript-container">
<VSCodeProgressRing />
</div>
<div className={styles.container}>
<LoadingDots />
</div>
</div>
)

const LoadingDots: React.FunctionComponent = () => (
<div className={styles.dotsHolder}>
<div className={styles.dot} />
<div className={styles.dot} />
<div className={styles.dot} />
</div>
)
Loading