fix broken stuff
This commit is contained in:
parent
9978d12a70
commit
0a5bb9aca7
|
@ -264,6 +264,7 @@ function Converter() {
|
||||||
{
|
{
|
||||||
ImageQuantizerKernels.map((strat) => (
|
ImageQuantizerKernels.map((strat) => (
|
||||||
<option
|
<option
|
||||||
|
key={strat}
|
||||||
value={strat}
|
value={strat}
|
||||||
>{strat}</option>
|
>{strat}</option>
|
||||||
))
|
))
|
||||||
|
@ -334,6 +335,7 @@ function Converter() {
|
||||||
{
|
{
|
||||||
ColorDistanceCalculators.map((strat) => (
|
ColorDistanceCalculators.map((strat) => (
|
||||||
<option
|
<option
|
||||||
|
key={strat}
|
||||||
value={strat}
|
value={strat}
|
||||||
>{strat}</option>
|
>{strat}</option>
|
||||||
))
|
))
|
||||||
|
|
|
@ -267,6 +267,7 @@ function ModCanvastools() {
|
||||||
>
|
>
|
||||||
{['build', 'protect', 'wipe'].map((opt) => (
|
{['build', 'protect', 'wipe'].map((opt) => (
|
||||||
<option
|
<option
|
||||||
|
key={opt}
|
||||||
value={opt}
|
value={opt}
|
||||||
>
|
>
|
||||||
{opt}
|
{opt}
|
||||||
|
@ -330,6 +331,7 @@ function ModCanvastools() {
|
||||||
>
|
>
|
||||||
{['protect', 'unprotect'].map((opt) => (
|
{['protect', 'unprotect'].map((opt) => (
|
||||||
<option
|
<option
|
||||||
|
key={opt}
|
||||||
value={opt}
|
value={opt}
|
||||||
>
|
>
|
||||||
{opt}
|
{opt}
|
||||||
|
@ -485,6 +487,7 @@ function ModCanvastools() {
|
||||||
>
|
>
|
||||||
{['spare', 'spareext', 'spareextu'].map((opt) => (
|
{['spare', 'spareext', 'spareextu'].map((opt) => (
|
||||||
<option
|
<option
|
||||||
|
key={opt}
|
||||||
value={opt}
|
value={opt}
|
||||||
>
|
>
|
||||||
{opt}
|
{opt}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const Tab = ({ onClick, activeTab, label }) => {
|
const Tab = ({ onClick, active, label }) => {
|
||||||
let className = 'tab-list-item';
|
let className = 'tab-list-item';
|
||||||
if (activeTab === label) {
|
if (active) {
|
||||||
className += ' tab-list-active';
|
className += ' tab-list-active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,35 @@
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import Tab from './Tab';
|
import Tab from './Tab';
|
||||||
|
|
||||||
const Tabs = ({ children }) => {
|
const Tabs = ({ children, activeTab, setActiveTab }) => (
|
||||||
const [activeTab, setActiveTab] = useState(children[0].props.label);
|
<div className="tabs">
|
||||||
|
<ol className="tab-list">
|
||||||
|
{children.map((child) => {
|
||||||
|
if (!child.props) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const { label } = child.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tabs">
|
<Tab
|
||||||
<ol className="tab-list">
|
active={activeTab === label}
|
||||||
{children.map((child) => {
|
key={label}
|
||||||
if (!child.props) {
|
label={label}
|
||||||
return undefined;
|
onClick={(tab) => setActiveTab(tab)}
|
||||||
}
|
/>
|
||||||
const { label } = child.props;
|
);
|
||||||
|
})}
|
||||||
return (
|
</ol>
|
||||||
<Tab
|
<div className="tab-content">
|
||||||
activeTab={activeTab}
|
{children.map((child) => {
|
||||||
key={label}
|
if (!child.props || child.props.label !== activeTab) {
|
||||||
label={label}
|
return undefined;
|
||||||
onClick={(tab) => setActiveTab(tab)}
|
}
|
||||||
/>
|
return child.props.children;
|
||||||
);
|
})}
|
||||||
})}
|
|
||||||
</ol>
|
|
||||||
<div className="tab-content">
|
|
||||||
{children.map((child) => {
|
|
||||||
if (!child.props || child.props.label !== activeTab) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return child.props.children;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
</div>
|
||||||
};
|
);
|
||||||
|
|
||||||
export default Tabs;
|
export default Tabs;
|
||||||
|
|
|
@ -55,7 +55,7 @@ const Chat = ({
|
||||||
const {
|
const {
|
||||||
chatChannel = 1,
|
chatChannel = 1,
|
||||||
inputMessage = '',
|
inputMessage = '',
|
||||||
} = useSelector((state) => state.windows.args[windowId]);
|
} = useSelector((state) => state.windows.args[windowId] || {});
|
||||||
|
|
||||||
const { stayScrolled } = useStayScrolled(listRef, {
|
const { stayScrolled } = useStayScrolled(listRef, {
|
||||||
initialScroll: Infinity,
|
initialScroll: Infinity,
|
||||||
|
@ -101,7 +101,7 @@ const Chat = ({
|
||||||
if (!inptMsg) return;
|
if (!inptMsg) return;
|
||||||
// send message via websocket
|
// send message via websocket
|
||||||
SocketClient.sendChatMessage(inptMsg, chatChannel);
|
SocketClient.sendChatMessage(inptMsg, chatChannel);
|
||||||
dispatch(setChatInputMessage(''));
|
setChatInputMessage('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -196,9 +196,7 @@ const Chat = ({
|
||||||
}}
|
}}
|
||||||
id={`chtipt-${windowId}`}
|
id={`chtipt-${windowId}`}
|
||||||
value={inputMessage}
|
value={inputMessage}
|
||||||
onChange={(e) => dispatch(
|
onChange={(e) => setChatInputMessage(e.target.value)}
|
||||||
setChatInputMessage(e.target.value),
|
|
||||||
)}
|
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
maxLength="200"
|
maxLength="200"
|
||||||
type="text"
|
type="text"
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { Suspense } from 'react';
|
import React, { Suspense, useCallback } from 'react';
|
||||||
import { useSelector, useDispatch } from 'react-redux';
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
import { t } from 'ttag';
|
import { t } from 'ttag';
|
||||||
|
|
||||||
import { fetchStats } from '../../store/actions';
|
import {
|
||||||
|
fetchStats,
|
||||||
|
setWindowArgs,
|
||||||
|
} from '../../store/actions';
|
||||||
import useInterval from '../hooks/interval';
|
import useInterval from '../hooks/interval';
|
||||||
import LogInArea from '../LogInArea';
|
import LogInArea from '../LogInArea';
|
||||||
import Tabs from '../Tabs';
|
import Tabs from '../Tabs';
|
||||||
|
@ -22,8 +25,17 @@ const UserArea = ({ windowId }) => {
|
||||||
const name = useSelector((state) => state.user.name);
|
const name = useSelector((state) => state.user.name);
|
||||||
const userlvl = useSelector((state) => state.user.userlvl);
|
const userlvl = useSelector((state) => state.user.userlvl);
|
||||||
const lastStatsFetch = useSelector((state) => state.ranks.lastFetch);
|
const lastStatsFetch = useSelector((state) => state.ranks.lastFetch);
|
||||||
|
const {
|
||||||
|
activeTab = t`Profile`,
|
||||||
|
} = useSelector((state) => state.windows.args[windowId] || {});
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const setActiveTab = useCallback((label) => {
|
||||||
|
dispatch(setWindowArgs(windowId, {
|
||||||
|
activeTab: label,
|
||||||
|
}));
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
if (Date.now() - 300000 > lastStatsFetch) {
|
if (Date.now() - 300000 > lastStatsFetch) {
|
||||||
dispatch(fetchStats());
|
dispatch(fetchStats());
|
||||||
|
@ -32,7 +44,7 @@ const UserArea = ({ windowId }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
<Tabs>
|
<Tabs activeTab={activeTab} setActiveTab={setActiveTab}>
|
||||||
<div label={t`Profile`}>
|
<div label={t`Profile`}>
|
||||||
{(name) ? <UserAreaContent /> : <LogInArea windowId={windowId} />}
|
{(name) ? <UserAreaContent /> : <LogInArea windowId={windowId} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -606,6 +606,7 @@ export function setWindowArgs(
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
type: 'SET_WINDOW_ARGS',
|
type: 'SET_WINDOW_ARGS',
|
||||||
|
windowId,
|
||||||
args,
|
args,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,9 @@ export default function windows(
|
||||||
windows: newWindows,
|
windows: newWindows,
|
||||||
args: {
|
args: {
|
||||||
...state.args,
|
...state.args,
|
||||||
[windowId]: args,
|
[windowId]: {
|
||||||
|
...args,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user