diff --git a/packages/desktop/src/components/ConversationDetails.tsx b/packages/desktop/src/components/ConversationDetails.tsx
index 298f373..1d54c8a 100644
--- a/packages/desktop/src/components/ConversationDetails.tsx
+++ b/packages/desktop/src/components/ConversationDetails.tsx
@@ -92,6 +92,7 @@ export default function ConversationDetails() {
diff --git a/packages/desktop/src/components/ConversationList.tsx b/packages/desktop/src/components/ConversationList.tsx
index 0e8b0c7..98cf19f 100644
--- a/packages/desktop/src/components/ConversationList.tsx
+++ b/packages/desktop/src/components/ConversationList.tsx
@@ -117,6 +117,7 @@ function ConversationRow({ conversation }: { conversation: Conversation }) {
diff --git a/packages/desktop/src/components/NewConversationDialog.tsx b/packages/desktop/src/components/NewConversationDialog.tsx
index e764346..92f84a0 100644
--- a/packages/desktop/src/components/NewConversationDialog.tsx
+++ b/packages/desktop/src/components/NewConversationDialog.tsx
@@ -26,6 +26,7 @@ import { User } from '@nirvana/core/src/models/user.model';
import useAuth from '../providers/AuthProvider';
import UserDetailRow from '../subcomponents/UserDetailRow';
import CircularProgress from '@mui/material/CircularProgress';
+import { NirvanaRules } from '../util/rules';
export default function NewConversationDialog({
open,
@@ -106,7 +107,12 @@ export default function NewConversationDialog({
const handleSubmitLocal = useCallback(async () => {
if (selectedUsers.length === 0) {
- enqueueSnackbar('Must a person!', { variant: 'error' });
+ enqueueSnackbar('Must select a person!', { variant: 'error' });
+ return;
+ }
+
+ if (selectedUsers.length + 1 >= NirvanaRules.maxMembersPerConversation) {
+ enqueueSnackbar('A group can only have 8 people including you!', { variant: 'error' });
return;
}
diff --git a/packages/desktop/src/subcomponents/ConversationLabel.tsx b/packages/desktop/src/subcomponents/ConversationLabel.tsx
index 65f997e..da0214d 100644
--- a/packages/desktop/src/subcomponents/ConversationLabel.tsx
+++ b/packages/desktop/src/subcomponents/ConversationLabel.tsx
@@ -5,7 +5,7 @@ import { User } from '@nirvana/core/src/models/user.model';
import { Typography } from '@mui/material';
import useAuth from '../providers/AuthProvider';
-type IConversationLabel =
+type IConversationLabel = (
| {
conversationName?: string;
users: User[];
@@ -13,18 +13,28 @@ type IConversationLabel =
| {
conversationName: string;
users?: User[];
- };
+ }
+) & { isSelected?: boolean };
/**
* if there is a name in the conversation, then return that
* if not, then return first three names
*/
-export default function ConversationLabel({ conversationName, users }: IConversationLabel) {
+export default function ConversationLabel({
+ conversationName,
+ users,
+ isSelected = false,
+}: IConversationLabel) {
const { user } = useAuth();
if (conversationName) {
return (
-
+
{conversationName}
);
@@ -36,7 +46,12 @@ export default function ConversationLabel({ conversationName, users }: IConversa
const firstName = filteredUsers[0].displayName.split(' ')[0];
return (
-
+
{firstName}
);
@@ -48,7 +63,12 @@ export default function ConversationLabel({ conversationName, users }: IConversa
const formattedFirstnames = firstNames.slice(0, -1).join(',') + ' and ' + firstNames.slice(-1);
return (
-
+
{formattedFirstnames}
);
diff --git a/packages/desktop/src/util/rules.ts b/packages/desktop/src/util/rules.ts
new file mode 100644
index 0000000..03a129e
--- /dev/null
+++ b/packages/desktop/src/util/rules.ts
@@ -0,0 +1,5 @@
+// the rules of the game
+
+export const NirvanaRules = {
+ maxMembersPerConversation: 8,
+};