diff --git a/Web-App/frontend/src/views/page/PageView.vue b/Web-App/frontend/src/views/page/PageView.vue index 133771e..eca9a06 100644 --- a/Web-App/frontend/src/views/page/PageView.vue +++ b/Web-App/frontend/src/views/page/PageView.vue @@ -584,7 +584,35 @@ const suggestAs = computed(() => suggesting.value && editable.value && auth.user ? { id: auth.user.id, name: me.value.name } : null, ); +// On phones the header has room for the main buttons only; favourite, +// attach, history and info move to the top of the More menu (below sm, +// where those buttons are hidden with max-sm:hidden). +const phoneQuery = typeof window !== "undefined" ? window.matchMedia("(width < 40rem)") : null; +const phone = ref(phoneQuery?.matches ?? false); +const onPhoneChange = (e: MediaQueryListEvent) => (phone.value = e.matches); +phoneQuery?.addEventListener("change", onPhoneChange); +onBeforeUnmount(() => phoneQuery?.removeEventListener("change", onPhoneChange)); +const phoneItems = computed(() => { + if (!phone.value || !page.value) return []; + const items: MenuItem[] = [ + { + label: t(page.value.favorite ? "page.unfavorite" : "page.favorite"), + icon: "star", + onSelect: () => void toggleFavorite(), + }, + ]; + if (editable.value && main.value && mode.value === "page") { + items.push({ label: t("page.attach"), icon: "paperclip", onSelect: () => filePicker.value?.click() }); + } + items.push( + { label: t("page.history.title"), icon: "restore", onSelect: () => (historyOpen.value = !historyOpen.value) }, + { label: t("properties.info"), icon: "info", onSelect: () => (infoOpen.value = !infoOpen.value) }, + ); + return items; +}); + const menu = computed(() => [ + ...phoneItems.value, ...(mode.value === "page" ? [{ label: t("page.find"), icon: "search" as const, onSelect: () => editorRef.value?.openFind() }] : []), @@ -760,7 +788,7 @@ const purge = () =>