Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: responsive prefs page #883

Merged
merged 6 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions add-on/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@
"message": "Failed to stop IPFS node",
"description": "System notification title displayed when stopping an IPFS node fails (notify_stopIpfsNodeErrorTitle)"
},
"option_page_header" : {
"message": "Companion Preferences",
"description": "Main header on the Preferences screen (option_page_header)"
},
"option_legend_readMore" : {
"message": "Read more",
"description": "A generic link in option description on the Preferences screen (option_legend_readMore)"
Expand Down
16 changes: 8 additions & 8 deletions add-on/src/options/forms/api-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ function apiForm ({ ipfsApiUrl, ipfsApiPollMs, automaticMode, onOptionChange })

return html`
<form>
<fieldset class="mb3 pa4 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0 mb3">${browser.i18n.getMessage('option_header_api')}</h2>
<div>
<fieldset class="mb3 pa1 pa4-ns pa3 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0-ns mb3-ns mb1 mt2 ">${browser.i18n.getMessage('option_header_api')}</h2>
<div class="flex-row-ns pb0-ns">
<label for="ipfsApiUrl">
<dl>
<dt>${browser.i18n.getMessage('option_ipfsApiUrl_title')}</dt>
<dd>${browser.i18n.getMessage('option_ipfsApiUrl_description')}</dd>
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="ipfsApiUrl"
type="url"
inputmode="url"
Expand All @@ -34,15 +34,15 @@ function apiForm ({ ipfsApiUrl, ipfsApiPollMs, automaticMode, onOptionChange })
onchange=${onIpfsApiUrlChange}
value=${ipfsApiUrl} />
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="ipfsApiPollMs">
<dl>
<dt>${browser.i18n.getMessage('option_ipfsApiPollMs_title')}</dt>
<dd>${browser.i18n.getMessage('option_ipfsApiPollMs_description')}</dd>
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="ipfsApiPollMs"
type="number"
inputmode="numeric"
Expand All @@ -53,14 +53,14 @@ function apiForm ({ ipfsApiUrl, ipfsApiPollMs, automaticMode, onOptionChange })
onchange=${onIpfsApiPollMsChange}
value=${ipfsApiPollMs} />
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="automaticMode">
<dl>
<dt>${browser.i18n.getMessage('option_automaticMode_title')}</dt>
<dd>${browser.i18n.getMessage('option_automaticMode_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'automaticMode', checked: automaticMode, onchange: onAutomaticModeChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'automaticMode', checked: automaticMode, onchange: onAutomaticModeChange })}</div>
</div>
</fieldset>
</form>
Expand Down
16 changes: 8 additions & 8 deletions add-on/src/options/forms/dnslink-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ function dnslinkForm ({

return html`
<form>
<fieldset class="mb3 pa4 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0 mb3">${browser.i18n.getMessage('option_header_dnslink')}</h2>
<div>
<fieldset class="mb3 pa1 pa4-ns pa3 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0-ns mb3-ns mb1 mt2 ">${browser.i18n.getMessage('option_header_dnslink')}</h2>
<div class="flex-row-ns pb0-ns">
<label for="dnslinkPolicy">
<dl>
<dt>${browser.i18n.getMessage('option_dnslinkPolicy_title')}</dt>
Expand All @@ -31,7 +31,7 @@ function dnslinkForm ({
</dd>
</dl>
</label>
<select id="dnslinkPolicy" name='dnslinkPolicy' onchange=${onDnslinkPolicyChange}>
<select id="dnslinkPolicy" name='dnslinkPolicy' class="self-center-ns bg-white" onchange=${onDnslinkPolicyChange}>
<option
value='false'
selected=${String(dnslinkPolicy) === 'false'}>
Expand All @@ -49,16 +49,16 @@ function dnslinkForm ({
</option>
</select>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="dnslinkDataPreload">
<dl>
<dt>${browser.i18n.getMessage('option_dnslinkDataPreload_title')}</dt>
<dd>${browser.i18n.getMessage('option_dnslinkDataPreload_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'dnslinkDataPreload', checked: dnslinkDataPreload, disabled: dnslinkRedirect, onchange: onDnslinkDataPreloadChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'dnslinkDataPreload', checked: dnslinkDataPreload, disabled: dnslinkRedirect, onchange: onDnslinkDataPreloadChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="dnslinkRedirect">
<dl>
<dt>${browser.i18n.getMessage('option_dnslinkRedirect_title')}</dt>
Expand All @@ -71,7 +71,7 @@ function dnslinkForm ({
</dd>
</dl>
</label>
<div>${switchToggle({ id: 'dnslinkRedirect', checked: dnslinkRedirect, onchange: onDnslinkRedirectChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'dnslinkRedirect', checked: dnslinkRedirect, onchange: onDnslinkRedirectChange })}</div>
</div>
</fieldset>
</form>
Expand Down
36 changes: 18 additions & 18 deletions add-on/src/options/forms/experiments-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,46 @@ function experimentsForm ({

return html`
<form>
<fieldset class="mb3 pa4 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0 mb3">${browser.i18n.getMessage('option_header_experiments')}</h2>
<fieldset class="mb3 pa1 pa4-ns pa3 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0-ns mb3-ns mb1 mt2 ">${browser.i18n.getMessage('option_header_experiments')}</h2>
<div class="mb2">${browser.i18n.getMessage('option_experiments_warning')}</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="displayNotifications">
<dl>
<dt>${browser.i18n.getMessage('option_displayNotifications_title')}</dt>
<dd>${browser.i18n.getMessage('option_displayNotifications_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'displayNotifications', checked: displayNotifications, onchange: onDisplayNotificationsChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'displayNotifications', checked: displayNotifications, onchange: onDisplayNotificationsChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="catchUnhandledProtocols">
<dl>
<dt>${browser.i18n.getMessage('option_catchUnhandledProtocols_title')}</dt>
<dd>${browser.i18n.getMessage('option_catchUnhandledProtocols_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'catchUnhandledProtocols', checked: catchUnhandledProtocols, onchange: onCatchUnhandledProtocolsChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'catchUnhandledProtocols', checked: catchUnhandledProtocols, onchange: onCatchUnhandledProtocolsChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="recoverFailedHttpRequests">
<dl>
<dt>${browser.i18n.getMessage('option_recoverFailedHttpRequests_title')}</dt>
<dd>${browser.i18n.getMessage('option_recoverFailedHttpRequests_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'recoverFailedHttpRequests', checked: recoverFailedHttpRequests, onchange: onrecoverFailedHttpRequestsChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'recoverFailedHttpRequests', checked: recoverFailedHttpRequests, onchange: onrecoverFailedHttpRequestsChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="linkify">
<dl>
<dt>${browser.i18n.getMessage('option_linkify_title')}</dt>
<dd>${browser.i18n.getMessage('option_linkify_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'linkify', checked: linkify, onchange: onLinkifyChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'linkify', checked: linkify, onchange: onLinkifyChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="detectIpfsPathHeader">
<dl>
<dt>${browser.i18n.getMessage('option_detectIpfsPathHeader_title')}</dt>
Expand All @@ -75,9 +75,9 @@ function experimentsForm ({
</dd>
</dl>
</label>
<div>${switchToggle({ id: 'detectIpfsPathHeader', checked: detectIpfsPathHeader, onchange: onDetectIpfsPathHeaderChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'detectIpfsPathHeader', checked: detectIpfsPathHeader, onchange: onDetectIpfsPathHeaderChange })}</div>
</div>
<div class="o-50">
<div class="flex-row-ns pb0-ns o-50">
<label for="ipfsProxy">
<dl>
<dt>${browser.i18n.getMessage('option_ipfsProxy_title')}</dt>
Expand All @@ -97,31 +97,31 @@ function experimentsForm ({
</dd>
</dl>
</label>
<div>${switchToggle({ id: 'ipfsProxy', checked: ipfsProxy, disabled: true, onchange: onIpfsProxyChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'ipfsProxy', checked: ipfsProxy, disabled: true, onchange: onIpfsProxyChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="logNamespaces">
<dl>
<dt>${browser.i18n.getMessage('option_logNamespaces_title')}</dt>
<dd>${browser.i18n.getMessage('option_logNamespaces_description')}</dd>
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="logNamespaces"
type="text"
required
onchange=${onOptionChange('logNamespaces')}
value=${logNamespaces} />
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="resetAllOptions">
<dl>
<dt>${browser.i18n.getMessage('option_resetAllOptions_title')}</dt>
<dd>${browser.i18n.getMessage('option_resetAllOptions_description')}</dd>
</dl>
</label>
<div><button id="resetAllOptions" class="Button transition-all sans-serif v-mid fw5 nowrap lh-copy bn br1 pa2 pointer focus-outline white bg-red white" onclick=${onOptionsReset}>${browser.i18n.getMessage('option_resetAllOptions_title')}</button></div>
<div class="self-center-ns"><button id="resetAllOptions" class="Button transition-all sans-serif v-mid fw5 nowrap lh-copy bn br1 pa2 pointer focus-outline white bg-red white" onclick=${onOptionsReset}>${browser.i18n.getMessage('option_resetAllOptions_title')}</button></div>
</div>
</fieldset>
</form>
Expand Down
16 changes: 8 additions & 8 deletions add-on/src/options/forms/file-import-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function fileImportForm ({ importDir, openViaWebUI, preloadAtPublicGateway, onOp
const onPreloadAtPublicGatewayChange = onOptionChange('preloadAtPublicGateway')
return html`
<form>
<fieldset class="mb3 pa4 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0 mb3">${browser.i18n.getMessage('option_header_fileImport')}</h2>
<div>
<fieldset class="mb3 pa1 pa4-ns pa3 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0-ns mb3-ns mb1 mt2 ">${browser.i18n.getMessage('option_header_fileImport')}</h2>
<div class="flex-row-ns pb0-ns">
<label for="importDir">
<dl>
<dt>${browser.i18n.getMessage('option_importDir_title')}</dt>
Expand All @@ -26,31 +26,31 @@ function fileImportForm ({ importDir, openViaWebUI, preloadAtPublicGateway, onOp
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="importDir"
type="text"
pattern="^\/(.*)"
required
onchange=${onImportDirChange}
value=${importDir} />
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="openViaWebUI">
<dl>
<dt>${browser.i18n.getMessage('option_openViaWebUI_title')}</dt>
<dd>${browser.i18n.getMessage('option_openViaWebUI_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'openViaWebUI', checked: openViaWebUI, onchange: onOpenViaWebUIChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'openViaWebUI', checked: openViaWebUI, onchange: onOpenViaWebUIChange })}</div>
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="preloadAtPublicGateway">
<dl>
<dt>${browser.i18n.getMessage('option_preloadAtPublicGateway_title')}</dt>
<dd>${browser.i18n.getMessage('option_preloadAtPublicGateway_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'preloadAtPublicGateway', checked: preloadAtPublicGateway, onchange: onPreloadAtPublicGatewayChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'preloadAtPublicGateway', checked: preloadAtPublicGateway, onchange: onPreloadAtPublicGatewayChange })}</div>
</div>
</fieldset>
</form>
Expand Down
30 changes: 15 additions & 15 deletions add-on/src/options/forms/gateways-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ function gatewaysForm ({

return html`
<form>
<fieldset class="mb3 pa4 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0 mb3">${browser.i18n.getMessage('option_header_gateways')}</h2>
<div>
<fieldset class="mb3 pa1 pa4-ns pa3 bg-snow-muted charcoal">
<h2 class="ttu tracked f6 fw4 teal mt0-ns mb3-ns mb1 mt2 ">${browser.i18n.getMessage('option_header_gateways')}</h2>
<div class="flex-row-ns pb0-ns">
<label for="publicGatewayUrl">
<dl>
<dt>${browser.i18n.getMessage('option_publicGatewayUrl_title')}</dt>
<dd>${browser.i18n.getMessage('option_publicGatewayUrl_description')}</dd>
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="publicGatewayUrl"
type="url"
inputmode="url"
Expand All @@ -54,7 +54,7 @@ function gatewaysForm ({
onchange=${onPublicGatewayUrlChange}
value=${publicGatewayUrl} />
</div>
<div>
<div class="flex-row-ns pb0-ns">
<label for="publicSubdomainGatewayUrl">
<dl>
<dt>${browser.i18n.getMessage('option_publicSubdomainGatewayUrl_title')}</dt>
Expand All @@ -67,7 +67,7 @@ function gatewaysForm ({
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="publicSubdomainGatewayUrl"
type="url"
inputmode="url"
Expand All @@ -79,7 +79,7 @@ function gatewaysForm ({
value=${publicSubdomainGatewayUrl} />
</div>
${supportRedirectToCustomGateway && allowChangeOfCustomGateway ? html`
<div>
<div class="flex-row-ns pb0-ns">
<label for="customGatewayUrl">
<dl>
<dt>${browser.i18n.getMessage('option_customGatewayUrl_title')}</dt>
Expand All @@ -89,7 +89,7 @@ function gatewaysForm ({
</dl>
</label>
<input
class="bg-white navy"
class="bg-white navy self-center-ns"
id="customGatewayUrl"
type="url"
inputmode="url"
Expand All @@ -104,18 +104,18 @@ function gatewaysForm ({
</div>
` : null}
${supportRedirectToCustomGateway ? html`
<div>
<div class="flex-row-ns pb0-ns">
<label for="useCustomGateway">
<dl>
<dt>${browser.i18n.getMessage('option_useCustomGateway_title')}</dt>
<dd>${browser.i18n.getMessage('option_useCustomGateway_description')}</dd>
</dl>
</label>
<div>${switchToggle({ id: 'useCustomGateway', checked: useCustomGateway, onchange: onUseCustomGatewayChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'useCustomGateway', checked: useCustomGateway, onchange: onUseCustomGatewayChange })}</div>
</div>
` : null}
${supportRedirectToCustomGateway ? html`
<div>
<div class="flex-row-ns pb0-ns">
<label for="useSubdomains">
<dl>
<dt>${browser.i18n.getMessage('option_useSubdomains_title')}</dt>
Expand All @@ -127,23 +127,23 @@ function gatewaysForm ({
</dd>
</dl>
</label>
<div>${switchToggle({ id: 'useSubdomains', checked: useSubdomains, onchange: onUseSubdomainProxyChange })}</div>
<div class="self-center-ns">${switchToggle({ id: 'useSubdomains', checked: useSubdomains, onchange: onUseSubdomainProxyChange })}</div>
</div>
` : null}
${supportRedirectToCustomGateway ? html`
<div>
<div class="flex-row-ns pb0-ns">
<label for="noIntegrationsHostnames">
<dl>
<dt>${browser.i18n.getMessage('option_noIntegrationsHostnames_title')}</dt>
<dd>${browser.i18n.getMessage('option_noIntegrationsHostnames_description')}</dd>
</dl>
</label>
<textarea
class="bg-white navy"
class="bg-white navy self-center-ns"
id="noIntegrationsHostnames"
spellcheck="false"
onchange=${onNoIntegrationsHostnamesChange}
rows="4"
rows="1"
>${hostArrayToText(noIntegrationsHostnames)}</textarea>
</div>
` : null}
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/options/forms/global-toggle-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const switchToggle = require('../../pages/components/switch-toggle')
function globalToggleForm ({ active, onOptionChange }) {
const toggle = onOptionChange('active')
return html`
<form class="db mb3 bg-aqua-muted charcoal">
<form class="db b mb3 bg-aqua-muted charcoal">
<label for="active" class="dib pa3 flex items-center pointer ${!active ? 'charcoal bg-gray-muted br2' : ''}">
${switchToggle({ id: 'active', checked: active, onchange: toggle, style: 'mr3' })}
${browser.i18n.getMessage('panel_headerActiveToggleTitle')}
Expand Down
Loading