mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	feat(react/settings): port network connections
This commit is contained in:
		
							parent
							
								
									27cc33888a
								
							
						
					
					
						commit
						6fb90abd75
					
				@ -21,6 +21,7 @@ export default function OtherSettings() {
 | 
				
			|||||||
            <RevisionSnapshotInterval />
 | 
					            <RevisionSnapshotInterval />
 | 
				
			||||||
            <HtmlImportTags />
 | 
					            <HtmlImportTags />
 | 
				
			||||||
            <ShareSettings />
 | 
					            <ShareSettings />
 | 
				
			||||||
 | 
					            <NetworkSettings />
 | 
				
			||||||
        </>
 | 
					        </>
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -167,4 +168,18 @@ function ShareSettings() {
 | 
				
			|||||||
            </FormGroup>
 | 
					            </FormGroup>
 | 
				
			||||||
        </OptionsSection>
 | 
					        </OptionsSection>
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function NetworkSettings() {
 | 
				
			||||||
 | 
					    const [ checkForUpdates, setCheckForUpdates ] = useTriliumOptionBool("checkForUpdates");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <OptionsSection title={t("network_connections.network_connections_title")}>
 | 
				
			||||||
 | 
					            <FormCheckbox
 | 
				
			||||||
 | 
					                name="check-for-updates"
 | 
				
			||||||
 | 
					                label={t("network_connections.check_for_updates")}
 | 
				
			||||||
 | 
					                currentValue={checkForUpdates} onChange={setCheckForUpdates}
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					        </OptionsSection>
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,28 +0,0 @@
 | 
				
			|||||||
import OptionsWidget from "../options_widget.js";
 | 
					 | 
				
			||||||
import { t } from "../../../../services/i18n.js";
 | 
					 | 
				
			||||||
import type { OptionMap } from "@triliumnext/commons";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const TPL = /*html*/`
 | 
					 | 
				
			||||||
<div class="options-section">
 | 
					 | 
				
			||||||
    <h4>${t("network_connections.network_connections_title")}</h4>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <label class="tn-checkbox">
 | 
					 | 
				
			||||||
        <input class="check-for-updates form-check-input" type="checkbox" name="check-for-updates">
 | 
					 | 
				
			||||||
        ${t("network_connections.check_for_updates")}
 | 
					 | 
				
			||||||
    </label>
 | 
					 | 
				
			||||||
</div>`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export default class NetworkConnectionsOptions extends OptionsWidget {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private $checkForUpdates!: JQuery<HTMLElement>;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    doRender() {
 | 
					 | 
				
			||||||
        this.$widget = $(TPL);
 | 
					 | 
				
			||||||
        this.$checkForUpdates = this.$widget.find(".check-for-updates");
 | 
					 | 
				
			||||||
        this.$checkForUpdates.on("change", () => this.updateCheckboxOption("checkForUpdates", this.$checkForUpdates));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    async optionsLoaded(options: OptionMap) {
 | 
					 | 
				
			||||||
        this.setCheckboxState(this.$checkForUpdates, options.checkForUpdates);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user