diff --git a/client/components/Card.jsx b/client/components/Card.jsx
index 4f27551..aec1200 100644
--- a/client/components/Card.jsx
+++ b/client/components/Card.jsx
@@ -1,11 +1,24 @@
-import { Box, Center, useColorModeValue } from "@chakra-ui/react";
+import { Box, Center, Icon, useColorModeValue } from "@chakra-ui/react";
import Image from "next/image";
import { useRouter } from "next/router";
import React from "react";
-import { FaDiscord, FaTree, FaWhatsapp } from "react-icons/fa";
+import {
+ FaDiscord,
+ FaRegSnowflake,
+ FaSun,
+ FaTree,
+ FaWhatsapp,
+} from "react-icons/fa";
+import { GiChestnutLeaf } from "react-icons/gi";
import Tilt from "react-vanilla-tilt";
-const Icon = ({ link, titleColor }) => (
+const termToIcon = {
+ Fall: GiChestnutLeaf,
+ Winter: FaRegSnowflake,
+ Summer: FaSun,
+};
+
+const LinkIcon = ({ link, titleColor }) => (
<>
{link.includes("discord") && (
@@ -19,7 +32,28 @@ const Icon = ({ link, titleColor }) => (
>
);
-export const Card = ({ name, description, image, links, id }) => {
+const CourseInfo = ({ descriptionColor, campus, term, year }) => (
+ <>
+
+ {campus} {year}
+
+ >
+);
+
+export const Card = ({
+ name,
+ image,
+ links,
+ id,
+ isCommunity,
+ courseInformation,
+}) => {
const { locale, defaultLocale, push } = useRouter();
const backgroundColor = useColorModeValue("#FFFFFF", "#181a1b");
const descriptionColor = useColorModeValue("gray.600", "gray.400");
@@ -45,6 +79,7 @@ export const Card = ({ name, description, image, links, id }) => {
{
>
{name}
-
-
- {description}
-
+ {!isCommunity && (
+
+ )}
{links.map((link, index) => (
-
+
))}
diff --git a/client/gql/GroupChat.js b/client/gql/GroupChat.js
index bd0a00c..b7c3280 100644
--- a/client/gql/GroupChat.js
+++ b/client/gql/GroupChat.js
@@ -89,6 +89,12 @@ export const SEARCH_GROUPCHATS = gql`
links
id
isCommunity
+ courseInformation {
+ term
+ campus
+ code
+ year
+ }
}
totalPages
pageNumber
@@ -110,6 +116,12 @@ export const SEARCH_ALL_GROUPCHATS = gql`
links
id
isCommunity
+ courseInformation {
+ term
+ campus
+ code
+ year
+ }
}
totalPages
pageNumber
diff --git a/server/dist/resolvers/GroupChatResolver.js b/server/dist/resolvers/GroupChatResolver.js
index 560f6bb..72b49d7 100644
--- a/server/dist/resolvers/GroupChatResolver.js
+++ b/server/dist/resolvers/GroupChatResolver.js
@@ -82,10 +82,19 @@ let GroupChatResolver = class GroupChatResolver {
if (type != undefined) {
queryObj = { ...queryObj, isCommunity: type };
}
- const groupChats = await database_1.GroupChat.find(queryObj)
- .sort({ views: -1, likes: -1 })
- .skip(page * pageSize)
- .limit(pageSize);
+ let groupChats;
+ if (type) {
+ groupChats = await database_1.GroupChat.find(queryObj)
+ .sort({ views: -1, likes: -1 })
+ .skip(page * pageSize)
+ .limit(pageSize);
+ }
+ else {
+ groupChats = await database_1.GroupChat.find(queryObj)
+ .sort({ created: -1, views: -1, likes: -1 })
+ .skip(page * pageSize)
+ .limit(pageSize);
+ }
const totalCount = await database_1.GroupChat.find(queryObj).countDocuments();
if (totalCount === 0) {
return {
diff --git a/server/dist/resolvers/GroupChatResolver.js.map b/server/dist/resolvers/GroupChatResolver.js.map
index dc96b5f..72feab5 100644
--- a/server/dist/resolvers/GroupChatResolver.js.map
+++ b/server/dist/resolvers/GroupChatResolver.js.map
@@ -1 +1 @@
-{"version":3,"file":"GroupChatResolver.js","sourceRoot":"","sources":["../../resolvers/GroupChatResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA8D;AAC9D,0CAA6E;AAC7E,sCAAsC;AACtC,sCAAiD;AACjD,mDAAwE;AACxE,wCAA4D;AAC5D,4CAAsC;AAGtC,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAA9B;QACE,aAAQ,GAAG,CAAC,CAAC;IA2Mf,CAAC;IAxMC,KAAK,CAAC,kBAAkB;QACtB,MAAM,UAAU,GAAG,MAAM,oBAAc,CAAC,IAAI,EAAE,CAAC;QAC/C,OAAO;YACL,UAAU,EAAE,UAAU,CAAC,GAAG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,CAAA,EAAc,WAAA,kBAAG,CAAC,QAAQ,CAAC,CAAA;;;;qDAQvD;AAGD;IADC,uBAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;IACD,WAAA,kBAAG,CAAC,IAAI,CAAC,CAAA;;;;wDAW/B;AAGD;IADC,uBAAQ,CAAC,GAAG,EAAE,CAAC,kBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxB,WAAA,kBAAG,CAAC,IAAI,CAAC,CAAA;;;;uDAM9B;AAtNU,iBAAiB;IAD7B,uBAAQ,CAAC,kBAAS,CAAC;GACP,iBAAiB,CAuN7B;AAvNY,8CAAiB"}
\ No newline at end of file
diff --git a/server/resolvers/GroupChatResolver.ts b/server/resolvers/GroupChatResolver.ts
index 7ffcd3e..8fd5d21 100644
--- a/server/resolvers/GroupChatResolver.ts
+++ b/server/resolvers/GroupChatResolver.ts
@@ -102,10 +102,21 @@ export class GroupChatResolver {
if (type != undefined) {
queryObj = { ...queryObj, isCommunity: type };
}
- const groupChats = await GroupChatModel.find(queryObj)
- .sort({ views: -1, likes: -1 })
- .skip(page * pageSize)
- .limit(pageSize);
+
+ let groupChats;
+
+ if (type) {
+ groupChats = await GroupChatModel.find(queryObj)
+ .sort({ views: -1, likes: -1 })
+ .skip(page * pageSize)
+ .limit(pageSize);
+ } else {
+ groupChats = await GroupChatModel.find(queryObj)
+ .sort({ created: -1, views: -1, likes: -1 })
+ .skip(page * pageSize)
+ .limit(pageSize);
+ }
+
const totalCount = await GroupChatModel.find(queryObj).countDocuments();
if (totalCount === 0) {
return {