-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from acmauth/wallet
Wallet
- Loading branch information
Showing
5 changed files
with
141 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang='ts'> | ||
import { onMount } from 'svelte'; | ||
import QRCode from 'qrcode' | ||
import type { qrItem } from './qrItem'; | ||
import { alertController } from 'ionic-svelte'; | ||
import { qrStore } from './qrStore'; | ||
import { goto } from '$app/navigation'; | ||
import { reload } from 'ionicons/icons'; | ||
export let qr1: qrItem; | ||
onMount(() => { | ||
const qrCodeElement = document.getElementById(qr1.data); | ||
QRCode.toCanvas(qrCodeElement, qr1.data, { width: 200, height: 200 }); | ||
}); | ||
const showAlert = async (options) => { | ||
const alert = await alertController.create(options); | ||
await alert.present(); | ||
}; | ||
function deleteQR() { | ||
const options = { | ||
header: 'Αφαίρεση QR;', | ||
message: 'Θέλεις να αφαιρεθεί το QR από το πορτοφόλι σου;', | ||
buttons: [{ | ||
text: 'ΟΧΙ', | ||
role: 'cancel', | ||
handler: () => { | ||
return; | ||
} | ||
}, | ||
{ | ||
text: 'ΝΑΙ', | ||
role: 'confirm', | ||
handler: () => { | ||
qrStore.update((store) => store.filter((item) => item.data !== qr1.data)); | ||
} | ||
}] | ||
}; | ||
showAlert(options); | ||
} | ||
</script> | ||
|
||
|
||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<ion-div on:click={deleteQR}> | ||
<canvas id="{qr1.data}"></canvas> | ||
<ion-label>{qr1.title}</ion-label> | ||
</ion-div> | ||
|
||
<style> | ||
ion-div { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface qrItem { | ||
title: string, | ||
data: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { persisted } from 'svelte-persisted-store' | ||
import type { qrItem } from './qrItem'; | ||
|
||
export const qrStore = persisted('qrStore', new Array<qrItem>()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters