diff --git a/client/package-lock.json b/client/package-lock.json
index 2c3a6c5..5ed1547 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -14,6 +14,7 @@
"@trpc/client": "^10.44.1",
"@trpc/react-query": "^10.44.1",
"@trpc/server": "^10.44.1",
+ "clsx": "^2.1.1",
"dayjs": "^1.11.9",
"firebase": "^10.1.0",
"react": "^18.2.0",
@@ -24,6 +25,7 @@
"react-masonry-css": "^1.0.16",
"react-router-dom": "^6.14.2",
"styled-components": "^6.1.0",
+ "tailwind-merge": "^2.5.2",
"uuid": "^9.0.1",
"zod": "^3.22.4"
},
@@ -5406,6 +5408,14 @@
"node": ">=6"
}
},
+ "node_modules/clsx": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -11777,6 +11787,15 @@
"react": "^16.11.0 || ^17.0.0 || ^18.0.0"
}
},
+ "node_modules/tailwind-merge": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.2.tgz",
+ "integrity": "sha512-kjEBm+pvD+6eAwzJL2Bi+02/9LFLal1Gs61+QB7HvTfQQ0aXwC5LGT8PEt1gS0CWKktKe6ysPTAy3cBC5MeiIg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/dcastil"
+ }
+ },
"node_modules/tailwindcss": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
diff --git a/client/package.json b/client/package.json
index 5cf6922..9e3f09d 100644
--- a/client/package.json
+++ b/client/package.json
@@ -17,6 +17,7 @@
"@trpc/client": "^10.44.1",
"@trpc/react-query": "^10.44.1",
"@trpc/server": "^10.44.1",
+ "clsx": "^2.1.1",
"dayjs": "^1.11.9",
"firebase": "^10.1.0",
"react": "^18.2.0",
@@ -27,6 +28,7 @@
"react-masonry-css": "^1.0.16",
"react-router-dom": "^6.14.2",
"styled-components": "^6.1.0",
+ "tailwind-merge": "^2.5.2",
"uuid": "^9.0.1",
"zod": "^3.22.4"
},
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 7453552..8a558bf 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -10,6 +10,7 @@ import { useState } from 'react';
import { trpc } from './utils/trpc';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { httpBatchLink } from '@trpc/client';
+import ActivityWrapper from './components/ActivityWrapper';
export default function App({ queryClient }: { queryClient: QueryClient }) {
const { getToken, userId } = useAuth();
@@ -40,10 +41,10 @@ export default function App({ queryClient }: { queryClient: QueryClient }) {
-
-
+
diff --git a/client/src/components/ActivityWrapper.tsx b/client/src/components/ActivityWrapper.tsx
new file mode 100644
index 0000000..3f0b071
--- /dev/null
+++ b/client/src/components/ActivityWrapper.tsx
@@ -0,0 +1,11 @@
+import cn from '../utils/utils';
+
+export default function ActivityWrapper({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return
{children}
;
+}
diff --git a/client/src/components/Nav.tsx b/client/src/components/Nav.tsx
index f24bf1b..f197d31 100644
--- a/client/src/components/Nav.tsx
+++ b/client/src/components/Nav.tsx
@@ -9,8 +9,8 @@ export default function Nav() {
//returns header of logo and profile button or "sign in/sign up" if user is not registered.
return (
-
-
+
+
) : (
-
+
-
+
Login
-
+
Sign up
diff --git a/client/src/components/ProjectsView.tsx b/client/src/components/ProjectsView.tsx
index 525ed02..141c90d 100644
--- a/client/src/components/ProjectsView.tsx
+++ b/client/src/components/ProjectsView.tsx
@@ -60,8 +60,8 @@ export default function ProjectsView(props: {
{proj.meetType}
{proj.tags.map((tag) => (
-
- {tag}
+
+ {tag}
))}
diff --git a/client/src/index.css b/client/src/index.css
index 6f603db..163f67f 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -12,7 +12,7 @@ body {
display: -ms-flexbox; /* Not needed if autoprefixing */
display: flex; /* gutter size offset */
width: auto;
- gap: 4rem;
+ gap: 2.25rem;
}
.masonryCol {
diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx
index b03a8ca..35f4bf6 100644
--- a/client/src/pages/Home.tsx
+++ b/client/src/pages/Home.tsx
@@ -5,12 +5,6 @@ import { trpc } from '../utils/trpc';
export default function Home() {
const { user } = useUser();
- const { data } = trpc.projects.getAll.useQuery();
-
- if (data) {
- console.log(data);
- }
-
//home page with "welcome" and projects shown.
return (
@@ -34,8 +28,6 @@ export default function Home() {
*/
function Projects() {
- //const { data, isLoading } = useQuery(projectsQuery())
-
const { data, isLoading } = trpc.projects.getAll.useQuery();
if (isLoading)
diff --git a/client/src/pages/Project.tsx b/client/src/pages/Project.tsx
index 7f7b2fc..684de00 100644
--- a/client/src/pages/Project.tsx
+++ b/client/src/pages/Project.tsx
@@ -11,6 +11,7 @@ import { NavLink, Outlet, Form } from 'react-router-dom';
import Markdown from 'react-markdown';
import { RouterOutputs, trpc } from '../utils/trpc';
import { z } from 'zod';
+import ActivityWrapper from '../components/ActivityWrapper';
dayjjs.extend(relativeTime);
@@ -188,7 +189,7 @@ export default function Project() {
)}
-
+
{data.name}
@@ -239,7 +240,7 @@ export default function Project() {
-
+
>
);
@@ -302,7 +303,7 @@ function StatusChip({
to="edit"
className="inline-block bg-green-600 transition-colors hover:bg-green-700 py-1 px-6 rounded-lg text-zinc-100 font-medium"
>
- Edit Project Info
+ Edit Project InfoProje
);
@@ -591,19 +592,21 @@ export function ProjectPost() {
export function MemberList() {
const params = useParams();
- const { data } = trpc.projects.getMembers.useQuery(params.projectId ?? '');
+ const { user } = useUser();
+ const { data } = trpc.projects.getMembers.useQuery({
+ userId: user?.id ?? '',
+ projectId: params.projectId ?? '',
+ });
const utils = trpc.useUtils();
- // if (isLoading) return loading...
const kickUserMutation = trpc.projects.kickUser.useMutation({
onSuccess() {
- console.log('User Removed');
utils.projects.getMembers.invalidate();
},
});
if (!data) return Error Fetching Members
;
- if (!data.memberships || data.memberships.length == 0)
+ if (!data || data.length == 0)
return No Members
;
const handleKickUser = (e: React.MouseEvent) => {
@@ -620,17 +623,24 @@ export function MemberList() {
return (
- {data.memberships.map((member) => (
+ {data.map((member) => (
- {member.userId}
+ {member.name}
+
Kick Member
diff --git a/client/src/pages/Requests.tsx b/client/src/pages/Requests.tsx
index 19e9547..fff30d6 100644
--- a/client/src/pages/Requests.tsx
+++ b/client/src/pages/Requests.tsx
@@ -10,18 +10,14 @@ dayjjs.extend(relativeTime);
//request page to be shown.
export default function Requests() {
const { user } = useUser();
- // const { data, isLoading, isError } = useQuery(
- // requestsQuery(user ? user.id : "")
- // )
-
const { data, isLoading, isError } =
trpc.memberships.getAllIncomingRequests.useQuery(user?.id ?? '');
const utils = trpc.useUtils();
const acceptRequestMutation = trpc.memberships.acceptRequest.useMutation({
onSuccess() {
- console.log('Request Accepted');
utils.memberships.getAllIncomingRequests.invalidate();
+ utils.projects.getMembers.invalidate();
toast.success('Request Accepted');
},
});
diff --git a/client/src/utils/utils.ts b/client/src/utils/utils.ts
new file mode 100644
index 0000000..b1dbd8f
--- /dev/null
+++ b/client/src/utils/utils.ts
@@ -0,0 +1,5 @@
+import { clsx, type ClassValue } from 'clsx';
+import { twMerge } from 'tailwind-merge';
+export default function cn(...inputs: ClassValue[]) {
+ return twMerge(clsx(inputs));
+}
diff --git a/server/src/routers/projectsRouter.ts b/server/src/routers/projectsRouter.ts
index 0276ba7..fa03e1d 100644
--- a/server/src/routers/projectsRouter.ts
+++ b/server/src/routers/projectsRouter.ts
@@ -28,29 +28,7 @@ export const projectsRouter = router({
return data;
}),
- getMembers: publicProcedure
- .input(z.string())
- .query(async ({ ctx, input }) => {
- const data = await ctx.db.project.findFirst({
- where: {
- id: input,
- },
- select: {
- memberships: {
- where: {
- status: 'ACCEPTED',
- },
- select: {
- id: true,
- userId: true,
- },
- },
- },
- });
-
- return data;
- }),
- getUserList: authedProcedure
+ getMembers: authedProcedure
.input(
z.object({
projectId: z.string(),
@@ -61,6 +39,7 @@ export const projectsRouter = router({
const projectMemberships = await ctx.db.memberships.findMany({
where: {
projectId: input.projectId,
+ status: 'ACCEPTED',
},
});
@@ -68,13 +47,18 @@ export const projectsRouter = router({
(membership) => membership.userId,
);
+ if (userList.length === 0) {
+ return []
+ }
const users = await clerkClient.users.getUserList({ userId: userList });
- users.map((user) => ({
+ const filteredUser = users.map((user) => ({
+ id: user.id,
imageUrl: user.imageUrl,
email: user.emailAddresses,
name: `${user.firstName} ${user.lastName}`,
}));
- return users;
+
+ return filteredUser;
}),
getByUserId: authedProcedure
@@ -96,9 +80,10 @@ export const projectsRouter = router({
}),
)
.mutation(async ({ ctx, input }) => {
+ console.log(input)
await ctx.db.memberships.delete({
where: {
- projectId_userId: input,
+ projectId_userId: input
},
});
}),