Fix #888 Implement share card.
This commit is contained in:
parent
32a77180b0
commit
af61434b72
3 changed files with 42 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
|||
/* global Android */
|
||||
|
||||
const html = require('choo/html');
|
||||
const raw = require('choo/html/raw');
|
||||
const assets = require('../../common/assets');
|
||||
|
@ -140,6 +142,26 @@ function archiveDetails(translate, archive) {
|
|||
}
|
||||
|
||||
module.exports = function(state, emit, archive) {
|
||||
const copyOrShare =
|
||||
typeof window.Android !== 'object'
|
||||
? html`
|
||||
<button
|
||||
class="text-blue hover:text-blue-dark focus:text-blue-darker self-end font-medium flex items-center"
|
||||
onclick=${copy}
|
||||
>
|
||||
<img src="${assets.get('copy-16.svg')}" class="mr-2" /> ${
|
||||
state.translate('copyUrlHover')
|
||||
}
|
||||
</button>
|
||||
`
|
||||
: html`
|
||||
<button
|
||||
class="text-blue hover:text-blue-dark focus:text-blue-darker self-end font-medium flex items-center"
|
||||
onclick=${share}
|
||||
>
|
||||
<img src="${assets.get('share-16.svg')}" class="mr-2" /> Share
|
||||
</button>
|
||||
`;
|
||||
return html`
|
||||
<send-archive
|
||||
id="archive-${archive.id}"
|
||||
|
@ -162,12 +184,7 @@ module.exports = function(state, emit, archive) {
|
|||
</div>
|
||||
${archiveDetails(state.translate, archive)}
|
||||
<hr class="w-full border-t my-4">
|
||||
<button
|
||||
class="text-blue hover:text-blue-dark focus:text-blue-darker self-end font-medium flex items-center"
|
||||
onclick=${copy}>
|
||||
<img src="${assets.get('copy-16.svg')}" class="mr-2"/>
|
||||
${state.translate('copyUrlHover')}
|
||||
</button>
|
||||
${copyOrShare}
|
||||
</send-archive>`;
|
||||
|
||||
function copy(event) {
|
||||
|
@ -185,6 +202,11 @@ module.exports = function(state, emit, archive) {
|
|||
event.stopPropagation();
|
||||
emit('delete', { file: archive, location: 'success-screen' });
|
||||
}
|
||||
|
||||
function share(event) {
|
||||
event.stopPropagation();
|
||||
Android.shareUrl(archive.url);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.wip = function(state, emit) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue