Skip to content

Commit

Permalink
add npc jack controller
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Jan 25, 2025
1 parent d34c0d8 commit 4227fb0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/app/routes/email.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DestroyController } from "@controller/DestroyController";
import { NewGameController } from "@controller/NewGameController";
import { NpcJackController } from "@controller/NpcJackController";

interface Controller {
handle(userId: string, message: ForwardableEmailMessage): Promise<void>;
Expand All @@ -12,4 +13,5 @@ type Routes = {
export const routes: Routes = {
new: NewGameController,
destroy: DestroyController,
jack: NpcJackController,
};
37 changes: 37 additions & 0 deletions src/controller/NpcJackController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { inject, injectable } from "tsyringe-neo";

import { EmailController, EmailParams } from "./EmailController";
import { SESv2Client } from "@aws-sdk/client-sesv2";
import { SesEmailPresenter } from "@presenter/SesEmailPresenter";
import { DestroyUsecase } from "@usecase/DestroyUsecase";
import { KvCityRepository } from "@repository/KvCityRepository";

@injectable()
export class NpcJackController extends EmailController {
public static readonly SenderName: string = "Jack";

constructor(
@inject(SESv2Client) private readonly ses: SESv2Client,
@inject(KvCityRepository) private readonly cityRepository: KvCityRepository,
) {
super();
}

protected async onMessage(params: EmailParams): Promise<void> {
var sender = params.to;
if (!sender.includes("<")) {
sender = `${NpcJackController.SenderName} <${sender}>`;
}

const presenter = new SesEmailPresenter(this.ses, {
sender,
recipients: [params.from],
messageId: params.messageId,
references: params.references,
subject: params.subject,
});

presenter.addText("Hello, I'm Jack.");
await presenter.render();
}
}
22 changes: 11 additions & 11 deletions src/view/City.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,51 @@ import { FC } from "hono/jsx";

import { type CitySnapshot } from "@usecase/CitySnapshotUsecase";
import { Layout } from "./Layout";
import { css, cx } from 'hono/css'
import { css, cx } from "hono/css";

const pRelative = css`
position: relative;
`
`;

const pAbsolute = css`
position: absolute;
`
`;

const container = css`
display: flex;
width: 768px;
`
`;

const shell = css`
bottom: 33%;
left: 40%;
`
`;

const factory = css`
bottom: 46%;
left: 7%;
`
left: 7%;
`;

const hospital = css`
bottom: 46%;
right: 5%;
`
`;

const office = css`
bottom: 35%;
left: 0%;
`
`;

const people = css`
bottom: 34%;
right: 0%;
`
`;

export const City: FC<CitySnapshot> = ({ id }) => {
return (
<Layout>
<div class={cx(container, pRelative)}>
<img src="/bg.png" alt="mainCity"/>
<img src="/bg.png" alt="mainCity" />
<div class={cx(pAbsolute, shell)}>
<img src="/shell_0.png" alt="shell" />
</div>
Expand Down

0 comments on commit 4227fb0

Please sign in to comment.