|
404 | 404 | :intent "link"
|
405 | 405 | :target "_blank"))
|
406 | 406 |
|
407 |
| -(rum/defc user-proxy-settings-panel |
| 407 | +(rum/defc user-proxy-settings-container |
408 | 408 | [{:keys [protocol type] :as agent-opts}]
|
409 | 409 | (let [type (or (not-empty type) (not-empty protocol) "system")
|
410 | 410 | [opts set-opts!] (rum/use-state agent-opts)
|
411 | 411 | [testing? set-testing?!] (rum/use-state false)
|
412 | 412 | *test-input (rum/create-ref)
|
413 | 413 | disabled? (or (= (:type opts) "system") (= (:type opts) "direct"))]
|
414 |
| - [:div.cp__settings-network-proxy-panel |
| 414 | + [:div.cp__settings-network-proxy-cnt |
415 | 415 | [:h1.mb-2.text-2xl.font-bold (t :settings-page/network-proxy)]
|
416 | 416 | [:div.p-2
|
417 | 417 | [:p [:label [:strong (t :type)]
|
|
478 | 478 | (p/let [_ (ipc/ipc :setProxy opts)]
|
479 | 479 | (state/set-state! [:electron/user-cfgs :settings/agent] opts))))]]]))
|
480 | 480 |
|
| 481 | +(rum/defc load-from-web-url-container |
| 482 | + [] |
| 483 | + (let [[url set-url!] (rum/use-state "") |
| 484 | + [pending? set-pending?] (rum/use-state false) |
| 485 | + handle-submit! (fn [] |
| 486 | + (set-pending? true) |
| 487 | + (-> (p/delay 3000) |
| 488 | + (p/finally |
| 489 | + #(set-pending? false))))] |
| 490 | + |
| 491 | + [:div.px-4.pt-4.pb-2.rounded-md.flex.flex-col.gap-2 |
| 492 | + [:div.flex.flex-col.gap-3 |
| 493 | + (shui/input {:placeholder "http://" |
| 494 | + :value url |
| 495 | + :on-change #(set-url! (-> (util/evalue %) (util/trim-safe))) |
| 496 | + :auto-focus true}) |
| 497 | + [:span.text-gray-10 |
| 498 | + (shui/tabler-icon "info-circle" {:size 13}) |
| 499 | + [:span "URLs support both GitHub repositories and local development servers. |
| 500 | + (For examples: https://github.com/xyhp915/logseq-journals-calendar, |
| 501 | + http://localhost:8080/<plugin-dir-root>)"]] |
| 502 | + ] |
| 503 | + [:div.flex.justify-end |
| 504 | + (shui/button {:disabled (or pending? (string/blank? url)) |
| 505 | + :on-click handle-submit!} |
| 506 | + (if pending? (ui/loading) "Save"))]])) |
| 507 | + |
481 | 508 | (rum/defc auto-check-for-updates-control
|
482 | 509 | []
|
483 | 510 | (let [[enabled, set-enabled!] (rum/use-state (plugin-handler/get-enabled-auto-check-for-updates?))
|
|
614 | 641 |
|
615 | 642 | [{:hr true}]
|
616 | 643 |
|
617 |
| - (when (and (state/developer-mode?) |
618 |
| - (util/electron?)) |
619 |
| - [{:title [:span.flex.items-center.gap-1 (ui/icon "file-code") (t :plugin/open-preferences)] |
620 |
| - :options {:on-click |
621 |
| - #(p/let [root (plugin-handler/get-ls-dotdir-root)] |
622 |
| - (js/apis.openPath (str root "/preferences.json")))}} |
623 |
| - {:title [:span.flex.items-center.whitespace-nowrap.gap-1 |
624 |
| - (ui/icon "bug") (t :plugin/open-logseq-dir) [:code "~/.logseq"]] |
625 |
| - :options {:on-click |
626 |
| - #(p/let [root (plugin-handler/get-ls-dotdir-root)] |
627 |
| - (js/apis.openPath root))}}]) |
| 644 | + (when (state/developer-mode?) |
| 645 | + (if (util/electron?) |
| 646 | + [{:title [:span.flex.items-center.gap-1 (ui/icon "file-code") (t :plugin/open-preferences)] |
| 647 | + :options {:on-click |
| 648 | + #(p/let [root (plugin-handler/get-ls-dotdir-root)] |
| 649 | + (js/apis.openPath (str root "/preferences.json")))}} |
| 650 | + {:title [:span.flex.items-center.whitespace-nowrap.gap-1 |
| 651 | + (ui/icon "bug") (t :plugin/open-logseq-dir) [:code "~/.logseq"]] |
| 652 | + :options {:on-click |
| 653 | + #(p/let [root (plugin-handler/get-ls-dotdir-root)] |
| 654 | + (js/apis.openPath root))}}] |
| 655 | + [{:title [:span.flex.items-center.whitespace-nowrap.gap-1 |
| 656 | + (ui/icon "plug") (t :plugin/load-from-web-url)] |
| 657 | + :options {:on-click |
| 658 | + #(shui/dialog-open! load-from-web-url-container)}}])) |
628 | 659 |
|
629 | 660 | [{:title [:span.flex.items-center.gap-1 (ui/icon "alert-triangle") (t :plugin/report-security)]
|
630 | 661 | :options {:on-click #(plugin-handler/open-report-modal!)}}]
|
|
0 commit comments