mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 17:36:34 +00:00
Started rewriting the welcome screen
This commit is contained in:
@@ -16,14 +16,15 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/*background: var(--zen-main-browser-background) !important;*/
|
|
||||||
transition: .1s;
|
transition: .1s;
|
||||||
-moz-transform: scale(1.1); /* zoom */
|
-moz-transform: scale(1.1); /* zoom */
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
button {
|
||||||
display: none;
|
padding: 10px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -34,11 +35,18 @@ body {
|
|||||||
margin: 32px;
|
margin: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-split:not([hidden="true"]) {
|
||||||
|
display: flex;
|
||||||
|
margin: 12%;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
#enableFeatures .card {
|
#enableFeatures .card {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card h3 {
|
:not(#theme) .card h3 {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -126,9 +134,12 @@ input[type='checkbox'] {
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search h1,
|
#search h1 {
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
#theme h1 {
|
#theme h1 {
|
||||||
margin-bottom: 30px;
|
margin: 25px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page[hidden="true"] {
|
.page[hidden="true"] {
|
||||||
@@ -189,4 +200,27 @@ input[type='checkbox'] {
|
|||||||
|
|
||||||
.dot.active {
|
.dot.active {
|
||||||
background: light-dark(#000, #fff);
|
background: light-dark(#000, #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#colorList {
|
||||||
|
width: 500px;
|
||||||
|
border-radius: 99px;
|
||||||
|
height: 20px;
|
||||||
|
display: flex;
|
||||||
|
border: 2px solid var(--arrowpanel-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
#dragBall {
|
||||||
|
width: 17px;
|
||||||
|
height: 17px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
position: absolute;
|
||||||
|
top: calc(5px / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#colorListWrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 500px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
@@ -27,6 +27,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
<link rel="localization" href="branding/brand.ftl" />
|
<link rel="localization" href="branding/brand.ftl" />
|
||||||
<link rel="localization" href="browser/zen-welcome.ftl" />
|
<link rel="localization" href="browser/zen-welcome.ftl" />
|
||||||
|
|
||||||
|
<script src="chrome://browser/content/zenThemeModifier.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page" id="welcome">
|
<div class="page" id="welcome">
|
||||||
@@ -42,46 +44,61 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||||||
></button>
|
></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page" id="import">
|
<div class="page page-split" id="import">
|
||||||
<h1 data-l10n-id="welcome-dialog-import"></h1>
|
<div>
|
||||||
<p data-l10n-id="welcome-dialog-import-subtext"></p>
|
<h1 data-l10n-id="welcome-dialog-import"></h1>
|
||||||
|
<p data-l10n-id="welcome-dialog-import-subtext"></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hbox>
|
||||||
|
<button
|
||||||
|
class="primary"
|
||||||
|
id="importBrowser"
|
||||||
|
data-l10n-id="welcome-dialog-import-action"
|
||||||
|
></button>
|
||||||
|
<button
|
||||||
|
class="text-link ghost-button"
|
||||||
|
id="importNext"
|
||||||
|
data-l10n-id="welcome-dialog-skip"
|
||||||
|
></button>
|
||||||
|
</hbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br />
|
<div class="page page-split" id="theme">
|
||||||
|
<div>
|
||||||
<hbox>
|
<h1 data-l10n-id="welcome-dialog-theme"></h1>
|
||||||
|
<p data-l10n-id="welcome-dialog-theme-subtext"></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1 data-l10n-id="welcome-dialog-theme-header-1"></h1>
|
||||||
|
<div id="themeList" class="cardGroup"></div>
|
||||||
|
<h1 data-l10n-id="welcome-dialog-theme-header-2"></h1>
|
||||||
|
<div id="colorListWrapper">
|
||||||
|
<canvas id="colorList" class="cardGroup"></canvas>
|
||||||
|
<div id="dragBall"></div>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
|
id="themeNext"
|
||||||
class="primary"
|
class="primary"
|
||||||
id="importBrowser"
|
data-l10n-id="welcome-dialog-theme-action"
|
||||||
data-l10n-id="welcome-dialog-import-action"
|
|
||||||
></button>
|
></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page page-split" id="search">
|
||||||
|
<div>
|
||||||
|
<h1 data-l10n-id="welcome-dialog-search"></h1>
|
||||||
|
<p data-l10n-id="welcome-dialog-search-subtext"></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div id="searchList" class="cardGroup"></div>
|
||||||
<button
|
<button
|
||||||
class="text-link ghost-button"
|
id="searchNext"
|
||||||
id="importNext"
|
class="primary"
|
||||||
data-l10n-id="welcome-dialog-skip"
|
data-l10n-id="welcome-dialog-search-action"
|
||||||
></button>
|
></button>
|
||||||
</hbox>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="page" id="theme">
|
|
||||||
<h1 data-l10n-id="welcome-dialog-theme"></h1>
|
|
||||||
<p data-l10n-id="welcome-dialog-theme-subtext"></p>
|
|
||||||
<div id="themeList" class="cardGroup"></div>
|
|
||||||
<button
|
|
||||||
id="themeNext"
|
|
||||||
class="primary"
|
|
||||||
data-l10n-id="welcome-dialog-theme-action"
|
|
||||||
></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="page" id="search">
|
|
||||||
<h1 data-l10n-id="welcome-dialog-search"></h1>
|
|
||||||
<p data-l10n-id="welcome-dialog-search-subtext"></p>
|
|
||||||
<div id="searchList" class="cardGroup"></div>
|
|
||||||
<button
|
|
||||||
id="searchNext"
|
|
||||||
class="primary"
|
|
||||||
data-l10n-id="welcome-dialog-search-action"
|
|
||||||
></button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page" id="thanks">
|
<div class="page" id="thanks">
|
||||||
|
@@ -119,6 +119,7 @@ class Themes extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadThemes() {
|
async loadThemes() {
|
||||||
|
window.addEventListener('DOMContentLoaded', this.setColorBar);
|
||||||
await sleep(1000)
|
await sleep(1000)
|
||||||
|
|
||||||
const themes = (await AddonManager.getAddonsByTypes(['theme'])).filter(
|
const themes = (await AddonManager.getAddonsByTypes(['theme'])).filter(
|
||||||
@@ -150,13 +151,62 @@ class Themes extends Page {
|
|||||||
const name = document.createElement('h3')
|
const name = document.createElement('h3')
|
||||||
name.textContent = theme.name
|
name.textContent = theme.name
|
||||||
|
|
||||||
container.appendChild(img)
|
//container.appendChild(img)
|
||||||
container.appendChild(name)
|
container.appendChild(name)
|
||||||
|
|
||||||
themeList.appendChild(container)
|
themeList.appendChild(container)
|
||||||
themeElements.push(container)
|
themeElements.push(container)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setColorBar() {
|
||||||
|
const colorList = document.getElementById('colorList');
|
||||||
|
const ctx = colorList.getContext('2d');
|
||||||
|
let gradient = ctx.createLinearGradient(0, 0, 500, 20);
|
||||||
|
|
||||||
|
gradient.addColorStop(0.0, '#aac7ff');
|
||||||
|
gradient.addColorStop(0.1, '#aac7ff');
|
||||||
|
gradient.addColorStop(0.2, '#74d7cb');
|
||||||
|
gradient.addColorStop(0.3, '#a0d490');
|
||||||
|
gradient.addColorStop(0.4, '#dec663');
|
||||||
|
gradient.addColorStop(0.5, '#ffb787');
|
||||||
|
gradient.addColorStop(0.6, '#ffb1c0');
|
||||||
|
gradient.addColorStop(0.7, '#ddbfc3');
|
||||||
|
gradient.addColorStop(0.8, '#f6b0ea');
|
||||||
|
gradient.addColorStop(0.9, '#d4bbff');
|
||||||
|
|
||||||
|
ctx.fillStyle = gradient;
|
||||||
|
ctx.fillRect(0, 0, 1000, 150);
|
||||||
|
|
||||||
|
const dragBall = document.getElementById('dragBall');
|
||||||
|
dragBall.style.left = `0px`;
|
||||||
|
dragBall.addEventListener('mousedown', (e) => {
|
||||||
|
const rect = colorList.getBoundingClientRect();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const onMouseMove = (ev) => {
|
||||||
|
var x = ev.clientX - rect.left;
|
||||||
|
const data = ctx.getImageData(x - 17, 1, 1, 1).data;
|
||||||
|
dragBall.style.left = `${x - 17/2}px`;
|
||||||
|
if (x < 17) {
|
||||||
|
dragBall.style.left = `${17/2}px`;
|
||||||
|
x = 17;
|
||||||
|
} else if (x > rect.width - 17) {
|
||||||
|
dragBall.style.left = `${rect.width - 17 - (17/2)}px`;
|
||||||
|
x = rect.width - 17 - (17/2);
|
||||||
|
}
|
||||||
|
Services.prefs.setStringPref('zen.theme.accent-color', `#${data[0].toString(16)}${data[1].toString(16)}${data[2].toString(16)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const onMouseUp = () => {
|
||||||
|
document.removeEventListener('mousemove', onMouseMove);
|
||||||
|
document.removeEventListener('mouseup', onMouseUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', onMouseMove);
|
||||||
|
document.addEventListener('mouseup', onMouseUp);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Thanks extends Page {
|
class Thanks extends Page {
|
||||||
|
@@ -16,6 +16,9 @@ welcome-dialog-theme = 🎨 Choose a theme
|
|||||||
welcome-dialog-theme-subtext = Personalize your experience with your favorite look!
|
welcome-dialog-theme-subtext = Personalize your experience with your favorite look!
|
||||||
welcome-dialog-theme-action = Continue
|
welcome-dialog-theme-action = Continue
|
||||||
|
|
||||||
|
welcome-dialog-theme-header-1 = 1. Choose A theme
|
||||||
|
welcome-dialog-theme-header-2 = 2. Find Your Perfect Color
|
||||||
|
|
||||||
welcome-dialog-search = 🔍 Choose a search engine
|
welcome-dialog-search = 🔍 Choose a search engine
|
||||||
welcome-dialog-search-subtext = Select your preferred search engine to tailor your browsing experience!
|
welcome-dialog-search-subtext = Select your preferred search engine to tailor your browsing experience!
|
||||||
welcome-dialog-search-action = Next
|
welcome-dialog-search-action = Next
|
||||||
|
Reference in New Issue
Block a user