SHA256
Доделать связи и профиль
This commit is contained in:
@@ -104,10 +104,8 @@ function applyRelativeGender(map, rows) {
|
||||
|
||||
function getRelativeGenderMap(graph) {
|
||||
const map = new Map();
|
||||
applyRelativeGender(map, graph?.parents);
|
||||
applyRelativeGender(map, graph?.children);
|
||||
applyRelativeGender(map, graph?.siblings);
|
||||
applyRelativeGender(map, graph?.spouses);
|
||||
// Родственные связи пока скрыты из UI, хотя сервер продолжает хранить их коды.
|
||||
void graph;
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -115,6 +113,8 @@ function buildGraphModel(graph, centerLogin) {
|
||||
const login = normalizeLogin(graph?.login || centerLogin || state.session.login);
|
||||
const outFriends = toSet(graph?.outFriends);
|
||||
const inFriends = toSet(graph?.inFriends);
|
||||
const outCloseFriends = toSet(graph?.outCloseFriends);
|
||||
const inCloseFriends = toSet(graph?.inCloseFriends);
|
||||
const outParents = toSet(graph?.outParents);
|
||||
const inParents = toSet(graph?.inParents);
|
||||
const outChildren = toSet(graph?.outChildren);
|
||||
@@ -128,8 +128,8 @@ function buildGraphModel(graph, centerLogin) {
|
||||
const inContacts = toSet(graph?.inContacts);
|
||||
const outFollows = toSet(graph?.outFollows);
|
||||
const inFollows = toSet(graph?.inFollows);
|
||||
const outKnown = toSet(graph?.outKnownPersons);
|
||||
const inKnown = toSet(graph?.inKnownPersons);
|
||||
const outOfficial = toSet(graph?.outOfficialAccounts);
|
||||
const inOfficial = toSet(graph?.inOfficialAccounts);
|
||||
|
||||
const relativesGender = getRelativeGenderMap(graph);
|
||||
const allMarks = getMarkByLogin(graph?.allUsers);
|
||||
@@ -137,67 +137,35 @@ function buildGraphModel(graph, centerLogin) {
|
||||
const allLogins = uniqueLogins([
|
||||
...(graph?.outFriends || []),
|
||||
...(graph?.inFriends || []),
|
||||
...(graph?.outParents || []),
|
||||
...(graph?.inParents || []),
|
||||
...(graph?.outChildren || []),
|
||||
...(graph?.inChildren || []),
|
||||
...(graph?.outSiblings || []),
|
||||
...(graph?.inSiblings || []),
|
||||
...(graph?.outSpouses || []),
|
||||
...(graph?.inSpouses || []),
|
||||
...(graph?.outCloseFriends || []),
|
||||
...(graph?.inCloseFriends || []),
|
||||
...(graph?.outContacts || []),
|
||||
...(graph?.inContacts || []),
|
||||
...(graph?.outFollows || []),
|
||||
...(graph?.inFollows || []),
|
||||
...(graph?.outKnownPersons || []),
|
||||
...(graph?.inKnownPersons || []),
|
||||
...(graph?.outOfficialAccounts || []),
|
||||
...(graph?.inOfficialAccounts || []),
|
||||
]).filter((entry) => normKey(entry) !== normKey(login));
|
||||
|
||||
const relations = allLogins.map((targetLogin) => {
|
||||
const parentOut = hasLogin(outParents, targetLogin);
|
||||
const parentIn = hasLogin(inChildren, targetLogin);
|
||||
const childOut = hasLogin(outChildren, targetLogin);
|
||||
const childIn = hasLogin(inParents, targetLogin);
|
||||
const siblingOut = hasLogin(outSiblings, targetLogin);
|
||||
const siblingIn = hasLogin(inSiblings, targetLogin);
|
||||
const spouseOut = hasLogin(outSpouses, targetLogin);
|
||||
const spouseIn = hasLogin(inSpouses, targetLogin);
|
||||
const friendOut = hasLogin(outFriends, targetLogin);
|
||||
const friendIn = hasLogin(inFriends, targetLogin);
|
||||
const contactOut = hasLogin(outContacts, targetLogin) || hasLogin(outFollows, targetLogin) || hasLogin(outKnown, targetLogin);
|
||||
const contactIn = hasLogin(inContacts, targetLogin) || hasLogin(inFollows, targetLogin) || hasLogin(inKnown, targetLogin);
|
||||
const closeFriendOut = hasLogin(outCloseFriends, targetLogin);
|
||||
const closeFriendIn = hasLogin(inCloseFriends, targetLogin);
|
||||
const contactOut = hasLogin(outContacts, targetLogin) || hasLogin(outFollows, targetLogin) || hasLogin(outOfficial, targetLogin);
|
||||
const contactIn = hasLogin(inContacts, targetLogin) || hasLogin(inFollows, targetLogin) || hasLogin(inOfficial, targetLogin);
|
||||
|
||||
let role = 'contact';
|
||||
if (parentOut || parentIn) role = 'parent';
|
||||
else if (childOut || childIn) role = 'child';
|
||||
else if (spouseOut || spouseIn) role = 'spouse';
|
||||
else if (siblingOut || siblingIn) role = 'sibling';
|
||||
else if (friendOut || friendIn) role = 'friend';
|
||||
if (closeFriendOut || closeFriendIn || friendOut || friendIn) role = 'friend';
|
||||
|
||||
let forward = friendOut;
|
||||
let backward = friendIn;
|
||||
if (role === 'parent') {
|
||||
forward = parentOut;
|
||||
backward = parentIn;
|
||||
} else if (role === 'child') {
|
||||
forward = childOut;
|
||||
backward = childIn;
|
||||
} else if (role === 'spouse') {
|
||||
forward = spouseOut;
|
||||
backward = spouseIn;
|
||||
} else if (role === 'sibling') {
|
||||
forward = siblingOut;
|
||||
backward = siblingIn;
|
||||
} else if (role === 'contact') {
|
||||
forward = contactOut;
|
||||
backward = contactIn;
|
||||
}
|
||||
let forward = role === 'friend' ? (closeFriendOut || friendOut) : contactOut;
|
||||
let backward = role === 'friend' ? (closeFriendIn || friendIn) : contactIn;
|
||||
|
||||
return {
|
||||
login: targetLogin,
|
||||
key: normKey(targetLogin),
|
||||
role,
|
||||
isRelative: role === 'parent' || role === 'child' || role === 'spouse' || role === 'sibling',
|
||||
isRelative: false,
|
||||
gender: normalizeGender(relativesGender.get(normKey(targetLogin))),
|
||||
forward: Boolean(forward),
|
||||
backward: Boolean(backward),
|
||||
@@ -242,11 +210,10 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
// Фильтры слоёв (Фаза 3). Фокус всегда виден; предикат применяется к периферийным узлам.
|
||||
const FILTERS = {
|
||||
all: { label: 'Все', pred: () => true },
|
||||
family: { label: 'Семья', pred: (n) => n.relationType === 'family' },
|
||||
friends: { label: 'Друзья', pred: (n) => n.relationType === 'friend' },
|
||||
shining: { label: 'Сияющие', pred: (n) => Boolean(n.shining) },
|
||||
};
|
||||
const FILTER_ORDER = ['all', 'family', 'friends', 'shining'];
|
||||
const FILTER_ORDER = ['all', 'friends', 'shining'];
|
||||
let activeFilter = 'all';
|
||||
const filterChips = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user