diff --git a/packages/extension/src/@types/chat.ts b/packages/extension/src/@types/chat.ts
new file mode 100644
index 0000000000..5f16d82807
--- /dev/null
+++ b/packages/extension/src/@types/chat.ts
@@ -0,0 +1,132 @@
+// Params Type Definitions
+
+export interface NewGroupDetails {
+ isEditGroup: boolean;
+ group: GroupDetails;
+}
+export interface GroupDetails {
+ contents: string;
+ description: string;
+ groupId: string;
+ members: GroupMembers[];
+ name: string;
+ onlyAdminMessages: boolean;
+}
+
+export interface GroupMembers {
+ address: string;
+ pubKey: string;
+ encryptedSymmetricKey: string;
+ isAdmin: boolean;
+}
+
+export interface GroupMessagePayload {
+ message: string;
+ type: string;
+}
+
+export interface PublicKeyDetails {
+ address: string;
+ channelId: string;
+ privacySetting: string;
+ publicKey: string;
+}
+
+export interface NewMessageUpdate {
+ type: string;
+ message: Message;
+}
+
+// Graphql Type Definitions
+export interface Message {
+ id: string;
+ sender: string;
+ target: string;
+ contents: string;
+ groupId: string;
+ expiryTimestamp: string;
+ commitTimestamp: string;
+}
+
+export interface GroupAddress {
+ address: string;
+ pubKey: string;
+ lastSeenTimestamp: string;
+ groupLastSeenTimestamp: string;
+ encryptedSymmetricKey: string;
+ isAdmin: boolean;
+ removedAt: Date;
+}
+
+export interface Group {
+ id: string; // groupID
+ name: string; // contactAddress
+ isDm: boolean;
+ addresses: GroupAddress[];
+ lastMessageContents: string;
+ lastMessageSender: string;
+ lastMessageTimestamp: string;
+ lastSeenTimestamp: string;
+ description?: string;
+ createdAt: string;
+ removedAt: Date;
+}
+
+export interface Pagination {
+ page: number;
+ pageCount: number;
+ total: number;
+ lastPage: number;
+}
+
+//Redux Selectors Type Definitions
+export interface Messages {
+ [key: string]: Message;
+}
+
+export interface Chat {
+ contactAddress: string;
+ messages: Messages;
+ pubKey?: string;
+ pagination: Pagination;
+}
+
+//key is group ID
+export interface Chats {
+ [key: string]: Chat;
+}
+
+export interface BlockedAddressState {
+ [key: string]: boolean;
+}
+
+export interface Groups {
+ [contactAddress: string]: Group;
+}
+
+export interface NameAddress {
+ [key: string]: string;
+}
+
+export enum GroupChatOptions {
+ groupInfo,
+ muteGroup,
+ leaveGroup,
+ deleteGroup,
+ chatSettings,
+}
+
+export enum GroupChatMemberOptions {
+ addToAddressBook,
+ viewInAddressBook,
+ messageMember,
+ removeMember,
+ removeAdminStatus,
+ makeAdminStatus,
+ dissmisPopup,
+}
+
+export enum CommonPopupOptions {
+ cancel,
+ ok,
+}
diff --git a/packages/extension/src/bootstrap.tsx b/packages/extension/src/bootstrap.tsx
index d664ac5325..dd2edaf216 100644
--- a/packages/extension/src/bootstrap.tsx
+++ b/packages/extension/src/bootstrap.tsx
@@ -1,14 +1,14 @@
import React, { Suspense } from "react";
import ReactDOM from "react-dom";
-import { Banner } from "./components/banner";
+import { Banner } from "@components/banner";
const Application = React.lazy(() => import("./index"));
const LoadingScreen: React.FC = () => {
return (
+ {description} +
+- This contact will not be able to send you messages. The contact will - not be notified. + You will lose all your messages in this group. This action cannot be + undone
diff --git a/packages/extension/src/pages/setting/fiat/index.tsx b/packages/extension/src/pages/setting/fiat/index.tsx
index a596e7fa90..52feb54670 100644
--- a/packages/extension/src/pages/setting/fiat/index.tsx
+++ b/packages/extension/src/pages/setting/fiat/index.tsx
@@ -1,5 +1,5 @@
import React, { FunctionComponent, useMemo } from "react";
-import { HeaderLayout } from "../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { PageButton } from "../page-button";
import style from "../style.module.scss";
diff --git a/packages/extension/src/pages/setting/index.tsx b/packages/extension/src/pages/setting/index.tsx
index b143195b37..250fa60e92 100644
--- a/packages/extension/src/pages/setting/index.tsx
+++ b/packages/extension/src/pages/setting/index.tsx
@@ -1,12 +1,12 @@
import React, { FunctionComponent, useMemo } from "react";
-import { HeaderLayout } from "../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { useHistory } from "react-router";
import { PageButton } from "./page-button";
import style from "./style.module.scss";
import { useLanguage } from "../../languages";
import { useIntl } from "react-intl";
import { observer } from "mobx-react-lite";
-import { userChatActive } from "../../chatStore/user-slice";
+import { userChatActive } from "@chatStore/user-slice";
import { useSelector } from "react-redux";
// import { useStore } from "../../stores";
diff --git a/packages/extension/src/pages/setting/keyring/change/name.tsx b/packages/extension/src/pages/setting/keyring/change/name.tsx
index b65096f341..8e75ce0e86 100644
--- a/packages/extension/src/pages/setting/keyring/change/name.tsx
+++ b/packages/extension/src/pages/setting/keyring/change/name.tsx
@@ -1,9 +1,9 @@
import React, { FunctionComponent, useState, useEffect, useMemo } from "react";
-import { HeaderLayout } from "../../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { useHistory, useRouteMatch } from "react-router";
import { FormattedMessage, useIntl } from "react-intl";
-import { Input } from "../../../../components/form";
+import { Input } from "@components/form";
import { Button, Form } from "reactstrap";
import useForm from "react-hook-form";
import { useStore } from "../../../../stores";
diff --git a/packages/extension/src/pages/setting/keyring/index.tsx b/packages/extension/src/pages/setting/keyring/index.tsx
index c4b4be3636..a34e659e31 100644
--- a/packages/extension/src/pages/setting/keyring/index.tsx
+++ b/packages/extension/src/pages/setting/keyring/index.tsx
@@ -1,6 +1,6 @@
import React, { FunctionComponent, useState } from "react";
-import { HeaderLayout } from "../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { observer } from "mobx-react-lite";
import { useStore } from "../../../stores";
@@ -9,17 +9,17 @@ import { useHistory } from "react-router";
import { Button, Popover, PopoverBody } from "reactstrap";
import style from "./style.module.scss";
-import { useLoadingIndicator } from "../../../components/loading-indicator";
+import { useLoadingIndicator } from "@components/loading-indicator";
import { PageButton } from "../page-button";
import { MultiKeyStoreInfoWithSelectedElem } from "@keplr-wallet/background";
import { FormattedMessage, useIntl } from "react-intl";
-import { store } from "../../../chatStore";
-import { resetUser } from "../../../chatStore/user-slice";
+import { store } from "@chatStore/index";
+import { resetUser } from "@chatStore/user-slice";
import {
resetChatList,
setIsChatSubscriptionActive,
-} from "../../../chatStore/messages-slice";
-import { messageAndGroupListenerUnsubscribe } from "../../../graphQL/messages-api";
+} from "@chatStore/messages-slice";
+import { messageAndGroupListenerUnsubscribe } from "@graphQL/messages-api";
export const SetKeyRingPage: FunctionComponent = observer(() => {
const intl = useIntl();
diff --git a/packages/extension/src/pages/setting/language/index.tsx b/packages/extension/src/pages/setting/language/index.tsx
index 4653dd6d8f..4b38b4f997 100644
--- a/packages/extension/src/pages/setting/language/index.tsx
+++ b/packages/extension/src/pages/setting/language/index.tsx
@@ -1,5 +1,5 @@
import React, { FunctionComponent, useCallback, useMemo } from "react";
-import { HeaderLayout } from "../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { PageButton } from "../page-button";
import style from "../style.module.scss";
diff --git a/packages/extension/src/pages/setting/page-button.tsx b/packages/extension/src/pages/setting/page-button.tsx
index a463406251..7f2af4f5a4 100644
--- a/packages/extension/src/pages/setting/page-button.tsx
+++ b/packages/extension/src/pages/setting/page-button.tsx
@@ -3,7 +3,7 @@ import React, { FunctionComponent } from "react";
import classnames from "classnames";
import stylePageButton from "./page-button.module.scss";
-import { ToolTip } from "../../components/tooltip";
+import { ToolTip } from "@components/tooltip";
export const PageButton: FunctionComponent<
{
diff --git a/packages/extension/src/pages/setting/token/add/index.tsx b/packages/extension/src/pages/setting/token/add/index.tsx
index 2799451381..9ff02fe0e8 100644
--- a/packages/extension/src/pages/setting/token/add/index.tsx
+++ b/packages/extension/src/pages/setting/token/add/index.tsx
@@ -1,19 +1,19 @@
import React, { FunctionComponent, useEffect, useState } from "react";
-import { HeaderLayout } from "../../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { useHistory } from "react-router";
import { useIntl, FormattedMessage } from "react-intl";
import style from "./style.module.scss";
import { Button, Form } from "reactstrap";
-import { Input } from "../../../../components/form";
+import { Input } from "@components/form";
import { observer } from "mobx-react-lite";
import { useStore } from "../../../../stores";
import useForm from "react-hook-form";
import { Bech32Address } from "@keplr-wallet/cosmos";
import { CW20Currency, Secret20Currency } from "@keplr-wallet/types";
import { useInteractionInfo } from "@keplr-wallet/hooks";
-import { useLoadingIndicator } from "../../../../components/loading-indicator";
-import { useNotification } from "../../../../components/notification";
+import { useLoadingIndicator } from "@components/loading-indicator";
+import { useNotification } from "@components/notification";
interface FormData {
contractAddress: string;
diff --git a/packages/extension/src/pages/setting/token/manage/index.tsx b/packages/extension/src/pages/setting/token/manage/index.tsx
index 420e57d860..a4ec6e00af 100644
--- a/packages/extension/src/pages/setting/token/manage/index.tsx
+++ b/packages/extension/src/pages/setting/token/manage/index.tsx
@@ -1,5 +1,5 @@
import React, { FunctionComponent } from "react";
-import { HeaderLayout } from "../../../../layouts";
+import { HeaderLayout } from "@layouts/index";
import { useHistory } from "react-router";
import { PageButton } from "../../page-button";
@@ -7,8 +7,8 @@ import style from "./style.module.scss";
import { observer } from "mobx-react-lite";
import { useStore } from "../../../../stores";
import { Bech32Address } from "@keplr-wallet/cosmos";
-import { useNotification } from "../../../../components/notification";
-import { useConfirm } from "../../../../components/confirm";
+import { useNotification } from "@components/notification";
+import { useConfirm } from "@components/confirm";
import { CW20Currency, Secret20Currency } from "@keplr-wallet/types";
import { useIntl } from "react-intl";
diff --git a/packages/extension/src/pages/sign/details-tab.tsx b/packages/extension/src/pages/sign/details-tab.tsx
index a4cca82d69..b5a51ee44c 100644
--- a/packages/extension/src/pages/sign/details-tab.tsx
+++ b/packages/extension/src/pages/sign/details-tab.tsx
@@ -8,7 +8,7 @@ import styleDetailsTab from "./details-tab.module.scss";
import { renderAminoMessage } from "./amino";
import { Msg } from "@cosmjs/launchpad";
import { FormattedMessage, useIntl } from "react-intl";
-import { FeeButtons, MemoInput } from "../../components/form";
+import { FeeButtons, MemoInput } from "@components/form";
import {
IFeeConfig,
IGasConfig,
diff --git a/packages/extension/src/pages/sign/index.tsx b/packages/extension/src/pages/sign/index.tsx
index e33c03a04d..141e9c3386 100644
--- a/packages/extension/src/pages/sign/index.tsx
+++ b/packages/extension/src/pages/sign/index.tsx
@@ -1,7 +1,7 @@
import React, { FunctionComponent, useEffect, useMemo, useState } from "react";
import { Button } from "reactstrap";
-import { HeaderLayout } from "../../layouts";
+import { HeaderLayout } from "@layouts/index";
import style from "./style.module.scss";
diff --git a/packages/extension/src/public/assets/group710.svg b/packages/extension/src/public/assets/group710.svg
new file mode 100644
index 0000000000..07ff8c284d
--- /dev/null
+++ b/packages/extension/src/public/assets/group710.svg
@@ -0,0 +1,4 @@
+
diff --git a/packages/extension/src/public/assets/toggle.svg b/packages/extension/src/public/assets/toggle.svg
new file mode 100644
index 0000000000..065237c14d
--- /dev/null
+++ b/packages/extension/src/public/assets/toggle.svg
@@ -0,0 +1,4 @@
+
diff --git a/packages/extension/src/chatStore/index.ts b/packages/extension/src/stores/chats/index.ts
similarity index 78%
rename from packages/extension/src/chatStore/index.ts
rename to packages/extension/src/stores/chats/index.ts
index 1bc4280275..0cc00c5f48 100644
--- a/packages/extension/src/chatStore/index.ts
+++ b/packages/extension/src/stores/chats/index.ts
@@ -3,6 +3,7 @@ import { persistReducer } from "redux-persist";
// import { composeWithDevTools } from 'redux-devtools-extension';
import localStorage from "redux-persist/lib/storage";
import { messageStore } from "./messages-slice";
+import { newGroupStore } from "./new-group-slice";
import { userStore } from "./user-slice";
const messagesConfig = {
@@ -10,6 +11,11 @@ const messagesConfig = {
storage: localStorage,
};
+const newGroupConfig = {
+ key: "newGroup",
+ storage: localStorage,
+};
+
const userConfig = {
key: "user",
storage: localStorage,
@@ -21,11 +27,13 @@ const customizedMiddleware = (getDefaultMiddleware: any) =>
});
const persistedMessages = persistReducer(messagesConfig, messageStore);
const persistedUserDetails = persistReducer(userConfig, userStore);
+const persistedNewGroupDetails = persistReducer(newGroupConfig, newGroupStore);
export const store = configureStore({
reducer: {
messages: persistedMessages,
user: persistedUserDetails,
+ newGroup: persistedNewGroupDetails,
},
middleware: customizedMiddleware,
});
diff --git a/packages/extension/src/chatStore/messages-slice.ts b/packages/extension/src/stores/chats/messages-slice.ts
similarity index 72%
rename from packages/extension/src/chatStore/messages-slice.ts
rename to packages/extension/src/stores/chats/messages-slice.ts
index 6463eb84d6..37b23e52eb 100644
--- a/packages/extension/src/chatStore/messages-slice.ts
+++ b/packages/extension/src/stores/chats/messages-slice.ts
@@ -1,63 +1,17 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
-import { Message } from "../graphQL/messages-queries";
-import { CHAT_PAGE_COUNT, GROUP_PAGE_COUNT } from "../config.ui.var";
-
-export interface MessageMap {
- [key: string]: Message;
-}
-
-interface ContactState {
- contactAddress: string;
- messages: MessageMap;
- pubKey?: string;
- pagination: Pagination;
-}
-
-export interface Pagination {
- page: number;
- pageCount: number;
- total: number;
- lastPage: number;
-}
-
-//key is group ID
-export interface MessagesState {
- [key: string]: ContactState;
-}
-
-interface BlockedAddressState {
- [key: string]: boolean;
-}
-
-export interface GroupAddress {
- address: string;
- pubKey: string;
- lastSeenTimestamp: string;
- groupLastSeenTimestamp: string;
- encryptedSymmetricKey: string;
- isAdmin: boolean;
-}
-
-export interface Group {
- id: string; // groupID
- name: string; // contactAddress
- isDm: boolean;
- addresses: GroupAddress[];
- lastMessageContents: string;
- lastMessageSender: string;
- lastMessageTimestamp: string;
- lastSeenTimestamp: string;
- createdAt: string;
-}
-
-export interface Groups {
- [contactAddress: string]: Group;
-}
+import {
+ BlockedAddressState,
+ Chats,
+ Groups,
+ Message,
+ Pagination,
+} from "@chatTypes";
+import { CHAT_PAGE_COUNT, GROUP_PAGE_COUNT } from "../../config.ui.var";
interface State {
groups: Groups;
groupsPagination: Pagination;
- chats: MessagesState;
+ chats: Chats;
blockedAddress: BlockedAddressState;
errorMessage?: { type: string; message: string; level: number };
isChatGroupPopulated: boolean;
@@ -94,7 +48,7 @@ export const messagesSlice = createSlice({
contactAddress: userAddress,
messages: {},
pagination: {
- page: 0,
+ page: -1,
pageCount: CHAT_PAGE_COUNT,
lastPage: 0,
total: CHAT_PAGE_COUNT,
@@ -106,10 +60,12 @@ export const messagesSlice = createSlice({
},
resetChatList: (_state, _action) => initialState,
updateMessages: (state: any, action: PayloadAction