// profile.jsx — Профиль: подписка (подробно — экран «Мой тариф»), ответы анкеты, промокод // на Хакку-коворк, Telegram, выход. function Profile({ nav }) { const { user, member, profile } = ME(); const cfg = CFG(); const active = member.state === 'active'; const [cowork, setCowork] = React.useState(null); React.useEffect(() => { if (!active || !profile) return; fetch('/api/coworking', { credentials:'same-origin' }).then(r => r.json()).then(j => setCowork(j && j.coworking)).catch(() => {}); }, []); const goal = goalTitleOf(profile); const fresh = profile && profile.first_name; // анкета п. 3.2; старые — с уровнем, ролью, «делиться» const sphere = profile && profile.sphere && (profile.sphere === 'other' ? (profile.sphere_custom || 'Другое') : ((cfg.spheres || []).find(s => s.id === profile.sphere) || {}).title); const level = profile && (cfg.levels || []).find(l => l.id === profile.ai_level); const role = profile && profile.role && (profile.role === 'other' ? profile.role_custom || 'Другое' : ((cfg.roles || []).find(r => r.id === profile.role) || {}).title); const share = profile && [...(profile.share || []).map(id => ((cfg.share || []).find(s => s.id === id) || {}).title).filter(Boolean), profile.share_custom].filter(Boolean); const Row = ({ k, v }) => (
{k}{v || '—'}
); return (
Профиль

{fresh ? `${profile.first_name} ${profile.last_name || ''}`.trim() : user.name || user.email}

{user.email} · вход через Hakku ID

Подписка

{active && {TIER_LABEL[member.tier]}}
{active && member.grace_until && member.grace_until !== member.paid_until && !member.admin && (
После даты оплаты доступ держится ещё 3 дня, до {fmtDate(member.grace_until)}.
)} {!member.admin && (
{active ? : Выбрать тариф ↗}
)}
{cowork && } {active && (

Анкета

{profile && fresh && ( <> {profile.about &&
{profile.about}
} )} {profile && !fresh && ( <> {level && } {role && } {share && share.length > 0 && }

Анкета обновилась: добавились город, сфера и пара слов о себе. Дополни, чтобы мы знакомили тебя с участниками рядом.

)} {!profile &&

Анкета не заполнена. Заполни, чтобы получить подборку материалов под цель.

}
)} {active && (
Telegram
Уведомления от бота hakku.ai. Без бота пришлём на почту.
track('tg:connect')} style={{ textDecoration:'none' }}>Подключить Telegram ↗
)}
); } window.Profile = Profile;