2018-10-26 03:55:11 +02:00
|
|
|
const html = require('choo/html');
|
|
|
|
const { copyToClipboard } = require('../utils');
|
|
|
|
|
2018-10-29 17:52:24 +01:00
|
|
|
module.exports = function(name, url) {
|
2018-10-26 03:55:11 +02:00
|
|
|
return function(state, emit, close) {
|
|
|
|
return html`
|
2019-01-11 01:22:40 +01:00
|
|
|
<send-copy-dialog
|
|
|
|
class="flex flex-col items-center text-center p-4 max-w-sm"
|
|
|
|
>
|
2018-11-16 21:39:36 +01:00
|
|
|
<h1 class="font-bold my-4">${state.translate('notifyUploadDone')}</h1>
|
|
|
|
<p class="font-normal leading-normal text-grey-darker word-break-all">
|
|
|
|
${state.translate('copyUrlFormLabelWithName', { filename: name })}
|
|
|
|
</p>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
id="share-url"
|
2019-02-13 20:14:53 +01:00
|
|
|
class="w-full my-4 border rounded-lg leading-loose h-12 px-2 py-1"
|
2018-11-16 21:39:36 +01:00
|
|
|
value="${url}"
|
|
|
|
readonly="true"
|
|
|
|
/>
|
2019-02-11 22:48:06 +01:00
|
|
|
<button class="btn rounded-lg w-full flex-no-shrink" onclick="${copy}">
|
2018-11-16 21:39:36 +01:00
|
|
|
${state.translate('copyUrlFormButton')}
|
|
|
|
</button>
|
2019-01-11 10:15:03 +01:00
|
|
|
<a
|
2019-02-13 20:14:53 +01:00
|
|
|
class="text-blue-dark hover:text-blue-darker focus:text-blue-darker my-4 font-medium cursor-pointer"
|
2019-01-11 10:15:03 +01:00
|
|
|
onclick="${close}"
|
2018-11-16 21:39:36 +01:00
|
|
|
>${state.translate('okButton')}</a
|
|
|
|
>
|
2019-01-11 01:22:40 +01:00
|
|
|
</send-copy-dialog>
|
2018-11-16 21:39:36 +01:00
|
|
|
`;
|
2018-10-26 03:55:11 +02:00
|
|
|
|
|
|
|
function copy(event) {
|
|
|
|
event.stopPropagation();
|
|
|
|
copyToClipboard(url);
|
|
|
|
event.target.textContent = state.translate('copiedUrl');
|
|
|
|
setTimeout(close, 1000);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|