File tree Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export default function MessagesView({
17
17
Header ?: ReactNode ;
18
18
} ) {
19
19
const localize = useLocalize ( ) ;
20
+ const scrollButtonPreference = useRecoilValue ( store . showScrollButton ) ;
20
21
const fontSize = useRecoilValue ( store . fontSize ) ;
21
22
const { screenshotTargetRef } = useScreenshot ( ) ;
22
23
const [ currentEditId , setCurrentEditId ] = useState < number | string | null > ( - 1 ) ;
@@ -83,7 +84,10 @@ export default function MessagesView({
83
84
unmountOnExit = { false }
84
85
// appear
85
86
>
86
- { ( ) => showScrollButton && < ScrollToBottom scrollHandler = { handleSmoothToRef } /> }
87
+ { ( ) =>
88
+ showScrollButton &&
89
+ scrollButtonPreference && < ScrollToBottom scrollHandler = { handleSmoothToRef } />
90
+ }
87
91
</ CSSTransition >
88
92
</ div >
89
93
</ div >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { ForkSettings } from './ForkSettings';
7
7
import ChatDirection from './ChatDirection' ;
8
8
import ShowThinking from './ShowThinking' ;
9
9
import LaTeXParsing from './LaTeXParsing' ;
10
+ import ScrollButton from './ScrollButton' ;
10
11
import ModularChat from './ModularChat' ;
11
12
import SaveDraft from './SaveDraft' ;
12
13
@@ -31,6 +32,9 @@ function Chat() {
31
32
< div className = "pb-3" >
32
33
< SaveDraft />
33
34
</ div >
35
+ < div className = "pb-3" >
36
+ < ScrollButton />
37
+ </ div >
34
38
< ForkSettings />
35
39
< div className = "pb-3" >
36
40
< ModularChat />
Original file line number Diff line number Diff line change 1
1
import { useRecoilState } from 'recoil' ;
2
- import HoverCardSettings from '../HoverCardSettings' ;
3
2
import { Switch } from '~/components/ui/Switch' ;
4
3
import useLocalize from '~/hooks/useLocalize' ;
5
4
import store from '~/store' ;
Original file line number Diff line number Diff line change
1
+ import { useRecoilState } from 'recoil' ;
2
+ import { Switch } from '~/components/ui/Switch' ;
3
+ import useLocalize from '~/hooks/useLocalize' ;
4
+ import store from '~/store' ;
5
+
6
+ export default function ScrollButton ( {
7
+ onCheckedChange,
8
+ } : {
9
+ onCheckedChange ?: ( value : boolean ) => void ;
10
+ } ) {
11
+ const [ showScrollButton , setShowScrollButton ] = useRecoilState < boolean > ( store . showScrollButton ) ;
12
+ const localize = useLocalize ( ) ;
13
+
14
+ const handleCheckedChange = ( value : boolean ) => {
15
+ setShowScrollButton ( value ) ;
16
+ if ( onCheckedChange ) {
17
+ onCheckedChange ( value ) ;
18
+ }
19
+ } ;
20
+
21
+ return (
22
+ < div className = "flex items-center justify-between" >
23
+ < div className = "flex items-center space-x-2" >
24
+ < div > { localize ( 'com_nav_scroll_button' ) } </ div >
25
+ </ div >
26
+ < Switch
27
+ id = "scrollButton"
28
+ checked = { showScrollButton }
29
+ onCheckedChange = { handleCheckedChange }
30
+ className = "ml-4"
31
+ data-testid = "scrollButton"
32
+ />
33
+ </ div >
34
+ ) ;
35
+ }
Original file line number Diff line number Diff line change @@ -882,6 +882,7 @@ export default {
882
882
com_nav_command_settings : 'Command Settings' ,
883
883
com_nav_command_settings_description : 'Customize which commands are available in the chat' ,
884
884
com_nav_no_search_results : 'No search results found' ,
885
+ com_nav_scroll_button : 'Scroll to the end button' ,
885
886
com_nav_setting_general : 'General' ,
886
887
com_nav_setting_chat : 'Chat' ,
887
888
com_nav_setting_beta : 'Beta features' ,
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ const localStorageAtoms = {
33
33
chatDirection : atomWithLocalStorage ( 'chatDirection' , 'LTR' ) ,
34
34
showCode : atomWithLocalStorage ( LocalStorageKeys . SHOW_ANALYSIS_CODE , true ) ,
35
35
saveDrafts : atomWithLocalStorage ( 'saveDrafts' , true ) ,
36
+ showScrollButton : atomWithLocalStorage ( 'showScrollButton' , true ) ,
36
37
forkSetting : atomWithLocalStorage ( 'forkSetting' , '' ) ,
37
38
splitAtTarget : atomWithLocalStorage ( 'splitAtTarget' , false ) ,
38
39
rememberDefaultFork : atomWithLocalStorage ( LocalStorageKeys . REMEMBER_FORK_OPTION , false ) ,
You can’t perform that action at this time.
0 commit comments