@@ -58,22 +58,31 @@ <h2 class="font-bold mb-4 ml-4">Conversations</h2>
5858 </ button >
5959
6060 <!-- theme controller is copied from https://daisyui.com/components/theme-controller/ -->
61- <!-- TODO: memorize this theme selection in localStorage, maybe also add "auto" option -->
6261 < div class ="dropdown dropdown-end dropdown-bottom ">
6362 < div tabindex ="0 " role ="button " class ="btn m-1 ">
6463 Theme
6564 < svg width ="12px " height ="12px " class ="inline-block h-2 w-2 fill-current opacity-60 " xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 2048 2048 ">
6665 < path d ="M1799 349l242 241-1017 1017L7 590l242-241 775 775 775-775z "> </ path >
6766 </ svg >
6867 </ div >
69- < ul tabindex ="0 " class ="dropdown-content bg-base-300 rounded-box z-[1] w-52 p-2 shadow-2xl ">
68+ < ul tabindex ="0 " class ="dropdown-content bg-base-300 rounded-box z-[1] w-52 p-2 shadow-2xl h-80 overflow-y-auto ">
69+ < li >
70+ < button
71+ class ="btn btn-sm btn-block w-full btn-ghost justify-start "
72+ :class ="{ 'btn-active': selectedTheme === 'auto' } "
73+ @click ="setSelectedTheme('auto') ">
74+ auto
75+ </ button >
76+ </ li >
7077 < li v-for ="theme in themes ">
7178 < input
7279 type ="radio "
7380 name ="theme-dropdown "
7481 class ="theme-controller btn btn-sm btn-block w-full btn-ghost justify-start "
7582 :aria-label ="theme "
76- :value ="theme " />
83+ :value ="theme "
84+ :checked ="selectedTheme === theme "
85+ @click ="setSelectedTheme(theme) " />
7786 </ li >
7887 </ ul >
7988 </ div >
@@ -204,8 +213,9 @@ <h2 class="font-bold mb-4 ml-4">Conversations</h2>
204213 isGenerating : false ,
205214 pendingMsg : null , // the on-going message from assistant
206215 abortController : null ,
216+ selectedTheme : localStorage . getItem ( 'theme' ) || 'auto' ,
207217 // const
208- themes : [ 'light' , 'dark' , 'retro' , 'cyberpunk' , 'aqua' , 'valentine ' , 'synthwave ' ] ,
218+ themes : [ 'light' , 'dark' , 'cupcake' , 'bumblebee' , 'emerald' , 'corporate' , 'synthwave' , ' retro', 'cyberpunk' , 'valentine' , 'halloween' , 'garden' , 'forest' , ' aqua', 'lofi ' , 'pastel' , 'fantasy' , 'wireframe' , 'black' , 'luxury' , 'dracula' , 'cmyk' , 'autumn' , 'business' , 'acid' , 'lemonade' , 'night' , 'coffee' , 'winter' , 'dim' , 'nord' , 'sunset '] ,
209219 }
210220 } ,
211221 computed : { } ,
@@ -218,6 +228,15 @@ <h2 class="font-bold mb-4 ml-4">Conversations</h2>
218228 resizeObserver . observe ( pendingMsgElem ) ;
219229 } ,
220230 methods : {
231+ setSelectedTheme ( theme ) {
232+ if ( theme === 'auto' ) {
233+ this . selectedTheme = 'auto' ;
234+ localStorage . removeItem ( 'theme' ) ;
235+ } else {
236+ this . selectedTheme = theme ;
237+ localStorage . setItem ( 'theme' , theme ) ;
238+ }
239+ } ,
221240 newConversation ( ) {
222241 if ( this . isGenerating ) return ;
223242 this . viewingConvId = Conversations . getNewConvId ( ) ;
0 commit comments