Skip to content

Commit

Permalink
feat: page qrcode (#53)
Browse files Browse the repository at this point in the history
* feat: page qrcode

* fix lint

---------

Co-authored-by: Esurio <[email protected]>
  • Loading branch information
1673beta and 1673beta authored Jun 30, 2024
1 parent 789fb04 commit c741187
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkQrcode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div :class="$style.title">
<QRCodeVue3
:value="qrCode"
:qrOptions="{ errorCorrectionLevel: 'H' }"
:qrOptions="{ errorCorrectionLevel: 'H' }"
:cornersSquareOptions="{ type: 'extra-rounded' }"
:cornersDotOptions="{ type: 'square' }"
:dotsOptions="{
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/os.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ export async function displayQrCode(qrCode: string) {
resolve(dispose);
},
},
).then((res) =>{
).then((res) => {
dispose = res.dispose;
});
})
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/follow-me.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if (!remoteAccountId.result) {
const subscribeUri = data.links.find(
(link: { rel: string }) => link.rel === "http://ostatus.org/schema/1.0/subscribe",
).template;
window.location.href = subscribeUri.replace("{uri}", accountUri.includes("@") ? accountUri: `${accountUri}@${hostRaw}`,);
window.location.href = subscribeUri.replace("{uri}", accountUri.includes("@") ? accountUri : `${accountUri}@${hostRaw}`,);
})
.catch((_) => {
window.location.href = `/@${accountUri}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/gallery/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function shareWithNote() {
}

function shareQrCode() {
os.displayQrCode(`${url}/gallery/${post.value.id}`)
os.displayQrCode(`${url}/gallery/${post.value.id}`);
}

function like() {
Expand Down
7 changes: 7 additions & 0 deletions packages/frontend/src/pages/page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.other">
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
<button v-tooltip="i18n.ts.getQrCode" class="_button" :class="$style.generalActionButton" @click="shareQrCode"><i class="ti ti-qrcode ti-fw"></i></button>
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
</div>
</div>
Expand Down Expand Up @@ -188,6 +189,12 @@ function copyLink() {
os.success();
}

function shareQrCode() {
if (!page.value) return;

os.displayQrCode(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
}

function shareWithNote() {
if (!page.value) return;

Expand Down

0 comments on commit c741187

Please sign in to comment.