Skip to content

Commit

Permalink
Code: 型の名前を変更
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Oct 19, 2024
1 parent e21e618 commit 71b7273
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions src/components/Dialog/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ import { withProgressDotNotation as withProgress } from "@/store/ui";
type MediaType = "audio" | "text";

export type TextDialogResult = "OK" | "CANCEL";
export type TextAlertDialogOptions = {
export type AlertDialogOptions = {
type?: DialogType;
title: string;
message: string;
ok?: string;
};
export type TextConfirmDialogOptions = {
export type ConfirmDialogOptions = {
type?: DialogType;
title: string;
message: string;
actionName: string;
cancel?: string;
};
export type TextWarningDialogOptions = {
export type WarningDialogOptions = {
type?: DialogType;
title: string;
message: string;
actionName: string;
cancel?: string;
};
export type TextQuestionDialogOptions = {
export type QuestionDialogOptions = {
type?: DialogType;
title: string;
message: string;
Expand All @@ -55,7 +55,7 @@ export type NotifyAndNotShowAgainButtonOption = {
export type LoadingScreenOption = { message: string };

// 汎用ダイアログを表示
export const showAlertDialog = async (options: TextAlertDialogOptions) => {
export const showAlertDialog = async (options: AlertDialogOptions) => {
options.ok ??= "閉じる";

const { promise, resolve } = Promise.withResolvers<void>();
Expand All @@ -74,7 +74,7 @@ export const showAlertDialog = async (options: TextAlertDialogOptions) => {
return "OK" as const;
};

export const showConfirmDialog = async (options: TextConfirmDialogOptions) => {
export const showConfirmDialog = async (options: ConfirmDialogOptions) => {
options.cancel ??= "キャンセル";

const { promise, resolve } = Promise.withResolvers<number>();
Expand All @@ -94,7 +94,7 @@ export const showConfirmDialog = async (options: TextConfirmDialogOptions) => {
return index === 1 ? "OK" : "CANCEL";
};

export const showWarningDialog = async (options: TextWarningDialogOptions) => {
export const showWarningDialog = async (options: WarningDialogOptions) => {
options.cancel ??= "キャンセル";

const { promise, resolve } = Promise.withResolvers<number>();
Expand All @@ -115,7 +115,7 @@ export const showWarningDialog = async (options: TextWarningDialogOptions) => {
};

export const showQuestionDialog = async (

Check failure on line 117 in src/components/Dialog/Dialog.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `⏎··options:·QuestionDialogOptions,⏎` with `options:·QuestionDialogOptions`

Check failure on line 117 in src/components/Dialog/Dialog.ts

View workflow job for this annotation

GitHub Actions / build-test

Replace `⏎··options:·QuestionDialogOptions,⏎` with `options:·QuestionDialogOptions`
options: TextQuestionDialogOptions,
options: QuestionDialogOptions,
) => {
const { promise, resolve } = Promise.withResolvers<number>();
Dialog.create({
Expand Down
12 changes: 6 additions & 6 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ import {
TextDialogResult,
NotifyAndNotShowAgainButtonOption,
LoadingScreenOption,
TextAlertDialogOptions,
TextConfirmDialogOptions,
TextWarningDialogOptions,
AlertDialogOptions,
ConfirmDialogOptions,
WarningDialogOptions,
} from "@/components/Dialog/Dialog";
import {
LatestProjectType,
Expand Down Expand Up @@ -1972,15 +1972,15 @@ export type UiStoreTypes = {
};

SHOW_ALERT_DIALOG: {
action(payload: TextAlertDialogOptions): TextDialogResult;
action(payload: AlertDialogOptions): TextDialogResult;
};

SHOW_CONFIRM_DIALOG: {
action(payload: TextConfirmDialogOptions): TextDialogResult;
action(payload: ConfirmDialogOptions): TextDialogResult;
};

SHOW_WARNING_DIALOG: {
action(payload: TextWarningDialogOptions): TextDialogResult;
action(payload: WarningDialogOptions): TextDialogResult;
};

SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON: {
Expand Down
12 changes: 6 additions & 6 deletions src/store/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
import { createDotNotationPartialStore as createPartialStore } from "./vuex";
import { ActivePointScrollMode } from "@/type/preload";
import {
TextAlertDialogOptions,
TextConfirmDialogOptions,
TextWarningDialogOptions,
AlertDialogOptions,
ConfirmDialogOptions,
WarningDialogOptions,
LoadingScreenOption,
NotifyAndNotShowAgainButtonOption,
connectAndExportTextWithDialog,
Expand Down Expand Up @@ -246,23 +246,23 @@ export const uiStore = createPartialStore<UiStoreTypes>({

SHOW_ALERT_DIALOG: {
action: createDotNotationUILockAction(
async (_, payload: TextAlertDialogOptions) => {
async (_, payload: AlertDialogOptions) => {
return await showAlertDialog(payload);
},
),
},

SHOW_CONFIRM_DIALOG: {
action: createDotNotationUILockAction(
async (_, payload: TextConfirmDialogOptions) => {
async (_, payload: ConfirmDialogOptions) => {
return await showConfirmDialog(payload);
},
),
},

SHOW_WARNING_DIALOG: {
action: createDotNotationUILockAction(
async (_, payload: TextWarningDialogOptions) => {
async (_, payload: WarningDialogOptions) => {
return await showWarningDialog(payload);
},
),
Expand Down

0 comments on commit 71b7273

Please sign in to comment.