mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-10 07:58:50 +01:00
Track spoilers
Turns out I'm using WeakMap wrong
This commit is contained in:
parent
7c5b0ccea3
commit
39efda9e38
2 changed files with 13 additions and 4 deletions
|
@ -130,7 +130,7 @@ function Status({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [showSpoiler, setShowSpoiler] = useState(false);
|
const showSpoiler = snapStates.spoilers.has(id) || false;
|
||||||
|
|
||||||
const debugHover = (e) => {
|
const debugHover = (e) => {
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
|
@ -293,7 +293,11 @@ function Status({
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setShowSpoiler(!showSpoiler);
|
if (showSpoiler) {
|
||||||
|
states.spoilers.delete(id);
|
||||||
|
} else {
|
||||||
|
states.spoilers.set(id, true);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
||||||
|
@ -356,7 +360,11 @@ function Status({
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setShowSpoiler(!showSpoiler);
|
if (showSpoiler) {
|
||||||
|
states.spoilers.delete(id);
|
||||||
|
} else {
|
||||||
|
states.spoilers.add(id);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} /> Sensitive
|
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} /> Sensitive
|
||||||
|
|
|
@ -10,8 +10,9 @@ export default proxy({
|
||||||
notifications: [],
|
notifications: [],
|
||||||
notificationsNew: [],
|
notificationsNew: [],
|
||||||
notificationsLastFetchTime: null,
|
notificationsLastFetchTime: null,
|
||||||
accounts: new WeakMap(),
|
accounts: new Map(),
|
||||||
reloadStatusPage: 0,
|
reloadStatusPage: 0,
|
||||||
|
spoilers: proxyMap([]),
|
||||||
// Modals
|
// Modals
|
||||||
showCompose: false,
|
showCompose: false,
|
||||||
showSettings: false,
|
showSettings: false,
|
||||||
|
|
Loading…
Reference in a new issue