1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-08 20:22:45 +01:00

stubbed copy dialog

This commit is contained in:
Danny Coates 2018-10-25 18:55:11 -07:00
parent d881755814
commit 7ad63ae004
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
6 changed files with 1946 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import * as metrics from './metrics';
import Archive from './archive'; import Archive from './archive';
import { bytes } from './utils'; import { bytes } from './utils';
import okDialog from './ui/okDialog'; import okDialog from './ui/okDialog';
import copyDialog from './ui/copyDialog';
export default function(state, emitter) { export default function(state, emitter) {
let lastRender = 0; let lastRender = 0;
@ -156,6 +157,7 @@ export default function(state, emitter) {
if (password) { if (password) {
emitter.emit('password', { password, file: ownedFile }); emitter.emit('password', { password, file: ownedFile });
} }
state.modal = copyDialog(ownedFile.url);
state.animation = () => { state.animation = () => {
const x = document.querySelector('.foo'); const x = document.querySelector('.foo');
const y = x.previousElementSibling; const y = x.previousElementSibling;

29
app/ui/copyDialog.js Normal file
View File

@ -0,0 +1,29 @@
const html = require('choo/html');
const assets = require('../../common/assets');
const { copyToClipboard } = require('../utils');
module.exports = function(url) {
return function(state, emit, close) {
return html`
<div class="flex flex-col p-4">
<input
type="image"
class="self-end text-white"
alt="Close"
src="${assets.get('close-16.svg')}"
onclick=${close}/>
<h1 class="font-normal mt-2">${state.translate('notifyUploadDone')}</h1>
<input type="text" class="w-full my-4 border rounded leading-loose" value=${url} readonly="true"/>
<button class="border rounded bg-blue text-white leading-loose w-full" onclick=${copy}>
${state.translate('copyUrlFormButton')}
</button>
</div>`;
function copy(event) {
event.stopPropagation();
copyToClipboard(url);
event.target.textContent = state.translate('copiedUrl');
setTimeout(close, 1000);
}
};
};

1899
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,7 @@
"npm-run-all": "^4.1.3", "npm-run-all": "^4.1.3",
"nyc": "^13.0.1", "nyc": "^13.0.1",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.2.0",
"prettier": "^1.14.3", "prettier": "^1.14.3",
"proxyquire": "^2.1.0", "proxyquire": "^2.1.0",
"puppeteer": "^1.9.0", "puppeteer": "^1.9.0",

View File

@ -7,6 +7,14 @@ class TailwindExtractor {
const options = { const options = {
plugins: [ plugins: [
require('tailwindcss')('./tailwind.js'), require('tailwindcss')('./tailwind.js'),
require('postcss-preset-env')
]
};
if (process.env.NODE_ENV === 'development') {
options.map = { inline: true };
} else {
options.plugins.push(
require('@fullhuman/postcss-purgecss')({ require('@fullhuman/postcss-purgecss')({
content: ['./app/*.js', './app/ui/*.js'], content: ['./app/*.js', './app/ui/*.js'],
extractors: [ extractors: [
@ -15,15 +23,13 @@ const options = {
extensions: ['js'] extensions: ['js']
} }
] ]
}), })
);
options.plugins.push(
require('cssnano')({ require('cssnano')({
preset: 'default' preset: 'default'
}) })
] );
};
if (process.env.NODE_ENV === 'development') {
options.map = { inline: true };
} }
module.exports = options; module.exports = options;

View File

@ -200,7 +200,8 @@ const web = {
], ],
devtool: 'source-map', devtool: 'source-map',
devServer: { devServer: {
before: require('./server/bin/dev'), before:
process.env.NODE_ENV === 'development' && require('./server/bin/dev'),
compress: true, compress: true,
hot: false, hot: false,
host: '0.0.0.0', host: '0.0.0.0',
@ -217,7 +218,7 @@ const web = {
module.exports = (env, argv) => { module.exports = (env, argv) => {
const mode = argv.mode || 'production'; const mode = argv.mode || 'production';
console.error(`mode: ${mode}`); console.error(`mode: ${mode}`);
web.mode = serviceWorker.mode = mode; process.env.NODE_ENV = web.mode = serviceWorker.mode = mode;
if (mode === 'development') { if (mode === 'development') {
// istanbul instruments the source for code coverage // istanbul instruments the source for code coverage
webJsOptions.plugins.push('istanbul'); webJsOptions.plugins.push('istanbul');