@@ -95,51 +95,71 @@ export function PromptSettings({ settings, setSettings }: PromptSettingsProps) {
9595 return (
9696 < div className = "tone-settings" >
9797 < div className = "tones-list" >
98- { Object . entries ( settings . custom_prompts ) . map ( ( [ name , prompt ] ) => (
98+ { /* Always show Improve Writing first */ }
99+ { settings . custom_prompts [ "Improve Writing" ] && (
99100 < div
100- key = { name }
101- className = { `tone-item ${ settings . selected_tone === name ? 'selected' : '' } ` }
102- onClick = { ( ) => handleSelectTone ( name ) }
101+ key = "Improve Writing"
102+ className = { `tone-item ${ settings . selected_tone === "Improve Writing" ? 'selected' : '' } ` }
103+ onClick = { ( ) => handleSelectTone ( "Improve Writing" ) }
103104 >
104105 < div className = "tone-item-content" >
105- < span className = "tone-name" > { name } </ span >
106+ < span className = "tone-name" > Improve Writing </ span >
106107 < div className = "tone-actions" >
107- { settings . selected_tone === name && (
108+ { settings . selected_tone === "Improve Writing" && (
108109 < svg className = "check-icon" xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 2 } stroke = "currentColor" >
109110 < path strokeLinecap = "round" strokeLinejoin = "round" d = "M4.5 12.75l6 6 9-13.5" />
110111 </ svg >
111112 ) }
112- { name !== "Improve Writing" && (
113- < >
114- < button
115- className = "edit-button"
116- onClick = { ( e ) => {
117- e . stopPropagation ( ) ;
118- handleEdit ( name ) ;
119- } }
120- >
121- < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" >
122- < path strokeLinecap = "round" strokeLinejoin = "round" d = "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
123- </ svg >
124- </ button >
125- < button
126- className = "delete-button"
127- onClick = { ( e ) => {
128- e . stopPropagation ( ) ;
129- handleDeleteTone ( name ) ;
130- } }
131- >
132- < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" >
133- < path strokeLinecap = "round" strokeLinejoin = "round" d = "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
134- </ svg >
135- </ button >
136- </ >
137- ) }
138113 </ div >
139114 </ div >
140- < div className = "tone-prompt" > { prompt } </ div >
115+ < div className = "tone-prompt" > { settings . custom_prompts [ "Improve Writing" ] } </ div >
141116 </ div >
142- ) ) }
117+ ) }
118+
119+ { /* Show all other tones */ }
120+ { Object . entries ( settings . custom_prompts )
121+ . filter ( ( [ name ] ) => name !== "Improve Writing" )
122+ . map ( ( [ name , prompt ] ) => (
123+ < div
124+ key = { name }
125+ className = { `tone-item ${ settings . selected_tone === name ? 'selected' : '' } ` }
126+ onClick = { ( ) => handleSelectTone ( name ) }
127+ >
128+ < div className = "tone-item-content" >
129+ < span className = "tone-name" > { name } </ span >
130+ < div className = "tone-actions" >
131+ { settings . selected_tone === name && (
132+ < svg className = "check-icon" xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 2 } stroke = "currentColor" >
133+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M4.5 12.75l6 6 9-13.5" />
134+ </ svg >
135+ ) }
136+ < button
137+ className = "edit-button"
138+ onClick = { ( e ) => {
139+ e . stopPropagation ( ) ;
140+ handleEdit ( name ) ;
141+ } }
142+ >
143+ < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" >
144+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
145+ </ svg >
146+ </ button >
147+ < button
148+ className = "delete-button"
149+ onClick = { ( e ) => {
150+ e . stopPropagation ( ) ;
151+ handleDeleteTone ( name ) ;
152+ } }
153+ >
154+ < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" >
155+ < path strokeLinecap = "round" strokeLinejoin = "round" d = "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
156+ </ svg >
157+ </ button >
158+ </ div >
159+ </ div >
160+ < div className = "tone-prompt" > { prompt } </ div >
161+ </ div >
162+ ) ) }
143163 </ div >
144164 < button className = "add-tone-button" onClick = { ( ) => setIsFormOpen ( true ) } >
145165 < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" >
0 commit comments