fix chat container height

fix login input width
fix context menu closing
This commit is contained in:
HF 2021-04-29 04:36:15 +02:00
parent 3ce2da7709
commit 24fbbab6c0
8 changed files with 30 additions and 33 deletions

View File

@ -37,12 +37,6 @@ export function closeAlert(): Action {
};
}
export function toggleChatBox(): Action {
return {
type: 'TOGGLE_CHAT_BOX',
};
}
export function toggleHistoricalView(): Action {
return {
type: 'TOGGLE_HISTORICAL_VIEW',
@ -662,12 +656,6 @@ export function showContextMenu(
};
}
// TODO CHAT MODAL
export function showChatModal(forceModal: boolean = false): Action {
if (window.innerWidth > 604 && !forceModal) { return toggleChatBox(); }
return showModal('CHAT');
}
export function openChatChannel(cid: number): Action {
return {
type: 'OPEN_CHAT_CHANNEL',
@ -737,7 +725,7 @@ export function setChatChannel(windowId: number, cid: number): Action {
return {
type: 'SET_CHAT_CHANNEL',
windowId,
cid,
cid: Number(cid),
};
}

View File

@ -10,7 +10,7 @@ import { connect } from 'react-redux';
import { MdForum } from 'react-icons/md';
import { t } from 'ttag';
import { showChatModal, openChatWindow } from '../actions';
import { openChatWindow } from '../actions';
const ChatButton = ({

View File

@ -27,7 +27,7 @@ function validate(nameoremail, password) {
const inputStyles = {
display: 'inline-block',
width: '100%',
width: '75%',
maxWidth: '35em',
};

View File

@ -25,7 +25,7 @@ const Window = ({ id }) => {
const startMove = useCallback((event) => {
event.preventDefault();
dispatch(focusWindow());
dispatch(focusWindow(id));
let {
clientX: startX,
@ -52,7 +52,7 @@ const Window = ({ id }) => {
const startResize = useCallback((event) => {
event.preventDefault();
dispatch(focusWindow());
dispatch(focusWindow(id));
let {
clientX: startX,

View File

@ -15,7 +15,6 @@ import ChannelDropDown from '../ChannelDropDown';
import {
showUserAreaModal,
showChatModal,
setChatChannel,
setChatInputMessage,
fetchChatMessages,
@ -30,7 +29,6 @@ function escapeRegExp(string) {
const Chat = ({
windowId,
showExpand,
}) => {
const listRef = useRef();
const targetRef = useRef();
@ -139,16 +137,6 @@ const Chat = ({
title={t`Channel settings`}
tabIndex={-1}
></span>
&nbsp;
{(showExpand)
&& (
<span
onClick={() => dispatch(showChatModal())}
role="button"
title={t`maximize`}
tabIndex={-1}
></span>
)}
</div>
<ul
className="chatarea"

View File

@ -41,9 +41,17 @@ export default function chat(
switch (action.type) {
case 'RECEIVE_ME':
case 'LOGIN': {
// making sure object keys are numbers
const channels = {};
const channelsJson = action.channels;
const cids = Object.keys(channelsJson);
for (let i = 0; i < cids.length; i += 1) {
const cid = cids[i];
channels[Number(cid)] = channelsJson[cid];
}
return {
...state,
channels: action.channels,
channels,
blocked: action.blocked,
};
}
@ -106,7 +114,7 @@ export default function chat(
case 'ADD_CHAT_CHANNEL': {
const { channel } = action;
const [cid] = Object.keys(channel);
const cid = Number(Object.keys(channel)[0]);
if (state.channels[cid]) {
return state;
}

View File

@ -32,6 +32,19 @@ export default function contextMenu(
const {
menuType, xPos, yPos, args,
} = action;
// if the same context menu is already open, close it
if (state.menuOpen && state.menuType === menuType
&& !(
Object.keys(state.args).length === Object.keys(args).length
&& Object.keys(state.args).every(
(key) => state.args[key] === args[key],
)
)) {
return {
...state,
menuOpen: false,
};
}
return {
...state,
menuType,

View File

@ -193,7 +193,7 @@ tr:nth-child(even) {
display: flex;
flex-direction: column;
width: 100%;
height: calc(100% - 1px);
height: calc(100% - 2px);
}
.win-content {
@ -611,7 +611,7 @@ tr:nth-child(even) {
.chatlink {
position: absolute;
top: 5px;
right: 17px;
right: 20px;
font-weight: bold;
color: #4a4a49;
transition: font-size 0.2s;