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

Lightning address + diverse nostr signers #203

Merged
merged 13 commits into from
Aug 14, 2024
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"editor.guides.bracketPairs": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
// "editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"],
"files.exclude": {
"**/.git": true,
Expand Down
25 changes: 25 additions & 0 deletions src/components/HistoryTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@
</q-item-section>
</q-item>
</q-list>
<div class="text-center q-mt-lg">
<q-btn
rounded
outline
dense
@click="filterPending = !filterPending"
:color="filterPending ? 'primary' : 'grey'"
:label="filterPending ? 'Show all' : 'Filter pending'"
class="q-ml-sm q-px-md"
size="sm"
/>
</div>
<div v-if="paginatedTokens.length === 0" class="text-center q-mt-lg">
<q-item-label caption class="text-primary">No history yet</q-item-label>
</div>
Expand Down Expand Up @@ -107,8 +119,14 @@ export default defineComponent({
return {
currentPage: 1,
pageSize: 5,
filterPending: false,
};
},
watch: {
filterPending: function () {
this.currentPage = 1;
},
},
computed: {
...mapState(useTokensStore, ["historyTokens"]),
...mapWritableState(useReceiveTokensStore, [
Expand All @@ -121,6 +139,13 @@ export default defineComponent({
paginatedTokens() {
const start = (this.currentPage - 1) * this.pageSize;
const end = start + this.pageSize;
if (this.filterPending) {
return this.historyTokens
.filter((token) => token.status === "pending")
.slice()
.reverse()
.slice(start, end);
}
return this.historyTokens.slice().reverse().slice(start, end);
},
},
Expand Down
1 change: 1 addition & 0 deletions src/components/InvoiceDetailDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
position="top"
backdrop-filter="blur(2px) brightness(60%)"
no-backdrop-dismiss
full-height
>
<q-card class="q-px-lg q-pt-md q-pb-md qcard">
<!-- invoice is not entered -->
Expand Down
24 changes: 23 additions & 1 deletion src/components/InvoicesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@
</q-item-section>
</q-item>
</q-list>

<div class="text-center q-mt-lg">
<q-btn
rounded
outline
dense
@click="filterPending = !filterPending"
:color="filterPending ? 'primary' : 'grey'"
:label="filterPending ? 'Show all' : 'Filter pending'"
class="q-ml-sm q-px-md"
size="sm"
/>
</div>
<div v-if="paginatedInvoices.length === 0" class="text-center q-mt-lg">
<q-item-label caption class="text-primary"
>No invoices yet</q-item-label
Expand Down Expand Up @@ -91,8 +102,14 @@ export default defineComponent({
return {
currentPage: 1,
pageSize: 5,
filterPending: false,
};
},
watch: {
filterPending: function () {
this.currentPage = 1;
},
},
computed: {
...mapWritableState(useUiStore, ["showInvoiceDetails"]),
...mapWritableState(useWalletStore, [
Expand All @@ -106,6 +123,11 @@ export default defineComponent({
paginatedInvoices() {
const start = (this.currentPage - 1) * this.pageSize;
const end = start + this.pageSize;
if (this.filterPending) {
return this.invoiceHistory
.filter((invoice) => invoice.status === "pending")
.slice(start, end);
}
return this.invoiceHistory.slice().reverse().slice(start, end);
},
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/MintSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ export default defineComponent({
methods: {
...mapActions(useNostrStore, [
"init",
"connect",
"initNdkReadOnly",
"getUserPubkey",
"fetchEventsFromUser",
"fetchMints",
Expand Down Expand Up @@ -761,7 +761,7 @@ export default defineComponent({
}
},
initNdk: async function () {
await this.connect();
await this.initNdkReadOnly();
console.log(await this.getUserPubkey());
// console.log("### fetch events");
// console.log(await this.fetchEventsFromUser());
Expand All @@ -770,7 +770,7 @@ export default defineComponent({
},
fetchMintsFromNdk: async function () {
this.discoveringMints = true;
await this.connect();
await this.initNdkReadOnly();
console.log("### fetch mints");
let maxTries = 5;
let tries = 0;
Expand Down
9 changes: 4 additions & 5 deletions src/components/ReceiveTokenDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@
rounded
flat
class="q-mr-sm"
v-if="
decodeToken(receiveData.tokensBase64) &&
!tokenAlreadyInHistory(receiveData.tokensBase64)
"
v-if="decodeToken(receiveData.tokensBase64)"
>Later
<q-tooltip>Add to history to receive later</q-tooltip>
</q-btn>
Expand Down Expand Up @@ -232,10 +229,12 @@ export default defineComponent({
);
},
addPendingTokenToHistory: function (token) {
const tokensStore = useTokensStore();
if (this.tokenAlreadyInHistory(token)) {
this.notifySuccess("Ecash already in history");
this.showReceiveTokens = false;
return;
}
const tokensStore = useTokensStore();
const decodedToken = this.decodeToken(token);
// get amount from decodedToken.token.proofs[..].amount
const amount = this.getProofs(decodedToken).reduce(
Expand Down
1 change: 1 addition & 0 deletions src/components/SendTokenDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
position="top"
backdrop-filter="blur(2px) brightness(60%)"
no-backdrop-dismiss
full-height
>
<q-card class="q-pa-none q-pt-none qcard">
<!-- enter send data -->
Expand Down
Loading
Loading