diff --git a/client/src/components/Avatar/index.tsx b/client/src/components/Avatar/index.tsx
index 8de2928..ee6261b 100644
--- a/client/src/components/Avatar/index.tsx
+++ b/client/src/components/Avatar/index.tsx
@@ -19,23 +19,6 @@ const Background = styled.div<{ color: string; size?: string }>`
background-color: ${(props) => props.color};
`;
-const Shape = styled.div<{
- color: string;
- startX: string;
- startY: string;
- shapeWidth: string;
- shapeHeight: string;
- isCircle: boolean;
-}>`
- position: absolute;
- top: ${(props) => props.startY};
- left: ${(props) => props.startX};
- height: ${(props) => props.shapeHeight};
- width: ${(props) => props.shapeWidth};
- background-color: ${(props) => props.color};
- border-radius: ${(props) => (props.isCircle ? "50%" : "none")};
-`;
-
interface Props {
thumbnail: string;
size?: "small" | "medium" | "large";
diff --git a/client/src/components/ContentContainer/index.tsx b/client/src/components/ContentContainer/index.tsx
index 5d308d5..14cf752 100644
--- a/client/src/components/ContentContainer/index.tsx
+++ b/client/src/components/ContentContainer/index.tsx
@@ -6,6 +6,18 @@ const Container = styled.div`
width: 800px;
`;
+const Wrapper = styled.div1`
+ box-sizing: border-box;
+ color: rgb(255, 255, 255);
+ cursor: default;
+ display: block;
+ flex-shrink: 0;
+ font-family: "Inter UI", "SF Pro Display", -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+ font-size: 16px;
+ font-weight: 400;
+ height: 125.047px;
+`;
+
class ContentContainer extends Component {
public render() {
return {this.props.children};
diff --git a/client/src/components/Header/index.tsx b/client/src/components/Header/index.tsx
index 6fbdabc..d5f689c 100644
--- a/client/src/components/Header/index.tsx
+++ b/client/src/components/Header/index.tsx
@@ -56,6 +56,23 @@ const EndAligner = styled.div`
grid-column-gap: 60px;
`;
+const Shape = styled.div<{
+ color: string;
+ startX: string;
+ startY: string;
+ shapeWidth: string;
+ shapeHeight: string;
+ isCircle: boolean;
+}>`
+ position: absolute;
+ top: ${(props) => props.startY};
+ left: ${(props) => props.startX};
+ height: ${(props) => props.shapeHeight};
+ width: ${(props) => props.shapeWidth};
+ background-color: ${(props) => props.color};
+ border-radius: ${(props) => (props.isCircle ? "50%" : "none")};
+`;
+
class Header extends Component {
public render() {
return (
@@ -76,7 +93,7 @@ class Header extends Component {
);
})}
- {this.props.user && (
+ {this.props.user && this.props.account.type === 'free' && (
Sign Out
diff --git a/client/src/context/UserContext.tsx b/client/src/context/UserContext.tsx
index 138c1bc..bd980fe 100644
--- a/client/src/context/UserContext.tsx
+++ b/client/src/context/UserContext.tsx
@@ -3,9 +3,10 @@ import { User } from "../types";
export interface UserContextProps {
user?: User;
+ account: Account;
}
-const UserContext = createContext({});
+const UserContext = createContext({account: {}});
/*
used guidance from https://stackoverflow.com/a/51717096
diff --git a/client/src/pages/Messages.tsx b/client/src/pages/Messages.tsx
index 055d6c1..b7dc1ed 100644
--- a/client/src/pages/Messages.tsx
+++ b/client/src/pages/Messages.tsx
@@ -86,6 +86,7 @@ class Messages extends Component {
onClick={this.onTabClicked}
shouldShowAlert={clientRoom.hasUnreadMessage}
isAlive={otherUserSocket ? otherUserSocket.isActive : false}
+ isHidden={{otherUserSocket.lastMessagedAt < Date.now() - 245000}}
>
{otherRoomUser &&
`${otherRoomUser.name.first} ${otherRoomUser.name.last}`}
diff --git a/package.json b/package.json
index 7b34127..30943ed 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
"name": "message-app",
"version": "1.0.0",
"description": "",
+ "type": "module",
"main": "index.js",
"dependencies": {
"concurrently": "^5.1.0",
diff --git a/server/src/models/Message.ts b/server/src/models/Message.ts
index d795dea..993f7a2 100644
--- a/server/src/models/Message.ts
+++ b/server/src/models/Message.ts
@@ -32,6 +32,23 @@ class MessageModel extends Model {
return result.insertedId;
}
+
+ public async removeItem(
+ senderId: string,
+ roomId: string,
+ contents: string,
+ timeSent: number
+ ) {
+ const collection = await this.getCollection();
+ const result = await collection.removeOne({
+ sender: senderId,
+ timeSent,
+ contents,
+ room: new ObjectID(roomId),
+ });
+
+ return result.deletedId;
+ }
}
export default MessageModel;
diff --git a/server/src/schema-init.ts b/server/src/schema-init.ts
index fa38b96..f25a0d3 100644
--- a/server/src/schema-init.ts
+++ b/server/src/schema-init.ts
@@ -50,6 +50,18 @@ const runTheDB = async () => {
rooms: [firstRoomItem._id, secondRoomItem._id],
unreadMessages: [],
},
+ {
+ name: {
+ first: "Vivian",
+ last: "Hu",
+ },
+ timeZone: "(UTC-07:00) Pacific Time (US & Canada)",
+ thumbnail:
+ "bc=#CBF13C;st=sq,sbc=#D061B2,sds=56%,ssx=66%,ssy=2%,or=h;st=sq,sbc=#5135F2,sds=35%,ssx=83%,ssy=33%,or=v;st=rt,sbc=#088395,sds=31%,ssx=17%,ssy=40%,or=h",
+ workingHours: [],
+ rooms: [firstRoomItem._id, secondRoomItem._id],
+ unreadMessages: [],
+ },
{
name: {
first: "Joe",
diff --git a/server/src/socket.ts b/server/src/socket.ts
index 79736e0..293b35b 100644
--- a/server/src/socket.ts
+++ b/server/src/socket.ts
@@ -128,7 +128,7 @@ class Socket {
private sendUserMessage = (id: string, isActive: boolean) => {
this.clients.forEach((client) => {
if (client.id === id) {
- client.socket.send(JSON.stringify({ id: client.id, isActive }));
+ client.socket.send(JSON.stringify({ id: client.id, isActive, lastMessagedAt }));
}
});
};