Skip to content

Commit

Permalink
testing registermailbox function
Browse files Browse the repository at this point in the history
  • Loading branch information
ynnelson committed Dec 11, 2022
1 parent 9957af6 commit 8a3d30a
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 314 deletions.
52 changes: 52 additions & 0 deletions app/main_window/actions/domains/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,55 @@ export const deleteDomain = domain => {
return result;
};
};

/*
* Register Mailboxes under domain
*/
export const REGISTER_MAILBOX_REQUEST = 'DOMAIN::REGISTER_MAILBOX_REQUEST';
export const registerMailboxRequest = () => {
return {
type: REGISTER_MAILBOX_REQUEST
};
};

export const REGISTER_MAILBOX_SUCCESS = 'DOMAIN::REGISTER_MAILBOX_SUCCESS';
export const registerMailboxSuccess = payload => {
return {
type: REGISTER_MAILBOX_SUCCESS,
payload
};
};

export const REGISTER_MAILBOX_FAILURE = 'DOMAIN::REGISTER_MAILBOX_FAILURE';
export const registerMailboxFailure = (error: Error) => {
return {
type: REGISTER_MAILBOX_FAILURE,
error
};
};

export const registerMailbox = (payload: {
type: 'SUB' | 'CLAIMED';
email: string;
displayName: string;
domain: string;
recoveryEmail: string;
deviceType: 'DESKTOP' | 'MOBILE';
}) => {
return async (dispatch: Dispatch) => {
dispatch(registerMailboxRequest());
let result;

try {
result = await DomainService.registerMailbox(payload);
console.log(result);
} catch (error) {
dispatch(registerMailboxFailure(error));
return error;
}

dispatch(registerMailboxSuccess(result));

return result;
};
};
31 changes: 17 additions & 14 deletions app/main_window/components/Layout/TopBar/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, Fragment } from 'react';
import { useSelector } from 'react-redux';

// EXTERNAL LIBRAIRIES
import { usePopper } from 'react-popper';
import { usePopper } from 'react-popper';
import { Dialog, Menu, Transition } from '@headlessui/react';
import { Portal } from 'react-portal';
import { Logout, Setting, User } from 'react-iconly';
Expand Down Expand Up @@ -144,7 +144,7 @@ const UserMenu = (props: Props) => {

return (
<>
<Menu as="div" className="relative ">
<Menu as="div" className="relative">
{({ open }) => (
<>
<div
Expand Down Expand Up @@ -183,6 +183,7 @@ const UserMenu = (props: Props) => {
<div
ref={popperElRef}
style={styles.popper}
className="z-50"
{...attributes.popper}
>
<Transition
Expand Down Expand Up @@ -229,27 +230,29 @@ const UserMenu = (props: Props) => {
</div>

<div className="pl-3 flex flex-col overflow-hidden max-w-[175px]">
<div className="text-sm leading-5 font-semibold break-all">
<div className="text-sm leading-5 font-semibold overflow-ellipsis overflow-x-hidden">
{mailbox?.name?.length > 0
? mailbox?.name
: mailbox?.address}
</div>
{mailbox?.name?.length > 0 && (
<div className="text-xs leading-5 font-normal text-gray-500 break-all">
<div className="text-xs leading-5 font-normal text-gray-500 overflow-ellipsis overflow-x-hidden">
{mailbox?.address}
</div>
)}
</div>
</div>
<div
className="w-full pt-3 text-center"
style={{ cursor: 'pointer' }}
onClick={() => onSelect('settings')}
>
<div className="text-xs rounded border border-gray-300 py-1 text-gray-500 hover:bg-gray-100">
Account Settings
<Menu.Item>
<div
className="w-full pt-3 text-center"
style={{ cursor: 'pointer' }}
onClick={() => onSelect('settings')}
>
<div className="text-xs rounded border border-gray-300 py-1 text-gray-500 hover:bg-gray-100">
Account Settings
</div>
</div>
</div>
</Menu.Item>
</div>
{switcherData.length > 0 && (
<div className="py-1 max-h-[300px] overflow-y-scroll">
Expand Down Expand Up @@ -295,10 +298,10 @@ const UserMenu = (props: Props) => {
)}
</div>
<div className="pl-3 flex flex-col overflow-hidden max-w-[200px]">
<div className="text-xs leading-4 flex justify-between font-semibold text-ellipsis whitespace-nowrap">
<div className="text-xs leading-4 flex justify-between font-semibold overflow-ellipsis overflow-x-hidden whitespace-nowrap">
{m?.name || m?.address}
</div>
<div className="text-xs leading-4 flex justify-between font-normal text-gray-500 text-ellipsis whitespace-nowrap">
<div className="text-xs leading-4 flex justify-between font-normal text-gray-500 overflow-ellipsis overflow-x-hidden whitespace-nowrap">
{m?.address}
</div>
</div>
Expand Down
Loading

0 comments on commit 8a3d30a

Please sign in to comment.