From 34d904864185b64a6935b8fec75e80656ae12acf Mon Sep 17 00:00:00 2001 From: Xeltica Date: Thu, 15 Sep 2022 16:36:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=83=B3=E3=83=97=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=83=88=E6=96=87=E5=AD=97=E6=95=B0=E3=82=921024=E3=81=AB?= =?UTF-8?q?=E6=8B=A1=E5=BC=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1663226831484-expandTemplateLength.ts | 13 ++ src/backend/models/entities/user.ts | 2 +- src/frontend/pages/apps/misshai.scss | 9 ++ src/frontend/pages/apps/misshai.tsx | 135 ++++++++++-------- 4 files changed, 97 insertions(+), 62 deletions(-) create mode 100644 migration/1663226831484-expandTemplateLength.ts diff --git a/migration/1663226831484-expandTemplateLength.ts b/migration/1663226831484-expandTemplateLength.ts new file mode 100644 index 0000000..b36acd8 --- /dev/null +++ b/migration/1663226831484-expandTemplateLength.ts @@ -0,0 +1,13 @@ +import {MigrationInterface, QueryRunner} from 'typeorm'; + +export class expandTemplateLength1663226831484 implements MigrationInterface { + name = 'expandTemplateLength1663226831484' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "template" TYPE character varying(1024)'); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "template" TYPE character varying(280)'); + } +} diff --git a/src/backend/models/entities/user.ts b/src/backend/models/entities/user.ts index cba5eeb..ad08e85 100644 --- a/src/backend/models/entities/user.ts +++ b/src/backend/models/entities/user.ts @@ -76,7 +76,7 @@ export class User implements IUser { @Column({ type: 'varchar', - length: 280, + length: 1024, nullable: true, }) public template: string | null; diff --git a/src/frontend/pages/apps/misshai.scss b/src/frontend/pages/apps/misshai.scss index 4ad80dc..4048f11 100644 --- a/src/frontend/pages/apps/misshai.scss +++ b/src/frontend/pages/apps/misshai.scss @@ -14,4 +14,13 @@ > .templateSetting { flex: 5 0 300px; } +} + +.textarea-wrapper { + position: relative; + > .textarea-remaining { + position: absolute; + right: 16px; + bottom: 16px; + } } \ No newline at end of file diff --git a/src/frontend/pages/apps/misshai.tsx b/src/frontend/pages/apps/misshai.tsx index 1b009bd..ac3aec4 100644 --- a/src/frontend/pages/apps/misshai.tsx +++ b/src/frontend/pages/apps/misshai.tsx @@ -187,6 +187,8 @@ export const MisshaiPage: React.VFC = () => { const defaultTemplate = t('_template.default'); + const remaining = 1024 - (draft.template ?? defaultTemplate).length; + return session.isLoading || score.isLoading || !session.data || !score.data ? (
@@ -233,72 +235,83 @@ export const MisshaiPage: React.VFC = () => {

{t('settings')}

- -

{t('alertMode')}

-
- { alertModes.map((mode) => ( -