diff --git a/Dockerfile b/Dockerfile index 464d3a5..3ca87e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,10 @@ RUN rm -rf src/web/package.json node_modules src/server/node_modules && \ # Hack for greatly reducing the size of the image. For some reason I couldn't find # a cleaner way to do this. -RUN \ - rm ./node_modules/.prisma/client/libquery_engine-linux-musl.so.node && \ - rm ./node_modules/prisma/libquery_engine-linux-musl.so.node && \ - rm ./node_modules/@prisma/engines/libquery_engine-linux-musl.so.node +# RUN \ +# rm ./node_modules/.prisma/client/libquery_engine-linux-musl.so.node && \ +# rm ./node_modules/prisma/libquery_engine-linux-musl.so.node && \ +# rm ./node_modules/@prisma/engines/libquery_engine-linux-musl.so.node FROM node:16.17.0-alpine diff --git a/README.md b/README.md index bdbad3d..4c8ac10 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# Club Voting System +# ClubVotingSystem -The Club Voting system was developed in the runup to the 2022 AGM for the Programmers' Society. Since then it has been continually updated and improved. +## About +ClubVotingSystem lets you do real-time voting in a safe and controlled environment. It was initially developed in 2022 for the Annual General Meeting (AGM) for UTS Programmers' Society. ## Features - [x] Responsive UI @@ -8,3 +9,71 @@ The Club Voting system was developed in the runup to the 2022 AGM for the Progra - [x] User facing dashboard - [x] Admin dashboard - [x] Anonymous voting + +## Use Cases +1. Committee election in Annual & Special General Meetings (AGMs & SGMs) +2. Voting where memberships are required + +## Limitation +You can only vote & ask one question at a time. + +## Get Started +### Prerequisites +Install [Docker](https://www.docker.com/) + +### Steps +1. Clone the repo +``` +git clone https://github.com/ProgSoc/ClubVotingSystem.git +cd ClubVotingSystem +``` + +2. Install dependencies +``` +yarn install +``` + +3. Run database on Docker +``` +docker-compose up -d +``` + +4. Run client & server on localhost +``` +yarn web dev +yarn server dev +``` + +## How to Contribute +1. Pick your favourite issue (or make one) +2. Make a comment saying you'll work on it +3. Wait for the issue to be assigned to you +4. Fork the repo +5. Commit your changes with the issue number (e.g., issue #2) +6. Make a pull request +7. Wait for approval + 1. If approved: You're done! + 2. Else: See comments + +## Project Structure +``` +project-root/ +│ +├── .gitignore +├── .dockerignore +├── Dockerfile +├── docker-compose.yml +├── package.json +├── ... +└── src/ + ├── server/ + | ├── src/ + │ ├── package.json + │ └── ... + └── web/ + ├── src/ + ├── index.html + ├── package.json + ├── tailwind.config.cjs + └── ... +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7c97ce4..cbde5b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,10 @@ services: - 8080:8080 environment: PORT: 8080 - DATABASE_URL: postgres://postgres:psqlpass@postgre:5432/voting + DATABASE_URL: postgres://postgres:psqlpass@postgres:5432/voting # volumes: - postgre: + postgres: image: postgres restart: unless-stopped environment: diff --git a/src/server/src/routers/room.ts b/src/server/src/routers/room.ts index 87cbcc2..17da56d 100644 --- a/src/server/src/routers/room.ts +++ b/src/server/src/routers/room.ts @@ -8,7 +8,7 @@ import { withRoomVoterFunctions } from '../room/interaction/user'; import { publicProcedure, router } from '../trpc'; export const roomRouter = router({ - create: publicProcedure + createNewRoom: publicProcedure .input( z.object({ name: z.string().min(1), diff --git a/src/web/src/components/styles.tsx b/src/web/src/components/styles.tsx index 8526c6e..16f1105 100644 --- a/src/web/src/components/styles.tsx +++ b/src/web/src/components/styles.tsx @@ -19,7 +19,7 @@ export const PageContainer = ({ children, className }: BaseProps) => ( ); export const Heading = ({ children, className }: BaseProps) => ( -

{children}

+

{children}

); export const Question = ({ children, className }: BaseProps) => ( diff --git a/src/web/src/pages/CreateRoomPage.tsx b/src/web/src/pages/CreateRoomPage.tsx index 92139e4..cd1b771 100644 --- a/src/web/src/pages/CreateRoomPage.tsx +++ b/src/web/src/pages/CreateRoomPage.tsx @@ -10,7 +10,7 @@ export function CreateRoomPage() { const [pageName, setPageName] = useState(''); const navigate = useNavigate(); - const mutation = trpc.room.create.useMutation(); + const mutation = trpc.room.createNewRoom.useMutation(); const onSubmit = async () => { const result = await mutation.mutateAsync({ name: pageName.trim() }); @@ -24,7 +24,7 @@ export function CreateRoomPage() { return ( Create a new room -
+
setPageName(e.target.value)} /> + +
+ + + +
+ + )} diff --git a/src/web/src/pages/room/admin/QuestionSettingPage.tsx b/src/web/src/pages/room/admin/QuestionSettingPage.tsx index d244494..395b2cd 100644 --- a/src/web/src/pages/room/admin/QuestionSettingPage.tsx +++ b/src/web/src/pages/room/admin/QuestionSettingPage.tsx @@ -150,7 +150,9 @@ function SetQuestion({ data }: { data: QuestionSettingData }) { }; return ( - <> +
initialValues={{ question: '', @@ -170,10 +172,12 @@ function SetQuestion({ data }: { data: QuestionSettingData }) { }; return ( -
+
+
diff --git a/src/web/src/pages/room/admin/WaitingRoomManagemenentPage.tsx b/src/web/src/pages/room/admin/WaitingRoomManagemenentPage.tsx index e52ae82..cce24b1 100644 --- a/src/web/src/pages/room/admin/WaitingRoomManagemenentPage.tsx +++ b/src/web/src/pages/room/admin/WaitingRoomManagemenentPage.tsx @@ -133,57 +133,65 @@ export function WaitingRoomManagementPage(props: { roomId: string; room: RoomPub -
- Waiting Room -
- {users.map((user) => ( +
+
+ Waiting Room +
+ {users.map((user) => ( +
+ +
{locationEnumLabel[user.details.location]}
+
+ + +
+
+ ))} +
+
+
+ Voters + {voters.map((user) => (
{locationEnumLabel[user.details.location]}
-
))}
- Voters - {voters.map((user) => ( -
- -
{locationEnumLabel[user.details.location]}
-
- -
-
- ))}
);