Actions now use resolver. Dialog handles websocket messaging. Added support for text values on actions.

This commit is contained in:
Tom
2025-01-15 00:58:55 +00:00
parent 9cda9a5738
commit c62b9aaaad
8 changed files with 121 additions and 53 deletions

View File

@ -2,18 +2,6 @@ main {
display: grid;
grid-template-columns: repeat(1, 1fr);
@media (min-width:1200px) {
grid-template-columns: repeat(2, 1fr);
}
@media (min-width:1650px) {
grid-template-columns: repeat(3, 1fr);
}
@media (min-width:2200px) {
grid-template-columns: repeat(4, 1fr);
}
grid-auto-flow: row dense;
grid-gap: 1rem;
justify-content: center;
@ -53,4 +41,22 @@ main {
& article:first-child {
flex: 1;
}
}
@media (min-width:1200px) {
main {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width:1650px) {
main {
grid-template-columns: repeat(3, 1fr);
}
}
@media (min-width:2200px) {
main {
grid-template-columns: repeat(4, 1fr);
}
}

View File

@ -37,30 +37,21 @@ export class ActionListComponent {
this.opened = true;
const dialogRef = this.dialog.open(ActionItemEditComponent, {
data: { action: {user_id: action.user_id, name: action.name, type: action.type, data: action.data }, actions: this.actions },
data: { action: { user_id: action.user_id, name: action.name, type: action.type, data: action.data }, actions: this.actions },
});
const isNewAction = action.name.length <= 0;
const requestType = isNewAction ? 'create_redeemable_action' : 'update_redeemable_action';
dialogRef.afterClosed().subscribe((result: RedeemableAction) => {
const isNewAction = action.name.length <= 0;
dialogRef.afterClosed().subscribe((result: RedeemableAction | undefined) => {
this.opened = false;
if (!result)
return;
this.client.first((d: any) => d.op == 4 && d.d.request.type == requestType && d.d.data.name == result.name)
?.subscribe(_ => {
if (isNewAction) {
this.actionsChange.emit(result);
} else {
action.type = result.type;
action.data = result.data;
}
});
if (isNewAction)
this.client.createRedeemableAction(result.name, result.type, result.data);
else
this.client.updateRedeemableAction(result.name, result.type, result.data);
if (isNewAction) {
this.actionsChange.emit(result);
} else {
action.type = result.type;
action.data = result.data;
}
});
}
}