diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index 97453110..565305cb 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -294,7 +294,7 @@ "add_image": "Add images", "poll": "Add a poll", "change_visibility": "Change visibility", - "change_sensitive": "Change sensitive", + "change_sensitive": "Mark media as sensitive", "add_cw": "Add content warning", "pined_hashtag": "Pin the hashtag" }, diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index f1b5b763..8e67e60a 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -11,7 +11,13 @@
- +
+ +
+
+ + +
@@ -26,6 +32,7 @@ import { useI18next } from 'vue3-i18next' import SideMenu from './TimelineSpace/SideMenu.vue' import HeaderMenu from './TimelineSpace/HeaderMenu.vue' import Contents from './TimelineSpace/Contents.vue' +import Compose from './TimelineSpace/Compose.vue' import Modals from './TimelineSpace/Modals.vue' import Mousetrap from 'mousetrap' import ReceiveDrop from './TimelineSpace/ReceiveDrop.vue' @@ -42,7 +49,7 @@ import { ACTION_TYPES as NEW_TOOT_ACTION } from '@/store/TimelineSpace/Modals/Ne export default defineComponent({ name: 'timeline-space', - components: { SideMenu, HeaderMenu, Modals, Contents, ReceiveDrop }, + components: { SideMenu, HeaderMenu, Modals, Contents, ReceiveDrop, Compose }, setup() { const space = 'TimelineSpace' const store = useStore() @@ -51,6 +58,7 @@ export default defineComponent({ const dropTarget = ref(null) const droppableVisible = ref(false) + const contentsRef = ref(null) const loading = computed(() => store.state.TimelineSpace.loading) const collapse = computed(() => store.state.TimelineSpace.SideMenu.collapse) @@ -155,10 +163,18 @@ export default defineComponent({ e.preventDefault() } + const composeResized = (event: { width: number; height: number }) => { + if (contentsRef.value) { + contentsRef.value.style.setProperty('height', `calc(100% - ${event.height}px)`) + } + } + return { loading, collapse, - droppableVisible + droppableVisible, + composeResized, + contentsRef } } }) @@ -169,6 +185,12 @@ export default defineComponent({ height: 100%; } +.compose-wrapper { + position: sticky; + bottom: 0; + padding: 0 12px 18px 12px; +} + .page { margin-left: 180px; height: 100%; diff --git a/src/renderer/components/TimelineSpace/Compose.vue b/src/renderer/components/TimelineSpace/Compose.vue new file mode 100644 index 00000000..6350bf81 --- /dev/null +++ b/src/renderer/components/TimelineSpace/Compose.vue @@ -0,0 +1,512 @@ + + + + + + + diff --git a/src/renderer/components/TimelineSpace/Contents/Home.vue b/src/renderer/components/TimelineSpace/Contents/Home.vue index 0a88ea50..5f9a0a8d 100644 --- a/src/renderer/components/TimelineSpace/Contents/Home.vue +++ b/src/renderer/components/TimelineSpace/Contents/Home.vue @@ -27,12 +27,6 @@ - -
- - - -
@@ -204,10 +198,6 @@ export default defineComponent({ }, 500) }) } - const upper = () => { - scroller.value.scrollToItem(0) - focusedId.value = null - } const focusNext = () => { if (currentFocusedIndex.value === -1) { focusedId.value = timeline.value[0].uri + timeline.value[0].id @@ -245,7 +235,6 @@ export default defineComponent({ focusToot, openSideBar, heading, - upper, account } } @@ -269,39 +258,6 @@ export default defineComponent({ .loading-card:empty { height: 0; } - - .upper { - position: fixed; - bottom: 20px; - right: 20px; - transition: all 0.5s; - } - - .upper-with-side-bar { - position: fixed; - bottom: 20px; - right: calc(20px + var(--current-sidebar-width)); - transition: all 0.5s; - } - - .upper-icon { - padding: 3px; - } - - .unread { - position: fixed; - right: 24px; - top: 52px; - background-color: rgba(0, 0, 0, 0.6); - color: #ffffff; - padding: 4px 8px; - border-radius: 0 0 2px 2px; - z-index: 1; - - &:empty { - display: none; - } - } } diff --git a/src/renderer/components/organisms/Toot.vue b/src/renderer/components/organisms/Toot.vue index 63b842c8..e14c269d 100644 --- a/src/renderer/components/organisms/Toot.vue +++ b/src/renderer/components/organisms/Toot.vue @@ -255,9 +255,9 @@ import { usernameWithStyle, accountNameWithStyle } from '@/utils/username' import { parseDatetime } from '@/utils/datetime' import { MUTATION_TYPES as SIDEBAR_MUTATION, ACTION_TYPES as SIDEBAR_ACTION } from '@/store/TimelineSpace/Contents/SideBar' import { ACTION_TYPES as PROFILE_ACTION } from '@/store/TimelineSpace/Contents/SideBar/AccountProfile' -import { ACTION_TYPES as NEW_ACTION } from '@/store/TimelineSpace/Modals/NewToot' import { ACTION_TYPES as DETAIL_ACTION } from '@/store/TimelineSpace/Contents/SideBar/TootDetail' import { ACTION_TYPES as REPORT_ACTION } from '@/store/TimelineSpace/Modals/Report' +import { MUTATION_TYPES as COMPOSE_MUTATION } from '@/store/TimelineSpace/Compose' import { ACTION_TYPES as MUTE_ACTION } from '@/store/TimelineSpace/Modals/MuteConfirm' import { ACTION_TYPES as VIEWER_ACTION } from '@/store/TimelineSpace/Modals/ImageViewer' import { ACTION_TYPES } from '@/store/organisms/Toot' @@ -477,7 +477,10 @@ export default defineComponent({ } } const openReply = () => { - store.dispatch(`TimelineSpace/Modals/NewToot/${NEW_ACTION.OPEN_REPLY}`, originalMessage.value) + store.commit(`TimelineSpace/Compose/${COMPOSE_MUTATION.SET_REPLY_TO_ID}`, { + acct: originalMessage.value.account.acct, + id: originalMessage.value.id + }) } const openDetail = (message: Entity.Status) => { store.dispatch(`TimelineSpace/Contents/SideBar/${SIDEBAR_ACTION.OPEN_TOOT_COMPONENT}`) diff --git a/src/renderer/store/TimelineSpace.ts b/src/renderer/store/TimelineSpace.ts index a55bc87b..fc4944ea 100644 --- a/src/renderer/store/TimelineSpace.ts +++ b/src/renderer/store/TimelineSpace.ts @@ -11,6 +11,7 @@ import { MyWindow } from '~/src/types/global' import { LocalServer } from '~/src/types/localServer' import { Setting } from '~/src/types/setting' import { DefaultSetting } from '~/src/constants/initializer/setting' +import Compose, { ComposeState } from './TimelineSpace/Compose' const win = (window as any) as MyWindow @@ -201,6 +202,7 @@ type TimelineSpaceModule = { HeaderMenu: HeaderMenuState Modals: ModalsModuleState Contents: ContentsModuleState + Compose: ComposeState } export type TimelineSpaceModuleState = TimelineSpaceModule & TimelineSpaceState @@ -211,7 +213,8 @@ const TimelineSpace: Module = { SideMenu, HeaderMenu, Modals, - Contents + Contents, + Compose }, state: state, mutations: mutations, diff --git a/src/renderer/store/TimelineSpace/Compose.ts b/src/renderer/store/TimelineSpace/Compose.ts new file mode 100644 index 00000000..1c2680a4 --- /dev/null +++ b/src/renderer/store/TimelineSpace/Compose.ts @@ -0,0 +1,37 @@ +import { Module, MutationTree } from 'vuex' +import { RootState } from '@/store' + +export type ReplyTo = { + acct: string + id: string +} + +export type ComposeState = { + inReplyTo: ReplyTo | null +} + +const state = (): ComposeState => ({ + inReplyTo: null +}) + +export const MUTATION_TYPES = { + SET_REPLY_TO_ID: 'setReplyToId', + CLEAR_REPLY_TO_ID: 'clearReplyToId' +} + +const mutations: MutationTree = { + [MUTATION_TYPES.SET_REPLY_TO_ID]: (state, inReplyTo: ReplyTo) => { + state.inReplyTo = inReplyTo + }, + [MUTATION_TYPES.CLEAR_REPLY_TO_ID]: state => { + state.inReplyTo = null + } +} + +const Compose: Module = { + namespaced: true, + state: state, + mutations: mutations +} + +export default Compose