Skip to content

Commit

Permalink
feat(share-plugin): add share name input
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Sep 1, 2021
1 parent 4df2ddd commit 657c597
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/plugins/iframeShare/src/IframeShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default {
shareBackendUrl() {
const apiUrl = this.$viewer.api.apiUrl;
if (apiUrl.includes("staging")) {
return SHARE_BACKEND_URL_STAGING;
// return SHARE_BACKEND_URL_STAGING;
return SHARE_BACKEND_URL_DEV;
} else if (apiUrl.includes("next")) {
return SHARE_BACKEND_URL_NEXT;
}
Expand Down
17 changes: 12 additions & 5 deletions src/plugins/iframeShare/src/ShareTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<div class="share-tab">
<template v-if="currentShare === null">
<div class="share-tab__body">
<BIMDataInput
:placeholder="$t('IframeSharePlugin.share_name')"
v-model="shareName"
/>
<Datepicker
v-model="expirationDate"
:clear-button="true"
Expand Down Expand Up @@ -71,6 +75,7 @@ import {
BIMDataButton,
BIMDataCheckbox,
BIMDataIcon,
BIMDataInput,
} from "@bimdata/design-system/components.js";
import shareIcon from "../assets/share.svg";
Expand All @@ -79,6 +84,7 @@ export default {
BIMDataButton,
BIMDataCheckbox,
BIMDataIcon,
BIMDataInput,
Datepicker,
},
props: {
Expand All @@ -91,17 +97,18 @@ export default {
fr,
en,
shareIcon,
shareName: "",
shareUrl: null,
keepCameraSetup: false,
expirationDate: null,
currentShare: null,
};
},
computed: {
iframeString() {
return (
`<iframe\n` +
` width="560" height="315"\n` +
` src="${this.currentShare}"\n` +
` src="${this.shareUrl}"\n` +
` frameborder="0"\n` +
` allowfullscreen>\n` +
`</iframe>`
Expand Down Expand Up @@ -141,7 +148,7 @@ export default {
const jsonResponse = await response.json();
const id = jsonResponse.id;
this.currentShare = `${this.shareBackendUrl}/${id}`;
this.shareLink = `${this.shareBackendUrl}/${id}`;
},
async copy(text) {
await navigator.clipboard.writeText(text);
Expand All @@ -151,10 +158,10 @@ export default {
});
},
copyUrl() {
this.copy(this.currentShare);
this.copy(this.shareUrl);
},
copyIframe() {
this.copy(this.iframeString);
this.copy(this.shareUrl);
},
},
};
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/iframeShare/src/iframeShare.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
manage_shares: "Manage shares",
expiration_date: "Expiration date",
share: "Share",
share_name: "Share name",
share_url: "Share link",
last_use_date: "Last use date",
},
Expand All @@ -38,6 +39,7 @@ export default {
manage_shares: "Gestion des partages",
expiration_date: "Date d'expiration",
share: "Partager",
share_name: "Nom du lien",
share_link: "Lien de partage",
last_use_date: "Dernière utilisation",
},
Expand Down

0 comments on commit 657c597

Please sign in to comment.