Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MobileHeaderBarをHeaderBarと統合 #44

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build/matexRecipes.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
toolbarIcons.svg:
saveVoice: save + volume_up
playAll: filled:play_arrow + notes
exportSelected: filled:save + volume_up
exportConnectAll: filled:save + link
exportAll: filled:save + notes
importText: filled:upload + outlined:import_contacts
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@openapitools/openapi-generator-cli": "2.7.0",
"@playwright/test": "1.40.1",
"@quasar/vite-plugin": "1.3.0",
"@sevenc-nanashi/matex": "1.0.1",
"@sevenc-nanashi/matex": "1.1.1",
"@types/async-lock": "1.4.0",
"@types/clone-deep": "4.0.1",
"@types/crypto-js": "4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion public/toolbarIcons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@
import { watch, computed } from "vue";
import { useGtm } from "@gtm-support/vue-gtm";
import { useRoute } from "vue-router";
import { useQuasar, Notify } from "quasar";
import ErrorBoundary from "@/components/ErrorBoundary.vue";
import { useStore } from "@/store";

const store = useStore();
store.dispatch("INIT_VUEX");

const $q = useQuasar();
Notify.setDefaults({
position: $q.platform.is.desktop ? "bottom" : "top",
});

// URLパラメータに従ってマルチエンジンをオフにする
const route = useRoute();
const query = computed(() => route.query);
Expand Down
43 changes: 41 additions & 2 deletions src/components/HeaderBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<template>
<q-header class="q-py-sm">
<q-toolbar v-if="isMobile" class="bg-primary text-white">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここ、コンテナとプレゼンター分けて、モバイル用のプレゼンター入れた方がいい気がしますね〜
リファクタリング箇所がわかってきた。

<mobile-menu v-if="isMobile" />
<template v-for="button in headerButtons" :key="button.text">
<q-space v-if="button.text === null" />
<q-btn
v-else
flat
round
dense
:disable="button.disable.value"
:icon="buttonIcons[button.tag]"
@click="button.click"
>
<q-tooltip>{{ button.text }}</q-tooltip>
</q-btn>
</template>
</q-toolbar>
<q-header v-else class="q-py-sm">
<q-toolbar>
<template v-for="button in headerButtons" :key="button.text">
<q-space v-if="button.text === null" />
Expand All @@ -20,6 +37,8 @@

<script setup lang="ts">
import { computed, ComputedRef } from "vue";
import { useQuasar } from "quasar";
import MobileMenu from "./MobileMenu.vue";
import {
generateAndConnectAndSaveAudioWithDialog,
multiGenerateAndSaveAudioWithDialog,
Expand All @@ -34,14 +53,19 @@ import {
} from "@/type/preload";
import { getToolbarButtonName } from "@/store/utility";

const $q = useQuasar();
const isMobile = computed(() => !$q.platform.is.desktop);

type ButtonContent = {
text: string;
click(): void;
disable: ComputedRef<boolean>;
tag: ToolbarButtonTagType;
};

type SpacerContent = {
text: null;
tag: null;
};

const store = useStore();
Expand Down Expand Up @@ -166,7 +190,7 @@ const importTextFile = () => {

const usableButtons: Record<
ToolbarButtonTagType,
Omit<ButtonContent, "text"> | null
Omit<ButtonContent, "text" | "tag"> | null
> = {
PLAY_CONTINUOUSLY: {
click: playContinuously,
Expand Down Expand Up @@ -214,12 +238,27 @@ const headerButtons = computed(() =>
return {
...buttonContent,
text: getToolbarButtonName(tag),
tag,
};
} else {
return {
text: null,
tag: null,
};
}
})
);

const buttonIcons: Record<ToolbarButtonTagType, string> = {
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
PLAY_CONTINUOUSLY: "playlist_play",
STOP: "stop",
EXPORT_AUDIO_SELECTED: "svguse:toolbarIcons.svg#exportSelected",
EXPORT_AUDIO_ALL: "svguse:toolbarIcons.svg#exportAll",
EXPORT_AUDIO_CONNECT_ALL: "svguse:toolbarIcons.svg#exportConnectAll",
UNDO: "undo",
REDO: "redo",
IMPORT_TEXT: "svguse:toolbarIcons.svg#importText",
SAVE_PROJECT: "save",
EMPTY: "",
};
</script>
133 changes: 0 additions & 133 deletions src/components/MobileHeaderBar.vue

This file was deleted.

83 changes: 83 additions & 0 deletions src/components/MobileMenu.vue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デフォルトスタイル選択とかってどこにいくことになりそうでしょう

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

設定画面ですかね?

Copy link
Member

@Hiroshiba Hiroshiba Jan 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほどです。
設定への遷移をプロジェクト選択画面に持たせる場合、3遷移になって流石に遠いかもですねぇ。
(そもそもスマホアプリでそんな細かい設定があるものなのか知らないですが。。)

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<template>
<q-btn flat round dense>
<q-icon name="menu" />
<q-menu transition-show="none" transition-hide="none">
<q-list dense>
<menu-item
v-for="(item, index) in menudata"
:key="item.label"
v-model:selected="subMenuOpenFlags[index]"
:menudata="item"
/>
</q-list>
</q-menu>
</q-btn>
<q-separator vertical spaced inset color="background" />
</template>

<script setup lang="ts">
import { ref } from "vue";
import { MenuItemData } from "./MenuBar.vue";
import MenuItem from "./MenuItem.vue";

const menudata = ref<MenuItemData[]>([
{
type: "button",
label: "選択している音声を書き出し",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
{
type: "button",
label: "すべての音声を書き出し",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
{
type: "button",
label: "すべての音声を繋げて書き出し",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
{
type: "separator",
},
{
type: "button",
label: "テキストを繋げて書き出し",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
{
type: "button",
label: "テキスト読み込み",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
{
type: "separator",
},
{
type: "button",
label: "メニューに戻る",
onClick: () => {
alert("TODO");
},
disableWhenUiLocked: true,
},
]);

const subMenuOpenFlags = ref<boolean[]>(
[...Array(menudata.value.length)].map(() => false)
);
</script>
Loading
Loading