Skip to content

Commit

Permalink
微調整
Browse files Browse the repository at this point in the history
* eslintが不要なように
* 型の修正
* provideの目的コメントは自明なので省いてみる
  • Loading branch information
Hiroshiba committed Dec 15, 2024
1 parent 2690ea5 commit 61de067
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/components/Dialog/DictionaryEditWordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ import { inject, ref } from "vue";
import { QInput } from "quasar";
import {
DictionaryManageDialogContext,
DictionaryManageDialogContextKey,
dictionaryManageDialogContextKey,
} from "./DictionaryManageDialog.vue";
import AudioAccent from "@/components/Talk/AudioAccent.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
Expand All @@ -176,7 +176,7 @@ import type { FetchAudioResult } from "@/store/type";
const store = useStore();
const context = inject<DictionaryManageDialogContext>(
DictionaryManageDialogContextKey,
dictionaryManageDialogContextKey,
);
if (context == undefined)
throw new Error(`dictionaryManageDialogContext == undefined`);
Expand Down
18 changes: 7 additions & 11 deletions src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@

<script lang="ts">
import { Ref, ComputedRef } from "vue";
// eslint-disable-next-line import/order
import { EngineId, SpeakerId, StyleId } from "@/type/preload";
export const dictionaryManageDialogContextKey = "dictionaryManageDialogContext";
export interface DictionaryManageDialogContext {
wordEditing: Ref<boolean>;
Expand All @@ -137,9 +137,9 @@ export interface DictionaryManageDialogContext {
isOnlyHiraOrKana: Ref<boolean>;
accentPhrase: Ref<AccentPhrase | undefined>;
voiceComputed: ComputedRef<{
engineId: string & EngineId;
speakerId: string & SpeakerId;
styleId: number & StyleId;
engineId: EngineId;
speakerId: SpeakerId;
styleId: StyleId;
}>;
surface: Ref<string>;
yomi: Ref<string>;
Expand All @@ -154,8 +154,6 @@ export interface DictionaryManageDialogContext {
toWordEditingState: () => void;
cancel: () => void;
}
export const DictionaryManageDialogContextKey = "dictionaryManageDialogContext";
</script>

<script setup lang="ts">
Expand All @@ -164,6 +162,7 @@ import { QInput } from "quasar";
import DictionaryEditWordDialog from "./DictionaryEditWordDialog.vue";
import { useStore } from "@/store";
import { AccentPhrase, UserDictWord } from "@/openapi";
import { EngineId, SpeakerId, StyleId } from "@/type/preload";
import {
convertHiraToKana,
convertLongVowel,
Expand Down Expand Up @@ -426,10 +425,7 @@ const toDialogClosedState = () => {
dictionaryManageDialogOpenedComputed.value = false;
};
/**
* provideで子コンポーネント(components/Dialog/DictionaryEditWordDialog.vue)に変数と関数を共有する
*/
provide<DictionaryManageDialogContext>("dictionaryManageDialogContext", {
provide<DictionaryManageDialogContext>(dictionaryManageDialogContextKey, {
wordEditing,
surfaceInput,
selectedId,
Expand Down

0 comments on commit 61de067

Please sign in to comment.