From 6f9e2750c50b7f97321ffac7412bbdbb48b2d9b9 Mon Sep 17 00:00:00 2001 From: balzack Date: Wed, 1 Jan 2025 12:13:23 -0800 Subject: [PATCH] setting message size --- .../mobile/src/conversation/Conversation.tsx | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/app/client/mobile/src/conversation/Conversation.tsx b/app/client/mobile/src/conversation/Conversation.tsx index a2a7194a..1950aa11 100644 --- a/app/client/mobile/src/conversation/Conversation.tsx +++ b/app/client/mobile/src/conversation/Conversation.tsx @@ -3,7 +3,7 @@ import {KeyboardAvoidingView, Platform, SafeAreaView, Pressable, View, FlatList, import {styles} from './Conversation.styled'; import {useConversation} from './useConversation.hook'; import {Message} from '../message/Message'; -import {Surface, Icon, Text, TextInput, IconButton, Divider} from 'react-native-paper'; +import {Surface, Icon, Text, TextInput, Menu, IconButton, Divider} from 'react-native-paper'; import { ActivityIndicator } from 'react-native-paper'; import { Colors } from '../constants/Colors'; import { Confirm } from '../confirm/Confirm'; @@ -24,12 +24,14 @@ export function Conversation({close}: {close: ()=>void}) { const [ alert, setAlert ] = useState(false); const [ sending, setSending ] = useState(false); const [ selected, setSelected ] = useState(null as null | string); + const [ sizeMenu, setSizeMenu ] = useState(false); const thread = useRef(); const scrolled = useRef(false); const contentHeight = useRef(0); const contentLead = useRef(null); const scrollOffset = useRef(0); - + const busy = useRef(false); + const alertParams = { title: state.strings.error, prompt: state.strings.tryAgain, @@ -42,8 +44,8 @@ export function Conversation({close}: {close: ()=>void}) { }; const sendMessage = async () => { -console.log("CALLING SEND MESSAGE"); - if (!sending) { + if (!busy.current && (state.message || state.assets.length > 0)) { + busy.current = true; setSending(true); try { await actions.send(); @@ -52,6 +54,7 @@ console.log("CALLING SEND MESSAGE"); setAlert(true); } setSending(false); + busy.current = false; } } @@ -176,15 +179,27 @@ console.log("CALLING SEND MESSAGE"); - + + setSizeMenu(false)} + anchor={setSizeMenu(true)}>}> + { actions.setTextSize(12); setSizeMenu(false) }} title={state.strings.textSmall} /> + { actions.setTextSize(16); setSizeMenu(false) }} title={state.strings.textMedium} /> + { actions.setTextSize(20); setSizeMenu(false) }} title={state.strings.textLarge} /> + + { sending && ( )} - { !sending && ( + { !sending && (state.message || state.assets.length != 0) && ( )} + { !sending && !state.message && state.assets.length == 0 && ( + + )}