-
Notifications
You must be signed in to change notification settings - Fork 63
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
[DOCSP-32954] Add ErrorBanner, React-Transition-Group #182
Conversation
if (conversationError) | ||
return ( | ||
<div className={styles.chatbot_input_area}> | ||
<ErrorBanner darkMode={darkMode} message={conversationError} /> | ||
</div> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think conversation errors are the concern of the input bar, especially given that we use it here to short circuit rendering. In the docs Chatbot
component we conditionally render the InputBar based on conversation error state rather than have the InputBar handle the conditional internally.
Could we refactor here to use that pattern instead? It'll make it easier to combine this all into shared components.
const defaultStyle = { | ||
transition: `opacity ${duration}ms ease-in`, | ||
opacity: 0, | ||
}; | ||
|
||
const transitionStyles = { | ||
entering: { opacity: 1 }, | ||
entered: { opacity: 1 }, | ||
exiting: { opacity: 0 }, | ||
exited: { opacity: 0 }, | ||
unmounted: { opacity: 0 }, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use emotion for this instead of the jsx style
prop. Also at this point we're not actually using any of these states so RTG isn't adding anything until we wire it up.
Since we're only doing CSS transitions right now I think it'd be easier to switch to CSSTransition
- then we don't have to manually process the state. We just write the CSS we want for each state and it's wired up automatically.
You should be able to put all this in the message_prompts
css (note the different state names compared to regular Transition
):
message_prompts: css`
margin-left: 70px;
@media screen and (max-width: 804px) {
margin-left: 50px;
}
transition: opacity ${duration}ms ease-in;
&-enter {
opacity: 0;
}
&-enter-active {
opacity: 1;
}
&-exit {
opacity: 1;
}
&-exit-active {
opacity: 0;
}
`,
then you'll replace Transition
with CSSTransition
, add the prop classNames={styles.message_prompts}
, and then add ref={nodeRef}
to the div that has the message_prompts
style.
<Transition in={inProp} timeout={duration} nodeRef={nodeRef}> | ||
{(state) => ( | ||
<div | ||
className={styles.message_prompts} | ||
style={{ ...defaultStyle, ...transitionStyles[state] }} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per my earlier comment about using emotion & CSSTransition. Also make sure to import CSSTransition
and delete the closing })
too!
<Transition in={inProp} timeout={duration} nodeRef={nodeRef}> | |
{(state) => ( | |
<div | |
className={styles.message_prompts} | |
style={{ ...defaultStyle, ...transitionStyles[state] }} | |
> | |
<CSSTransition | |
in={inProp} | |
timeout={duration} | |
nodeRef={nodeRef} | |
classNames={styles.message_prompts} | |
> | |
<div | |
className={styles.message_prompts} | |
ref={nodeRef} | |
> |
* [DOCSP-32954] feat(devcenter-chatbot): Add React-Transition-Group * [DOCSP-32954] feat(devcenter-chatbot): Add ErrorBanner * [DOCSP-32954] refactor(devcenter-chatbot): inputbar * [DOCSP-32954] refactor(devcenter-chatbot): react-transition-group * [DOCSP-32954] refactor(devcenter-chatbot): cleanup * [DOCSP-32954] refactor(devcenter-chatbot): update per sugestions
* [DOCSP-32953] Create basic elements to match with design (#158) * Initial Setup * [Snyk] Upgrade urllib from 3.17.2 to 3.18.0 (#147) * fix: upgrade urllib from 3.17.2 to 3.18.0 Snyk has created this PR to upgrade urllib from 3.17.2 to 3.18.0. See this package in npm: https://www.npmjs.com/package/urllib See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade urllib from 3.17.2 to 3.18.0 Snyk has created this PR to upgrade urllib from 3.17.2 to 3.18.0. See this package in npm: https://www.npmjs.com/package/urllib See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io> * (DOCSP-32670): Basic server load testing (#136) * draft basic load test w localhost..code working * add env base URL + second msg * ES5 for goja runtime * increase load + remove sleep * clean up * add bypass WAF headers * reduce # users * update staging test instructions * Apply suggestions from code review * (DOCSP-32757) [UI] Update to Responsive LG Chat Components (#145) * Add root release:chat-ui command * Release chat-ui-v0.0.5 * Update chat-ui release config * add default + remove unused style * (DOCSP-32616): Refactor config, add library, and log config (#143) * fix merge weirdness * latest updates checkpoint * app config refactor * add logger * remove index imports * export lib modules * change lib entry point * separate config module from running server for no port collision/separation of concern * update TS entry point * fix broken test * Update chat-server/src/app.ts * Update chat-server/src/app.ts * make preprocessor less biased toward shell (#149) * make preprocessor less biased toward shell * adjust test for pre-processor change * [Snyk] Upgrade mongodb from 5.8.0 to 5.8.1 (#151) * fix: upgrade mongodb from 5.8.0 to 5.8.1 Snyk has created this PR to upgrade mongodb from 5.8.0 to 5.8.1. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade mongodb from 5.8.0 to 5.8.1 Snyk has created this PR to upgrade mongodb from 5.8.0 to 5.8.1. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io> * add missing env example (#153) * change recommended prompt (#150) * [DOCSP-32953] feat(devcenter-chatbot): Create a DevCenter modal for mocked design * [DOCSP-32953] feat(devcenter-chatbot): Comment unused components --------- Co-authored-by: admin-token-bot <36773031+admin-token-bot@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io> Co-authored-by: Ben Perlmutter <90647379+mongodben@users.noreply.github.com> Co-authored-by: Nick Larew <nick.larew@mongodb.com> * [DOCSP-32954] Connect to backend to add messages (#169) * [Snyk] Upgrade urllib from 3.17.2 to 3.18.0 (#147) * fix: upgrade urllib from 3.17.2 to 3.18.0 Snyk has created this PR to upgrade urllib from 3.17.2 to 3.18.0. See this package in npm: https://www.npmjs.com/package/urllib See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade urllib from 3.17.2 to 3.18.0 Snyk has created this PR to upgrade urllib from 3.17.2 to 3.18.0. See this package in npm: https://www.npmjs.com/package/urllib See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io> * (DOCSP-32670): Basic server load testing (#136) * draft basic load test w localhost..code working * add env base URL + second msg * ES5 for goja runtime * increase load + remove sleep * clean up * add bypass WAF headers * reduce # users * update staging test instructions * Apply suggestions from code review * (DOCSP-32757) [UI] Update to Responsive LG Chat Components (#145) * Add root release:chat-ui command * Release chat-ui-v0.0.5 * Update chat-ui release config * add default + remove unused style * (DOCSP-32616): Refactor config, add library, and log config (#143) * fix merge weirdness * latest updates checkpoint * app config refactor * add logger * remove index imports * export lib modules * change lib entry point * separate config module from running server for no port collision/separation of concern * update TS entry point * fix broken test * Update chat-server/src/app.ts * Update chat-server/src/app.ts * make preprocessor less biased toward shell (#149) * make preprocessor less biased toward shell * adjust test for pre-processor change * [Snyk] Upgrade mongodb from 5.8.0 to 5.8.1 (#151) * fix: upgrade mongodb from 5.8.0 to 5.8.1 Snyk has created this PR to upgrade mongodb from 5.8.0 to 5.8.1. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade mongodb from 5.8.0 to 5.8.1 Snyk has created this PR to upgrade mongodb from 5.8.0 to 5.8.1. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/eng-documentationcloud-docs/project/2b705138-3e0b-4171-85b9-1c6093803e80?utm_source=github&utm_medium=referral&page=upgrade-pr --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io> * add missing env example (#153) * change recommended prompt (#150) * (DOCSP-32993, DOCSP-32906, DOCSP-32993, DOCSP-32990): Data sources for MD on Github + data ingestion of related content (#148) * stub out scquit source * draft of mongoose ingestion * clean up * add data source to CLI * fix langchain version * lock file updates * rebase + fix merge conflict * checkpoint * add other data sources * lock file update * fix broken test * more robust testing + annotations * Apply suggestions from code review Co-authored-by: Chris Bush <chris.bush@10gen.com> * implement CB feedback * fix broken test * implement addtional CB feedback --------- Co-authored-by: Chris Bush <chris.bush@10gen.com> * (DOCSP-33090) [UI] Remove experimental badge from input on focus (#155) * (DOCSP-32915) [UI] Streamer bugs out when switching tabs (#156) * (DOCSP-32991, DOCSP-32992): `GitDataSource`, functionality for converting HTML to Markdown, ingest Scala, Java Reactive Streams, and C docs (#152) * start stubbing out data source * draft GH HTML to MD * working handler w git data source * add scala/java reactive streams data sources * Add C driver * ingest C docs * fix page path func * add TODOs from other PR * strip HTML links + imgs * inc test timeout * rimraf in finally block * add git to dockerfile * move git install to correct docker stage * clarify ingest readme * (DOCSP-31928): Implement numbered lists (#154) * Refactor snooty rendering * Implement numbered list * Fix test * Fix test * Fix table render bug * Add more logging for render table issue * filter out very small chunks (#160) * filter out small chunks * fix failing tests * Fix failing tests * make min token count configurable * Update ingest/src/chunkMd.ts * Expand Contributing Guide and `ingest` README (#161) * updates * add git workflow * Launch pre releases (#162) * Release 0.0.6-1 * Release 0.0.10-1 * update lock file * Update README.md * update repo name in code (#163) * update repo name in code * Trigger build * Delete chat-server/trigger.me (#165) should have not been committed * UI Tweaks (#159) * clean up spec + remove ip address validation from rate msg (#166) * clean up spec + remove ip address validation from rate msg * remove test set up block for removed test * trigger ingest build * [DOCSP-32954] feat(devcenter-chatbot): Connect to backend to create a conversation and add messages * [DOCSP-32954] feat(devcenter-chatbot): Fix merge issues * [DOCSP-32954] feat(devcenter-chatbot): Fix PR Test issues * [DOCSP-32954] feat(devcenter-chatbot): Fix PR Test issues * [DOCSP-32954] feat(devcenter-chatbot): Add margin-left to message_prompts * [DOCSP-32954] feat(devcenter-chatbot): Add margin-top to ratings --------- Co-authored-by: admin-token-bot <36773031+admin-token-bot@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io> Co-authored-by: Ben Perlmutter <90647379+mongodben@users.noreply.github.com> Co-authored-by: Nick Larew <nick.larew@mongodb.com> Co-authored-by: Chris Bush <chris.bush@10gen.com> Co-authored-by: Chris Bush <chris.bush@mongodb.com> * [DOCSP-32954] Add Rating, Character Count, Initial, Disclaimer (#176) * [DOCSP-32954] feat(devcenter-chatbot): Fix merge issues * [DOCSP-32954] feat(devcenter-chatbot): Enable Rating and Add Disclaimer * [DOCSP-32954] feat(devcenter-chatbot): Add Character Count * [DOCSP-32954] feat(devcenter-chatbot): Pass user as prop * [DOCSP-32954] feat(devcenter-chatbot): Remove comment * [DOCSP-32954] feat(devcenter-chatbot): Fix Test Issue * [DOCSP-32954] feat(devcenter-chatbot): Fix Test Issue * [DOCSP-32954] feat(devcenter-chatbot): Remove unnecessary files * [DOCSP-32954] feat(devcenter-chatbot): Fix Test Issue * Resolve merge issue * [DOCSP-32954] Add ErrorBanner, React-Transition-Group #182 (#189) * [DOCSP-32954] feat(devcenter-chatbot): Add React-Transition-Group * [DOCSP-32954] feat(devcenter-chatbot): Add ErrorBanner * [DOCSP-32954] refactor(devcenter-chatbot): inputbar * [DOCSP-32954] refactor(devcenter-chatbot): react-transition-group * [DOCSP-32954] refactor(devcenter-chatbot): cleanup * [DOCSP-32954] refactor(devcenter-chatbot): update per sugestions * [DOCSP-32954] refactor(devcenter-chatbot): update per PR comments --------- Co-authored-by: admin-token-bot <36773031+admin-token-bot@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io> Co-authored-by: Ben Perlmutter <90647379+mongodben@users.noreply.github.com> Co-authored-by: Nick Larew <nick.larew@mongodb.com> Co-authored-by: Chris Bush <chris.bush@10gen.com> Co-authored-by: Chris Bush <chris.bush@mongodb.com>
Resources