From ca7eeb9b7aebd0e992ea613841ed06368fe97956 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Tue, 6 Oct 2020 14:34:03 -0700 Subject: [PATCH] add privacy policy link to 'about' dialog --- src/main/index.js | 7 +++++++ src/renderer/about.css | 12 ++++++++++++ src/renderer/about.jsx | 28 ++++++++++++++++++++++++---- src/renderer/app.jsx | 4 ++-- src/renderer/index.js | 13 +++++++++++-- 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 8977a3d..8b182ec 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -200,6 +200,9 @@ const createWindow = ({search = null, url = 'index.html', ...browserWindowOption const fullUrl = makeFullUrl(url, search); window.loadURL(fullUrl); + window.once('ready-to-show', () => { + webContents.send('ready-to-show'); + }); return window; }; @@ -398,6 +401,10 @@ ipcMain.on('open-about-window', () => { _windows.about.show(); }); +ipcMain.on('open-privacy-policy-window', () => { + _windows.privacy.show(); +}); + // start loading initial project data before the GUI needs it so the load seems faster const initialProjectDataPromise = (async () => { if (argv._.length === 0) { diff --git a/src/renderer/about.css b/src/renderer/about.css index 68b55f4..43f9ce7 100644 --- a/src/renderer/about.css +++ b/src/renderer/about.css @@ -5,6 +5,14 @@ html, body { font-weight: bolder; } +a:active, a:hover, a:link, a:visited { + color: currentColor; +} + +a:active, a:hover { + filter: brightness(0.9); +} + .aboutBox { margin: 0; position: absolute; @@ -25,3 +33,7 @@ html, body { .aboutDetails { font-size: x-small; } + +.aboutFooter { + font-size: small; +} diff --git a/src/renderer/about.jsx b/src/renderer/about.jsx index b07c2e4..da1ff42 100644 --- a/src/renderer/about.jsx +++ b/src/renderer/about.jsx @@ -1,3 +1,4 @@ +import {ipcRenderer} from 'electron'; import React from 'react'; import ReactDOM from 'react-dom'; import {productName, version} from '../../package.json'; @@ -5,6 +6,16 @@ import {productName, version} from '../../package.json'; import logo from '../icon/ScratchDesktop.svg'; import styles from './about.css'; +// don't actually follow the link in the `href` attribute +// instead, tell the main process to open the privacy policy window +const showPrivacyPolicy = event => { + if (event) { + event.preventDefault(); + } + ipcRenderer.send('open-privacy-policy-window'); + return false; +}; + const AboutElement = () => (
{component} | {componentVersion} |