Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QR-Code for Share Links #2162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Himmelxd
Copy link

@Himmelxd Himmelxd commented May 11, 2024

Closes #1606
at least supposed to
image

src/components/QrModal.vue Outdated Show resolved Hide resolved
l10n/de.json Outdated Show resolved Hide resolved
l10n/de_DE.json Outdated Show resolved Hide resolved
src/components/QrModal.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
@Chartman123
Copy link
Collaborator

@Himmelxd thanks for this PR :) I added some comments on the code

@Chartman123 Chartman123 added this to the 4.3 milestone May 12, 2024
@Himmelxd Himmelxd requested a review from Chartman123 May 12, 2024 14:08
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments and in my opinion improvements. @susnux Please also have a look at it 🙂

src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
@Chartman123 Chartman123 requested review from susnux and Koc May 12, 2024 19:11
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So except those two comments (that slipped through before), everything looks fine from my side. Could you please squash all commits into one?

src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
@Himmelxd Himmelxd force-pushed the himmel/qrcode-sharelinks branch 3 times, most recently from 9d3afde to e71359c Compare May 13, 2024 10:54
@Chartman123 Chartman123 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 13, 2024
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me now :) @susnux please have another look

@Himmelxd
Copy link
Author

Thank you for your review and great comments :D

@Himmelxd Himmelxd force-pushed the himmel/qrcode-sharelinks branch 2 times, most recently from 9794111 to 41ab25d Compare May 16, 2024 14:54
@Himmelxd Himmelxd requested a review from susnux May 17, 2024 13:30
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments again... Please also do another rebase to squash all commits into one.

src/components/QRDialog.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
src/components/SidebarTabs/SharingSidebarTab.vue Outdated Show resolved Hide resolved
Signed-off-by: Felix Beichler <felix@beichlers.de>

resolve first comments

Signed-off-by: Felix Beichler <felix@beichlers.de>

move modal into tab vue

Signed-off-by: Felix Beichler <felix@beichlers.de>

remove spaces (again)

Signed-off-by: Felix Beichler <felix@beichlers.de>

refactor qr-variables to single object on this.

Signed-off-by: Felix Beichler <felix@beichlers.de>

resolve comments

Signed-off-by: Felix Beichler <felix@beichlers.de>

remove url label

Signed-off-by: Felix Beichler <felix@beichlers.de>

resolve comments

Signed-off-by: Felix Beichler <felix@beichlers.de>

parameterize alt text

Signed-off-by: Felix Beichler <felix@beichlers.de>

fix order of iconqr import

Signed-off-by: Felix Beichler <felix@beichlers.de>

change nc modal to dialog

Signed-off-by: Felix Beichler <felix@beichlers.de>

resolve Share {formTitle}

Signed-off-by: Felix Beichler <felix@beichlers.de>

separate qr dialog to component

Signed-off-by: Felix Beichler <felix@beichlers.de>

resolve comments

Signed-off-by: Felix Beichler <felix@beichlers.de>
Copy link
Collaborator

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes!

But I still have some changes 🙈
I meant to abstract the whole dialog as a component, so also move the NcDialog to the QRDialog component.

Some minor stuff like making it reactive (currently in your version the uri is only built on create).

Comment on lines +2 to +9
<div class="qrDialog__content">
<h2>{{ title }}</h2>
<div>
<img :src="uri"
:title="text"
:alt="t('forms', 'QR code representation of {text}', { text: text })">
</div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div class="qrDialog__content">
<h2>{{ title }}</h2>
<div>
<img :src="uri"
:title="text"
:alt="t('forms', 'QR code representation of {text}', { text: text })">
</div>
</div>
<NcDialog class="qr-dialog"
close-on-click-outside
:name="title"
:open="open"
@close="$emit('close')>
<div class="qr-dialog__content">
<img :src="uri"
:title="text"
:alt="t('forms', 'QR code representation of {text}', { text: text })">
</div>
</NcDialog>

The idea is to wrap the dialog not only the content, especially to use the NcDialog name instead of custom heading.

Comment on lines +39 to +41
created() {
this.generateQr()
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
created() {
this.generateQr()
},
watch {
text: {
immediate: true,
handler() {
this.generateQr()
},
},
},

Allow to be reactive to prop changes.

Comment on lines +57 to +60
.qrDialog__content {
margin-bottom: 50px;
text-align: center;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.qrDialog__content {
margin-bottom: 50px;
text-align: center;
}
.qr-dialog__content {
display: flex;
justify-content: space-around;
width: 100%;
}

@@ -60,6 +60,12 @@
</template>
{{ t('forms', 'Copy to clipboard') }}
</NcActionLink>
<NcActionButton @click="openQrDialog(getPublicShareLink(share))">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<NcActionButton @click="openQrDialog(getPublicShareLink(share))">
<NcActionButton @click="openQrDialog(share)">

Better to handle the logic in the method than in the template.

Comment on lines +100 to +103
<NcDialog :open.sync="qrDialog" close-on-click-outside="true" @close="qrDialog=false">
<QRDialog :title="t('forms', 'Share {formTitle}', { formTitle: form.title })"
:text="qrDialog" />
</NcDialog>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<NcDialog :open.sync="qrDialog" close-on-click-outside="true" @close="qrDialog=false">
<QRDialog :title="t('forms', 'Share {formTitle}', { formTitle: form.title })"
:text="qrDialog" />
</NcDialog>
<QRDialog :open="qrDialogText !== null"
:title="t('forms', 'Share {formTitle}', { formTitle: form.title })"
:text="qrDialogText"
@close="qrDialogText = null" />

Abstract the dialog and move it to the component instead.

@@ -232,6 +249,7 @@ export default {
return {
isLoading: false,
appConfig: loadState(appName, 'appConfig'),
qrDialog: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qrDialog: false,
qrDialogText: null,

Mixing boolean and string here is not really obvious I think, so instead make it string by default with null to explicitly mark no value.

Comment on lines +412 to +414
async openQrDialog(qrText) {
this.qrDialog = qrText
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async openQrDialog(qrText) {
this.qrDialog = qrText
},
openQrDialog(share) {
this.qrDialogText = getPublicShareLink(share)
},

see above (also this is not async)

@susnux
Copy link
Collaborator

susnux commented May 21, 2024

PS: My code suggestions are only to show what I meant, they are not tested and need some refactoring ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request feature: 👥 sharing settings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form share with QR codes
3 participants