mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-28 03:53:29 +03: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) => {
|
||||
if (e.shiftKey) {
|
||||
|
@ -293,7 +293,11 @@ function Status({
|
|||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setShowSpoiler(!showSpoiler);
|
||||
if (showSpoiler) {
|
||||
states.spoilers.delete(id);
|
||||
} else {
|
||||
states.spoilers.set(id, true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
||||
|
@ -356,7 +360,11 @@ function Status({
|
|||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setShowSpoiler(!showSpoiler);
|
||||
if (showSpoiler) {
|
||||
states.spoilers.delete(id);
|
||||
} else {
|
||||
states.spoilers.add(id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} /> Sensitive
|
||||
|
|
|
@ -10,8 +10,9 @@ export default proxy({
|
|||
notifications: [],
|
||||
notificationsNew: [],
|
||||
notificationsLastFetchTime: null,
|
||||
accounts: new WeakMap(),
|
||||
accounts: new Map(),
|
||||
reloadStatusPage: 0,
|
||||
spoilers: proxyMap([]),
|
||||
// Modals
|
||||
showCompose: false,
|
||||
showSettings: false,
|
||||
|
|
Loading…
Add table
Reference in a new issue