From 0e0413d0963897ef2ef1580c2ae945b4bcdf9125 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sun, 7 Mar 2021 10:43:40 +0530 Subject: [PATCH 1/5] fix: Remove redundant css_variables import --- frappe/public/scss/desk/index.scss | 1 - frappe/public/scss/website/index.scss | 1 - frappe/public/scss/website/variables.scss | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frappe/public/scss/desk/index.scss b/frappe/public/scss/desk/index.scss index 1643034322..5f5fef251b 100644 --- a/frappe/public/scss/desk/index.scss +++ b/frappe/public/scss/desk/index.scss @@ -1,5 +1,4 @@ @import "variables"; -@import "css_variables"; @import "../common/mixins.scss"; @import "../common/global.scss"; @import "../common/icons.scss"; diff --git a/frappe/public/scss/website/index.scss b/frappe/public/scss/website/index.scss index 88f3b1db73..94b1249de1 100644 --- a/frappe/public/scss/website/index.scss +++ b/frappe/public/scss/website/index.scss @@ -1,6 +1,5 @@ @import '~quill/dist/quill.core'; @import 'variables'; -@import 'css_variables'; @import '~bootstrap/scss/bootstrap'; @import "../common/mixins"; @import "../common/global"; diff --git a/frappe/public/scss/website/variables.scss b/frappe/public/scss/website/variables.scss index fa68b57ad6..293d02b06d 100644 --- a/frappe/public/scss/website/variables.scss +++ b/frappe/public/scss/website/variables.scss @@ -131,5 +131,6 @@ $spacers: ( @import "~bootstrap/scss/functions"; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; +@import 'css_variables'; $code-color: $purple; From caaed1a4e5ce0c0b079a31bd7b757076c7ad4358 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sun, 7 Mar 2021 10:46:41 +0530 Subject: [PATCH 2/5] fix: Move data-theme attribute to root (html) - So that the HTML background matches with the theme background color --- frappe/public/js/frappe/ui/theme_switcher.js | 33 ++---- frappe/www/app.html | 114 ++++++++++--------- 2 files changed, 69 insertions(+), 78 deletions(-) diff --git a/frappe/public/js/frappe/ui/theme_switcher.js b/frappe/public/js/frappe/ui/theme_switcher.js index 31baf697f0..317198bca5 100644 --- a/frappe/public/js/frappe/ui/theme_switcher.js +++ b/frappe/public/js/frappe/ui/theme_switcher.js @@ -14,7 +14,7 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { } refresh() { - this.current_theme = document.body.dataset.theme; + this.current_theme = document.documentElement.getAttribute("data-theme") || "light"; this.fetch_themes().then(() => { this.render(); }); @@ -45,7 +45,6 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { }); } - get_preview_html(theme) { const preview = $(`
@@ -69,15 +68,9 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher {
`); - // preview.on('mouseover', () => { - // this.toggle_theme(theme.name, true) - // }) - - // preview.on('mouseleave', () => { - // this.toggle_theme(this.current_theme, true) - // }) - preview.on('click', () => { + if (this.current_theme === theme.name) return; + this.themes.forEach((th) => { th.$html.removeClass("selected"); }); @@ -89,19 +82,15 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { return preview; } - toggle_theme(theme, preview=false) { - if (!preview) { - document.body.dataset.theme = theme.toLowerCase(); - frappe.show_alert("Theme Changed", 3); + toggle_theme(theme) { + this.current_theme = theme.toLowerCase(); + document.documentElement.setAttribute("data-theme", this.current_theme); + frappe.show_alert("Theme Changed", 3); - frappe.call('frappe.core.doctype.user.user.switch_theme', { - theme: toTitle(theme) - }); - } else { - document.body.dataset.theme = theme.toLowerCase(); - } + frappe.xcall("frappe.core.doctype.user.user.switch_theme", { + theme: toTitle(theme) + }); } - show() { this.dialog.show(); } @@ -109,4 +98,4 @@ frappe.ui.ThemeSwitcher = class ThemeSwitcher { hide() { this.dialog.hide(); } -}; \ No newline at end of file +}; diff --git a/frappe/www/app.html b/frappe/www/app.html index 715ddaf409..8da4d11c00 100644 --- a/frappe/www/app.html +++ b/frappe/www/app.html @@ -1,65 +1,67 @@ - - - - - - - - - - - - - - - Frappe - - - {% for include in include_css -%} - - {%- endfor -%} - - - {% include "public/icons/timeless/symbol-defs.svg" %} -
- -
-
-
-
-
-
+ + + + + + + + + + + + + + + + Frappe + + + {% for include in include_css -%} + + {%- endfor -%} + + + {% include "public/icons/timeless/symbol-defs.svg" %} +
+ +
+
+
+
+
+
- + - + - {% for include in include_js %} - - {% endfor %} - {% include "templates/includes/app_analytics/google_analytics.html" %} - {% include "templates/includes/app_analytics/mixpanel_analytics.html" %} + {% for include in include_js %} + + {% endfor %} + {% include "templates/includes/app_analytics/google_analytics.html" %} + {% include "templates/includes/app_analytics/mixpanel_analytics.html" %} - {% for sound in (sounds or []) %} - - {% endfor %} - + {% for sound in (sounds or []) %} + + {% endfor %} + + From 738e6f50ab954bffaa83d805a466074e7a1cb0cb Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sun, 7 Mar 2021 10:48:40 +0530 Subject: [PATCH 3/5] fix: Remove unnecessary background transitions - to avoid inconsitent transition while switching the theme --- frappe/public/scss/desk/global.scss | 13 ------------- frappe/public/scss/desk/variables.scss | 4 ++++ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/frappe/public/scss/desk/global.scss b/frappe/public/scss/desk/global.scss index f4d6384352..b145879e1f 100644 --- a/frappe/public/scss/desk/global.scss +++ b/frappe/public/scss/desk/global.scss @@ -3,19 +3,6 @@ html { background-color: var(--bg-color); } -// transition -* { - transition: background-color 0.5s, background 0.5s; -} - -a, -.badge { - transition: 0.2s; -} - -.btn { - transition: background-color 0.2s, background 0.2s; -} body { diff --git a/frappe/public/scss/desk/variables.scss b/frappe/public/scss/desk/variables.scss index 57a117cd31..2855277ccd 100644 --- a/frappe/public/scss/desk/variables.scss +++ b/frappe/public/scss/desk/variables.scss @@ -95,6 +95,10 @@ $btn-active-box-shadow: var(--shadow-inset); $mark-bg: #FDF9AF; $mark-padding: 0; +// transitions +$btn-transition: none; +$input-transition: none; + // popover $enable-shadows: true; $popover-border-radius: var(--border-radius); From 87826f024179d3989b48ecf15998526f00a3690b Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sun, 7 Mar 2021 12:52:39 +0530 Subject: [PATCH 4/5] fix: Line hieght of checkbox label --- frappe/public/scss/common/global.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/frappe/public/scss/common/global.scss b/frappe/public/scss/common/global.scss index 91cc31c50d..20778176d4 100644 --- a/frappe/public/scss/common/global.scss +++ b/frappe/public/scss/common/global.scss @@ -8,7 +8,6 @@ --checkbox-right-margin: 8px; .label-area { - line-height: 1; font-size: var(--text-sm); } From 8962ba064756a49c939d2ff0bf629d579cd98025 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sun, 7 Mar 2021 19:14:31 +0530 Subject: [PATCH 5/5] fix: Temporarily use firefox for testing - https://travis-ci.com/github/frappe/frappe/jobs/488819006 testing is failing due to some incompatibility --- .travis.yml | 2 +- frappe/commands/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53ad56a948..ffada0286f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ addons: - test_site_producer mariadb: 10.3 postgresql: 9.5 - chrome: stable + firefox: latest services: - xvfb diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index e9fa7217a8..13c6ca812f 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -578,7 +578,7 @@ def run_ui_tests(context, app, headless=False): frappe.commands.popen("yarn add cypress@^6 cypress-file-upload@^5 --no-lockfile") # run for headless mode - run_or_open = 'run --browser chrome --record --key 4a48f41c-11b3-425b-aa88-c58048fa69eb' if headless else 'open' + run_or_open = 'run --browser firefox --record --key 4a48f41c-11b3-425b-aa88-c58048fa69eb' if headless else 'open' command = '{site_env} {password_env} {cypress} {run_or_open}' formatted_command = command.format(site_env=site_env, password_env=password_env, cypress=cypress_path, run_or_open=run_or_open)