2022-12-10 12:14:48 +03:00
|
|
|
import { proxy } from 'valtio';
|
|
|
|
|
2023-01-09 14:11:34 +03:00
|
|
|
const states = proxy({
|
2022-12-10 12:14:48 +03:00
|
|
|
history: [],
|
2023-01-07 15:26:23 +03:00
|
|
|
statuses: {},
|
2022-12-10 12:14:48 +03:00
|
|
|
home: [],
|
|
|
|
homeNew: [],
|
|
|
|
homeLastFetchTime: null,
|
|
|
|
notifications: [],
|
|
|
|
notificationsNew: [],
|
|
|
|
notificationsLastFetchTime: null,
|
2023-01-07 15:26:23 +03:00
|
|
|
accounts: {},
|
2022-12-10 12:14:48 +03:00
|
|
|
reloadStatusPage: 0,
|
2023-01-07 15:26:23 +03:00
|
|
|
spoilers: {},
|
|
|
|
scrollPositions: {},
|
2022-12-10 12:14:48 +03:00
|
|
|
// Modals
|
|
|
|
showCompose: false,
|
|
|
|
showSettings: false,
|
|
|
|
showAccount: false,
|
2023-01-04 14:03:11 +03:00
|
|
|
composeCharacterCount: 0,
|
2022-12-10 12:14:48 +03:00
|
|
|
});
|
2023-01-09 14:11:34 +03:00
|
|
|
export default states;
|
|
|
|
|
|
|
|
export function saveStatus(status, opts) {
|
|
|
|
const { override } = Object.assign({ override: true }, opts);
|
|
|
|
if (!status) return;
|
|
|
|
if (!override && states.statuses[status.id]) return;
|
|
|
|
states.statuses[status.id] = status;
|
|
|
|
if (status.reblog) {
|
|
|
|
states.statuses[status.reblog.id] = status.reblog;
|
|
|
|
}
|
|
|
|
}
|