Skip to content

Commit

Permalink
Add TextCard
Browse files Browse the repository at this point in the history
  • Loading branch information
MBoretto committed Oct 5, 2023
1 parent fe23b1a commit 101b57a
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<template>
<div id="main">
<div
v-if="is_telegram_client && is_telegram_api_updated"
>
<!-- v-if="is_telegram_client && is_telegram_api_updated"-->
<div>
<v-card
class="mx-auto"
max-width="600"
Expand Down Expand Up @@ -82,12 +81,17 @@
<GeoCard
v-if="enriched_values[akey]['type'] === 'geo'"
:coordinate="enriched_values[akey]['info']"
@remove-key="removeKey(key)"
@remove-key="removeKey(akey)"
/>
<UrlCard
v-if="enriched_values[akey]['type'] === 'url'"
:url="enriched_values[akey]['info']"
@remove-key="removeKey(key)"
@remove-key="removeKey(akey)"
/>
<TextCard
v-if="enriched_values[akey]['type'] === 'text' || enriched_values[akey]['type'] === 'wifi' || enriched_values[akey]['type'] === 'vcard'"
:text="enriched_values[akey]['info']"
@remove-key="removeKey(akey)"
/>
</v-expansion-panel-text>
</v-expansion-panel>
Expand Down Expand Up @@ -185,11 +189,13 @@
import { prepareUrl, prepareCoordinate } from './helpers'
import UrlCard from "./components/UrlCard.vue";
import GeoCard from "./components/GeoCard.vue";
import TextCard from "./components/TextCard.vue";
export default {
components: {
UrlCard,
GeoCard
GeoCard,
TextCard,
},
data() {
return {
Expand All @@ -198,8 +204,10 @@ export default {
last_code: null,
show_history: true,
// Cloud storage
cloud_storage_keys: [],
cloud_storage_values: {},
// cloud_storage_keys: [],
// cloud_storage_values: {},
cloud_storage_keys: [ "1696492897779", "1696492893878", "1696492890069", "1696492865770" ],
cloud_storage_values: {"1696492897779": "geo:46.227638,2.213749", "1696492893878": "WIFI:S:mywifi;T:WPA;P:12345678;;", "1696492890069": "BEGIN:VCARD\nVERSION:2.1\nN:Doe;John\nFN:John Doe\nORG:Telegram\nTITLE:Dr\nTEL:+20345968753\nEMAIL:[email protected]\nADR:;;2 ABC street;London;London;16873;uk\nURL:www.telegram.org\nEND:VCARD\n", "1696492865770": "https://telegram.com" },
enriched_values: {},
is_continuous_scan: false,
show_debug: false,
Expand Down Expand Up @@ -283,11 +291,13 @@ export default {
if (code_type == "geo") {
this.enriched_values[key]['info'] = prepareCoordinate(this.cloud_storage_values[key]);
} else if (code_type == "wifi") {
//this.enriched_values[key]['info'] = processWifiCode(this.cloud_storage_values[key]);
this.enriched_values[key]['info'] = this.cloud_storage_values[key];
} else if (code_type == "vcard") {
//this.enriched_values[key]['info'] = processVcardCode(this.cloud_storage_values[key]);
this.enriched_values[key]['info'] = this.cloud_storage_values[key];
} else if (code_type == "url") {
this.enriched_values[key]['info'] = prepareUrl(this.cloud_storage_values[key]);
} else if (code_type == "text") {
this.enriched_values[key]['info'] = this.cloud_storage_values[key];
}
},
Expand Down
56 changes: 56 additions & 0 deletions src/components/TextCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<v-card
class="mx-auto"
max-width="600"
variant="flat"
>
<v-card-item>
<div>
{{ atext }}
</div>
</v-card-item>
<v-card-actions>
<v-spacer />
<v-btn
color="red"
icon="mdi-delete-outline"
variant="text"
@click="$emit('remove-key')"
/>
</v-card-actions>
</v-card>
</template>

<script>
import { defineComponent } from 'vue';
export default defineComponent({
name: "TextCard",
props: {
text: {
type: String, // Object is a constructor for objects
required: true, // This is optional, but it makes the prop required
}
},
emits: [
'remove-key'
],
data() {
return {
atext: this.text,
};
},
created() {
console.log(this.coordinate);
},
methods: {
openLink(lat, lng) {
this.TWA.openLink('https://maps.google.com/?q=' + lat + ',' + lng);
},
},
});
</script>



<style scoped>
</style>

0 comments on commit 101b57a

Please sign in to comment.