Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions app/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import FileReceiver from './fileReceiver';
import FileSender from './fileSender';
import copyDialog from './ui/copyDialog';
import faviconProgressbar from './ui/faviconProgressbar';
import howItWorksDialog from './ui/howItWorksDialog';
import okDialog from './ui/okDialog';
import shareDialog from './ui/shareDialog';
import signupDialog from './ui/signupDialog';
Expand Down Expand Up @@ -264,6 +265,11 @@ export default function(state, emitter) {
copyToClipboard(url);
});

emitter.on('showHowItWorks', () => {
state.modal = howItWorksDialog();
render();
});

emitter.on('closeModal', () => {
if (
state.PREFS.surveyUrl &&
Expand Down
19 changes: 17 additions & 2 deletions app/ui/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const html = require('choo/html');
const Component = require('choo/component');

class Footer extends Component {
constructor(name, state) {
constructor(name, state, emit) {
super(name);
this.state = state;
this.emit = emit;
}

update() {
Expand All @@ -13,9 +14,23 @@ class Footer extends Component {

createElement() {
const translate = this.state.translate;
const emit = this.emit;

const onHowItWorks = e => {
e.preventDefault();
emit('showHowItWorks');
};

// Add additional links from configuration if available
var links = [];
var links = [
html`
<li class="snd-footer-item">
<a href="#" onclick=${onHowItWorks}>
${translate('footerLinkHowItWorks')}
</a>
</li>
`
];
if (this.state != undefined && this.state.WEB_UI != undefined) {
const WEB_UI = this.state.WEB_UI;

Expand Down
141 changes: 141 additions & 0 deletions app/ui/howItWorksDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
const html = require('choo/html');

module.exports = function howItWorksDialog() {
return function(state, emit, close) {
const t = key => state.translate(key);

return html`
<send-how-dialog class="snd-how">
<button
class="snd-how-close"
onclick=${close}
aria-label="${t('howItWorksCloseLabel')}"
>
×
</button>

<h2 class="snd-display snd-how-title">${t('howItWorksTitle')}</h2>
<p class="snd-body-sm snd-how-lede">${t('howItWorksLede')}</p>

${diagram(t)}

<ol class="snd-how-steps" aria-label="${t('howItWorksStepsLabel')}">
<li class="snd-how-step">
<span class="snd-how-step-num">01</span>
<div>
<h3 class="snd-how-step-title">${t('howItWorksStep1Title')}</h3>
<p class="snd-how-step-body">${t('howItWorksStep1Body')}</p>
</div>
</li>
<li class="snd-how-step">
<span class="snd-how-step-num">02</span>
<div>
<h3 class="snd-how-step-title">${t('howItWorksStep2Title')}</h3>
<p class="snd-how-step-body">${t('howItWorksStep2Body')}</p>
</div>
</li>
<li class="snd-how-step">
<span class="snd-how-step-num">03</span>
<div>
<h3 class="snd-how-step-title">${t('howItWorksStep3Title')}</h3>
<p class="snd-how-step-body">${t('howItWorksStep3Body')}</p>
</div>
</li>
<li class="snd-how-step">
<span class="snd-how-step-num">04</span>
<div>
<h3 class="snd-how-step-title">${t('howItWorksStep4Title')}</h3>
<p class="snd-how-step-body">${t('howItWorksStep4Body')}</p>
</div>
</li>
</ol>

<p class="snd-how-foot snd-code-sm">${t('howItWorksFootnote')}</p>

<button
class="snd-btn snd-btn--primary snd-btn--full snd-how-cta"
onclick=${close}
>
${t('howItWorksClose')}
</button>
</send-how-dialog>
`;
};
};

function diagram(t) {
return html`
<figure
class="snd-how-diagram"
role="img"
aria-label="${t('howItWorksDiagramAlt')}"
>
<svg viewBox="0 0 480 140" preserveAspectRatio="xMidYMid meet">
<defs>
<linearGradient id="snd-how-wire" x1="0" x2="1" y1="0" y2="0">
<stop offset="0%" stop-color="var(--snd-line)" />
<stop offset="50%" stop-color="var(--snd-accent)" stop-opacity="0.6" />
<stop offset="100%" stop-color="var(--snd-line)" />
</linearGradient>
</defs>

<line
x1="78" y1="70" x2="402" y2="70"
stroke="url(#snd-how-wire)" stroke-width="1.5"
stroke-dasharray="4 4"
/>

<g class="snd-how-node" transform="translate(40,70)">
<rect x="-32" y="-26" width="64" height="52" rx="0"
fill="var(--snd-card)" stroke="var(--snd-line)" stroke-width="1.25"/>
<path d="M -12 -10 H 6 L 12 -4 V 12 H -12 Z"
fill="none" stroke="var(--snd-text)" stroke-width="1.25"
stroke-linejoin="round" stroke-linecap="round"/>
<line x1="-8" y1="-2" x2="8" y2="-2" stroke="var(--snd-text)" stroke-width="1"/>
<line x1="-8" y1="3" x2="8" y2="3" stroke="var(--snd-text)" stroke-width="1"/>
<line x1="-8" y1="8" x2="4" y2="8" stroke="var(--snd-text)" stroke-width="1"/>
<text x="0" y="44" text-anchor="middle"
font-family="var(--snd-font-mono)" font-size="9"
fill="var(--snd-mute)" letter-spacing="0.06em">
${t('howItWorksDiagramYou')}
</text>
</g>

<g class="snd-how-node" transform="translate(240,70)">
<rect x="-36" y="-26" width="72" height="52" rx="0"
fill="var(--snd-card)" stroke="var(--snd-line)" stroke-width="1.25"/>
<path d="M -10 4 V -4 a 10 10 0 0 1 20 0 V 4"
fill="none" stroke="var(--snd-accent)" stroke-width="1.5"
stroke-linecap="round"/>
<rect x="-14" y="4" width="28" height="14" rx="1"
fill="none" stroke="var(--snd-accent)" stroke-width="1.5"/>
<circle cx="0" cy="11" r="1.5" fill="var(--snd-accent)"/>
<text x="0" y="44" text-anchor="middle"
font-family="var(--snd-font-mono)" font-size="9"
fill="var(--snd-mute)" letter-spacing="0.06em">
${t('howItWorksDiagramServer')}
</text>
</g>

<g class="snd-how-node" transform="translate(440,70)">
<rect x="-32" y="-26" width="64" height="52" rx="0"
fill="var(--snd-card)" stroke="var(--snd-line)" stroke-width="1.25"/>
<circle cx="0" cy="-6" r="6" fill="none"
stroke="var(--snd-text)" stroke-width="1.25"/>
<path d="M -10 14 a 10 10 0 0 1 20 0" fill="none"
stroke="var(--snd-text)" stroke-width="1.25" stroke-linecap="round"/>
<text x="0" y="44" text-anchor="middle"
font-family="var(--snd-font-mono)" font-size="9"
fill="var(--snd-mute)" letter-spacing="0.06em">
${t('howItWorksDiagramRecipient')}
</text>
</g>

<g class="snd-how-packet">
<rect x="-6" y="-5" width="12" height="10" rx="0"
fill="var(--snd-accent)" />
</g>
</svg>
</figure>
`;
}
35 changes: 19 additions & 16 deletions app/ui/notFound.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
const html = require('choo/html');
const assets = require('../../common/assets');
const modal = require('./modal');

module.exports = function(state, emit) {
const btnText = state.user.loggedIn ? 'okButton' : 'sendYourFilesLink';
return html`
<main class="snd-main snd-main--centered">
${state.modal && modal(state, emit)}
<section class="snd-recipient">
<h1 class="snd-display text-center my-2">
<section class="snd-complete">
<div class="snd-complete-hero" aria-hidden="true">
<svg viewBox="0 0 100 100" width="96" height="96">
<rect x="1.5" y="1.5" width="97" height="97" fill="none" stroke="var(--snd-line)" stroke-width="1"/>
<rect x="18" y="18" width="64" height="64" fill="none" stroke="var(--snd-line)" stroke-width="1"/>
<rect x="35" y="35" width="30" height="30" fill="none" stroke="var(--snd-mute)" stroke-width="1.5"/>
<line x1="35" y1="65" x2="65" y2="35" stroke="var(--snd-mute)" stroke-width="2" stroke-linecap="square"/>
</svg>
</div>
<p class="snd-tag snd-text-dim">EXPIRED</p>
<h1 class="snd-display text-center">
${state.translate('expiredTitle')}
</h1>
<svg class="text-primary my-12">
<use xlink:href="${assets.get('notFound.svg')}#svg124" />
</svg>
<p
class="snd-body snd-text-mute max-w-md text-center leading-normal ${state
.user.loggedIn
? 'hidden'
: ''}"
>
<p class="snd-caption snd-text-dim">
> share no longer available · file removed from server
</p>
<p class="snd-body snd-text-mute text-center ${state.user.loggedIn ? 'hidden' : ''}">
${state.translate('trySendDescription')}
</p>
<p class="my-5">
<a href="/" class="snd-btn snd-btn--primary flex items-center" role="button"
>${state.translate(btnText)}</a
>
<p>
<a href="/" class="snd-btn snd-btn--primary" role="button">
${state.translate(btnText)}
</a>
</p>
</section>
</main>
Expand Down
Loading
Loading