Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as L from 'partial.lenses';
- import * as R from 'ramda';
- const cardTypes = {
- INSTAGRAM: {
- title: 'follow us on instagram',
- body:
- 'Check out our Instagram for the latest Somnia Amor information and news.',
- icon: 'whatshot',
- href: 'https://www.instagram.com/',
- },
- ABOUT: {
- title: 'learn about our process',
- body:
- 'If you have any questions about what we do, check the about page.',
- icon: 'local_library',
- link: '/landing/home',
- },
- WELCOME: {
- title: 'welcome to somnia amor!',
- body:
- 'Create your profile to start getting matched with awesome people.',
- icon: 'mood',
- link: '/dashboard/profile',
- },
- REQUEST_MATCHMAKER: {
- title: 'enough typing, lets talk!',
- body:
- 'Book an appointment to speak on the phone with one of our expert matchmakers.',
- icon: 'mood',
- },
- MATCHMAKER_REQUESTED: {
- title: 'stay tuned!',
- body:
- 'You should recieve an email from one of our expert matchmakers shortly.',
- icon: 'check',
- color: 'green',
- },
- MATCHMAKER_ASSIGNED: {
- title: 'meet your matchmaker!',
- body:
- 'Check out your new matchmaker\'s contact details and more.',
- icon: 'new_releases',
- },
- MATCHMAKER: {
- title: 'your matchmaker',
- },
- };
- const populateNotifications = types => user => L.modify(
- ['notifications', L.elems],
- notification => R.pipe(
- R.assoc('type', notification),
- R.ifElse(
- R.pipe(
- R.prop('type'),
- R.equals('MATCHMAKER'),
- ),
- x => R.mergeLeft(
- R.pick(
- ['email', 'firstName', 'lastName', 'bio', 'avatar'],
- user.matchmaker,
- ),
- x,
- ),
- x => x,
- ),
- )(types[notification]),
- )(user);
- const populateUser = user => populateNotifications(cardTypes)(user);
- // NOTE: these are ordered by increasing permission level:
- const userRoles = ['CLIENT', 'MATCHMAKER', 'ADMIN'];
- const getPermissionLevel = roles => role => roles.indexOf(role);
- const getPermissionLevel$ = getPermissionLevel(userRoles);
- export {
- populateUser,
- getPermissionLevel$ as getPermissionLevel,
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement