pl-fe: WIP migrate settings store to zustand

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-10-07 01:32:55 +02:00
parent 419877adcc
commit e4615b70f7
31 changed files with 351 additions and 306 deletions

View File

@ -1,18 +1,24 @@
import { Map as ImmutableMap, type Collection } from 'immutable';
import { Settings } from 'pl-fe/schemas/pl-fe/settings';
import type { Status } from 'pl-fe/normalizers';
const shouldFilter = (
status: Pick<Status, 'in_reply_to_id' | 'visibility' | 'reblog_id'>,
columnSettings: Collection<any, any>,
columnSettings: Settings['timelines'][''],
) => {
const shows = ImmutableMap({
const fallback = {
reblog: true,
reply: true,
direct: false,
};
const shows = {
reblog: status.reblog_id !== null,
reply: status.in_reply_to_id !== null,
direct: status.visibility === 'direct',
});
};
return shows.some((value, key) => columnSettings.getIn(['shows', key]) === false && value);
return Object.entries(shows).some(([key, value]) => (columnSettings?.shows || fallback)[key as 'reblog' | 'reply' | 'direct'] === false && value);
};
export { shouldFilter };