change how coords are storedin modtools
fix persist/REHYDRATE
This commit is contained in:
parent
eefa210ed0
commit
cd9177cc1b
|
@ -71,7 +71,6 @@ const Captcha = ({ autoload, width }) => {
|
|||
({t`Tip: Not case-sensitive; I and l are the same`})
|
||||
</span>
|
||||
</p>
|
||||
<br />
|
||||
{errors.map((error) => (
|
||||
<p key={error} className="errormessage">
|
||||
<span>{t`Error`}</span>: {error}
|
||||
|
@ -149,7 +148,6 @@ const Captcha = ({ autoload, width }) => {
|
|||
}}
|
||||
/>
|
||||
<input type="hidden" name="captchaid" value={captchaData.id || '0'} />
|
||||
<br />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -145,13 +145,6 @@ function ModCanvastools() {
|
|||
const [cleanAction, selectCleanAction] = useState('spare');
|
||||
const [protAction, selectProtAction] = useState('protect');
|
||||
const [date, selectDate] = useState(maxDate);
|
||||
const [coords, selectCoords] = useState(keptState.coords);
|
||||
const [tlcoords, selectTLCoords] = useState(keptState.tlcoords);
|
||||
const [brcoords, selectBRCoords] = useState(keptState.brcoords);
|
||||
const [tlrcoords, selectTLRCoords] = useState(keptState.tlrcoords);
|
||||
const [brrcoords, selectBRRCoords] = useState(keptState.brrcoords);
|
||||
const [tlccoords, selectTLCCoords] = useState(keptState.tlccoords);
|
||||
const [brccoords, selectBRCCoords] = useState(keptState.brccoords);
|
||||
const [resp, setResp] = useState(null);
|
||||
const [cleanerstats, setCleanerStats] = useState({});
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
@ -201,10 +194,6 @@ function ModCanvastools() {
|
|||
// nothing
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCleanerStats((stats) => setCleanerStats(stats));
|
||||
}, []);
|
||||
|
||||
useInterval(() => {
|
||||
getCleanerStats((stats) => setCleanerStats(stats));
|
||||
}, 10000);
|
||||
|
@ -278,7 +267,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Coordinates in X_Y format:`}
|
||||
<input
|
||||
value={coords}
|
||||
defaultValue={keptState.coords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -287,9 +276,7 @@ function ModCanvastools() {
|
|||
type="text"
|
||||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectCoords(co);
|
||||
keptState.coords = co;
|
||||
keptState.coords = evt.target.value.trim();
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
|
@ -303,7 +290,7 @@ function ModCanvastools() {
|
|||
submitImageAction(
|
||||
imageAction,
|
||||
selectedCanvas,
|
||||
coords,
|
||||
keptState.coords,
|
||||
(ret) => {
|
||||
setSubmitting(false);
|
||||
setResp(ret);
|
||||
|
@ -341,7 +328,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Top-left corner`} (X_Y):
|
||||
<input
|
||||
value={tlcoords}
|
||||
defaultValue={keptState.tlcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -351,7 +338,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectTLCoords(co);
|
||||
keptState.tlcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -359,7 +345,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Bottom-right corner`} (X_Y):
|
||||
<input
|
||||
value={brcoords}
|
||||
defaultValue={keptState.brcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -369,7 +355,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectBRCoords(co);
|
||||
keptState.brcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -384,8 +369,8 @@ function ModCanvastools() {
|
|||
submitProtAction(
|
||||
protAction,
|
||||
selectedCanvas,
|
||||
tlcoords,
|
||||
brcoords,
|
||||
keptState.tlcoords,
|
||||
keptState.brcoords,
|
||||
(ret) => {
|
||||
setSubmitting(false);
|
||||
setResp(ret);
|
||||
|
@ -416,7 +401,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Top-left corner`} (X_Y):
|
||||
<input
|
||||
value={tlrcoords}
|
||||
defaultValue={keptState.tlrcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -426,7 +411,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectTLRCoords(co);
|
||||
keptState.tlrcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -434,7 +418,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Bottom-right corner`} (X_Y):
|
||||
<input
|
||||
value={brrcoords}
|
||||
defaultValue={keptState.brrcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -444,7 +428,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectBRRCoords(co);
|
||||
keptState.brrcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -459,8 +442,8 @@ function ModCanvastools() {
|
|||
submitRollback(
|
||||
date,
|
||||
selectedCanvas,
|
||||
tlrcoords,
|
||||
brrcoords,
|
||||
keptState.tlrcoords,
|
||||
keptState.brrcoords,
|
||||
(ret) => {
|
||||
setSubmitting(false);
|
||||
setResp(ret);
|
||||
|
@ -501,7 +484,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Top-left corner`} (X_Y):
|
||||
<input
|
||||
value={tlccoords}
|
||||
defaultValue={keptState.tlccoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -511,7 +494,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectTLCCoords(co);
|
||||
keptState.tlccoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -519,7 +501,7 @@ function ModCanvastools() {
|
|||
<p>
|
||||
{t`Bottom-right corner`} (X_Y):
|
||||
<input
|
||||
value={brccoords}
|
||||
defaultValue={keptState.brccoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -529,7 +511,6 @@ function ModCanvastools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectBRCCoords(co);
|
||||
keptState.brccoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -544,15 +525,15 @@ function ModCanvastools() {
|
|||
submitCanvasCleaner(
|
||||
cleanAction,
|
||||
selectedCanvas,
|
||||
tlccoords,
|
||||
brccoords,
|
||||
keptState.tlccoords,
|
||||
keptState.brccoords,
|
||||
(ret) => {
|
||||
setCleanerStats({
|
||||
running: true,
|
||||
percent: 'N/A',
|
||||
method: cleanAction,
|
||||
tl: tlccoords,
|
||||
br: brccoords,
|
||||
tl: keptState.tlccoords,
|
||||
br: keptState.brccoords,
|
||||
canvasId: selectedCanvas,
|
||||
});
|
||||
setSubmitting(false);
|
||||
|
|
|
@ -70,13 +70,9 @@ async function submitWatchAction(
|
|||
|
||||
function ModWatchtools() {
|
||||
const [selectedCanvas, selectCanvas] = useState(0);
|
||||
const [tlcoords, selectTLCoords] = useState(keepState.tlcoords);
|
||||
const [brcoords, selectBRCoords] = useState(keepState.brcoords);
|
||||
const [interval, selectInterval] = useState(keepState.interval);
|
||||
const [sortAsc, setSortAsc] = useState(true);
|
||||
const [sortBy, setSortBy] = useState(0);
|
||||
const [table, setTable] = useState({});
|
||||
const [iid, selectIid] = useState(keepState.iid);
|
||||
const [resp, setResp] = useState(null);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
|
@ -137,7 +133,7 @@ function ModWatchtools() {
|
|||
</select>
|
||||
{` ${t`Interval`}: `}
|
||||
<input
|
||||
value={interval}
|
||||
defaultValue={keepState.interval}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -147,13 +143,12 @@ function ModWatchtools() {
|
|||
placeholder="15m"
|
||||
onChange={(evt) => {
|
||||
const newInterval = evt.target.value.trim();
|
||||
selectInterval(newInterval);
|
||||
keepState.interval = newInterval;
|
||||
}}
|
||||
/>
|
||||
{` ${t`IID (optional)`}: `}
|
||||
<input
|
||||
value={iid}
|
||||
defaultValue={keepState.iid}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -163,7 +158,6 @@ function ModWatchtools() {
|
|||
placeholder="xxxx-xxxxx-xxxx"
|
||||
onChange={(evt) => {
|
||||
const newIid = evt.target.value.trim();
|
||||
selectIid(newIid);
|
||||
keepState.iid = newIid;
|
||||
}}
|
||||
/>
|
||||
|
@ -171,7 +165,7 @@ function ModWatchtools() {
|
|||
<p>
|
||||
{t`Top-left corner`} (X_Y):
|
||||
<input
|
||||
value={tlcoords}
|
||||
defaultValue={keepState.tlcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -181,7 +175,6 @@ function ModWatchtools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectTLCoords(co);
|
||||
keepState.tlcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -189,7 +182,7 @@ function ModWatchtools() {
|
|||
<p>
|
||||
{t`Bottom-right corner`} (X_Y):
|
||||
<input
|
||||
value={brcoords}
|
||||
defaultValue={keepState.brcoords}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
width: '100%',
|
||||
|
@ -199,7 +192,6 @@ function ModWatchtools() {
|
|||
placeholder="X_Y"
|
||||
onChange={(evt) => {
|
||||
const co = evt.target.value.trim();
|
||||
selectBRCoords(co);
|
||||
keepState.brcoords = co;
|
||||
}}
|
||||
/>
|
||||
|
@ -214,10 +206,10 @@ function ModWatchtools() {
|
|||
submitWatchAction(
|
||||
'all',
|
||||
selectedCanvas,
|
||||
tlcoords,
|
||||
brcoords,
|
||||
interval,
|
||||
iid,
|
||||
keepState.tlcoords,
|
||||
keepState.brcoords,
|
||||
keepState.interval,
|
||||
keepState.iid,
|
||||
(ret) => {
|
||||
setSubmitting(false);
|
||||
setResp(ret.info);
|
||||
|
@ -245,10 +237,10 @@ function ModWatchtools() {
|
|||
submitWatchAction(
|
||||
'summary',
|
||||
selectedCanvas,
|
||||
tlcoords,
|
||||
brcoords,
|
||||
interval,
|
||||
iid,
|
||||
keepState.tlcoords,
|
||||
keepState.brcoords,
|
||||
keepState.interval,
|
||||
keepState.iid,
|
||||
(ret) => {
|
||||
setSubmitting(false);
|
||||
setResp(ret.info);
|
||||
|
|
|
@ -30,7 +30,7 @@ function Modtools() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className="content">
|
||||
<div className="content" style={{ overflowWrap: 'anywhere' }}>
|
||||
{parts.map((part, ind) => (
|
||||
<React.Fragment key={part}>
|
||||
<span
|
||||
|
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
const Tab = ({ onClick, active, label }) => {
|
||||
let className = 'tab-list-item';
|
||||
if (active) {
|
||||
className += ' tab-list-active';
|
||||
className += ' active';
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -64,6 +64,4 @@ class PopUps {
|
|||
|
||||
const popUps = new PopUps();
|
||||
|
||||
window.lol = popUps.wins;
|
||||
|
||||
export default popUps;
|
||||
|
|
|
@ -183,6 +183,9 @@ export default function windows(
|
|||
state = initialState,
|
||||
action,
|
||||
) {
|
||||
if (action.type.startsWith('persist')) {
|
||||
console.log(action);
|
||||
}
|
||||
switch (action.type) {
|
||||
case 'OPEN_WIN': {
|
||||
/*
|
||||
|
@ -496,14 +499,15 @@ export default function windows(
|
|||
|
||||
case 'persist/REHYDRATE': {
|
||||
const { showWindows } = state;
|
||||
if (!showWindows) {
|
||||
if (!showWindows || action.key !== 'wind') {
|
||||
// don't persist on small screens
|
||||
return state;
|
||||
}
|
||||
|
||||
console.log(action);
|
||||
const loadedState = {
|
||||
...state,
|
||||
...action.payload.windows,
|
||||
...action.payload,
|
||||
};
|
||||
const args = { ...loadedState.args };
|
||||
const positions = { ...loadedState.positions };
|
||||
|
|
|
@ -11,10 +11,11 @@ import gui from './reducers/gui';
|
|||
import ranks from './reducers/ranks';
|
||||
import chatRead from './reducers/chatRead';
|
||||
|
||||
export const CURRENT_VERSION = 8;
|
||||
export const CURRENT_VERSION = 11;
|
||||
|
||||
export const migrate = (state, version) => {
|
||||
if (!state || version !== CURRENT_VERSION) {
|
||||
console.log('migrate', state, version);
|
||||
if (!state || !state._persist || state._persist.version !== version) {
|
||||
console.log('Newer version run, resetting store.');
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
|
|
@ -73,4 +73,6 @@ const store = createStore(
|
|||
|
||||
persistStore(store);
|
||||
|
||||
window.lol = store;
|
||||
|
||||
export default store;
|
||||
|
|
|
@ -144,14 +144,14 @@ a:hover {
|
|||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.tab-list-item:hover {
|
||||
background-color: #6d6d6d;
|
||||
border: solid #ccc;
|
||||
border-width: 1px 1px 0 1px;
|
||||
.tab-list-item:not(.active):hover {
|
||||
background-color: #dbdbdb;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tab-list-active {
|
||||
.tab-list-item.active {
|
||||
background-color: white;
|
||||
color: #262a30;
|
||||
border: solid #ccc;
|
||||
border-width: 1px 1px 0 1px;
|
||||
}
|
||||
|
@ -555,6 +555,11 @@ tr:nth-child(even) {
|
|||
font-size: 16px;
|
||||
}
|
||||
|
||||
.Alert p,.window p {
|
||||
margin-top: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 5%;
|
||||
padding-right: 5%;
|
||||
|
@ -742,7 +747,7 @@ table td span, .chatname, .mention, .ping {
|
|||
vertical-align: bottom;
|
||||
}
|
||||
table td span {
|
||||
max-width: 140px;
|
||||
max-width: 180px;
|
||||
}
|
||||
.chatname {
|
||||
padding-left: 4px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user