fix chat container height
fix login input width fix context menu closing
This commit is contained in:
parent
3ce2da7709
commit
24fbbab6c0
|
@ -37,12 +37,6 @@ export function closeAlert(): Action {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toggleChatBox(): Action {
|
|
||||||
return {
|
|
||||||
type: 'TOGGLE_CHAT_BOX',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function toggleHistoricalView(): Action {
|
export function toggleHistoricalView(): Action {
|
||||||
return {
|
return {
|
||||||
type: 'TOGGLE_HISTORICAL_VIEW',
|
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 {
|
export function openChatChannel(cid: number): Action {
|
||||||
return {
|
return {
|
||||||
type: 'OPEN_CHAT_CHANNEL',
|
type: 'OPEN_CHAT_CHANNEL',
|
||||||
|
@ -737,7 +725,7 @@ export function setChatChannel(windowId: number, cid: number): Action {
|
||||||
return {
|
return {
|
||||||
type: 'SET_CHAT_CHANNEL',
|
type: 'SET_CHAT_CHANNEL',
|
||||||
windowId,
|
windowId,
|
||||||
cid,
|
cid: Number(cid),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
||||||
import { MdForum } from 'react-icons/md';
|
import { MdForum } from 'react-icons/md';
|
||||||
import { t } from 'ttag';
|
import { t } from 'ttag';
|
||||||
|
|
||||||
import { showChatModal, openChatWindow } from '../actions';
|
import { openChatWindow } from '../actions';
|
||||||
|
|
||||||
|
|
||||||
const ChatButton = ({
|
const ChatButton = ({
|
||||||
|
|
|
@ -27,7 +27,7 @@ function validate(nameoremail, password) {
|
||||||
|
|
||||||
const inputStyles = {
|
const inputStyles = {
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
width: '100%',
|
width: '75%',
|
||||||
maxWidth: '35em',
|
maxWidth: '35em',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ const Window = ({ id }) => {
|
||||||
|
|
||||||
const startMove = useCallback((event) => {
|
const startMove = useCallback((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dispatch(focusWindow());
|
dispatch(focusWindow(id));
|
||||||
|
|
||||||
let {
|
let {
|
||||||
clientX: startX,
|
clientX: startX,
|
||||||
|
@ -52,7 +52,7 @@ const Window = ({ id }) => {
|
||||||
|
|
||||||
const startResize = useCallback((event) => {
|
const startResize = useCallback((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dispatch(focusWindow());
|
dispatch(focusWindow(id));
|
||||||
|
|
||||||
let {
|
let {
|
||||||
clientX: startX,
|
clientX: startX,
|
||||||
|
|
|
@ -15,7 +15,6 @@ import ChannelDropDown from '../ChannelDropDown';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
showUserAreaModal,
|
showUserAreaModal,
|
||||||
showChatModal,
|
|
||||||
setChatChannel,
|
setChatChannel,
|
||||||
setChatInputMessage,
|
setChatInputMessage,
|
||||||
fetchChatMessages,
|
fetchChatMessages,
|
||||||
|
@ -30,7 +29,6 @@ function escapeRegExp(string) {
|
||||||
|
|
||||||
const Chat = ({
|
const Chat = ({
|
||||||
windowId,
|
windowId,
|
||||||
showExpand,
|
|
||||||
}) => {
|
}) => {
|
||||||
const listRef = useRef();
|
const listRef = useRef();
|
||||||
const targetRef = useRef();
|
const targetRef = useRef();
|
||||||
|
@ -139,16 +137,6 @@ const Chat = ({
|
||||||
title={t`Channel settings`}
|
title={t`Channel settings`}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>⚙</span>
|
>⚙</span>
|
||||||
|
|
||||||
{(showExpand)
|
|
||||||
&& (
|
|
||||||
<span
|
|
||||||
onClick={() => dispatch(showChatModal())}
|
|
||||||
role="button"
|
|
||||||
title={t`maximize`}
|
|
||||||
tabIndex={-1}
|
|
||||||
>↷</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<ul
|
<ul
|
||||||
className="chatarea"
|
className="chatarea"
|
||||||
|
|
|
@ -41,9 +41,17 @@ export default function chat(
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'RECEIVE_ME':
|
case 'RECEIVE_ME':
|
||||||
case 'LOGIN': {
|
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 {
|
return {
|
||||||
...state,
|
...state,
|
||||||
channels: action.channels,
|
channels,
|
||||||
blocked: action.blocked,
|
blocked: action.blocked,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -106,7 +114,7 @@ export default function chat(
|
||||||
|
|
||||||
case 'ADD_CHAT_CHANNEL': {
|
case 'ADD_CHAT_CHANNEL': {
|
||||||
const { channel } = action;
|
const { channel } = action;
|
||||||
const [cid] = Object.keys(channel);
|
const cid = Number(Object.keys(channel)[0]);
|
||||||
if (state.channels[cid]) {
|
if (state.channels[cid]) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,19 @@ export default function contextMenu(
|
||||||
const {
|
const {
|
||||||
menuType, xPos, yPos, args,
|
menuType, xPos, yPos, args,
|
||||||
} = action;
|
} = 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 {
|
return {
|
||||||
...state,
|
...state,
|
||||||
menuType,
|
menuType,
|
||||||
|
|
|
@ -193,7 +193,7 @@ tr:nth-child(even) {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 1px);
|
height: calc(100% - 2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.win-content {
|
.win-content {
|
||||||
|
@ -611,7 +611,7 @@ tr:nth-child(even) {
|
||||||
.chatlink {
|
.chatlink {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
right: 17px;
|
right: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #4a4a49;
|
color: #4a4a49;
|
||||||
transition: font-size 0.2s;
|
transition: font-size 0.2s;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user