Adding in archiver screen, temp api calls

This commit is contained in:
iamBadgers
2025-08-10 22:38:30 -07:00
parent 902cc4f2e8
commit 678095a004
3 changed files with 96 additions and 30 deletions

View File

@@ -1,14 +1,67 @@
import { id as moduleId } from "../../module.json";
import { CharacterManagerClient } from "../../proto/character.client";
import { GetCharacterRequest } from '../../proto/character'
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
export class CharacterArchiver extends Application {
static override get defaultOptions() {
const options = super.defaultOptions;
options.id = "character-archiver";
options.template = "modules/rush-character-archive-foundry-module/templates/CharacterArchiver.hbs";
options.width = 500;
options.height = 270;
options.tabs = [{ navSelector: ".tabs", contentSelector: ".theatre-config-contents", initial: "main" }];
return options;
}
readonly characterId: String;
readonly character: Actor | undefined;
readonly client = new CharacterManagerClient(
new GrpcWebFetchTransport({
baseUrl: 'http://localhost/api',
format: 'binary',
}),
);
thingy: any;
constructor(characterId: string) {
super()
this.characterId = characterId;
this.character = (game as Game).actors!.get(characterId);
}
static override get defaultOptions() {
const options = super.defaultOptions;
options.id = "character-archiver";
options.template = `modules/${moduleId}/templates/CharacterArchiver.hbs`;
options.width = 500;
options.height = 270;
options.tabs = [];
return options;
}
override getData() {
return {
potato: "potato tato po tato",
reads: this.thingy
};
}
override activateListeners(html: JQuery<HTMLElement>): void {
console.log("activating listeners");
super.activateListeners(html);
html
.find("button.archive-button")
.on("click", this._archiveButton.bind(this));
}
private async _archiveButton() {
console.log("Potato");
let request = GetCharacterRequest.fromJson({
})
console.log("Potato");
await this.client.getCharacter(request).then((res: any) => {
console.log(res)
this.thingy = res.response;
console.log(res);
this.render(true);
})
}
}