diff --git a/frontend_nuxt/app.vue b/frontend_nuxt/app.vue index 8eab548cf..a79f1c6d2 100644 --- a/frontend_nuxt/app.vue +++ b/frontend_nuxt/app.vue @@ -22,6 +22,7 @@ + @@ -30,6 +31,7 @@ import HeaderComponent from '~/components/HeaderComponent.vue' import MenuComponent from '~/components/MenuComponent.vue' import GlobalPopups from '~/components/GlobalPopups.vue' import ConfirmDialog from '~/components/ConfirmDialog.vue' +import ChatFloating from '~/components/ChatFloating.vue' import { useIsMobile } from '~/utils/screen' const isMobile = useIsMobile() diff --git a/frontend_nuxt/components/ChatFloating.vue b/frontend_nuxt/components/ChatFloating.vue new file mode 100644 index 000000000..d1202bfba --- /dev/null +++ b/frontend_nuxt/components/ChatFloating.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/frontend_nuxt/pages/message-box/[id].vue b/frontend_nuxt/pages/message-box/[id].vue index fee571f53..5f049289e 100644 --- a/frontend_nuxt/pages/message-box/[id].vue +++ b/frontend_nuxt/pages/message-box/[id].vue @@ -7,6 +7,10 @@

{{ isChannel ? conversationName : otherParticipant?.username }}

+
+ + +
@@ -82,6 +86,10 @@ const { fetchUnreadCount: refreshGlobalUnreadCount } = useUnreadCount() const { fetchChannelUnread: refreshChannelUnread } = useChannelsUnreadCount() let subscription = null +const chatFloating = useState('chatFloating', () => false) +const chatPath = useState('chatPath', () => '/message-box') +const isFloat = computed(() => route.query.float === '1') + const messages = ref([]) const participants = ref([]) const loading = ref(true) @@ -115,6 +123,24 @@ function handleAvatarError(event) { event.target.src = '/default-avatar.svg' } +function minimizeChat() { + chatPath.value = route.fullPath + chatFloating.value = true + navigateTo('/') +} + +function maximizeChat() { + if (window.parent) { + window.parent.postMessage( + { + type: 'maximize-chat', + path: route.fullPath.replace('?float=1', '').replace('&float=1', ''), + }, + '*', + ) + } +} + // No changes needed here, as renderMarkdown is now imported. // The old function is removed. @@ -411,6 +437,7 @@ onUnmounted(() => { font-size: 18px; font-weight: 600; margin: 0; + flex: 1; } .messages-list { @@ -524,4 +551,15 @@ onUnmounted(() => { margin-left: 10px; margin-right: 10px; } + +.chat-controls { + margin-left: auto; + cursor: pointer; + display: flex; + align-items: center; +} + +.control-icon { + font-size: 16px; +} diff --git a/frontend_nuxt/pages/message-box/index.vue b/frontend_nuxt/pages/message-box/index.vue index d2af0f6af..73abdde2c 100644 --- a/frontend_nuxt/pages/message-box/index.vue +++ b/frontend_nuxt/pages/message-box/index.vue @@ -1,5 +1,9 @@