Skip to content

Commit

Permalink
feat: 初期設定ダイアログの状態管理を追加し、openedEditorをオプショナルに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Dec 29, 2024
1 parent 47c42c7 commit 101bd4c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ onMounted(async () => {
isAcceptTermsDialogOpen:
import.meta.env.MODE !== "development" &&
store.state.acceptTerms !== "Accepted",
isInitialSettingsDialogOpen: store.state.openedEditor == undefined,
});
// プロジェクトファイルが指定されていればロード
Expand Down
29 changes: 15 additions & 14 deletions src/components/Dialog/AllDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ const isAcceptRetrieveTelemetryDialogOpenComputed = computed({
}),
});
// 初期設定ダイアログ
const isInitialSettingsDialogOpenComputed = computed({
get: () =>
!store.state.isAcceptTermsDialogOpen &&
!store.state.isCharacterOrderDialogOpen &&
!store.state.isDefaultStyleSelectDialogOpen &&
!store.state.isAcceptRetrieveTelemetryDialogOpen &&
store.state.isInitialSettingsDialogOpen,
set: (val) => {
void store.actions.SET_DIALOG_OPEN({
isInitialSettingsDialogOpen: val,
});
},
});
// エディタのアップデート確認ダイアログ
const canOpenNotificationDialog = computed(() => {
return (
Expand Down Expand Up @@ -172,18 +187,4 @@ const isImportSongProjectDialogOpenComputed = computed({
isImportSongProjectDialogOpen: val,
}),
});
// 初期設定ダイアログ
const isSelectedEditorType = computed(() => store.state.openedEditor);
console.log(isSelectedEditorType.value);
const isInitialSettingsDialogOpenComputed = computed({
get: () => store.state.isInitialSettingsDialogOpen,
set: (val) => {
if (isSelectedEditorType.value) {
void store.actions.SET_DIALOG_OPEN({
isInitialSettingsDialogOpen: val,
});
}
},
});
</script>
4 changes: 1 addition & 3 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,7 @@ export type SettingStoreState = {
experimentalSetting: ExperimentalSettingType;
confirmedTips: ConfirmedTips;
engineSettings: EngineSettings;
} & Omit<RootMiscSettingType, "openedEditor"> & {
openedEditor: EditorType | undefined; // undefinedのときはどのエディタを開くか定まっていない
};
} & RootMiscSettingType;

// keyとvalueの型を連動するようにしたPayloadを作る
type KeyValuePayload<R, K extends keyof R = keyof R> = K extends keyof R
Expand Down
2 changes: 1 addition & 1 deletion src/store/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const uiStoreState: UiStoreState = {
isUpdateNotificationDialogOpen: false,
isExportSongAudioDialogOpen: false,
isImportSongProjectDialogOpen: false,
isInitialSettingsDialogOpen: true,
isInitialSettingsDialogOpen: false,
isMaximized: false,
isPinned: false,
isFullscreen: false,
Expand Down
2 changes: 1 addition & 1 deletion src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export type ConfirmedTips = {

// ルート直下にある雑多な設定値
export const rootMiscSettingSchema = z.object({
openedEditor: z.enum(["talk", "song"]).default("talk"),
openedEditor: z.enum(["talk", "song"]).optional(),
editorFont: z.enum(["default", "os"]).default("default"),
showTextLineNumber: z.boolean().default(false),
showAddAudioItemButton: z.boolean().default(true),
Expand Down

0 comments on commit 101bd4c

Please sign in to comment.