File tree Expand file tree Collapse file tree 7 files changed +29
-2
lines changed
Expand file tree Collapse file tree 7 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,17 @@ const registerContentScript = async () => {
1919 const settings = await getStorage < Partial < Settings > > ( "settings" , { } ) ;
2020 if ( ! settings . redmineURL ) return ;
2121
22+ // Unregister content script
2223 await chrome . scripting
2324 . unregisterContentScripts ( {
2425 ids : [ "content" ] ,
2526 } )
2627 . catch ( ( ) => undefined ) ;
28+
29+ // If showCurrentIssueTimer is disabled, do not register content script
30+ if ( ! settings . features ?. showCurrentIssueTimer ) return ;
31+
32+ // Register content script
2733 await chrome . scripting . registerContentScripts ( [
2834 {
2935 id : "content" ,
@@ -35,7 +41,7 @@ const registerContentScript = async () => {
3541} ;
3642registerContentScript ( ) ;
3743chrome . runtime . onMessage . addListener ( ( message ) => {
38- if ( message === "redmine-url- changed" ) {
44+ if ( [ "settings-changed:redmineURL" , "settings- changed:showCurrentIssueTimer" ] . includes ( message ) ) {
3945 registerContentScript ( ) ;
4046 }
4147} ) ;
Original file line number Diff line number Diff line change 141141 "settings.features.add-notes.description" : " Notizen zu Ticket hinzufügen" ,
142142 "settings.features.cache-comments.title" : " Kommentare zwischenspeichern" ,
143143 "settings.features.cache-comments.description" : " Kommentare zwischenspeichern, bis sie übermittelt wurden" ,
144+ "settings.features.show-current-issue-timer.title" : " Aktuellen Ticket-Timer anzeigen" ,
145+ "settings.features.show-current-issue-timer.description" : " Aktuellen Ticket-Timer auf Redmine Seite anzeigen" ,
144146 "settings.style" : " Styling" ,
145147 "settings.style.display-search-always.title" : " Suche immer anzeigen" ,
146148 "settings.style.sticky-scroll.title" : " Sticky scroll" ,
Original file line number Diff line number Diff line change 140140 "settings.features.add-notes.description" : " Adding notes to an issue" ,
141141 "settings.features.cache-comments.title" : " Cache comments" ,
142142 "settings.features.cache-comments.description" : " Cache comments until they are submitted" ,
143+ "settings.features.show-current-issue-timer.title" : " Show current issue timer" ,
144+ "settings.features.show-current-issue-timer.description" : " Show current issue timer on Redmine page" ,
143145 "settings.style" : " Styling" ,
144146 "settings.style.display-search-always.title" : " Display search always" ,
145147 "settings.style.sticky-scroll.title" : " Sticky scroll" ,
Original file line number Diff line number Diff line change 140140 "settings.features.add-notes.description" : " Ajouter des notes à un ticket" ,
141141 "settings.features.cache-comments.title" : " Mise en cache des commentaires" ,
142142 "settings.features.cache-comments.description" : " Mettre en cache les commentaires jusqu'à leur soumission" ,
143+ "settings.features.show-current-issue-timer.title" : " Show current issue timer" ,
144+ "settings.features.show-current-issue-timer.description" : " Show current issue timer on Redmine page" ,
143145 "settings.style" : " Style" ,
144146 "settings.style.display-search-always.title" : " Afficher toujours la recherche" ,
145147 "settings.style.sticky-scroll.title" : " Défilement fixe" ,
Original file line number Diff line number Diff line change 140140 "settings.features.add-notes.description" : " Добавлять примечания в задачи" ,
141141 "settings.features.cache-comments.title" : " Кеширование комментариев" ,
142142 "settings.features.cache-comments.description" : " Кешировать комментарии пока они не отправлены" ,
143+ "settings.features.show-current-issue-timer.title" : " Show current issue timer" ,
144+ "settings.features.show-current-issue-timer.description" : " Show current issue timer on Redmine page" ,
143145 "settings.style" : " Отображение" ,
144146 "settings.style.display-search-always.title" : " Display search always" ,
145147 "settings.style.sticky-scroll.title" : " Закрепить названия проектов при прокрутке списка задач" ,
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ const SettingsPage = () => {
7171 } ) ,
7272 addNotes : Yup . boolean ( ) ,
7373 cacheComments : Yup . boolean ( ) ,
74+ showCurrentIssueTimer : Yup . boolean ( ) ,
7475 } ) ,
7576 style : Yup . object ( {
7677 displaySearchAlways : Yup . boolean ( ) ,
@@ -273,6 +274,13 @@ const SettingsPage = () => {
273274 description = { formatMessage ( { id : "settings.features.cache-comments.description" } ) }
274275 as = { CheckBox }
275276 />
277+ < Field
278+ type = "checkbox"
279+ name = "features.showCurrentIssueTimer"
280+ title = { formatMessage ( { id : "settings.features.show-current-issue-timer.title" } ) }
281+ description = { formatMessage ( { id : "settings.features.show-current-issue-timer.description" } ) }
282+ as = { CheckBox }
283+ />
276284 </ div >
277285 </ Fieldset >
278286
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export type Settings = {
1414 roundingInterval : number ;
1515 cacheComments : boolean ;
1616 addNotes : boolean ;
17+ showCurrentIssueTimer : boolean ;
1718 } ;
1819 style : {
1920 displaySearchAlways : boolean ;
@@ -39,6 +40,7 @@ const defaultSettings: Settings = {
3940 roundingInterval : 15 ,
4041 cacheComments : true ,
4142 addNotes : false ,
43+ showCurrentIssueTimer : true ,
4244 } ,
4345 style : {
4446 displaySearchAlways : false ,
@@ -77,7 +79,10 @@ const SettingsProvider = ({ children }: { children: ReactNode }) => {
7779 setSettings : ( newData : Settings ) => {
7880 setData ( newData ) ;
7981 if ( newData . redmineURL !== data . redmineURL ) {
80- chrome . runtime . sendMessage ( "redmine-url-changed" ) ;
82+ chrome . runtime . sendMessage ( "settings-changed:redmineURL" ) ;
83+ }
84+ if ( newData . features . showCurrentIssueTimer !== data . features . showCurrentIssueTimer ) {
85+ chrome . runtime . sendMessage ( "settings-changed:showCurrentIssueTimer" ) ;
8186 }
8287 } ,
8388 } }
You can’t perform that action at this time.
0 commit comments